/* Wygląd systemu skupu. Kolory i czcionki takie jak w szkicach ekranów z oferty.
   Spis treści:
   1. Kolory i podstawy
   2. Układ: menu z boku, pasek u góry, menu na dole
   3. Nagłówek strony, przyciski, pola, komunikaty
   4. Kafelki i kroki
   5. Karty, listy, tabele, statusy
   6. Pulpit
   7. Zlecenie: pozycje i zdjęcia
   8. Zakończenie
   9. Logowanie
   10. Komunikat na dole ekranu i powiększanie zdjęć
   11. Tablet i telefon */

/* ---------- 1. Kolory i podstawy ---------- */

:root {
    --app-bg: #F4F6F3;
    --card: #FFFFFF;
    --ink: #1B231D;
    --muted: #5E6A62;
    --line: #DFE4DF;
    --line-2: #C6CEC7;
    --soft: #EEF1EE;
    --hover: #F8FAF7;
    --brand: #14501C;       /* zieleń Empton */
    --brand-2: #2F7A22;
    --brand-soft: #E6F0E1;
    --eprint: #0B5CAB;      /* niebieski E-PRINT */
    --eprint-soft: #E5EEF8;
    --blue: #285C82;
    --blue-soft: #E4EDF4;
    --red: #A1261B;
    --red-soft: #FBE9E7;
    --amber: #865700;
    --amber-soft: #FAEFD7;
    --radius: 10px;
    --side-w: 252px;        /* szerokość menu bocznego */
    --top-h: 64px;          /* wysokość górnego paska na tablecie i telefonie */
    --tab-h: 66px;          /* wysokość dolnego menu na tablecie i telefonie */
    --sticky-top: 24px;     /* odstęp od góry dla elementów, które "jadą" przy przewijaniu */
    --f-head: 'Montserrat', 'Segoe UI', Arial, sans-serif;
    --f-body: 'Source Sans 3', 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--app-bg);
    color: var(--ink);
    font: 400 17px/1.5 var(--f-body);
    -webkit-tap-highlight-color: transparent;
}

h1, h2 { font-family: var(--f-head); margin: 0; }
p { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* Ikony z biblioteki Tabler Icons: <i class="ti ti-camera"></i> */
.ti { font-size: 1.2em; line-height: 1; flex: none; }

/* ---------- 2. Układ: menu z boku, pasek u góry, menu na dole ---------- */

/* Komputer i tablet poziomo: menu z lewej, treść z prawej */
body { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.topbar, .tabbar { display: none; }

.side {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 26px 16px 18px;
    background: var(--card);
    border-right: 1px solid var(--line);
    overflow-y: auto;
}
.side-logo { display: block; padding: 0 10px 10px; }
.side-logo img { display: block; width: 178px; height: auto; }
.side-role {
    padding: 8px 12px 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.side-nav { display: grid; gap: 4px; }
.side-section { margin-top: 14px; }
.side-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 50px;
    padding: 0 14px;
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius);
}
.side-nav a .ti { font-size: 23px; color: var(--muted); }
.side-nav a:hover { background: var(--hover); }
.side-nav a.on { color: var(--brand); background: var(--brand-soft); }
.side-nav a.on .ti { color: var(--brand); }
.nav-badge {
    margin-left: auto;
    min-width: 24px;
    padding: 0 7px;
    color: var(--amber);
    background: var(--amber-soft);
    border-radius: 999px;
    font-size: 13px;
    line-height: 24px;
    text-align: center;
}

.side-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding: 14px 6px 0;
    border-top: 1px solid var(--line);
}
.avatar {
    display: grid;
    place-content: center;
    width: 40px;
    height: 40px;
    flex: none;
    color: var(--brand);
    background: var(--brand-soft);
    border-radius: 50%;
    font-weight: 700;
}
.side-name { flex: 1; min-width: 0; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.side-name small { display: block; color: var(--muted); font-size: 14px; font-weight: 400; }
.side-account { padding: 4px 6px; margin: -4px -6px; color: inherit; text-decoration: none; border-radius: 8px; }
.side-account:hover, .side-account.on { background: var(--hover); }
.side-account:hover small, .side-account.on small { color: var(--brand); }

/* Okrągły przycisk z samą ikoną */
.icon-btn {
    display: grid;
    place-content: center;
    width: 42px;
    height: 42px;
    flex: none;
    padding: 0;
    color: var(--muted);
    background: none;
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 17px;
    text-decoration: none;
}
.icon-btn:hover { color: var(--ink); background: var(--soft); }

/* ---------- 2b. Magazyn: tylko górny pasek z menu ---------- */

body.role-warehouse { display: block; --sticky-top: 96px; }
.wbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 76px;
    padding: 10px 28px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
}
.wbar-logo img { display: block; height: 50px; width: auto; }
.wbar-nav { display: flex; gap: 6px; margin-left: 8px; }
.wbar-nav a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 50px;
    padding: 0 16px;
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius);
}
.wbar-nav a .ti { font-size: 23px; color: var(--muted); }
.wbar-nav a:hover { background: var(--hover); }
.wbar-nav a.on { color: var(--brand); background: var(--brand-soft); }
.wbar-nav a.on .ti { color: var(--brand); }
.wbar-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 50px;
    margin-left: auto;
    padding: 0 14px;
    color: var(--brand);
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius);
}
.wbar-logout:hover { background: var(--hover); }
body.role-warehouse .main { padding-bottom: 56px; }
body.role-warehouse .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }

/* Węższy tablet i telefon: menu magazynu w drugim wierszu paska, ikony nad napisami */
@media (max-width: 900px) {
    .wbar { flex-wrap: wrap; gap: 6px 12px; padding: 8px 16px 0; }
    .wbar-logo img { height: 44px; }
    .wbar-nav { order: 3; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; margin: 0; gap: 0; }
    .wbar-nav a { flex-direction: column; justify-content: center; gap: 2px; min-height: 60px; padding: 6px 4px; font-size: 13px; text-align: center; border-radius: 0; border-bottom: 3px solid transparent; }
    .wbar-nav a.on { background: none; border-bottom-color: var(--brand); }
    .wbar-nav a .ti { font-size: 25px; }
    body.role-warehouse .main { padding: 20px 18px 40px; }
}

