/* =========================================================================================
   OBIEG — wygląd portalu.
   Kierunek: minimalizm w duchu Apple. Typografia robi robotę, jeden kolor przewodni tylko
   dla działań i zaznaczeń, listy zamiast tabel, cienkie linie zamiast cieni.
   Kolor przewodni biura zmienia się w JEDNYM miejscu: --akcent (i jego odcienie poniżej).
   ========================================================================================= */

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/geist-latin-ext-wght-normal.4841e590e2a9.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
    U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/geist-latin-wght-normal.a147f99cd533.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Paleta — tryb jasny */
  --tlo: #f2f3f7;
  --papier: #ffffff;
  --unos: #f7f8fa;              /* najechanie na wiersz, stopka grupy */
  --grafit: #1d1d1f;
  --popiel: #6e6e73;
  --popiel-jasny: #8e8e93;
  --linia: rgba(60, 60, 67, .12);
  --linia-mocna: #d1d1d6;
  --linia-hover: #b5b5bb;
  --wypelnienie: #e8e8ed;
  --wypelnienie-mocne: #dcdce2;
  --pole: #f2f2f7;              /* tło pól na telefonie */
  --seg-wybrany: #ffffff;
  --seg-hover: rgba(255, 255, 255, .55);
  --nav-tlo: rgba(255, 255, 255, .72);
  --pasek-akcji: rgba(242, 243, 247, .86);
  --pasek-biura: #1d1d1f;
  --cien: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .05);
  --cien-duzy: 0 12px 40px rgba(16, 24, 40, .08);
  --poswiata: 24%;              /* siła kolorowej poświaty u góry strony */
  --poswiata-2: 17%;

  /* Kolor przewodni biura — zmień tutaj, a reszta się dopasuje */
  --akcent: #0b63de;
  --akcent-jasny: #3b8bff;      /* górny kolor przejścia na przyciskach */
  --akcent-ciemny: #0850b8;
  --akcent-tlo: rgba(11, 99, 222, .09);
  --akcent-obrys: rgba(11, 99, 222, .35);

  /* Statusy: zawsze kropka + słowo */
  --zielony: #1f8a3d;
  --bursztyn: #b35c00;
  --czerwony: #d21f2a;
  --czerwony-tlo: rgba(210, 31, 42, .08);

  /* Kolor sekcji (ikona w menu, poświata u góry). Domyślnie kolor przewodni. */
  --sekcja: var(--akcent);
  --sekcja-2: #5e5ce6;

  /* Typografia */
  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --t-mala: .8125rem;   /* 13 */
  --t-opis: .9375rem;   /* 15 */
  --t-tekst: 1.0625rem; /* 17 */
  --t-h3: 1.3125rem;    /* 21 */
  --t-h2: 1.75rem;      /* 28 */
  --t-display: clamp(2.25rem, 1.4rem + 3.2vw, 3.5rem); /* 36–56 */

  /* Kształt */
  --r-maly: 10px;
  --r-sredni: 14px;
  --r-duzy: 20px;
  --szerokosc: 1040px;

  color-scheme: light;
}

/* Tryb ciemny: przełącznik w prawym górnym rogu (data-theme), a bez JS — ustawienie systemu. */
:root[data-theme="dark"] {
  --tlo: #000000;
  --papier: #1c1c1e;
  --unos: #242427;
  --grafit: #f5f5f7;
  --popiel: #a1a1a6;
  --popiel-jasny: #7c7c81;
  --linia: rgba(255, 255, 255, .09);
  --linia-mocna: #3a3a3c;
  --linia-hover: #636366;
  --wypelnienie: #2c2c2e;
  --wypelnienie-mocne: #3a3a3c;
  --pole: #2c2c2e;
  --seg-wybrany: #5a5a5f;
  --seg-hover: rgba(255, 255, 255, .06);
  --nav-tlo: rgba(18, 18, 20, .72);
  --pasek-akcji: rgba(10, 10, 12, .82);
  --pasek-biura: #2c2c2e;
  --cien: 0 0 0 1px rgba(255, 255, 255, .04);
  --cien-duzy: 0 0 0 1px rgba(255, 255, 255, .05), 0 16px 48px rgba(0, 0, 0, .5);
  --poswiata: 42%;
  --poswiata-2: 32%;
  --akcent: #2f8bff;
  --akcent-jasny: #5aa5ff;
  --akcent-ciemny: #1b74e8;
  --akcent-tlo: rgba(47, 139, 255, .16);
  --akcent-obrys: rgba(47, 139, 255, .5);
  --zielony: #30d158;
  --bursztyn: #ff9f0a;
  --czerwony: #ff453a;
  --czerwony-tlo: rgba(255, 69, 58, .14);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --tlo: #000000; --papier: #1c1c1e; --unos: #242427; --grafit: #f5f5f7; --popiel: #a1a1a6;
    --popiel-jasny: #7c7c81; --linia: rgba(255, 255, 255, .09); --linia-mocna: #3a3a3c;
    --linia-hover: #636366; --wypelnienie: #2c2c2e; --wypelnienie-mocne: #3a3a3c; --pole: #2c2c2e;
    --seg-wybrany: #5a5a5f; --seg-hover: rgba(255, 255, 255, .06); --nav-tlo: rgba(18, 18, 20, .72);
    --pasek-akcji: rgba(10, 10, 12, .82); --pasek-biura: #2c2c2e;
    --cien: 0 0 0 1px rgba(255, 255, 255, .04);
    --cien-duzy: 0 0 0 1px rgba(255, 255, 255, .05), 0 16px 48px rgba(0, 0, 0, .5);
    --poswiata: 42%; --poswiata-2: 32%; --akcent: #2f8bff; --akcent-jasny: #5aa5ff; --akcent-ciemny: #1b74e8;
    --akcent-tlo: rgba(47, 139, 255, .16); --akcent-obrys: rgba(47, 139, 255, .5);
    --zielony: #30d158; --bursztyn: #ff9f0a; --czerwony: #ff453a;
    --czerwony-tlo: rgba(255, 69, 58, .14);
    color-scheme: dark;
  }
}

