/* ============================================================
   System rezerwacji — wspólne style (strona publiczna + panel)
   ============================================================ */

:root {
    --brand:        #e2531f;
    --brand-dark:   #c4441a;
    --bg:           #0f1115;
    --bg-soft:      #171a21;
    --card:         #1c2029;
    --card-hi:      #232833;
    --line:         #2c323f;
    --text:         #eceef2;
    --text-dim:     #9aa2b1;
    --ok:           #34d399;
    --warn:         #fbbf24;
    --bad:          #f87171;
    --radius:       14px;
    --radius-sm:    9px;
    --shadow:       0 10px 30px rgba(0, 0, 0, .35);
    --font:         -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                    "Helvetica Neue", Arial, sans-serif;
}

/* Panel administracyjny — jaśniejszy motyw, żeby dane czytało się w dzień */
body.admin {
    --bg:      #f5f6f8;
    --bg-soft: #ffffff;
    --card:    #ffffff;
    --card-hi: #f2f4f7;
    --line:    #e2e5ea;
    --text:    #1b1f27;
    --text-dim:#69707d;
    --shadow:  0 1px 3px rgba(0, 0, 0, .08);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    font-size: 16px;
}

body.plain { background: var(--bg-soft); }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }

p { margin: 0 0 1em; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 18px; }
.wrap.narrow { max-width: 760px; }
.wrap.tight  { max-width: 560px; }

.muted { color: var(--text-dim); }
.small { font-size: .875rem; }
.big   { font-size: 1.15rem; }
.center{ text-align: center; }
.right { text-align: right; }
.nowrap{ white-space: nowrap; }
.mono  { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.strike{ text-decoration: line-through; opacity: .6; }

.stack   > * + * { margin-top: 14px; }
.stack-sm> * + * { margin-top: 8px; }
.row     { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end     { justify-content: flex-end; }
.grow    { flex: 1; }
.hide    { display: none !important; }

/* ---------------- Nagłówek ---------------- */

.topbar {
    background: var(--bg-soft);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar .wrap {
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 62px;
}
.brand {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--text);
    letter-spacing: -.02em;
}
.brand:hover { text-decoration: none; }
.brand span { color: var(--brand); }

.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a {
    color: var(--text-dim);
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: .93rem;
    font-weight: 500;
}
.nav a:hover { background: var(--card-hi); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--brand); color: #fff; }

/* ---------------- Karty ---------------- */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
}
.card + .card { margin-top: 16px; }
.card.pad-sm { padding: 14px 16px; }
.card h2:first-child, .card h1:first-child, .card h3:first-child { margin-top: 0; }

.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ---------------- Pokoje ---------------- */

.room-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .15s ease, border-color .15s ease;
}
.room-card:hover { transform: translateY(-3px); border-color: var(--brand); }
.room-card .thumb {
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, var(--card-hi), var(--bg-soft));
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: flex-end;
    padding: 14px;
}
.room-card .body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.room-card h3 { margin-bottom: .25em; }
.room-card .foot {
    margin-top: auto;
    padding-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--text-dim); font-size: .875rem; }
.meta b { color: var(--text); font-weight: 600; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    background: var(--card-hi);
    color: var(--text-dim);
    border: 1px solid var(--line);
}
.pill.ok   { color: var(--ok);    border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.pill.warn { color: var(--warn);  border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.pill.bad  { color: var(--bad);   border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.pill.brand{ color: #fff; background: var(--brand); border-color: var(--brand); }

.stars { color: #fbbf24; letter-spacing: 1px; }

/* ---------------- Przyciski ---------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--brand);
    color: #fff;
    border: 1px solid var(--brand);
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    font-size: .95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
    transition: background .15s ease;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--line);
}
.btn.ghost:hover { background: var(--card-hi); color: var(--text); }
.btn.sm { padding: 6px 13px; font-size: .85rem; }
.btn.lg { padding: 14px 28px; font-size: 1.02rem; }
.btn.block { display: flex; width: 100%; }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: #ef4444; }

/* ---------------- Formularze ---------------- */

label { display: block; font-size: .9rem; font-weight: 600; }
label .muted { font-weight: 400; }

input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=number], input[type=date], input[type=time], input[type=url],
input[type=month], select, textarea {
    width: 100%;
    margin-top: 5px;
    padding: 10px 12px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: .95rem;
}
body.admin input, body.admin select, body.admin textarea { background: #fff; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent);
}
textarea { min-height: 92px; resize: vertical; }

label.check, label.radio {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-weight: 400;
    font-size: .92rem;
    cursor: pointer;
}
label.check input, label.radio input { margin-top: 3px; width: auto; flex-shrink: 0; }

fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; margin: 0; }
legend { font-size: .85rem; font-weight: 700; color: var(--text-dim); padding: 0 6px; }

/* ---------------- Komunikaty ---------------- */

.alert {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--card-hi);
    font-size: .93rem;
}
.alert + .alert { margin-top: 10px; }
.alert.ok   { border-color: color-mix(in srgb, var(--ok) 45%, transparent);
              background: color-mix(in srgb, var(--ok) 12%, transparent); }
.alert.bad  { border-color: color-mix(in srgb, var(--bad) 45%, transparent);
              background: color-mix(in srgb, var(--bad) 12%, transparent); }
.alert.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent);
              background: color-mix(in srgb, var(--warn) 12%, transparent); }