/* Treść strony. container-type pozwala układowi zlecenia dopasować się do szerokości treści, a nie ekranu. */
.main {
    display: grid;
    align-content: start;
    gap: 20px;
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 32px 40px 56px;
    container-type: inline-size;
}

/* ---------- 3. Nagłówek strony, przyciski, pola, komunikaty ---------- */

.h-app { font-size: 28px; font-weight: 700; line-height: 1.2; }
.sub { margin-top: 4px; color: var(--muted); font-size: 16px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-self: start;
    color: var(--brand);
    font-weight: 600;
    text-decoration: none;
}
.back:hover { text-decoration: underline; }
.link { color: var(--brand); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 24px;
    font: 700 17px var(--f-body);
    color: #FFFFFF;
    background: var(--brand);
    border: 0;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { background: #0F4216; }
.btn:disabled { background: var(--line-2); cursor: not-allowed; }
.btn-ghost { color: var(--brand); background: var(--card); border: 1.5px solid var(--line-2); }
.btn-ghost:hover { background: var(--hover); border-color: var(--brand); }
.btn-full { width: 100%; }
.btn-link { text-decoration: none; }
label.btn { cursor: pointer; }

fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend, .label {
    display: block;
    margin-bottom: 10px;
    padding: 0;
    font-family: var(--f-head);
    font-size: 16px;
    font-weight: 600;
}
.opt { font-family: var(--f-body); font-weight: 400; color: var(--muted); }

.input {
    width: 100%;
    min-height: 54px;
    padding: 12px 16px;
    font: inherit;
    color: var(--ink);
    background: var(--card);
    border: 1.5px solid var(--line-2);
    border-radius: var(--radius);
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.hint { margin-top: 8px; color: var(--muted); font-size: 14px; }

/* Wyszukiwarka: ikona lupy w polu i przycisk obok */
.search { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.search > .ti { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 22px; pointer-events: none; }
.search .input { padding-left: 50px; }
.filters { display: grid; grid-template-columns: minmax(0, 1fr) 220px 200px; gap: 12px; }
.select { cursor: pointer; }

.alert { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-radius: var(--radius); font-weight: 600; }
.alert-ok { background: var(--brand-soft); color: var(--brand); }
.alert-error { background: var(--red-soft); color: var(--red); }
.alert-info { background: var(--blue-soft); color: var(--blue); }
.alert-warn { background: var(--amber-soft); color: var(--amber); }
.report {
    padding: 14px 18px;
    background: var(--amber-soft);
    color: var(--amber);
    border-radius: var(--radius);
    font-size: 15px;
}
.report ul { margin: 6px 0 0; padding-left: 20px; }

/* Ukryte dla oka, ale dostępne dla przeglądarki (pole wyboru pliku) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- 4. Kafelki i kroki ---------- */

/* Karta z formularzem */
.card {
    display: grid;
    gap: 26px;
    padding: 26px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
}

/* Duże kafelki do wybierania palcem */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile {
    position: relative;
    display: grid;
    align-content: center;
    gap: 2px;
    min-height: 84px;
    padding: 14px 18px;
    background: var(--card);
    border: 1.5px solid var(--line-2);
    border-radius: var(--radius);
    cursor: pointer;
}
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile img { height: 36px; width: auto; justify-self: start; margin-bottom: 6px; }
.tile span { font-size: 18px; font-weight: 700; }
.tile small { color: var(--muted); font-size: 14px; }
.tile:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.tile-eprint:has(input:checked) { background: var(--eprint-soft); border-color: var(--eprint); box-shadow: inset 0 0 0 1px var(--eprint); }
.tile:has(input:focus-visible) { outline: 3px solid var(--brand-2); outline-offset: 2px; }

/* Dwa pola obok siebie: Firma szeroka, NIP węższy */
.row-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }

/* Dolny pasek formularza z przyciskiem */
.nextbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}
.nextbar .hint { margin: 0; }

/* Pole Firma z podpowiedzią z bazy firm (nowy skup) */
.combo-field { position: relative; }
.combo-field > .ti { position: absolute; left: 16px; top: 27px; transform: translateY(-50%); color: var(--muted); font-size: 22px; pointer-events: none; }
.combo-field .input { padding-left: 50px; }
.combo .input.is-picked { border-color: var(--brand); }
.combo-list {
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: min(360px, 55vh);
    overflow-y: auto;
    padding: 6px;
    background: var(--card);
    border: 1px solid var(--line-2);
    border-radius: var(--radius);
    box-shadow: 0 14px 34px rgba(27, 35, 29, 0.14);
}
.combo-head { padding: 8px 12px 6px; color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.combo-opt { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.combo-opt > .ti { flex: none; color: var(--muted); font-size: 22px; }
.combo-opt:hover, .combo-opt.on { background: var(--soft); }
.combo-main { display: grid; gap: 1px; min-width: 0; }
.combo-main b { font-weight: 600; overflow-wrap: anywhere; }
.combo-main small { color: var(--muted); font-size: 14px; }
.combo-main mark { padding: 0 1px; color: var(--brand); background: var(--brand-soft); border-radius: 3px; }
.combo-new > .ti, .combo-new b { color: var(--brand); }
.combo-opt + .combo-new { margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; }
.combo-empty { padding: 10px 12px; color: var(--muted); font-size: 14px; }

/* Pod polem: wybrana firma albo nowa firma, z przyciskiem "Zmień" */
.company-picked { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 10px 10px 14px; color: var(--brand); background: var(--brand-soft); border-radius: var(--radius); }
.company-picked > .ti { flex: none; font-size: 22px; }
.company-picked span { display: grid; flex: 1; min-width: 0; }
.company-picked small { color: var(--ink); font-size: 14px; }
.company-picked .link-btn { flex: none; color: inherit; font-size: 15px; }
.company-picked.is-new { color: var(--blue); background: var(--blue-soft); }
.company-picked.is-new .link-btn:hover { background: #D3E2EE; }

/* Pytanie "Czy chodzi o tę firmę?" */
.company-ask { display: grid; gap: 8px; margin-top: 10px; padding: 14px; background: var(--amber-soft); border-radius: var(--radius); }
.ask-q { display: flex; align-items: center; gap: 8px; margin: 0 0 2px; color: var(--amber); font-weight: 700; }
.ask-q .ti { font-size: 22px; }
.ask-opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 8px 14px; font: inherit; color: var(--ink); text-align: left; background: var(--card); border: 1.5px solid var(--line-2); border-radius: var(--radius); cursor: pointer; }
.ask-opt:hover { border-color: var(--brand); }
.ask-opt > .ti { flex: none; color: var(--muted); font-size: 22px; }
.ask-opt span { display: grid; flex: 1; min-width: 0; }
.ask-opt b { overflow-wrap: anywhere; }
.ask-opt small { color: var(--muted); font-size: 14px; }
.ask-opt em { flex: none; color: var(--brand); font-style: normal; font-weight: 700; }
.company-ask .btn-small { justify-self: start; background: var(--card); }

.input[readonly] { color: var(--muted); background: var(--soft); }
.hint-error { color: var(--red); font-weight: 600; }

/* Kroki: Start, Pozycje, Zakończenie */
.stepper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--muted);
    font-weight: 600;
}
.stepper span { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.stepper i {
    display: grid;
    place-content: center;
    width: 28px;
    height: 28px;
    border: 1.5px solid var(--line-2);
    border-radius: 50%;
    font-style: normal;
    font-size: 13px;
}
.stepper i .ti { font-size: 16px; }
.stepper em { font-style: normal; }
.stepper b { flex: 1; min-width: 12px; max-width: 90px; height: 1px; background: var(--line-2); }
.stepper .on { color: var(--ink); }
.stepper .on i { background: var(--brand); border-color: var(--brand); color: #FFFFFF; }
.stepper .done { color: var(--brand); }
.stepper .done i { background: var(--brand-soft); border-color: var(--brand-soft); color: var(--brand); }

/* Zakładki filtra, np. Wszystkie, W trakcie, Do wyceny */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tabs a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    color: var(--ink);
    font-weight: 600;
    text-decoration: none;
    background: var(--card);
    border: 1.5px solid var(--line-2);
    border-radius: 999px;
}
.tabs a:hover { border-color: var(--brand); }
.tabs a span { color: var(--muted); font-weight: 400; }
.tabs a.on { color: #FFFFFF; background: var(--brand); border-color: var(--brand); }
.tabs a.on span { color: #FFFFFF; opacity: .8; }

/* ---------- 5. Karty, listy, tabele, statusy ---------- */

.panel {
    display: grid;
    gap: 18px;
    padding: 22px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.panel-h {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-family: var(--f-head);
    font-size: 17px;
    font-weight: 700;
}
.panel-h small { font-family: var(--f-body); font-size: 14px; font-weight: 400; color: var(--muted); }
.stack { display: grid; gap: 18px; align-content: start; }

/* Sekcja z nagłówkiem, np. "Otwarte zlecenia" */
.block { display: grid; gap: 12px; }
.block-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.block-h h2 { font-size: 19px; font-weight: 700; }

/* Pusty stan: ikona i krótki tekst */
.empty-state { justify-items: center; gap: 10px; padding: 32px 22px; text-align: center; color: var(--muted); }
.empty-state > .ti { font-size: 34px; color: var(--line-2); }

.badge, .chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}
.chip { background: var(--soft); color: var(--muted); }
.chip .ti { font-size: 15px; color: var(--cc, currentColor); }
.b-empton { background: var(--brand); color: #FFFFFF; }
.b-eprint { background: var(--eprint); color: #FFFFFF; }

/* Kolory statusów */
.s-in_progress { background: var(--blue-soft); color: var(--blue); }
.s-to_price { background: var(--amber-soft); color: var(--amber); }
.s-priced { background: var(--brand-soft); color: var(--brand); }

/* Karty otwartych zleceń */
.ocards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 12px; }
.ocard {
    display: grid;
    gap: 14px;
    padding: 18px 20px;
    color: inherit;
    text-decoration: none;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.ocard:hover { border-color: var(--brand); }
.oc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.oc-top b { display: block; font-size: 18px; overflow-wrap: anywhere; }
.oc-top small { display: block; color: var(--muted); font-size: 14px; }
.oc-bot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.oc-go { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; color: var(--brand); font-size: 15px; font-weight: 700; }

/* Prosta lista wierszy-linków */
.panel.list { gap: 0; padding: 0; overflow: hidden; }
.list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    color: inherit;
    text-decoration: none;
    border-top: 1px solid var(--line);
}
.list-row:first-child { border-top: 0; }
.list-row:hover { background: var(--hover); }
.list-row > .ti { color: var(--muted); }
.list-main { flex: 1; min-width: 0; }
.list-main b { display: block; overflow-wrap: anywhere; }
.list-main small { color: var(--muted); font-size: 14px; }
.list-side { display: grid; justify-items: end; gap: 4px; flex: none; }

/* ---------- Admin: konta, kosz, usuwanie ---------- */

.btn-danger { color: var(--red); border-color: #E3B8B2; }
.btn-danger:hover { background: var(--red-soft); }
.link-btn.link-danger { color: var(--red); }
.link-btn.link-danger:hover { background: var(--red-soft); }

/* Przycisk "Usuń zlecenie" obok statusu zlecenia */
.badges { align-items: center; }
.head-delete { margin: 0 0 0 4px; }
.inline-form { display: inline-flex; margin: 0 0 0 6px; vertical-align: middle; }
.head-delete .btn-small, .badges .head-btn { min-height: 32px; padding: 0 12px; font-size: 14px; }
.badges .head-btn { margin-left: 4px; }
.head-btn + .head-delete { margin-left: 0; }

/* Lista kont */
.user-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px 14px; padding: 14px 18px; border-top: 1px solid var(--line); }
.user-row:first-child { border-top: 0; }
.user-row.is-blocked .avatar { color: var(--muted); background: var(--soft); }
.user-row.is-blocked .list-main b { color: var(--muted); }
.user-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.user-actions { grid-column: 2 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.user-actions form { margin: 0; }
.user-pass summary { list-style: none; }
.user-pass summary::-webkit-details-marker { display: none; }
.user-pass[open] { flex-basis: 100%; }
.user-pass-form { display: flex; gap: 8px; max-width: 480px; margin-top: 8px; }
.user-pass-form .input { min-height: 44px; }
.badge-admin { color: #FFFFFF; background: var(--brand); }
.badge-office { color: var(--blue); background: var(--blue-soft); }
.badge-warehouse { color: var(--ink); background: var(--soft); }
.badge-blocked { color: var(--red); background: var(--red-soft); }

/* Hasła: Twoje hasło i hasło magazynu */
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 18px; align-items: start; }
.account-grid .btn { justify-self: start; }
.wh-pass { display: grid; gap: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.wh-pass .label { margin-bottom: 4px; }
.wh-pass-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }

/* Firma: łączenie i usuwanie */
.merge-similar { display: grid; gap: 8px; }
.merge-similar .label { margin-bottom: 0; }
.merge-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--hover); border: 1px solid var(--line); border-radius: var(--radius); }
.merge-row .btn { flex: none; }
.merge-any { display: grid; gap: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.merge-delete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }

/* Historia poprawek zlecenia */
.history { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.history li { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.history li:first-child { border-top: 0; padding-top: 0; }
.history-ic { display: grid; flex: none; place-content: center; width: 32px; height: 32px; color: var(--muted); background: var(--soft); border-radius: 8px; }
.history-ic .ti { font-size: 18px; }
.history-what { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.history-what small { color: var(--muted); font-size: 13px; }
#history:empty { display: none; }

/* Przycisk "Pobierz" z wyborem formatu (Excel albo CSV) */
.export-menu { position: relative; }
.export-menu summary { list-style: none; }
.export-menu summary::-webkit-details-marker { display: none; }
.export-menu summary .ti-chevron-down { font-size: 16px; transition: transform .15s; }
.export-menu[open] summary .ti-chevron-down { transform: rotate(180deg); }
.export-list { position: absolute; z-index: 30; top: calc(100% + 6px); right: 0; display: grid; width: 300px; padding: 6px; background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: 0 14px 34px rgba(27, 35, 29, 0.14); }
.export-list a { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; color: var(--ink); text-decoration: none; border-radius: 8px; }
.export-list a:hover { background: var(--soft); }
.export-list a > .ti { margin-top: 2px; color: var(--brand); font-size: 22px; }
.export-list span { display: grid; gap: 2px; }
.export-list small { color: var(--muted); font-size: 13px; }
@media (max-width: 700px) {
    /* Na telefonie przycisk jest po lewej, więc lista rozwija się w prawo i mieści na ekranie. */
    .export-list { left: 0; right: auto; width: min(300px, calc(100vw - 32px)); }
}

/* Kosz */
.trash-row:hover { background: transparent; }
.trash-row .list-main small { display: block; }
.trash-row form { flex: none; margin: 0; }

/* Tabela */
.table-wrap {
    overflow-x: auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.table { width: 100%; border-collapse: collapse; font-size: 16px; }
.table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table th.r, .table td.r { text-align: right; }
.table tr[data-href] { cursor: pointer; }
.table tfoot td { font-weight: 700; background: var(--hover); border-top: 1.5px solid var(--line-2); border-bottom: 0; }
.table tr[data-href]:hover td { background: var(--hover); }
.td-sub { display: block; color: var(--muted); font-size: 14px; }
.td-wrap { min-width: 160px; white-space: normal !important; }
.td-go { width: 1%; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

.pager { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 14px; }

/* ---------- 6. Pulpit ---------- */

/* Duże kafelki na starcie magazynu */
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.action {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    min-height: 168px;
    padding: 22px;
    color: var(--ink);
    text-decoration: none;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
}
.action:hover { border-color: var(--brand); }
.action > span:nth-child(2) { flex: 1; min-width: 0; }
.action b { display: block; font-family: var(--f-head); font-size: 20px; }
.action small { display: block; color: var(--muted); font-size: 15px; }
.action > .ti { font-size: 24px; color: var(--muted); }
.action-ic {
    display: grid;
    place-content: center;
    width: 58px;
    height: 58px;
    flex: none;
    color: var(--brand);
    background: var(--brand-soft);
    border-radius: 14px;
}
.action-ic .ti { font-size: 30px; }
.action-main { color: #FFFFFF; background: var(--brand); border-color: var(--brand); }
.action-main:hover { background: #0F4216; }
.action-main small, .action-main > .ti { color: rgba(255, 255, 255, .8); }
.action-main .action-ic { color: #FFFFFF; background: rgba(255, 255, 255, .14); }

/* Liczniki na pulpicie biura */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    column-gap: 14px;
    padding: 18px 20px;
    color: var(--ink);
    text-decoration: none;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
}
a.stat:hover { border-color: var(--brand); }
.stat-ic {
    grid-row: span 2;
    display: grid;
    place-content: center;
    width: 44px;
    height: 44px;
    color: var(--muted);
    background: var(--soft);
    border-radius: 10px;
}
.stat-ic .ti { font-size: 22px; }
.stat-n { font-family: var(--f-head); font-size: 28px; font-weight: 700; line-height: 1.15; }
.stat-n small { font-size: 16px; color: var(--muted); }
.stat-l { color: var(--muted); font-size: 15px; }
.stat-amber .stat-ic { color: var(--amber); background: var(--amber-soft); }
.stat-blue .stat-ic { color: var(--blue); background: var(--blue-soft); }

/* ---------- 7. Zlecenie: pozycje i zdjęcia ---------- */

.order-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }

/* Na wąskiej treści jedna kolumna. Gdy treść ma co najmniej 880 px: formularz z lewej, lista z prawej. */
.order-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
@container (min-width: 880px) {
    .order-grid { grid-template-columns: minmax(320px, 390px) minmax(0, 1fr); }
    .order-grid-view { grid-template-columns: minmax(0, 1fr); }
    .add-panel { position: sticky; top: var(--sticky-top); }
}

/* Kolory rodzajów: toner zielony, tusz niebieski, bęben bursztynowy, odpad szary */
.k-toner { --cc: var(--brand); --cs: var(--brand-soft); }
.k-ink { --cc: var(--blue); --cs: var(--blue-soft); }
.k-drum { --cc: var(--amber); --cs: var(--amber-soft); }
.k-waste { --cc: var(--muted); --cs: var(--soft); }

/* Rodzaj: cztery kafelki */
.kinds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kind {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 58px;
    padding: 10px 14px;
    font-weight: 600;
    background: var(--card);
    border: 1.5px solid var(--line-2);
    border-radius: var(--radius);
    cursor: pointer;
}
.kind .ti { font-size: 24px; color: var(--cc); }
.kind input { position: absolute; opacity: 0; pointer-events: none; }
.kind:has(input:checked) { background: var(--cs); border-color: var(--cc); box-shadow: inset 0 0 0 1px var(--cc); }
.kind:has(input:focus-visible) { outline: 3px solid var(--brand-2); outline-offset: 2px; }

/* Stan: dwa przyciski obok siebie */
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1.5px solid var(--line-2); border-radius: var(--radius); overflow: hidden; }
.seg label { position: relative; display: grid; place-content: center; min-height: 54px; font-weight: 600; background: var(--card); cursor: pointer; }
.seg label + label { border-left: 1.5px solid var(--line-2); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { color: #FFFFFF; background: var(--brand); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--brand-2); outline-offset: -3px; }

/* Ilość: minus, pole, plus i szybki wybór */
.qty { display: grid; grid-template-columns: 58px minmax(0, 1fr) 58px; border: 1.5px solid var(--line-2); border-radius: var(--radius); overflow: hidden; }
.qty button { display: grid; place-content: center; color: var(--ink); background: var(--card); border: 0; cursor: pointer; font-size: 20px; }
.qty button:active { background: var(--soft); }
.qty input {
    width: 100%;
    min-height: 56px;
    text-align: center;
    font: 700 20px var(--f-body);
    border: 0;
    border-left: 1.5px solid var(--line-2);
    border-right: 1.5px solid var(--line-2);
}
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.quick button {
    min-height: 44px;
    font: 600 16px var(--f-body);
    background: var(--card);
    border: 1.5px solid var(--line-2);
    border-radius: 8px;
    cursor: pointer;
}
.quick button:active { background: var(--soft); }

/* Lista pozycji */
.items { list-style: none; margin: 0; padding: 0; }
.item-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.item-row:first-child { border-top: 0; }
.item-ic { display: grid; place-content: center; width: 42px; height: 42px; color: var(--cc); background: var(--cs); border-radius: 10px; }
.item-ic .ti { font-size: 22px; }
.item-name { min-width: 0; }
.item-name b { display: block; overflow-wrap: anywhere; }
.item-name small { color: var(--muted); font-size: 14px; }
.item-qty { font-weight: 700; white-space: nowrap; }
.icon-btn-del:hover { color: var(--red); background: var(--red-soft); }
.item-actions { display: flex; align-items: center; gap: 2px; }
.item-actions form { margin: 0; }

/* Formularz zmiany pozycji: pod pozycją, na całą szerokość */
.item-edit { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 14px; background: var(--hover); border: 1px solid var(--line); border-radius: var(--radius); }
.item-edit .label { margin-bottom: 6px; font-size: 15px; }
.item-edit .seg label { min-height: 46px; }
.item-edit .qty input { min-height: 48px; }
.item-edit-actions { display: flex; align-items: center; gap: 12px; }
@container (min-width: 700px) {
    .item-edit:has(.seg) { grid-template-columns: 220px minmax(0, 1fr) 190px; align-items: end; }
    .item-edit .item-edit-actions { grid-column: 1 / -1; }
}
.tag-out { display: inline-block; margin-left: 6px; padding: 0 6px; font-size: 12px; font-weight: 600; color: var(--amber); background: var(--amber-soft); border-radius: 4px; }
.sumbar { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }

/* Nowo dodana pozycja na chwilę się podświetla */
.item-row.is-new { animation: flash 1.6s ease-out; }
@keyframes flash {
    from { background: var(--brand-soft); }
    to { background: transparent; }
}

/* Siatka zdjęć */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photo { position: relative; margin: 0; aspect-ratio: 4 / 3; overflow: hidden; background: var(--soft); border-radius: 10px; }
.photo-link { display: block; width: 100%; height: 100%; cursor: zoom-in; }
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-zoom {
    position: absolute;
    left: 8px;
    bottom: 8px;
    display: grid;
    place-content: center;
    width: 34px;
    height: 34px;
    color: #FFFFFF;
    background: rgba(27, 35, 29, .66);
    border-radius: 50%;
    pointer-events: none;
}
.photo form { position: absolute; top: 8px; right: 8px; }
.photo-del {
    display: grid;
    place-content: center;
    width: 36px;
    height: 36px;
    color: #FFFFFF;
    background: rgba(27, 35, 29, .72);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 15px;
}
.photo-del:hover { background: var(--red); }
.photo-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

/* ---------- 7b. Wycena (biuro) ---------- */

/* Pasek wyceny na stronie zlecenia */
.pricebar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.pricebar .muted { display: inline-flex; align-items: center; gap: 8px; }
.pricebar-sum { display: flex; flex-wrap: wrap; gap: 10px 32px; }
.pricebar-sum span { color: var(--muted); font-size: 14px; }
.pricebar-sum b { display: block; color: var(--ink); font-size: 20px; }

/* Układ wyceny: pozycje i zdjęcia z lewej, podsumowanie z prawej (na wąskim ekranie pod pozycjami) */
.pricing-grid { display: grid; gap: 18px; grid-template-areas: "items" "summary" "photos"; }
.area-items { grid-area: items; }
.area-photos { grid-area: photos; }
.summary { grid-area: summary; }
@container (min-width: 980px) {
    .pricing-grid { grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "items summary" "photos summary"; align-items: start; }
    .summary { position: sticky; top: var(--sticky-top); }
}

/* Wiersz wyceny: ikona, nazwa, cena z cennika, pole ceny, wartość */
.price-head, .price-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 150px 150px 120px;
    grid-template-areas: "ic name sug input value" "ic name sug tag value";
    column-gap: 14px;
    align-items: center;
}
.price-head { grid-template-areas: none; padding-bottom: 6px; color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.price-head .r { text-align: right; }
.price-row { padding: 12px 0; border-top: 1px solid var(--line); }
.price-row .item-ic { grid-area: ic; }
.price-row .item-name { grid-area: name; }
.price-sug { grid-area: sug; display: flex; align-items: center; gap: 8px; font-size: 15px; }
.price-input { grid-area: input; position: relative; display: block; }
.price-input .input { min-height: 48px; padding: 8px 40px 8px 12px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.price-unit { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.price-value { grid-area: value; text-align: right; font-weight: 700; white-space: nowrap; }
.price-fixed { grid-area: input; justify-self: end; font-weight: 700; white-space: nowrap; }
.price-tag { grid-area: tag; justify-self: end; margin-top: 4px; font-size: 12px; font-weight: 700; }
.tag-list { color: var(--muted); }
.tag-own { color: var(--blue); }
.tag-missing { color: var(--amber); }
.link-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px; color: var(--brand); background: none; border: 0; border-radius: 6px; font: 700 14px var(--f-body); cursor: pointer; }
.link-btn:hover { background: var(--brand-soft); }

/* Wąska treść: wiersz wyceny układa się w kilku liniach */
@container (max-width: 700px) {
    .price-head { display: none; }
    .price-row {
        grid-template-columns: 42px minmax(0, 1fr) auto;
        grid-template-areas: "ic name name" "ic sug sug" "ic input value" "ic tag tag";
        row-gap: 8px;
    }
    .price-row .item-ic { align-self: start; }
    .price-tag { justify-self: start; margin: 0; }
}

/* Podsumowanie wyceny */
.price-input-wide .input { text-align: left; }
.sum { display: grid; grid-template-columns: minmax(0, 1fr) auto; row-gap: 10px; margin: 0; }
.sum dt { color: var(--muted); }
.sum dd { margin: 0; padding-left: 16px; font-weight: 700; text-align: right; white-space: nowrap; }
.sum .sum-total { padding-top: 12px; border-top: 1px solid var(--line); color: var(--ink); font-family: var(--f-head); font-size: 20px; font-weight: 700; }
.summary-actions { display: grid; gap: 10px; }

/* Sumy nad listą zleceń (biuro) */
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.totals > div { display: grid; gap: 2px; padding: 14px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.totals span { color: var(--muted); font-size: 14px; }
.totals b { font-family: var(--f-head); font-size: 21px; }
.totals small { color: var(--muted); font-size: 13px; }
.totals .totals-main { background: var(--brand-soft); border-color: var(--brand-soft); }
.totals .totals-main b { color: var(--brand); }

.tabs a.tab-clear { color: var(--muted); border-color: transparent; background: none; }
.tabs a.tab-clear:hover { color: var(--ink); }
.btn-small { min-height: 38px; padding: 0 14px; font-size: 15px; }
.two-cols { display: grid; gap: 20px; }
@container (min-width: 1000px) {
    .two-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
.stat-green .stat-ic { color: var(--brand); background: var(--brand-soft); }
.stat-money { font-size: 22px; white-space: nowrap; }

/* ---------- 7c. Czas przyjęcia, filtry i sortowanie ---------- */

/* Oś czasu zlecenia: rozpoczęte, zakończone, ile trwało */
.timeline {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 28px;
    padding: 14px 18px;
    color: var(--muted);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    font-size: 15px;
}
.timeline span { display: inline-flex; align-items: center; gap: 8px; }
.timeline .ti { font-size: 20px; color: var(--brand); }
.timeline b { color: var(--ink); }
.timeline .timeline-action { margin-left: auto; }

/* Panel filtrów nad listą zleceń */
.filter-panel { gap: 14px; padding: 16px 18px; }
.filter-row { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 12px; align-items: end; }
.filter-dates { grid-template-columns: 250px 170px 170px auto; justify-content: start; }
.field { display: grid; gap: 6px; }
.field > span { color: var(--muted); font-size: 14px; font-weight: 600; }
.field .input { min-height: 48px; padding-top: 8px; padding-bottom: 8px; }
.filter-panel .search .input { min-height: 48px; }
.filter-panel .btn { min-height: 48px; }
.search:not(:has(.btn)) { grid-template-columns: minmax(0, 1fr); }

/* "Więcej filtrów": rozwijany kawałek formularza */
.more-filters summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--brand);
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}
.more-filters summary::-webkit-details-marker { display: none; }
.more-filters[open] summary { margin-bottom: 12px; }
.filter-more { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* Szybkie okresy: Dziś, Ten miesiąc... */
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.presets a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    color: var(--muted);
    background: var(--soft);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}
.presets a:hover { color: var(--ink); }
.presets a.on { color: var(--brand); background: var(--brand-soft); }
.presets .preset-clear { background: none; }

/* Nagłówki tabeli do sortowania */
.th-sort { display: inline-flex; align-items: center; gap: 4px; color: inherit; text-decoration: none; }
.th-sort .ti { font-size: 15px; opacity: .45; }
.th-sort:hover, .th-sort.on { color: var(--ink); }
.th-sort.on .ti { opacity: 1; color: var(--brand); }
.table th.r .th-sort { justify-content: flex-end; }
.table-orders td { padding-left: 12px; padding-right: 12px; }
.table-orders th { padding-left: 12px; padding-right: 12px; }

/* ---------- 7d. Baza tonerów i okienko "Dodaj model" ---------- */

.kinds-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row-2-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.model-list .list-row { padding: 10px 18px; }
.model-list .item-ic { width: 38px; height: 38px; }

/* Cała baza: skróty do producentów, grupy i siatka modeli */
.models-head { margin-top: 8px; }
.producer-jump { display: flex; flex-wrap: wrap; gap: 6px; }
.producer-jump .chip { min-height: 36px; padding: 0 12px; font-size: 14px; color: var(--ink); text-decoration: none; background: var(--card); border: 1px solid var(--line-2); }
.producer-jump .chip:hover { border-color: var(--brand); color: var(--brand); }
.model-groups { display: grid; gap: 22px; }
.model-group { display: grid; gap: 10px; scroll-margin-top: calc(var(--sticky-top) + 8px); }
.model-group-h { display: flex; align-items: baseline; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.model-group-h h3 { margin: 0; font-family: var(--f-head); font-size: 17px; font-weight: 700; }
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 8px; }
.model { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 12px 8px 8px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.model .item-ic { flex: none; width: 36px; height: 36px; }
.model .item-ic .ti { font-size: 20px; }
.model-main { display: grid; min-width: 0; }
.model-main b { overflow-wrap: anywhere; }
.model-main small { color: var(--muted); font-size: 13px; }
.model-main .tag-out { margin-left: 4px; }

/* Okienko nad stroną (<dialog>). ::backdrop to przyciemnione tło pod okienkiem. */
.modal {
    width: min(520px, calc(100vw - 32px));
    padding: 0;
    color: var(--ink);
    border: 0;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.modal::backdrop { background: rgba(27, 35, 29, .45); }
.modal form { display: grid; gap: 18px; padding: 22px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-family: var(--f-head); font-size: 19px; font-weight: 700; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- 8. Zakończenie ---------- */

.finishbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.finishbar .hint { margin: 0; }

/* Podsumowanie: opis po lewej, wartość po prawej */
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 24px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

/* Potwierdzenie po zakończeniu */
.done-card { justify-items: center; padding: 44px 24px; text-align: center; }
.done-mark {
    display: grid;
    place-content: center;
    width: 68px;
    height: 68px;
    color: var(--brand);
    background: var(--brand-soft);
    border-radius: 50%;
    font-size: 26px;
}
.done-t { font-size: 22px; font-weight: 700; }
.done-card .sub { max-width: 460px; margin: 0; }
.done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* ---------- 9. Logowanie ---------- */

.login-page { display: block; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
    width: 100%;
    max-width: 420px;
    display: grid;
    gap: 18px;
    padding: 34px 30px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(27, 35, 29, .08);
}
.login-logo { width: 220px; height: auto; justify-self: start; margin-bottom: 4px; }

/* Pole wyboru "Zapamiętaj to urządzenie" */
.check { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; background: var(--hover); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.check input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--brand); cursor: pointer; }
.check span { display: grid; gap: 2px; font-weight: 600; }
.check small { color: var(--muted); font-size: 14px; font-weight: 400; }
.check:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); }

/* ---------- 10. Komunikat na dole ekranu i powiększanie zdjęć ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(560px, calc(100vw - 32px));
    padding: 14px 20px;
    color: #FFFFFF;
    background: var(--ink);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
    font-weight: 600;
    transform: translateX(-50%);
    animation: toast-in .2s ease-out;
}
.toast .ti { font-size: 22px; }
.toast-ok .ti { color: #9AD68F; }
.toast-error { background: var(--red); }
@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* Przycisk "Pobierz" w powiększeniu zdjęcia (PhotoSwipe) */
.pswp__button--download { display: grid; place-content: center; color: #FFFFFF; text-decoration: none; }
.pswp__button--download .ti { font-size: 24px; }

/* ---------- 11. Tablet i telefon ---------- */

/* Tablet pionowo i telefon: zamiast menu z boku pasek u góry i menu na dole */
@media (max-width: 1023px) {
    :root { --sticky-top: calc(var(--top-h) + 16px); }

    body { display: block; }
    .side { display: none; }

    .topbar {
        position: sticky;
        top: 0;
        z-index: 20;
        display: flex;
        align-items: center;
        gap: 12px;
        height: var(--top-h);
        padding: 0 20px;
        background: var(--card);
        border-bottom: 1px solid var(--line);
    }
    .top-logo img { display: block; height: 44px; width: auto; }
    .top-admin + .top-logout { margin-left: 4px; }
    .top-role { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
    .top-role .ti { font-size: 15px; }
    .top-role { padding: 2px 10px; color: var(--muted); background: var(--soft); border-radius: 999px; font-size: 14px; font-weight: 600; }
    .top-logout {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        margin-left: auto;
        min-height: 44px;
        padding: 0 6px;
        color: var(--brand);
        font-weight: 600;
        text-decoration: none;
    }

    .tabbar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 20;
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(0, 1fr);
        height: calc(var(--tab-h) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: var(--card);
        border-top: 1px solid var(--line);
    }
    .tabbar a {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        color: var(--muted);
        font-size: 13px;
        font-weight: 600;
        text-decoration: none;
    }
    .tabbar a .ti { font-size: 25px; }
    .tabbar a.on { color: var(--brand); }
    .tabbar a.on::before { content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; background: var(--brand); border-radius: 0 0 3px 3px; }
    .tabbar .nav-badge { position: absolute; top: 6px; left: calc(50% + 6px); margin: 0; min-width: 20px; padding: 0 5px; font-size: 12px; line-height: 20px; }
    .tabbar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    .main { padding: 24px 24px calc(var(--tab-h) + 40px); }
    .toast { bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); }
}

/* Szeroka tabela tylko na szerokiej treści. Na węższej zwarta lista (tablet pionowo, telefon). */
@container (min-width: 1000px) {
    .only-narrow { display: none !important; }
}
@container (max-width: 999.98px) {
    .only-wide { display: none !important; }
}

/* Tablet pionowo */
@media (max-width: 760px) {
    .row-2, .filters, .filter-row { grid-template-columns: minmax(0, 1fr); }
    .filter-dates { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-dates .field:first-child, .filter-dates .btn { grid-column: 1 / -1; }
    .totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }

}

/* Telefon */
@media (max-width: 600px) {
    .topbar { padding: 0 16px; }
    .top-logo img { height: 42px; }
    .top-logout span { display: none; }
    .main { padding: 18px 16px calc(var(--tab-h) + 32px); gap: 16px; }
    .h-app { font-size: 23px; }
    .card { padding: 18px; gap: 22px; }
    .panel { padding: 18px; }
    .stepper { padding: 12px 14px; gap: 8px; }
    .stepper span:not(.on) em { display: none; }
    .tile { padding: 12px 14px; }
    .nextbar, .finishbar { flex-direction: column; align-items: stretch; }
    .nextbar .hint, .finishbar .hint { text-align: center; }
    .done-actions { flex-direction: column; width: 100%; }
    .head-actions { width: 100%; }
    .head-actions .btn { flex: 1; }
    .actions { grid-template-columns: minmax(0, 1fr); }
    .action { flex-direction: row; align-items: center; min-height: 88px; padding: 16px; }
    .stat { padding: 14px 16px; column-gap: 12px; grid-template-columns: 40px minmax(0, 1fr); }
    .stat-ic { width: 40px; height: 40px; }
    .stat-n { font-size: 24px; }
    .stat > * { min-width: 0; }
    .stat-money { font-size: 18px; white-space: normal; }
    .stat-l { font-size: 14px; line-height: 1.3; }
    .only-wide-btn { display: none; }
    .login-card { padding: 26px 20px; }
}

/* Bardzo wąski telefon */
@media (max-width: 480px) {
    .kinds-3 .kind { flex-direction: column; justify-content: center; gap: 4px; min-height: 72px; padding: 8px; text-align: center; }
    .modal-actions .btn { flex: 1; }
}
@media (max-width: 420px) {
    .tabbar a { font-size: 11px; }
    .tiles { grid-template-columns: minmax(0, 1fr); }
    .item-row { grid-template-columns: 38px minmax(0, 1fr) auto auto; gap: 8px; }
    .item-ic { width: 38px; height: 38px; }
    .photo-buttons { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- 12. Potwierdzenie przyjęcia (wydruk i PDF) ---------- */

body.doc-page { display: block; background: var(--soft); }
.doc-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-width: 210mm;
    margin: 0 auto;
    padding: 20px 16px 12px;
}
.doc-toolbar .tabs a { min-height: 40px; }

/* Kartka A4: 210 mm szerokości */
.doc {
    display: grid;
    gap: 22px;
    max-width: 210mm;
    margin: 0 auto 40px;
    padding: 16mm 15mm;
    color: #111;
    background: #FFFFFF;
    border: 1px solid var(--line);
    font-size: 14px;
    line-height: 1.45;
}
.doc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 14px; border-bottom: 2px solid #111; }
.doc-logo { height: 62px; width: auto; }
.doc-brand { display: grid; gap: 1px; text-align: right; font-size: 13px; color: #333; }
.doc-brand b { color: #111; font-size: 14px; }
.doc-title h1 { font-size: 24px; }
.doc-title p { color: #444; }
.doc-meta { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.doc-meta div { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid #CCC; border-radius: 6px; }
.doc-meta span { color: #555; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.doc-meta small { color: #444; }

.doc-table-wrap { overflow-x: auto; }
.doc-table { width: 100%; border-collapse: collapse; }
.doc-table th, .doc-table td { padding: 7px 8px; border-bottom: 1px solid #DDD; text-align: left; vertical-align: top; }
.doc-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #555; border-bottom: 1.5px solid #111; }
.doc-table .r { text-align: right; white-space: nowrap; }

.doc-sum { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; }
.doc-count span { color: #555; margin-right: 6px; }
.doc-money { min-width: 260px; }

.doc-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 36px; }
.doc-sign div { display: grid; gap: 6px; color: #555; font-size: 12px; text-align: center; }
.doc-sign span { display: block; height: 40px; border-bottom: 1px solid #111; }
.doc-foot { padding-top: 10px; border-top: 1px solid #DDD; color: #777; font-size: 11px; }

/* Na wydruku: tylko kartka, bez paska z przyciskami, tła i ramki */
@page { size: A4; margin: 12mm; }
@media print {
    body.doc-page { background: #FFFFFF; }
    .doc-toolbar { display: none; }
    .doc { max-width: none; margin: 0; padding: 0; border: 0; }
    .doc-table tr { break-inside: avoid; }
    .doc-sign { break-inside: avoid; }
}

/* Telefon: dane w kolumnie */
@media (max-width: 600px) {
    .doc { padding: 18px 14px; }
    .doc-head { flex-direction: column; }
    .doc-brand { text-align: left; }
    .doc-meta { grid-template-columns: minmax(0, 1fr); }
    .doc-table { font-size: 13px; }
}