/* Kolory sekcji pulpitu biura — jak ikony w Ustawieniach iPhone'a */
[data-sekcja="odebrane"] { --sekcja: #0a84ff; --sekcja-2: #5e5ce6; }
[data-sekcja="do-ksiegowania"] { --sekcja: #28b463; --sekcja-2: #00b5ad; }
[data-sekcja="dokumenty"] { --sekcja: #7d5cf0; --sekcja-2: #c35bf2; }
[data-sekcja="odrzucone"] { --sekcja: #ff453a; --sekcja-2: #ff2d78; }
[data-sekcja="klienci"] { --sekcja: #ff9500; --sekcja-2: #ff5e3a; }
[data-sekcja="stan"] { --sekcja: #14a6c9; --sekcja-2: #34c3a0; }

* { box-sizing: border-box; }

/* Kolorowa poświata u góry każdej strony — w kolorze sekcji (portal: kolor przewodni).
   Prześwituje przez półprzezroczysty pasek nawigacji. */
body { position: relative; isolation: isolate; }
body::before {
  content: ""; position: absolute; z-index: -1; inset: 0 0 auto 0; height: 34rem; pointer-events: none;
  background:
    radial-gradient(64rem 30rem at 18% -3rem, color-mix(in srgb, var(--sekcja) var(--poswiata), transparent), transparent 70%),
    radial-gradient(50rem 26rem at 72% -5rem, color-mix(in srgb, var(--sekcja-2) var(--poswiata-2), transparent), transparent 70%);
}
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: var(--t-tekst);
  line-height: 1.47;
  letter-spacing: -.011em;
  color: var(--grafit);
  background: var(--tlo);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--akcent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .15em; }
:focus-visible { outline: 3px solid var(--akcent-obrys); outline-offset: 2px; border-radius: 6px; }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.022em; line-height: 1.1; }
h1 { font-size: var(--t-h2); }
h2 { font-size: var(--t-h3); }
h3 { font-size: var(--t-tekst); }
p { margin: 0 0 1em; }

.muted { color: var(--popiel); }
.small { font-size: var(--t-opis); }
.tiny { font-size: var(--t-mala); }
.num, .amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* --- Pasek nawigacji ------------------------------------------------------------------ */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: var(--nav-tlo);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--linia);
}
.nav-inner {
  max-width: var(--szerokosc); margin: 0 auto; height: 52px;
  padding: 0 max(1.25rem, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 1.25rem;
}
.wordmark { display: inline-flex; align-items: center; gap: .5rem; color: var(--grafit);
            font-weight: 650; font-size: 1.0625rem; letter-spacing: .02em; }
.wordmark:hover { text-decoration: none; }
.wordmark svg { width: 22px; height: 22px; }
.nav .company { color: var(--popiel); font-size: var(--t-opis); white-space: nowrap;
                overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nav .company select {
  font: inherit; color: var(--grafit); border: 0; background: transparent; padding: .25rem 1.25rem .25rem 0;
  appearance: none; cursor: pointer; max-width: 46vw; min-height: 0; width: auto;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236e6e73' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right center;
}
.nav .company select:focus { box-shadow: none; }
.nav .spacer { flex: 1; }
.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-links a, .nav-links button {
  font: inherit; font-size: var(--t-opis); color: var(--grafit); background: none; border: 0;
  padding: 0; cursor: pointer; opacity: .8;
}
.nav-links a:hover, .nav-links button:hover { opacity: 1; text-decoration: none; }
.nav-links form { display: contents; }

/* Przełącznik trybu jasny / ciemny (prawy górny róg) */
.theme-toggle { flex: none; width: 34px; height: 34px; margin-right: -.35rem; border: 0; border-radius: 50%;
                display: grid; place-items: center; background: transparent; color: var(--grafit);
                cursor: pointer; transition: background-color .15s; }
.theme-toggle:hover { background: var(--wypelnienie); }
.theme-toggle svg { width: 19px; height: 19px; grid-area: 1 / 1; transition: transform .35s ease, opacity .25s; }
:root[data-theme="dark"] .ico-moon, :root:not([data-theme="dark"]) .ico-sun {
  opacity: 0; transform: rotate(-90deg) scale(.6); }
@media (prefers-reduced-motion: no-preference) {
  html.motyw-zmiana *, html.motyw-zmiana *::before, html.motyw-zmiana *::after {
    transition: background-color .3s ease, border-color .3s ease, color .3s ease, fill .3s ease !important; }
}

/* Tryb biura — wyraźny, ciemny pasek */
.office-bar { background: var(--pasek-biura); color: #f5f5f7; font-size: var(--t-mala); }
.office-bar-inner { max-width: var(--szerokosc); margin: 0 auto; min-height: 40px;
                    padding: .45rem max(1.25rem, env(safe-area-inset-left));
                    display: flex; align-items: center; gap: .5rem 1.25rem; flex-wrap: wrap; }
.office-bar .dot { width: 7px; height: 7px; border-radius: 50%; background: #ffb340;
                   display: inline-block; margin-right: .5rem; vertical-align: 1px; }
.office-bar strong { font-weight: 600; }
.office-bar-text { flex: 1 1 auto; min-width: 0; }
.office-bar-links { display: flex; gap: 1.25rem; white-space: nowrap; }
.office-bar a { color: #f5f5f7; opacity: .75; }
.office-bar a:hover { opacity: 1; }

/* --- Układ ---------------------------------------------------------------------------- */
.container { width: 100%; max-width: var(--szerokosc); margin: 0 auto; flex: 1;
             padding: 2.5rem max(1.25rem, env(safe-area-inset-left)) 4rem; }
.narrow { max-width: 420px; margin: 1rem auto 0; }

.hero { margin: .5rem 0 2rem; }
.hero .context { color: var(--popiel); font-size: var(--t-opis); margin-bottom: .6rem; }
.hero h1 { font-size: var(--t-display); font-weight: 650; letter-spacing: -.035em;
           line-height: 1.04; max-width: 15ch; text-wrap: balance; }
.hero .lead { color: var(--popiel); font-size: var(--t-tekst); margin: .9rem 0 0; max-width: 52ch; }

.panel { background: var(--papier); border-radius: var(--r-duzy); padding: 1.5rem; }
.panel + .panel { margin-top: 1rem; }
.panel > h2 { margin-bottom: 1rem; }

.back { display: inline-block; font-size: var(--t-opis); margin-bottom: 1.5rem; }

/* --- Przyciski i formularze ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 44px; padding: 0 1.25rem; border-radius: 999px; border: 0; cursor: pointer;
  font: inherit; font-size: var(--t-opis); font-weight: 550; letter-spacing: -.01em;
  background: var(--wypelnienie); color: var(--grafit); text-decoration: none;
  transition: background-color .15s, transform .08s;
}
.btn:hover { text-decoration: none; background: var(--wypelnienie-mocne); }
.btn:active { transform: scale(.98); }
.btn-primary { color: #fff; background: linear-gradient(180deg, var(--akcent-jasny), var(--akcent));
               box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 1px 2px rgba(0, 0, 0, .12),
                           0 4px 14px -4px color-mix(in srgb, var(--akcent) 60%, transparent); }
.btn-primary:hover { background: linear-gradient(180deg, var(--akcent), var(--akcent-ciemny)); }
.btn-danger { background: var(--czerwony-tlo); color: var(--czerwony); }
.btn-danger:hover { background: rgba(210, 31, 42, .12); }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; }

.field { margin-bottom: 1.1rem; }
label, .label { display: block; font-size: var(--t-opis); font-weight: 550; margin-bottom: .4rem; }
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=month], input[type=date], input[type=number], select, textarea {
  width: 100%; font: inherit; font-size: var(--t-tekst); color: var(--grafit);
  min-height: 48px; padding: .7rem .95rem; border-radius: var(--r-sredni);
  border: 1px solid var(--linia-mocna); background: var(--papier);
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: var(--popiel-jasny); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--akcent); box-shadow: 0 0 0 4px var(--akcent-tlo);
}
.field .help { color: var(--popiel); font-size: var(--t-mala); margin-top: .4rem; }
.errors { list-style: none; margin: .4rem 0 0; padding: 0; color: var(--czerwony);
          font-size: var(--t-mala); }
.form-errors { background: var(--czerwony-tlo); color: var(--czerwony); border-radius: var(--r-sredni);
               padding: .75rem 1rem; font-size: var(--t-opis); margin-bottom: 1.1rem; }
.code-input { font-size: 1.375rem !important; font-weight: 550; letter-spacing: .14em;
              text-transform: uppercase; text-align: center; font-variant-numeric: tabular-nums; }

/* --- Logowanie, rejestracja ----------------------------------------------------------- */
/* Jedyne miejsce z „mocnym” tłem: zorza w kolorach biura za szklaną kartą. */
.auth-page::before {
  height: 100%; min-height: 100vh;
  background:
    radial-gradient(38rem 30rem at 12% 8%, color-mix(in srgb, #0a84ff 34%, transparent), transparent 68%),
    radial-gradient(34rem 28rem at 88% 18%, color-mix(in srgb, #bf5af2 28%, transparent), transparent 66%),
    radial-gradient(40rem 26rem at 55% 100%, color-mix(in srgb, #30d0c6 26%, transparent), transparent 70%);
}
:root[data-theme="dark"] .auth-page::before { opacity: .9; }
.auth-page .nav { background: transparent; border-bottom-color: transparent; backdrop-filter: none;
                  -webkit-backdrop-filter: none; }
.auth-page .footer-inner { border-top-color: transparent; }
.auth { max-width: 440px; margin: 4vh auto 0; padding: 2.25rem 2.25rem 1.75rem;
        background: color-mix(in srgb, var(--papier) 78%, transparent); border-radius: 26px;
        backdrop-filter: saturate(180%) blur(30px); -webkit-backdrop-filter: saturate(180%) blur(30px);
        box-shadow: 0 0 0 1px color-mix(in srgb, var(--grafit) 6%, transparent), 0 30px 80px -20px rgba(16, 24, 40, .25); }
.auth .mark { width: 44px; height: 44px; margin-bottom: 1.5rem; display: block; }
.auth h1 { font-size: var(--t-h2); margin-bottom: .5rem; }
.auth .lead { color: var(--popiel); margin-bottom: 2rem; }
.auth .after { margin-top: 1.75rem; font-size: var(--t-opis); color: var(--popiel); }
.auth .after p { margin: 0 0 .4rem; }

/* --- Segmenty statusów i wyszukiwarka ------------------------------------------------- */
.toolbar { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.segmented { display: inline-flex; background: var(--wypelnienie); border-radius: 12px; padding: 3px;
             gap: 2px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.segmented a { padding: .42rem .9rem; border-radius: 9px; color: var(--grafit); white-space: nowrap;
               font-size: var(--t-opis); font-weight: 500; }
.segmented a:hover { text-decoration: none; background: var(--seg-hover); }
.segmented a.active { background: var(--seg-wybrany); box-shadow: 0 1px 3px rgba(0, 0, 0, .1),
                      0 0 0 .5px rgba(0, 0, 0, .04); font-weight: 600; }
.segmented .count { color: var(--popiel); margin-left: .3rem; font-variant-numeric: tabular-nums; }
.filters { display: flex; gap: .6rem; flex: 1 1 380px; }
.search { position: relative; flex: 1; }
.search input { min-height: 40px; padding-left: 2.25rem; border: 0; background: var(--wypelnienie);
                border-radius: var(--r-maly); font-size: var(--t-opis); }
.search svg { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%);
              width: 15px; height: 15px; color: var(--popiel); pointer-events: none; }
.filters select { min-height: 40px; width: auto; flex: none; border: 0; background-color: var(--wypelnienie);
                  border-radius: var(--r-maly); font-size: var(--t-opis); padding: 0 2.2rem 0 .9rem;
                  appearance: none; cursor: pointer;
                  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236e6e73' stroke-width='1.5'/%3E%3C/svg%3E");
                  background-repeat: no-repeat; background-position: right .9rem center; }

/* --- Lista (styl iOS) ----------------------------------------------------------------- */
.list { background: var(--papier); border-radius: var(--r-duzy); overflow: hidden; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem 1.5rem;
       align-items: center; padding: 1rem 1.5rem; color: var(--grafit); position: relative; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 1.5rem; right: 0;
                      border-top: 1px solid var(--linia); }
a.row:hover { text-decoration: none; background: var(--unos); }
.row .title { font-weight: 550; font-size: var(--t-tekst); overflow: hidden;
              text-overflow: ellipsis; white-space: nowrap; }
.row .meta { color: var(--popiel); font-size: var(--t-mala); overflow: hidden;
             text-overflow: ellipsis; white-space: nowrap; }
.row .meta span + span::before { content: ""; display: inline-block; width: 3px; height: 3px;
                                 border-radius: 50%; background: currentColor; opacity: .6;
                                 margin: 0 .55rem; vertical-align: 3px; }
.row .amount { text-align: right; font-weight: 550; font-size: var(--t-tekst); }
.row .side { text-align: right; }
.row .note { grid-column: 1 / -1; color: var(--popiel); font-size: var(--t-mala);
             overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.status { display: inline-flex; align-items: center; gap: .4rem; font-size: var(--t-mala);
          color: var(--popiel); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-nowa { color: var(--bursztyn); }
.status-zaakceptowana { color: var(--zielony); }
.status-odrzucona { color: var(--czerwony); }
.status-zaksiegowana, .status-ksiegowosc { color: var(--popiel); }
.status-bez_decyzji { color: var(--popiel); }
/* Wysyłka do KSeF */
.ksef-w_kolejce, .ksef-przetwarzanie { color: var(--bursztyn); }
.ksef-przyjeta { color: var(--zielony); }
.ksef-odrzucona, .ksef-blad { color: var(--czerwony); }

/* Obecność klienta: zielona kropka = jest teraz w portalu */
.obecnosc { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none;
            margin-right: .5rem; vertical-align: 1px; background: var(--linia-mocna); }
.obecnosc--online { background: #30b158; box-shadow: 0 0 0 3px rgba(48, 177, 88, .18); }

.empty { padding: 3.5rem 1.5rem; text-align: center; color: var(--popiel); }
.empty strong { display: block; color: var(--grafit); font-size: var(--t-h3); font-weight: 600;
                margin-bottom: .35rem; letter-spacing: -.02em; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 1rem;
              margin-top: 1.25rem; font-size: var(--t-opis); }

/* --- Szczegóły faktury ---------------------------------------------------------------- */
.invoice-head { margin-bottom: 2rem; }
.invoice-head .who { font-size: var(--t-h2); font-weight: 600; letter-spacing: -.025em;
                     line-height: 1.15; margin-bottom: .35rem; }
.invoice-head .what { color: var(--popiel); font-size: var(--t-opis); margin-bottom: 1.5rem; }
.invoice-head .total { font-size: var(--t-display); font-weight: 650; letter-spacing: -.04em;
                       line-height: 1; font-variant-numeric: tabular-nums; }
.invoice-head .split { display: flex; gap: .4rem 1.75rem; flex-wrap: wrap; margin-top: .9rem;
                       color: var(--popiel); font-size: var(--t-opis); }
.invoice-head .split strong { color: var(--grafit); font-weight: 550; margin-left: .35rem;
                              font-variant-numeric: tabular-nums; }
.invoice-head .status { font-size: var(--t-opis); margin-top: 1.1rem; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1.25rem;
               align-items: start; grid-template-areas: "main side"; }
.detail-main { grid-area: main; min-width: 0; }
.detail-side { grid-area: side; position: sticky; top: 72px; }
@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; grid-template-areas: "side" "main"; }
  .detail-side { position: static; }
}

.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .7rem 1.5rem;
         margin: 0; font-size: var(--t-opis); }
.facts dt { color: var(--popiel); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts dd .tiny { display: block; color: var(--popiel); }

.lines { width: 100%; border-collapse: collapse; font-size: var(--t-opis); }
.lines th { text-align: left; font-weight: 500; color: var(--popiel); font-size: var(--t-mala);
            padding: 0 .75rem .6rem 0; }
.lines td { padding: .75rem .75rem .75rem 0; border-top: 1px solid var(--linia); vertical-align: top; }
.lines .num { text-align: right; }
.lines td:last-child, .lines th:last-child { padding-right: 0; }

/* Decyzja */
.decision { background: var(--papier); border-radius: var(--r-duzy); padding: 1.5rem;
            box-shadow: var(--cien-duzy); }
.decision h2 { margin-bottom: .35rem; }
.decision .sub { color: var(--popiel); font-size: var(--t-opis); margin-bottom: 1.25rem; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; margin-bottom: .6rem; }
.choice { position: relative; display: flex; align-items: center; min-height: 48px; margin: 0;
          padding: .55rem 2.1rem .55rem .85rem;
          border-radius: var(--r-sredni); border: 1px solid var(--linia-mocna); cursor: pointer;
          font-weight: 400; transition: border-color .15s, background-color .15s; }
.choice:hover { border-color: var(--linia-hover); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice strong { display: block; font-size: var(--t-opis); font-weight: 500; line-height: 1.25; }
.choice::after { content: ""; position: absolute; top: 50%; margin-top: -8px; right: .75rem; width: 16px;
                 height: 16px; border-radius: 50%; border: 1.5px solid var(--linia-mocna); }
.choice:has(input:checked) { border-color: var(--akcent); background: var(--akcent-tlo);
                             box-shadow: inset 0 0 0 1px var(--akcent); }
.choice:has(input:checked)::after {
  border-color: var(--akcent);
  background: var(--akcent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.2l2.3 2.3 4.7-4.9' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.choice:has(input:focus-visible) { outline: 3px solid var(--akcent-obrys); outline-offset: 2px; }
@media (max-width: 380px) { .choices { grid-template-columns: 1fr; } }
.choice-hint { min-height: 2.6em; margin: 0 0 1.25rem; color: var(--popiel); font-size: var(--t-mala);
               line-height: 1.4; }
.choice-hint:empty::before { content: attr(data-default); }

details.reject { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--linia); }
details.reject summary { cursor: pointer; color: var(--czerwony); font-size: var(--t-opis);
                         font-weight: 500; list-style: none; }
details.reject summary::-webkit-details-marker { display: none; }
details.reject[open] summary { margin-bottom: 1rem; }

.decided { padding: .9rem 1rem; border-radius: var(--r-sredni); background: var(--tlo);
           margin-bottom: 1.25rem; font-size: var(--t-opis); }
.decided .status { font-size: var(--t-opis); display: flex; }
.decided p { margin: .35rem 0 0; color: var(--popiel); }

.next { margin-top: 1rem; }

/* Historia */
.timeline { list-style: none; margin: 0; padding: 0; font-size: var(--t-opis); }
.timeline li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: .75rem;
               padding-bottom: 1rem; position: relative; }
.timeline li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; margin: .5rem 0 0 3px;
                       background: var(--popiel-jasny); }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 6px; top: 1.2rem;
                                       bottom: .1rem; width: 1px; background: var(--linia-mocna); }
.timeline .when { color: var(--popiel); font-size: var(--t-mala); }

/* Firmy (tryb biura) */
.badge-count { display: inline-flex; min-width: 1.6rem; height: 1.6rem; padding: 0 .45rem;
               border-radius: 999px; background: var(--akcent); color: #fff; font-size: var(--t-mala);
               font-weight: 600; align-items: center; justify-content: center;
               font-variant-numeric: tabular-nums; }

/* --- Komunikaty ----------------------------------------------------------------------- */
.messages { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.messages li { padding: .85rem 1.1rem; border-radius: var(--r-sredni); background: var(--papier);
               font-size: var(--t-opis); margin-bottom: .5rem; display: flex; gap: .6rem;
               align-items: baseline; }
.messages li::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%;
                       background: var(--akcent); transform: translateY(-1px); }
.messages li.success::before { background: var(--zielony); }
.messages li.error::before { background: var(--czerwony); }
.messages li.warning::before { background: var(--bursztyn); }
#decyzja .messages { margin-bottom: 1rem; }
#decyzja .messages li { background: var(--tlo); }

/* --- Stopka --------------------------------------------------------------------------- */
.footer { color: var(--popiel-jasny); font-size: var(--t-mala); }
.footer-inner { max-width: var(--szerokosc); margin: 0 auto; display: flex; flex-wrap: wrap;
                gap: .4rem 1.5rem; border-top: 1px solid var(--linia);
                padding: 1.25rem max(1.25rem, env(safe-area-inset-left))
                         calc(1.5rem + env(safe-area-inset-bottom)); }
.footer a { color: inherit; }
.footer .spacer { flex: 1; }

/* --- Odpowiedź na działanie: odświeżony panel decyzji delikatnie się pojawia ------------ */
#decyzja.htmx-settling .decision { animation: pojaw .35s ease-out; }
@keyframes pojaw { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.htmx-request .btn, .btn.htmx-request { opacity: .55; pointer-events: none; }

/* --- Telefon -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .container { padding-top: 1.5rem; }
  .nav .company { display: none; }
  .nav-links { gap: 1.1rem; }
  .row { padding: .9rem 1.1rem; }
  .row + .row::before { left: 1.1rem; }
  .panel, .decision { padding: 1.25rem; border-radius: var(--r-sredni); }
  .filters { flex-basis: 100%; flex-wrap: wrap; }
  .search { flex-basis: 100%; }
  .filters select { flex: 1 1 100%; }
  .segmented a { padding: .4rem .7rem; }
  .facts { grid-template-columns: 1fr; gap: .1rem; }
  .facts dd { margin-bottom: .6rem; }
  .lines .hide-mobile { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* =========================================================================================
   Pulpit biura (/biuro/…): menu po lewej, gęstsza tabela, ekran przeklikania.
   Biuro pracuje na dużym monitorze — tu wolno więcej informacji na ekranie niż w portalu.
   ========================================================================================= */
.biuro .nav-inner { max-width: none; padding-left: 1.5rem; padding-right: 1.5rem; }
.workspace { flex: 1; display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: start; }
.sidebar { position: sticky; top: 52px; display: flex; flex-direction: column; gap: 2px;
           padding: 1.25rem .75rem; min-height: calc(100vh - 52px); border-right: 1px solid var(--linia); }
.sidebar a { display: flex; align-items: center; gap: .7rem; padding: .45rem .6rem;
             border-radius: var(--r-maly); color: var(--grafit); font-size: var(--t-opis); font-weight: 500; }
.sidebar a:hover { text-decoration: none; background: color-mix(in srgb, var(--papier) 60%, transparent); }
.sidebar a.active { background: var(--papier); box-shadow: var(--cien); font-weight: 600; }
.sidebar a > span:nth-of-type(2) { flex: 1; }
/* Kolorowe ikony sekcji jak w Ustawieniach iPhone'a: biały znak na kolorowym kwadraciku. */
.ikona { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
         color: #fff; background: linear-gradient(180deg, color-mix(in srgb, var(--sekcja) 72%, #fff),
                                                   var(--sekcja));
         box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 1px 2px rgba(0, 0, 0, .12); }
.ikona svg { width: 18px; height: 18px; }
.sidebar a:not(.active) .ikona { filter: saturate(.9); }
.sidebar .count { color: var(--popiel); font-size: var(--t-mala); font-variant-numeric: tabular-nums; }
.sidebar hr { border: 0; border-top: 1px solid var(--linia); margin: .75rem .5rem; }

.workspace-main { min-width: 0; padding: 1.5rem clamp(1rem, 2.5vw, 2.25rem) 6rem; }

.work-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
             margin-bottom: 1.25rem; }
.work-head h1 { font-size: var(--t-h2); margin-bottom: .3rem; }
.work-head p { margin: 0; font-size: var(--t-opis); }
.office-filters select { min-height: 38px; width: auto; border: 0; background-color: var(--wypelnienie);
                         border-radius: var(--r-maly); font-size: var(--t-opis); padding: 0 2rem 0 .8rem;
                         appearance: none; cursor: pointer;
                         background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236e6e73' stroke-width='1.5'/%3E%3C/svg%3E");
                         background-repeat: no-repeat; background-position: right .8rem center; max-width: 16rem; }
.office-filters .search { flex: 1 1 16rem; max-width: 24rem; }
.office-filters .clear { font-size: var(--t-opis); }
#lista > .segmented { margin-bottom: .75rem; }
.retention { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; background: var(--papier);
             border-radius: var(--r-sredni); padding: .75rem 1rem; margin-bottom: 1rem; }
.retention .label { margin: 0; }
.ksef-attention { display: flex; align-items: flex-start; gap: .7rem; background: var(--papier);
                  border-radius: var(--r-sredni); padding: .8rem 1rem; margin-bottom: 1rem; font-size: var(--t-opis); }
.ksef-attention .state-dot { margin-top: .45rem; }
.ksef-attention p { margin: 0; }
.ledger tr.group-row:hover { background: none; }
.ledger .group-row th { padding: 1.1rem .9rem .5rem; border-top: 1px solid var(--linia); font-weight: 400;
                        color: var(--grafit); font-size: var(--t-opis); text-align: left; }
.ledger tbody .group-row:first-child th { border-top: 0; padding-top: .8rem; }
.ledger .group-row + tr td { border-top: 0; }
.group-row-inner { display: flex; align-items: center; gap: .35rem .75rem; flex-wrap: wrap; }
.group-row-inner form { margin: 0; }
.group-row-inner .link-button { font-size: var(--t-mala); }
.group-client { color: var(--grafit); font-weight: 650; }
.group-row .state-chip { font-size: var(--t-mala); color: var(--popiel); }

.ledger-wrap { background: var(--papier); border-radius: var(--r-duzy); overflow-x: auto; }
.ledger { width: 100%; border-collapse: collapse; font-size: var(--t-opis); }
.ledger th { text-align: left; font-size: var(--t-mala); font-weight: 500; color: var(--popiel);
             padding: .8rem .9rem .6rem; white-space: nowrap; border-bottom: 1px solid var(--linia); }
.ledger td { padding: .7rem .9rem; border-top: 1px solid var(--linia); vertical-align: top; }
.ledger tbody tr:first-child td { border-top: 0; }
.ledger tbody tr { position: relative; }
.ledger tbody tr:hover { background: var(--unos); }
.ledger .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger .sub { display: block; color: var(--popiel); font-size: var(--t-mala); }
.ledger .who { white-space: nowrap; max-width: 13rem; }
.ledger .who .clip { display: inline-block; max-width: 11rem; overflow: hidden; text-overflow: ellipsis;
                     vertical-align: bottom; }
.ledger .doc { min-width: 15rem; }
.ledger .doc a { color: var(--grafit); font-weight: 550; }
.ledger a.stretched::after { content: ""; position: absolute; inset: 0; }
.ledger .pick { width: 2.5rem; position: relative; z-index: 1; }
.ledger .pick input { width: 18px; height: 18px; }
.ledger .date { white-space: nowrap; }
.ledger .from-client { max-width: 18rem; }
.ledger .from-client .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger .source { white-space: nowrap; color: var(--popiel); font-size: var(--t-mala); }
.ledger .kind { font-size: var(--t-mala); }
.ledger .kind-sprzedaz { color: var(--akcent); }
.ledger tfoot td { border-top: 1px solid var(--linia-mocna); font-weight: 550; }
.ledger .empty { padding: 3rem 1rem; }
.bulk-bar { position: sticky; bottom: 1rem; display: flex; align-items: center; justify-content: flex-end;
            gap: 1rem; margin-top: .75rem; padding: .6rem .6rem .6rem 1.1rem; background: var(--papier);
            border-radius: 999px; box-shadow: 0 8px 30px rgba(0, 0, 0, .1); width: max-content;
            margin-left: auto; font-size: var(--t-opis); }

/* --- Przeklikanie --------------------------------------------------------------------- */
.verify-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: .5rem 1.5rem;
               align-items: center; margin-bottom: 1.25rem; }
.verify-head .back { margin: 0; }
.verify-title h1 { font-size: var(--t-h3); display: flex; align-items: center; }
.verify-title p { margin: .15rem 0 0; font-size: var(--t-opis); overflow: hidden; text-overflow: ellipsis;
                  white-space: nowrap; }
.verify-state { display: flex; flex-direction: column; align-items: flex-end; gap: .15rem; }
.stage { font-size: var(--t-mala); font-weight: 600; padding: .25rem .7rem; border-radius: 999px;
         background: var(--wypelnienie); white-space: nowrap; }
.stage-odebrana { background: rgba(179, 92, 0, .1); color: var(--bursztyn); }
.stage-sprawdzona { background: rgba(31, 138, 61, .1); color: var(--zielony); }
.stage-odrzucona { background: var(--czerwony-tlo); color: var(--czerwony); }
.stepper { display: flex; align-items: center; gap: .5rem; }
.stepper .btn { min-height: 36px; width: 36px; padding: 0; font-size: 1.2rem; }
.stepper span.btn[aria-disabled] { opacity: .35; }

.verify-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 1.25rem;
               align-items: start; }
.paper { position: sticky; top: 68px; max-height: calc(100vh - 150px); overflow: auto;
         background: var(--papier); border-radius: var(--r-sredni); border: 1px solid var(--linia-mocna);
         padding: 1.75rem; font-size: var(--t-opis); }
.paper p { margin: 0; }
.paper-top { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.paper-kind { color: var(--popiel); font-size: var(--t-mala); }
.paper-number { font-size: var(--t-h3); font-weight: 650; letter-spacing: -.02em; }
.paper-dates { display: grid; grid-template-columns: auto auto; gap: .15rem .9rem; margin: 0;
               font-size: var(--t-mala); text-align: right; }
.paper-dates dt { color: var(--popiel); }
.paper-dates dd { margin: 0; }
.parties { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.5rem;
           padding: 1rem 0; border-top: 1px solid var(--linia); border-bottom: 1px solid var(--linia); }
.party-label { color: var(--popiel); font-size: var(--t-mala); margin-bottom: .25rem !important; }
.party-name { font-weight: 600; }
.paper-lines, .paper-summary { width: 100%; border-collapse: collapse; font-size: var(--t-mala);
                               margin-bottom: 1.25rem; }
.paper-lines th, .paper-summary th { text-align: left; color: var(--popiel); font-weight: 500;
                                     padding: 0 .5rem .4rem 0; }
.paper-lines td, .paper-summary td { padding: .45rem .5rem .45rem 0; border-top: 1px solid var(--linia);
                                     vertical-align: top; }
.paper-lines .num, .paper-summary .num { text-align: right; font-variant-numeric: tabular-nums; }
.paper-summary { width: auto; margin-left: auto; min-width: 60%; }
.paper-summary tfoot td { font-weight: 600; border-top: 1px solid var(--linia-mocna); }
.paper-total { display: flex; justify-content: space-between; align-items: baseline; padding: .9rem 0;
               border-top: 1px solid var(--linia-mocna); }
.paper-total strong { font-size: var(--t-h2); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.paper-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .3rem 1rem;
               font-size: var(--t-mala); margin: 0 0 1rem; }
.paper-facts dt { color: var(--popiel); }
.paper-facts dd { margin: 0; overflow-wrap: anywhere; }
.paper-links { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: var(--t-mala);
               padding-top: .75rem; border-top: 1px solid var(--linia); }

.verify-form { display: flex; flex-direction: column; gap: .75rem; }
.fset { background: var(--papier); border-radius: var(--r-sredni); padding: 1.1rem 1.25rem .35rem; }
.fset h2 { font-size: var(--t-tekst); margin-bottom: .8rem; }
.fset-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; margin-bottom: .8rem; }
.fset-head h2 { margin: 0; }
.fset-row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.fset .field { margin-bottom: .8rem; }
.fset label, .fset .label { font-size: var(--t-mala); font-weight: 500; color: var(--popiel);
                            margin-bottom: .25rem; }
.fset input, .fset select, .fset textarea { min-height: 40px; padding: .45rem .7rem; font-size: var(--t-opis);
                                            border-radius: var(--r-maly); }
.fset textarea { min-height: 64px; }
.field.compact { margin: 0 0 .8rem; min-width: 11rem; }
.has-error input, .has-error select { border-color: var(--czerwony); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 .9rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 .9rem; }
.readout { min-height: 40px; display: flex; align-items: center; margin: 0; font-weight: 600;
           font-variant-numeric: tabular-nums; }
.with-action { display: flex; gap: .5rem; }
.btn-small { min-height: 40px; padding: 0 .9rem; font-size: var(--t-mala); flex: none; }
.type-switch { display: inline-flex; background: var(--wypelnienie); border-radius: 10px; padding: 3px;
               margin-bottom: .8rem; }
.type-switch label { margin: 0; padding: .45rem 1.1rem; border-radius: 8px; cursor: pointer;
                     color: var(--grafit) !important; font-size: var(--t-opis) !important; font-weight: 500; }
.type-switch label.on, .type-switch label:has(input:checked) { background: var(--papier);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .1); font-weight: 600; }
.type-switch input { position: absolute; opacity: 0; pointer-events: none; }
.client-says { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.client-says .status { font-size: var(--t-opis); }
.quote { border-left: 3px solid var(--linia-mocna); padding: .1rem 0 .1rem .8rem; color: var(--grafit); }
.quote-red { border-color: var(--czerwony); }
.notice { background: rgba(179, 92, 0, .08); color: var(--bursztyn); border-radius: var(--r-sredni);
          padding: .7rem 1rem; font-size: var(--t-opis); }
.toggle { display: inline-flex; align-items: center; gap: .4rem; margin: 0; font-weight: 400 !important; }
.toggle input { width: 16px; height: 16px; min-height: 0 !important; }

.entries { display: flex; flex-direction: column; margin-bottom: .5rem; }
.entry { display: grid; grid-template-columns: 6.5rem repeat(3, minmax(0, 1fr)) 2rem; gap: .4rem;
         align-items: start; padding: .6rem 0; border-top: 1px solid var(--linia); }
.entry .e-cat { grid-column: 1 / 3; }
.entry .e-desc { grid-column: 3 / 5; }
.entry-head { font-size: var(--t-mala); color: var(--popiel); padding: 0 0 .3rem; border-top: 0; }
.entry-head + .entry { border-top: 0; }
.entry input, .entry select { min-height: 36px; padding: .3rem .5rem; width: 100%; }
.entry input.num { text-align: right; }
.entry-remove input[type=checkbox] { display: none; }
.entry-errors { grid-column: 1 / -1; margin: 0 0 .3rem; }
.icon-button { border: 0; background: none; cursor: pointer; font-size: 1.3rem; line-height: 1;
               color: var(--popiel); width: 2rem; height: 36px; border-radius: var(--r-maly); }
.icon-button:hover { background: var(--wypelnienie); color: var(--czerwony); }
.entries-foot { margin-bottom: .6rem; }
.entries-sum { display: grid; grid-template-columns: 6.5rem repeat(3, minmax(0, 1fr)) 2rem; gap: .4rem;
               padding: .6rem 0 .2rem; border-top: 1px solid var(--linia-mocna);
               font-weight: 600; font-size: var(--t-opis); }
.entries-sum .num { text-align: right; padding-right: .5rem; }
.link-button { border: 0; background: none; color: var(--akcent); font: inherit; font-size: var(--t-opis);
               font-weight: 550; cursor: pointer; padding: .3rem 0; }
.sum-warning { color: var(--bursztyn); font-size: var(--t-mala); margin: 0 0 .8rem; }
details.history summary { cursor: pointer; font-weight: 600; padding-bottom: .8rem; }

.action-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: .6rem;
              flex-wrap: wrap; margin: 1.25rem calc(-1 * clamp(1rem, 2.5vw, 2.25rem)) -6rem;
              padding: .75rem clamp(1rem, 2.5vw, 2.25rem) calc(.75rem + env(safe-area-inset-bottom));
              background: var(--pasek-akcji); backdrop-filter: saturate(180%) blur(16px);
              -webkit-backdrop-filter: saturate(180%) blur(16px); border-top: 1px solid var(--linia); }
.action-bar form { margin: 0; }
.action-bar .spacer { flex: 1; }
.trash-box { position: relative; }
.trash-box summary { list-style: none; }
.trash-box summary::-webkit-details-marker { display: none; }
.trash-box form { position: absolute; bottom: calc(100% + .5rem); left: 0; width: 22rem; padding: 1rem;
                  background: var(--papier); border-radius: var(--r-sredni);
                  box-shadow: 0 12px 40px rgba(0, 0, 0, .15); display: flex; flex-direction: column; gap: .6rem; }
.trash-box label { margin: 0; font-size: var(--t-mala); color: var(--popiel); }

/* --- Klienci, karta klienta, ustawienia, stan systemu ------------------------------------ */
.ledger .raised { position: relative; z-index: 1; }
.ledger .who a { color: var(--grafit); font-weight: 550; }
.ledger .tabular { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger .actions { text-align: right; white-space: nowrap; }
.ledger tr.inactive td { color: var(--popiel); }
.ledger .ksef-cell { white-space: nowrap; }
.ksef-cell .ksef-blad, .error-text { color: var(--czerwony); }
.ledger-wrap.flat { border-radius: var(--r-maly); border: 1px solid var(--linia); margin-bottom: .8rem; }
.env { display: inline-block; font-size: var(--t-mala); font-weight: 600; padding: .1rem .55rem;
       border-radius: 999px; background: rgba(179, 92, 0, .1); color: var(--bursztyn); }
.env-prod { background: rgba(31, 138, 61, .1); color: var(--zielony); }
.check.inline { margin: 0; white-space: nowrap; font-size: var(--t-opis); }
.card-page { max-width: 980px; }
.workspace-main > .fset + .fset { margin-top: .9rem; }
.card-page .fset { margin-bottom: .9rem; padding-bottom: 1rem; }
.card-page .fset h3 { font-size: var(--t-opis); margin: 1.1rem 0 .6rem; }
.with-dot { display: flex; align-items: center; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .4rem; }
.span-2 { grid-column: span 2; }
.link-button.danger { color: var(--czerwony); }
.new-code { background: var(--akcent-tlo); border-radius: var(--r-sredni); padding: 1rem 1.1rem;
            margin: .8rem 0; }
.new-code p { margin: 0; }
.code-big { font-size: 2rem; font-weight: 650; letter-spacing: .12em; font-variant-numeric: tabular-nums;
            margin: .2rem 0 .8rem !important; }
.new-code textarea { min-height: 72px; margin-bottom: .5rem; font-size: var(--t-opis); }
.code-mono { font-weight: 650; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.overall { display: flex; align-items: center; gap: .6rem; background: var(--papier); border-radius: var(--r-sredni);
           padding: .9rem 1.1rem; margin-bottom: .9rem; font-weight: 600; }
.overall-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--zielony); }
.overall--warning .overall-dot { background: var(--bursztyn); }
.overall--error .overall-dot { background: var(--czerwony); }
.syschecks { display: flex; flex-direction: column; }
.syscheck { display: grid; grid-template-columns: 5.5rem 15rem minmax(0, 1fr); gap: .8rem; padding: .55rem 0;
            border-top: 1px solid var(--linia); font-size: var(--t-opis); align-items: baseline; }
.syscheck:first-child { border-top: 0; }
.check-state { font-size: var(--t-mala); font-weight: 650; }
.check-ok, .check-info { color: var(--zielony); }
.check-info { color: var(--popiel); }
.check-warning { color: var(--bursztyn); }
.check-error { color: var(--czerwony); }

/* --- Klienci: lista po lewej, szczegóły po prawej (jak Poczta / Ustawienia na Macu) ---- */
.split { display: grid; grid-template-columns: minmax(260px, 330px) minmax(0, 1fr); gap: 2rem;
         align-items: start; }
.split-list { position: sticky; top: calc(52px + 1.5rem); display: flex; flex-direction: column;
              max-height: calc(100vh - 52px - 3rem); min-height: 0; }
.split-list-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem;
                   margin-bottom: .9rem; }
.split-list-head h1 { font-size: var(--t-h2); margin: 0; }
.split-search { display: flex; flex-direction: column; gap: .45rem; margin-bottom: .75rem; }
.split-search .check { color: var(--popiel); margin: 0 0 0 .2rem; }
.client-list { background: var(--papier); border-radius: var(--r-duzy); padding: .35rem; overflow-y: auto;
               min-height: 0; flex: 1 1 auto; scrollbar-width: thin; }
.client-item { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; border-radius: 12px;
               color: var(--grafit); }
.client-item + .client-item { margin-top: 1px; }
.client-item:hover { background: var(--tlo); text-decoration: none; }
.client-item.active { color: #fff; background: linear-gradient(135deg, var(--akcent-jasny), var(--akcent));
                      box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--akcent) 70%, transparent); }
.client-item.active .client-sub, .client-item.active .state-chip { color: rgba(255, 255, 255, .82); }
.client-item.active .obecnosc--offline { background: rgba(255, 255, 255, .5); }
.client-item.active .state-chip::before { box-shadow: 0 0 0 1.5px #fff; }
.client-item.inactive .client-name { color: var(--popiel); }
.client-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .05rem; }
.client-name { font-size: var(--t-opis); font-weight: 550; white-space: nowrap; overflow: hidden;
               text-overflow: ellipsis; }
.client-sub { display: flex; align-items: center; gap: .55rem; font-size: var(--t-mala); color: var(--popiel);
              font-variant-numeric: tabular-nums; }
.count-pill { flex: none; min-width: 1.6rem; height: 1.45rem; padding: 0 .45rem; border-radius: 999px;
              display: inline-flex; align-items: center; justify-content: center; background: var(--wypelnienie);
              font-size: var(--t-mala); font-weight: 600; font-variant-numeric: tabular-nums; }
.client-item.active .count-pill { background: rgba(255, 255, 255, .22); color: #fff; }
.client-empty { margin: 0; padding: 1.25rem 1rem; color: var(--popiel); font-size: var(--t-opis); }

/* Stan KSeF: kropka w kolorze stanu + słowo. Te same nazwy stanów co KsefConnection.state. */
.state-aktualny { --stan: var(--zielony); }
.state-nieaktualny { --stan: var(--bursztyn); }
.state-blad { --stan: var(--czerwony); }
.state-nowe, .state-brak { --stan: var(--popiel-jasny); }
.state-wylaczone { --stan: var(--linia-mocna); }
.state-chip { display: inline-flex; align-items: center; gap: .3rem; font-weight: 550; }
.group-row .state-chip, .ksef-attention .state-chip { padding: .1rem .5rem; border-radius: 999px;
  background: color-mix(in srgb, var(--stan) 13%, transparent); color: color-mix(in srgb, var(--stan) 85%, var(--grafit)); }
.state-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--stan); }
.state-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--stan); }
.state-aktualny.state-dot { box-shadow: 0 0 0 3px rgba(31, 138, 61, .16); }
.state-blad.state-dot { box-shadow: 0 0 0 3px var(--czerwony-tlo); }

.split-detail { min-width: 0; }
.detail-back { display: none; }
.detail-inner { max-width: 760px; }
.detail-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.75rem; }
.detail-title { flex: 1; min-width: 0; }
.online-text { color: var(--zielony); }
.detail-head h2 { font-size: var(--t-h2); letter-spacing: -.025em; margin: 0 0 .25rem; gap: .6rem; }
.detail-head p { margin: 0; font-size: var(--t-opis); }
.detail-head .btn-row { flex: none; }
.detail-inner > .new-code { margin: 0 0 2rem; }

/* Grupy jak w Ustawieniach: białe pole, wiersze oddzielone cienką linią od lewej krawędzi tekstu. */
.group { margin: 0 0 2rem; }
.group-note { color: var(--popiel); font-size: var(--t-mala); margin: .55rem .15rem 0; }

/* Kopie zapasowe: lista w „Stanie systemu” i strona pobierania (ADR 0021) */
.backups { margin: 1.6rem 0 1.4rem; }
.backup-page { max-width: 44rem; }
.back-link { display: inline-block; margin-bottom: .75rem; font-size: var(--t-opis); }
.backup-name { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.backup-actions { margin-top: 1.1rem; }
.backup-cell .btn-small { min-height: 34px; }
.group-title { font-size: var(--t-tekst); font-weight: 650; margin: 0 0 .55rem .15rem; }
.group-body { background: var(--papier); border-radius: var(--r-duzy); overflow: hidden; }
.group-body form { margin: 0; }
.cell { position: relative; display: flex; align-items: center; gap: .9rem; min-height: 54px;
        padding: .7rem 1.15rem; margin: 0; font-size: var(--t-opis); }
.cell::before { content: ""; position: absolute; top: 0; left: 1.15rem; right: 0;
                border-top: 1px solid var(--linia); }
.group-body > .cell:first-child::before,
.group-body > .cell-details:first-child > .cell::before { display: none; }
.cell form { margin: 0; flex: none; }
.cell-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.cell-text strong { font-weight: 550; }
.cell-text .sub, .cell .sub { color: var(--popiel); font-size: var(--t-mala); font-weight: 400; }
.cell-value { color: var(--popiel); }
.state-cell { align-items: flex-start; padding-top: .95rem; padding-bottom: .95rem; }
.state-cell .state-dot { margin-top: .4rem; }

.field-cell { align-items: flex-start; padding-top: .5rem; padding-bottom: .5rem; }
.field-cell > label, .cell > .label { flex: 0 0 12rem; margin: 0; padding-top: .5rem; font-size: var(--t-opis);
                                      font-weight: 500; }
.cell > .label { padding-top: 0; }
.cell-control { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.cell-control input[type=text], .cell-control input[type=email], .cell-control input[type=password],
.cell-control input[type=date], .cell-control input[type=number], .cell-control select,
.cell-control textarea {
  min-height: 40px; padding: .45rem .65rem; border: 0; border-radius: var(--r-maly);
  background: transparent; font-size: var(--t-opis);
}
.cell-control input:hover, .cell-control select:hover, .cell-control textarea:hover { background: var(--unos); }
.cell-control input:focus, .cell-control select:focus, .cell-control textarea:focus {
  background: var(--papier); box-shadow: 0 0 0 1px var(--akcent), 0 0 0 4px var(--akcent-tlo);
}
.cell-control select { appearance: none; cursor: pointer; padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236e6e73' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .75rem center; }
.cell-control textarea { min-height: 76px; }
.cell-control input[type=file] { font-size: var(--t-mala); padding: .55rem .65rem; color: var(--popiel); }
.cell-control input[type=file]::file-selector-button {
  font: inherit; font-weight: 550; border: 0; border-radius: 999px; padding: .35rem .8rem; margin-right: .7rem;
  background: var(--wypelnienie); color: var(--grafit); cursor: pointer;
}
.field-cell.has-error input, .field-cell.has-error select { box-shadow: inset 0 0 0 1px var(--czerwony); }
.cell-error, .cell-help { font-size: var(--t-mala); padding: 0 .65rem .25rem; }
.cell-error { color: var(--czerwony); }
.cell-help { color: var(--popiel); }

/* Przełącznik (zamiast „ptaszka”) — prawdziwy checkbox, tylko inaczej narysowany. */
.switch-cell { cursor: pointer; font-weight: 400; }
.switch-cell > span:first-child { flex: 1; }
.switch-cell input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch { flex: none; position: relative; width: 50px; height: 30px; border-radius: 999px;
          background: var(--wypelnienie); transition: background-color .2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%;
                 background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .18), 0 0 0 .5px rgba(0, 0, 0, .05);
                 transition: transform .2s; }
.switch-cell input:checked + .switch { background: var(--akcent); }
.switch-cell input:checked + .switch::after { transform: translateX(20px); }
.switch-cell input:focus-visible + .switch { box-shadow: 0 0 0 4px var(--akcent-obrys); }

/* Wybór jednej z kilku opcji jako przyciski obok siebie. */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; border-radius: 11px;
       background: var(--wypelnienie); align-self: flex-start; }
.seg label { position: relative; margin: 0; font-weight: 500; font-size: var(--t-opis); cursor: pointer; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span { display: block; padding: .38rem 1rem; border-radius: 9px; transition: background-color .15s; }
.seg label:hover span { background: var(--seg-hover); }
.seg input:checked + span { background: var(--seg-wybrany); font-weight: 600;
                            box-shadow: 0 1px 3px rgba(0, 0, 0, .1), 0 0 0 .5px rgba(0, 0, 0, .04); }
.seg input:focus-visible + span { box-shadow: 0 0 0 3px var(--akcent-obrys); }
.field-cell .seg { margin: .2rem 0 .1rem .1rem; }

/* Rozwijany wiersz („Ustawienia połączenia”, „Dodaj osobę”, „Dane firmy”). */
.cell-details > summary { list-style: none; cursor: pointer; color: var(--akcent); font-weight: 500; }
.cell-details > summary::-webkit-details-marker { display: none; }
.cell-details > summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; flex: none;
  border-right: 1.5px solid var(--popiel-jasny); border-bottom: 1.5px solid var(--popiel-jasny);
  transform: rotate(-45deg); transition: transform .2s; }
.cell-details[open] > summary::after { transform: rotate(45deg); }
.cell-details > summary:hover { background: var(--unos); }
.cell-details > summary:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--akcent-obrys); }
.cell-details > form { animation: pojaw .2s ease-out; }
.cell-details .form-errors { margin: .75rem 1.15rem; }
.group-body .group-actions { display: flex; justify-content: flex-end; gap: .6rem; padding: .75rem 1.15rem;
                             border-top: 1px solid var(--linia); background: var(--unos); }
.group > .group-actions { display: flex; gap: .6rem; padding: 1rem 0 0; }
.group-foot { margin: .6rem 1.15rem 0; color: var(--popiel); font-size: var(--t-mala); max-width: 62ch; }
.detail-inner > .group-foot { margin-top: -1.4rem; }

/* Osoby z dostępem */
.person-cell .cell-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { position: relative; flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid;
          place-items: center; color: #fff; font-size: var(--t-mala); font-weight: 650; letter-spacing: .02em;
          background: linear-gradient(180deg, var(--ton-1, #a1a1a6), var(--ton-2, #7d7d82));
          box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22); }
/* Awatary firm: zaokrąglony kwadrat (jak ikony), osób: koło. Kolor stały dla danej firmy/osoby. */
.avatar-sq { border-radius: 10px; }
.avatar-lg { width: 56px; height: 56px; border-radius: 15px; font-size: 1.25rem; letter-spacing: .01em; }
.avatar-lg.avatar:not(.avatar-sq) { border-radius: 50%; }
.ton-0 { --ton-1: #5ac8fa; --ton-2: #0a7aff; }
.ton-1 { --ton-1: #8e8cff; --ton-2: #5856d6; }
.ton-2 { --ton-1: #dc8bff; --ton-2: #a550de; }
.ton-3 { --ton-1: #ff7aa2; --ton-2: #f0285a; }
.ton-4 { --ton-1: #ffbe4d; --ton-2: #ff8a00; }
.ton-5 { --ton-1: #5ee38a; --ton-2: #22a84a; }
.ton-6 { --ton-1: #5fd8e6; --ton-2: #1a9fb8; }
.ton-7 { --ton-1: #9aa8c2; --ton-2: #5b6b88; }
.avatar-biuro { --ton-1: #48484a; --ton-2: #1d1d1f; color: #fff; }
.avatar-biuro svg { width: 60%; height: 60%; }
.avatar .avatar-online { right: -2px; bottom: -2px; }
.client-item .avatar { width: 34px; height: 34px; font-size: .75rem; }
.client-item.active .avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, .55); }
.client-item.active .avatar-online { box-shadow: 0 0 0 2px var(--akcent); }
.group-row .avatar { width: 26px; height: 26px; border-radius: 8px; font-size: .6875rem; }
.avatar-xs { width: 22px; height: 22px; border-radius: 7px; font-size: .625rem; display: inline-grid;
             vertical-align: middle; margin-right: .5rem; }
.avatar-xs .avatar-online { width: 9px; height: 9px; }
.avatar-online { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%;
                 background: #30b158; box-shadow: 0 0 0 2px var(--papier); }
.avatar-pending { background: var(--wypelnienie); color: var(--popiel); }
.person-cell.pending strong { font-weight: 500; }

/* --- Wgrywanie dokumentów i odczyt (OCR) — ADR 0019 ------------------------------------ */
.upload-page { max-width: 760px; }
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; gap: .55rem;
            margin: 1rem 0 0; padding: 2.75rem 1.5rem; text-align: center; cursor: pointer;
            border: 2px dashed color-mix(in srgb, var(--sekcja) 40%, var(--linia-mocna));
            border-radius: var(--r-duzy); font-weight: 400;
            background: color-mix(in srgb, var(--sekcja) 5%, var(--papier));
            transition: border-color .15s, background-color .15s, transform .15s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--sekcja);
                                     background: color-mix(in srgb, var(--sekcja) 11%, var(--papier)); }
.dropzone.is-over { transform: scale(1.01); }
.dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone input[type=file]:focus-visible + .dropzone-icon { box-shadow: 0 0 0 4px var(--akcent-obrys); }
.dropzone-icon { width: 58px; height: 58px; border-radius: 17px; display: grid; place-items: center; color: #fff;
                 background: linear-gradient(180deg, color-mix(in srgb, var(--sekcja) 70%, #fff), var(--sekcja));
                 box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 8px 20px -8px var(--sekcja); }
.dropzone-icon svg { width: 30px; height: 30px; }
.dropzone strong { font-size: var(--t-tekst); font-weight: 600; }
.dropzone.has-error { border-color: var(--czerwony); }
.upload-result .state-dot { align-self: center; }

/* Lewa strona przeklikania: oryginał zamiast „kartki” z XML */
.original { position: sticky; top: 68px; display: flex; flex-direction: column; gap: .75rem;
            max-height: calc(100vh - 150px); }
.original-pdf { width: 100%; flex: 1; min-height: 70vh; border: 1px solid var(--linia-mocna);
                border-radius: var(--r-sredni); background: var(--papier); }
.original-image { display: block; padding: 0; border: 1px solid var(--linia-mocna); border-radius: var(--r-sredni);
                  background: var(--wypelnienie); overflow: auto; cursor: zoom-in; max-height: calc(100vh - 200px); }
.original-image img { display: block; width: 100%; height: auto; }
.original-image.is-zoomed { cursor: zoom-out; }
.original-image.is-zoomed img { width: 200%; max-width: none; }
.original .paper { position: static; max-height: none; overflow: visible; }
.original .paper-links { margin: 0; display: flex; gap: .4rem 1rem; flex-wrap: wrap; align-items: baseline; }
.word-doc table { width: 100%; border-collapse: collapse; margin: .75rem 0; font-size: var(--t-mala); }
.word-doc td, .word-doc th { border: 1px solid var(--linia-mocna); padding: .3rem .45rem; vertical-align: top; }
.word-doc p { margin: 0 0 .5rem; }

/* Pasek stanu odczytu nad formularzem */
.ocr-banner { display: flex; align-items: flex-start; gap: .8rem; padding: .85rem 1rem; margin-bottom: 1rem;
              border-radius: var(--r-sredni); font-size: var(--t-opis); background: var(--papier);
              box-shadow: var(--cien); }
.ocr-banner > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.ocr-banner .sub { color: var(--popiel); font-size: var(--t-mala); }
.ocr-banner .btn { flex: none; }
.ocr-mark { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
            color: #fff; font-weight: 700; font-size: .8125rem; background: var(--popiel-jasny); }
.ocr-mark svg { width: 15px; height: 15px; }
.ocr-done .ocr-mark { background: linear-gradient(180deg, #5ee38a, var(--zielony)); }
.ocr-attention .ocr-mark { background: linear-gradient(180deg, #ffbe4d, #ff8a00); }
.ocr-error { background: var(--czerwony-tlo); }
.ocr-error .ocr-mark { background: var(--czerwony); }
.ocr-pending { background: linear-gradient(100deg, var(--akcent-tlo), color-mix(in srgb, #bf5af2 10%, transparent)); }
.spinner { flex: none; width: 22px; height: 22px; margin: 2px; border-radius: 50%;
           border: 2.5px solid color-mix(in srgb, var(--akcent) 25%, transparent); border-top-color: var(--akcent);
           animation: krec .8s linear infinite; }
@keyframes krec { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: krec 2.4s linear infinite !important; } }

/* Pola, które odczyt oznaczył jako niepewne */
.ocr-chip { display: inline-block; margin-left: .35rem; padding: .05rem .45rem; border-radius: 999px;
            font-size: .6875rem; font-weight: 650; vertical-align: 1px;
            color: color-mix(in srgb, #ff8a00 80%, var(--grafit)); background: color-mix(in srgb, #ff9500 16%, transparent); }
.field.ocr-check input, .field.ocr-check select {
  border-color: #ff9500; box-shadow: 0 0 0 3px color-mix(in srgb, #ff9500 18%, transparent); }
.ocr-check-section .entries { border-radius: var(--r-maly);
  box-shadow: 0 0 0 2px color-mix(in srgb, #ff9500 55%, transparent); }
.reading-chip { color: var(--akcent); }
.memory-note { flex-basis: 100%; margin: .15rem 0 0; font-size: var(--t-mala); color: var(--popiel); }
.memory-note::before { content: "↺ "; color: var(--sekcja); font-weight: 700; }

/* --- Wystawianie faktury (portal) ------------------------------------------------------ */
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.hero-top .context { margin: 0; }
.issue-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.25rem; align-items: start; }
.issue-side { position: sticky; top: 72px; }
.issue-lines { display: flex; flex-direction: column; gap: .45rem; margin-bottom: .5rem; }
.issue-line { display: grid; grid-template-columns: minmax(0, 1fr) 4.5rem 4rem 6.5rem 5.5rem 6.5rem 2rem;
              gap: .4rem; align-items: start; }
.issue-line-head { font-size: var(--t-mala); color: var(--popiel); }
.issue-line input, .issue-line select { min-height: 40px; padding: .35rem .6rem; font-size: var(--t-opis);
                                        border-radius: var(--r-maly); }
.issue-line input.num { text-align: right; }
.issue-line [data-wartosc] { align-self: center; text-align: right; font-weight: 550; font-size: var(--t-opis); }
.issue .panel h2 { margin-bottom: 1rem; }
.issue .grid-2, .issue .grid-3 { gap: 0 1rem; }
.issue .field label { font-size: var(--t-opis); }
.issue-total { display: flex; justify-content: space-between; align-items: baseline; margin: 1rem 0 1.25rem;
               padding-top: 1rem; border-top: 1px solid var(--linia); }
.issue-total strong { font-size: var(--t-h2); letter-spacing: -.03em; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; margin: .2rem 0 .6rem; }
.check input { width: 18px; height: 18px; }
.exemption { margin-top: 1rem; }
.ksef-box .status { font-size: var(--t-opis); margin-bottom: .5rem; }

@media (max-width: 1100px) {
  .verify-grid { grid-template-columns: 1fr; }
  .paper { position: static; max-height: none; }
}
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; gap: 1.5rem; }
  .split-list { position: static; max-height: none; }
  .split.has-selection .split-list { display: none; }
  .detail-back { display: inline-flex; align-items: center; gap: .3rem; margin-bottom: 1rem;
                 font-size: var(--t-opis); }
  .detail-back::before { content: ""; width: 7px; height: 7px; border-left: 1.5px solid currentColor;
                         border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
  .sidebar { position: static; min-height: 0; flex-direction: row; overflow-x: auto; border-right: 0;
             border-bottom: 1px solid var(--linia); padding: .5rem; }
  .sidebar hr, .sidebar .advanced { display: none; }
  .sidebar a { white-space: nowrap; }
  .verify-head { grid-template-columns: 1fr auto; }
  .verify-head .back { grid-column: 1 / -1; }
  .issue-grid { grid-template-columns: 1fr; }
  .issue-side { position: static; }
  .issue-line { grid-template-columns: 1fr 1fr 1fr 2rem; }
  .issue-line > span:first-child { grid-column: 1 / -1; }
  .issue-line-head { display: none; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .detail-head { flex-wrap: wrap; }
  .detail-head h2 { font-size: var(--t-h3); }
  .detail-head .btn-row { flex-basis: 100%; }
  .field-cell { flex-direction: column; gap: .3rem; padding-top: .7rem; padding-bottom: .8rem; }
  .field-cell > label, .field-cell > .label { flex: none; padding: 0; font-size: var(--t-mala);
                                              color: var(--popiel); }
  .cell > .label { flex: none; }
  .cell-control { align-self: stretch; }
  .cell-control input[type=text], .cell-control input[type=email], .cell-control input[type=password],
  .cell-control input[type=date], .cell-control input[type=number], .cell-control select,
  .cell-control textarea { background-color: var(--pole); min-height: 44px; }
  .cell-error, .cell-help { padding-left: 0; }
  .field-cell .seg { margin-left: 0; }
  .cell-details > summary .sub { display: none; }
  .person-cell .cell-text { flex-basis: calc(100% - 36px - 1rem); }
  .person-cell .cell-text strong { white-space: normal; }
  .person-cell form:first-of-type { margin-left: calc(36px + .9rem); }
  .state-cell { flex-wrap: wrap; }
  .state-cell .cell-text { flex-basis: calc(100% - 2rem); }
  .state-cell form { margin-left: 1.9rem; }
  .state-cell form + form { margin-left: 0; }
  .person-cell { flex-wrap: wrap; }
  .span-2 { grid-column: auto; }
  .work-head { flex-direction: column; }
  .work-head h1 { font-size: var(--t-h3); }
  .syscheck { grid-template-columns: 4.5rem minmax(0, 1fr); }
  .syscheck .muted { grid-column: 1 / -1; }
  .parties { grid-template-columns: 1fr; }
  .hero-top { flex-direction: column; align-items: flex-start; }
  .nav-links { overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
  .biuro .nav-inner { padding-left: 1rem; padding-right: 1rem; }
  .paper { padding: 1.1rem; }
  .entry { grid-template-columns: repeat(3, minmax(0, 1fr)) 2rem; }
  .entry .e-rate { grid-column: 1 / 4; }
  .entry .entry-remove { grid-column: 4; grid-row: 1; }
  .entry .e-cat, .entry .e-desc { grid-column: 1 / -1; }
  .entry-head { display: none; }
  .entries-sum { grid-template-columns: auto repeat(3, minmax(0, 1fr)); font-size: var(--t-mala); }
  .verify-head { gap: .4rem 1rem; }
  .action-bar .btn { min-height: 40px; padding: 0 .9rem; }
}