.alert ul { margin: 6px 0 0; padding-left: 20px; }

/* ---------------- Kalendarz ---------------- */

.cal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.cal-title { font-weight: 700; font-size: 1.1rem; }

.cal {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.cal .dow {
    text-align: center;
    font-size: .75rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    padding-bottom: 4px;
}
.cal .day {
    position: relative;
    aspect-ratio: 1;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: .95rem;
    font-weight: 600;
    color: var(--text-dim);
    cursor: default;
    padding: 2px;
}
.cal .day.empty { border: none; background: none; }
.cal a.day { color: var(--text); cursor: pointer; }
.cal a.day:hover { border-color: var(--brand); text-decoration: none; }
.cal .day.has-free { background: var(--card); color: var(--text); }
.cal .day.full { opacity: .45; }
.cal .day.today { border-color: var(--brand); }
.cal .day.sel { background: var(--brand); border-color: var(--brand); color: #fff; }
.cal .day .cnt { font-size: .68rem; font-weight: 600; opacity: .85; }
.cal .day.sel .cnt { opacity: 1; }

/* ---------------- Terminy ---------------- */

.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(102px, 1fr)); gap: 9px; }
.slot {
    border: 1px solid var(--line);
    background: var(--bg-soft);
    border-radius: var(--radius-sm);
    padding: 11px 6px;
    text-align: center;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    transition: all .12s ease;
}
.slot:hover { border-color: var(--brand); text-decoration: none; }
.slot .price { display: block; font-size: .75rem; font-weight: 500; color: var(--text-dim); margin-top: 2px; }
.slot.taken {
    opacity: .38;
    cursor: not-allowed;
    text-decoration: line-through;
}
.slot.taken:hover { border-color: var(--line); }
.slot.sel { background: var(--brand); border-color: var(--brand); color: #fff; }
.slot.sel .price { color: rgba(255,255,255,.85); }

/* ---------------- Tabele ---------------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}
table.data th, table.data td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
table.data th {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-dim);
    font-weight: 700;
    white-space: nowrap;
}
table.data tbody tr:hover { background: var(--card-hi); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------- Podsumowanie zamówienia ---------------- */

.summary { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.summary .line {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 16px;
    font-size: .93rem;
    border-bottom: 1px solid var(--line);
}
.summary .line:last-child { border-bottom: none; }
.summary .line.total {
    background: var(--card-hi);
    font-weight: 800;
    font-size: 1.08rem;
}
.summary .line .lbl { color: var(--text-dim); }
.summary .line.total .lbl { color: var(--text); }

/* ---------------- Odliczanie koszyka ---------------- */

.hold-timer {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .87rem;
    font-weight: 600;
    color: var(--warn);
}
.hold-timer.urgent { color: var(--bad); }

/* ---------------- Kroki ---------------- */

.steps { display: flex; gap: 8px; margin-bottom: 22px; flex-wrap: wrap; }
.steps .step {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: .85rem;
    color: var(--text-dim);
    font-weight: 600;
}
.steps .step .n {
    width: 23px; height: 23px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: var(--card-hi);
    border: 1px solid var(--line);
    font-size: .75rem;
}
.steps .step.on { color: var(--text); }
.steps .step.on .n { background: var(--brand); border-color: var(--brand); color: #fff; }
.steps .step.done .n { background: var(--ok); border-color: var(--ok); color: #06281c; }
.steps .sep { color: var(--line); }

/* ---------------- Voucher do druku ---------------- */

.voucher-print {
    background: #fff;
    color: #18181b;
    border-radius: 16px;
    padding: 38px;
    max-width: 640px;
    margin: 0 auto;
    border: 2px dashed #d4d4d8;
}
.voucher-print .code {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------------- Stopka ---------------- */

.footer {
    margin-top: 56px;
    padding: 28px 0 40px;
    border-top: 1px solid var(--line);
    color: var(--text-dim);
    font-size: .88rem;
}

/* ---------------- Panel: układ boczny ---------------- */

.admin-shell { display: flex; min-height: 100vh; }
.side {
    width: 218px;
    flex-shrink: 0;
    background: var(--bg-soft);
    border-right: 1px solid var(--line);
    padding: 18px 12px;
}
.side .brand { display: block; padding: 0 10px 16px; }
.side nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: .92rem;
    font-weight: 500;
    margin-bottom: 2px;
}
.side nav a:hover { background: var(--card-hi); color: var(--text); text-decoration: none; }
.side nav a.active { background: var(--brand); color: #fff; }
.side .sep { height: 1px; background: var(--line); margin: 12px 6px; }
.main { flex: 1; padding: 24px; min-width: 0; }

.kpi { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
.kpi .box {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
}
.kpi .box .val { font-size: 1.7rem; font-weight: 800; line-height: 1.15; }
.kpi .box .lbl { font-size: .82rem; color: var(--text-dim); font-weight: 600; }

/* ---------------- Grafik dzienny w panelu ---------------- */

.schedule { display: grid; gap: 14px; }
.schedule .room-row { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.schedule .room-row > .hdr {
    padding: 9px 14px;
    background: var(--card-hi);
    font-weight: 700;
    font-size: .93rem;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}
.schedule .room-row > .body { padding: 12px 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.tile {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 8px 11px;
    font-size: .85rem;
    min-width: 92px;
    background: var(--bg-soft);
}
.tile .t { font-weight: 700; }
.tile .who { font-size: .78rem; color: var(--text-dim); white-space: nowrap;
             overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.tile.booked { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.tile.pending{ border-color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.tile.blocked{ border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.tile.free   { opacity: .55; }

/* ---------------- Druk ---------------- */

@media print {
    .topbar, .side, .nav, .btn, .footer, .no-print { display: none !important; }
    body { background: #fff; color: #000; }
    .card, .voucher-print { border-color: #ccc; box-shadow: none; }
    .main { padding: 0; }
}

/* ---------------- Telefon ---------------- */

@media (max-width: 720px) {
    .admin-shell { flex-direction: column; }
    .side {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--line);
        padding: 12px;
    }
    .side nav { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
    .side nav a { white-space: nowrap; margin-bottom: 0; }
    .side .sep { display: none; }
    .main { padding: 16px; }
    .cal .day { font-size: .82rem; }
    .card { padding: 16px; }
}

/* ============================================================
   Kalendarz miesięczny z godzinami w kratkach
   (układ jak w lock.me — cały miesiąc widoczny naraz)
   ============================================================ */

.lm-cal {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 7px;
}

.lm-dow {
    text-align: center;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-dim);
    padding-bottom: 2px;
}

.lm-day {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    padding: 5px 4px;
    min-height: 76px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.lm-day.pad { border: none; background: none; min-height: 0; }
.lm-day.off { opacity: .4; }
.lm-day.today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }

.lm-day .dnum {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px;
    font-weight: 800;
    font-size: .92rem;
    color: var(--text);
    padding: 0 2px 2px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 2px;
}
.lm-day .dnum .dow { font-size: .66rem; font-weight: 600; color: var(--text-dim); }
.lm-day.off .dnum { color: var(--text-dim); }

.lm-hours { display: flex; flex-direction: column; gap: 2px; }

.lm-cal .hour {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    padding: 3px 4px;
    border-radius: 5px;
    border: 1px solid transparent;
    background: var(--card-hi);
    color: var(--text);
    font-size: .76rem;
    font-weight: 700;
    font-family: inherit;
    line-height: 1.3;
    cursor: pointer;
    width: 100%;
    transition: background .12s ease, border-color .12s ease;
}
.lm-cal a.hour:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    text-decoration: none;
}
.lm-cal .hour .p { font-size: .62rem; font-weight: 600; opacity: .55; }
.lm-cal .hour.booked {
    background: transparent;
    border-color: var(--line);
    color: var(--text-dim);
    text-decoration: line-through;
    cursor: not-allowed;
    opacity: .5;
}
.lm-cal .hour.booked:hover { background: transparent; color: var(--text-dim); }

.lm-day .none { font-size: .7rem; color: var(--text-dim); text-align: center; padding: 6px 0; }

.lm-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .8rem; color: var(--text-dim); }
.lm-legend i { display: inline-block; width: 13px; height: 13px; border-radius: 4px;
               vertical-align: -2px; margin-right: 5px; }
.lm-legend .free  { background: var(--card-hi); border: 1px solid var(--line); }
.lm-legend .taken { background: transparent; border: 1px solid var(--line); opacity: .5; }

/* Telefon: siatka 7 kolumn jest nieczytelna — pokazujemy tylko dni
   z terminami, w układzie kafelkowym. */
@media (max-width: 860px) {
    .lm-cal { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
    .lm-dow, .lm-day.pad, .lm-day.empty { display: none; }
    .lm-day { min-height: 0; }
}
