/* =====================================================================
   LeonSystem · Magazyn — style
   Kolory marki: czerwień #E30613, szarość logo #7B7872, grafit.
   ===================================================================== */

/* ---------- 1. Zmienne (motyw jasny) ---------- */
:root {
  color-scheme: light;

  --font-ui: "Segoe UI Variable Text", "Segoe UI", ui-sans-serif, system-ui, -apple-system, Roboto, sans-serif;
  --font-cond: "Bahnschrift SemiCondensed", "Bahnschrift", "Arial Narrow", "Segoe UI", sans-serif;
  --font-mono: "Cascadia Mono", ui-monospace, Consolas, monospace;

  --r-xs: 6px;
  --r-sm: 9px;
  --r: 12px;
  --r-lg: 14px;
  --ease: cubic-bezier(.32, .72, .28, 1);

  --brand-red: #E30613;

  --bg: #F2F3F5;
  --surface: #FFFFFF;
  --surface-2: #F7F8FA;
  --surface-3: #EDEFF2;
  --line: #E3E5E9;
  --line-2: #D0D4DA;
  --text: #14161A;
  --text-2: #464B55;
  --text-3: #6B717D;
  --input-bg: #FFFFFF;
  --avatar-bg: #E8EAEE;

  --accent: #CC0A16;
  --accent-fill: #D9111E;
  --accent-fill-hi: #BF0D19;
  --accent-ink: #FFFFFF;
  --accent-soft: #FDECEE;
  --accent-line: #F4C2C6;
  --focus-ring: 0 0 0 3px rgba(217, 17, 30, .20);

  --ok: #0F7B53;
  --ok-soft: #E4F5EC;
  --warn: #965800;
  --warn-soft: #FFF3DA;
  --warn-line: #F1D08A;
  --crit: #C42B2B;
  --crit-soft: #FDECEC;

  --t-wydanie: #C2410C;
  --t-wydanie-soft: #FFEFE3;
  --t-zwrot: #0F7B53;
  --t-zwrot-soft: #E4F5EC;
  --t-rozliczenie: #6145CC;
  --t-rozliczenie-soft: #EFEBFF;
  --t-przyjecie: #1F5FC9;
  --t-przyjecie-soft: #E7EFFD;
  --t-korekta: #535A68;
  --t-korekta-soft: #ECEEF1;

  /* Kolory serii wykresu (zwalidowane pod daltonizm): na stanie / wydane */
  --series-1: #2a78d6;
  --series-2: #eb6834;

  --sidebar-bg: #0B0C0F;
  --sidebar-bg-2: #121419;
  --sidebar-fg: #A0A5AF;
  --sidebar-fg-hi: #FFFFFF;
  --sidebar-line: rgba(255, 255, 255, .07);
  --sidebar-accent: #FF3341;

  --shadow-1: 0 1px 2px rgba(16, 18, 24, .06);
  --shadow-2: 0 6px 18px rgba(16, 18, 24, .10);
  --shadow-3: 0 24px 60px -12px rgba(10, 12, 16, .38), 0 2px 8px rgba(10, 12, 16, .12);

  --sidebar-w: 248px;
}

/* ---------- 2. Motyw ciemny ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0A0B0E;
  --surface: #121418;
  --surface-2: #171A1F;
  --surface-3: #1F2228;
  --line: #262A31;
  --line-2: #363B44;
  --text: #EDEEF1;
  --text-2: #B0B4BD;
  --text-3: #868B95;
  --input-bg: #0D0F12;
  --avatar-bg: #262A31;

  --accent: #FF4855;
  --accent-fill: #D9111E;
  --accent-fill-hi: #EE2330;
  --accent-soft: #2A1215;
  --accent-line: #5A1E24;
  --focus-ring: 0 0 0 3px rgba(255, 72, 85, .28);

  --ok: #3CCB8F;
  --ok-soft: #0E2A20;
  --warn: #F2B54E;
  --warn-soft: #2B2112;
  --warn-line: #5C4520;
  --crit: #FF6F69;
  --crit-soft: #2C1414;

  --t-wydanie: #F59152;
  --t-wydanie-soft: #2D1C10;
  --t-zwrot: #3CCB8F;
  --t-zwrot-soft: #0E2A20;
  --t-rozliczenie: #A18CFF;
  --t-rozliczenie-soft: #211B3A;
  --t-przyjecie: #6FA6FF;
  --t-przyjecie-soft: #12213A;
  --t-korekta: #A9AEB8;
  --t-korekta-soft: #1F2228;

  --series-1: #3987e5;
  --series-2: #d95926;

  --sidebar-bg: #060709;
  --sidebar-bg-2: #0D0F13;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .45);
  --shadow-2: 0 6px 18px rgba(0, 0, 0, .5);
  --shadow-3: 0 24px 60px rgba(0, 0, 0, .65), 0 2px 8px rgba(0, 0, 0, .4);
}

/* ---------- 3. Podstawa ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.45 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; }
p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs); }
::selection { background: rgba(227, 6, 19, .18); }
code { font-family: var(--font-mono); font-size: .92em; background: var(--surface-3); padding: 1px 6px; border-radius: 5px; overflow-wrap: anywhere; }
.i { width: 18px; height: 18px; flex-shrink: 0; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.mono { font-family: var(--font-mono); font-size: .95em; }
.pre { white-space: pre-wrap; }
.nowrap { white-space: nowrap; }
.mt-4 { margin-top: 4px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.spinner {
  display: inline-block; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite; opacity: .65; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px 16px; color: var(--text-3); }

/* ---------- 4. Ekran startowy i logowanie ---------- */
.boot, .auth {
  min-height: 100vh;
  background:
    radial-gradient(1100px 560px at 85% -10%, rgba(227, 6, 19, .20), transparent 60%),
    radial-gradient(900px 520px at -10% 110%, rgba(227, 6, 19, .10), transparent 60%),
    #08090B;
}
.boot { display: grid; place-items: center; align-content: center; gap: 22px; color: #9DA2AD; }
.boot img { width: 230px; height: auto; }
.auth { display: grid; place-items: center; padding: 40px 16px; }
.auth-wrap { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; }
.auth-wide { max-width: 520px; }
.auth-logo { width: 250px; max-width: 80%; height: auto; margin-bottom: 28px; }
.auth-card {
  width: 100%; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 28px; box-shadow: var(--shadow-3);
}
.auth-title { font-family: var(--font-cond); font-weight: 600; font-size: 25px; letter-spacing: .2px; margin-bottom: 6px; }
.auth-sub { color: var(--text-2); font-size: 13.5px; margin-bottom: 20px; }
.auth-badge {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px;
  padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  font-weight: 600; font-size: 12px;
}
.auth-badge .i { width: 14px; height: 14px; }
.auth-note { margin: 16px 0 0; text-align: center; font-size: 12.5px; color: var(--text-3); }
.auth-foot { margin: 20px 0 0; font-size: 12px; color: #6F7581; }

/* ---------- 5. Układ: menu boczne + treść ---------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 60;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--sidebar-bg-2), var(--sidebar-bg) 40%);
  border-right: 1px solid var(--sidebar-line);
  color: var(--sidebar-fg);
}
.brand { display: block; padding: 24px 22px 0; }
.brand:focus-visible { outline-offset: -2px; }
.brand-logo { width: 172px; height: auto; }
.brand-tag {
  padding: 8px 22px 18px; font-family: var(--font-cond); font-size: 12px; letter-spacing: 3px;
  text-transform: uppercase; color: #7E838D; border-bottom: 1px solid var(--sidebar-line);
}
.nav { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px;
  height: 42px; padding: 0 12px; border-radius: 10px;
  color: var(--sidebar-fg); font-weight: 600; font-size: 13.5px; text-decoration: none;
  transition: background .15s, color .15s;
}
.nav a .i { width: 18px; height: 18px; opacity: .85; }
.nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .08); color: #fff; }
.nav a.active .i { color: var(--sidebar-accent); opacity: 1; }
.nav a.active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--sidebar-accent);
}
.sidebar-foot { border-top: 1px solid var(--sidebar-line); padding: 14px 14px 16px; }
.me { display: flex; align-items: center; gap: 10px; padding: 0 4px 12px; }
.me .avatar { background: #23262D; color: #fff; }
.me-text { min-width: 0; display: flex; flex-direction: column; }
.me-name { color: #fff; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-role { color: #858A94; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.side-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 8px; border-radius: 9px; border: 1px solid var(--sidebar-line);
  background: rgba(255, 255, 255, .03); color: var(--sidebar-fg); font-size: 12.5px; font-weight: 600;
  white-space: nowrap;
}
.side-btn .i { width: 15px; height: 15px; }
.side-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-backdrop { display: none; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar { display: none; }
.view { padding: 28px 32px 56px; max-width: 1440px; }

/* ---------- 6. Nagłówek strony ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-title { font-family: var(--font-cond); font-weight: 600; font-size: 28px; line-height: 1.15; letter-spacing: .2px; }
.page-sub { color: var(--text-2); margin: 5px 0 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.page-sub .i { width: 15px; height: 15px; color: var(--text-3); }
.page-sub.pre { display: block; max-width: 760px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-kicker { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; color: var(--text-2); font-weight: 600; font-size: 13px; }
.back-link .i { width: 16px; height: 16px; }
.back-link:hover { color: var(--text); text-decoration: none; }
.person-head { display: flex; align-items: center; gap: 16px; }
.danger-link { margin: 6px 0 0; text-align: right; }
.danger-link a { display: inline-flex; align-items: center; gap: 6px; color: var(--crit); font-size: 13px; font-weight: 600; }
.danger-link .i { width: 15px; height: 15px; }

/* ---------- 7. Karty ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); margin-bottom: 18px; min-width: 0;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  min-height: 54px; padding: 12px 18px; border-bottom: 1px solid var(--line);
}
.card-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.card-title .i { width: 17px; height: 17px; color: var(--text-3); }
.card-title .count { color: var(--text-3); font-weight: 500; }
.card-body { padding: 18px; }
.card-body-flush { padding: 0; }
.link { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 13px; }
.link .i { width: 15px; height: 15px; }
.link-strong { color: var(--text); font-weight: 600; }
.link-strong:hover { color: var(--accent); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2-wide { grid-template-columns: 1.45fr 1fr; }

/* ---------- 8. Przyciski ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid transparent;
  font-weight: 600; font-size: 13.5px; line-height: 1; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { text-decoration: none; }
.btn .i { width: 17px; height: 17px; }
.btn-primary {
  background: var(--accent-fill); color: var(--accent-ink);
  box-shadow: 0 1px 2px rgba(217, 17, 30, .25), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.btn-primary:hover { background: var(--accent-fill-hi); color: var(--accent-ink); }
.btn-secondary { background: var(--surface); border-color: var(--line-2); color: var(--text); box-shadow: var(--shadow-1); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--crit-soft); border-color: var(--accent-line); color: var(--crit); }
.btn-danger:hover:not(:disabled) { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; gap: 6px; }
.btn-sm .i { width: 15px; height: 15px; }
.btn-lg { height: 44px; padding: 0 18px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.is-busy { cursor: progress; }
.btn.is-busy::after {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-3);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .i { width: 17px; height: 17px; }
.icon-btn-danger:hover { background: var(--crit-soft); color: var(--crit); }

/* ---------- 9. Formularze ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.label small { font-weight: 400; color: var(--text-3); font-size: 12px; }
.hint { font-size: 12px; color: var(--text-3); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.span-2 { grid-column: 1 / -1; }

/* :where() = zerowa specyficzność, żeby klasy (np. .search input) mogły nadpisać te wartości */
:where(input:not([type=checkbox]):not([type=radio]), select, textarea) {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--input-bg); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  color: var(--text); font-size: 14px; transition: border-color .15s, box-shadow .15s;
}
:where(textarea) { height: auto; min-height: 64px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
:where(select) {
  appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23858A94' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: .8; }
input[type=date] { min-width: 0; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; user-select: none; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent-fill); cursor: pointer; }
.check-pill { height: 40px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); white-space: nowrap; }
.input-row { display: flex; gap: 8px; }
.input-row > input, .input-row > select { flex: 1; min-width: 0; }
.form-error {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--crit-soft); border: 1px solid var(--accent-line); color: var(--crit); font-size: 13.5px;
}
.form-error .i { width: 18px; height: 18px; margin-top: 1px; }
.field-inline { flex-direction: row; align-items: center; gap: 8px; }
.field-inline input { width: auto; }

.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.radio-card {
  position: relative; display: block; padding: 12px 14px; border: 1px solid var(--line-2);
  border-radius: var(--r); cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s;
}
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card b { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.radio-card b .i { width: 17px; height: 17px; color: var(--text-3); }
.radio-card small { display: block; margin-top: 3px; color: var(--text-3); font-size: 12.5px; }
.radio-card:hover { border-color: var(--text-3); }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.radio-card:has(input:checked) b .i { color: var(--accent); }
.radio-card:has(input:focus-visible) { box-shadow: var(--focus-ring); }

/* ---------- 10. Pasek narzędzi, wyszukiwanie, zakładki ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar > select { width: auto; min-width: 200px; }
.search { position: relative; display: block; flex: 1; min-width: 220px; }
.search > .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-3); pointer-events: none; }
.search input { padding-left: 38px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text-2); font-weight: 600; font-size: 12.5px;
}
.chip:hover { background: var(--surface-3); color: var(--text); }

.segmented {
  display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; margin-bottom: 16px;
  background: var(--surface-3); border-radius: 12px;
}
.seg-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 9px;
  color: var(--text-2); font-weight: 600; font-size: 13.5px; text-decoration: none;
}
.seg-btn .i { width: 17px; height: 17px; }
.seg-btn:hover { color: var(--text); text-decoration: none; }
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.seg-btn.active .i { color: var(--accent); }

.tabs { display: flex; gap: 2px; margin-bottom: 18px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: -1px;
  border-bottom: 2px solid transparent; color: var(--text-2); font-weight: 600; font-size: 13.5px;
  white-space: nowrap; text-decoration: none;
}
.tab .i { width: 16px; height: 16px; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); border-bottom-color: var(--accent-fill); }
.tab.active .i { color: var(--accent); }

/* ---------- 11. Tabele ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table thead th {
  position: sticky; top: 0; z-index: 1;
  padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase;
  color: var(--text-3); white-space: nowrap;
}
.card > .table-wrap:first-child .table thead th:first-child,
.card-head + .table-wrap .table thead th:first-child { border-top-left-radius: 0; }
.table td, .table tbody th { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; font-weight: 400; }
.table tbody tr:last-child td, .table tbody tr:last-child th { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; width: 1%; white-space: nowrap; }
.table .actions .btn + .btn, .table .actions .btn + .icon-btn { margin-left: 2px; }
.table a { color: var(--text); }
.table a:hover { color: var(--accent); }
.row-link { cursor: pointer; }
.row-link:hover td { background: var(--surface-2); }
.sortable button {
  display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit;
}
.sortable button:hover { color: var(--text); }
.sort-ind { font-size: 8px; color: var(--accent); min-width: 8px; }
.cell-title { font-weight: 600; color: var(--text); }
.cell-sub { display: block; font-size: 12px; color: var(--text-3); margin-top: 2px; }
.cell-sub-inline { font-size: 12px; color: var(--text-3); margin-left: 6px; }
.cell-person { display: flex; align-items: center; gap: 10px; }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: var(--r-xs);
  background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 500; white-space: nowrap;
}
.qty { font-weight: 600; }
.qty-zero { color: var(--text-3); }
.unit { color: var(--text-3); font-size: 12px; }
.table-compact td, .table-compact thead th { padding: 8px 14px; }
.table-compact thead th { position: static; }
.is-cancelled td { opacity: .55; }
.is-cancelled .op-lines { text-decoration: line-through; }
.is-inactive td { opacity: .6; }
.note-cell { max-width: 260px; min-width: 120px; white-space: pre-wrap; word-break: break-word; color: var(--text-2); font-size: 13px; }
.audit-details { min-width: 280px; color: var(--text-2); }
.table-period .group-row th, .table-period .group-row td { background: var(--surface-2); font-weight: 600; }
.table-period tbody + tbody .group-row th, .table-period tbody + tbody .group-row td { border-top: 1px solid var(--line); }
.table-period tbody tr:last-child td { border-bottom: 1px solid var(--line); }
.table .indent { padding-left: 30px; }

.op-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; min-width: 220px; }
.op-lines li { display: grid; gap: 4px; }
.op-line-top { display: flex; justify-content: space-between; gap: 14px; }
.op-line-qty { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.op-lines li.is-hl .op-line-name, .op-lines li.is-hl .op-line-name a { color: var(--accent); font-weight: 600; }
.cancel-info { margin-top: 6px; font-size: 12px; color: var(--crit); }

/* ---------- 12. Etykiety ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--r-xs);
  font-size: 12px; font-weight: 600; white-space: nowrap; vertical-align: middle;
}
.badge .i { width: 13px; height: 13px; }
.type-wydanie { background: var(--t-wydanie-soft); color: var(--t-wydanie); }
.type-zwrot { background: var(--t-zwrot-soft); color: var(--t-zwrot); }
.type-rozliczenie { background: var(--t-rozliczenie-soft); color: var(--t-rozliczenie); }
.type-przyjecie { background: var(--t-przyjecie-soft); color: var(--t-przyjecie); }
.type-korekta { background: var(--t-korekta-soft); color: var(--t-korekta); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-muted { background: var(--surface-3); color: var(--text-2); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-danger { background: var(--crit-soft); color: var(--crit); }

.avatar {
  display: inline-grid; place-items: center; flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
  background: var(--avatar-bg); color: var(--text-2); font-size: 12.5px; font-weight: 700; letter-spacing: .3px;
}
.avatar-sm { width: 30px; height: 30px; font-size: 11.5px; }
.avatar-lg { width: 54px; height: 54px; font-size: 18px; }

/* ---------- 13. Pulpit ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  display: flex; flex-direction: column; gap: 6px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  color: inherit; text-decoration: none; transition: border-color .15s, transform .15s var(--ease);
}
.kpi:hover { border-color: var(--line-2); transform: translateY(-1px); text-decoration: none; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.kpi-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-3); color: var(--text-2); }
.kpi-icon .i { width: 18px; height: 18px; }
.kpi:first-child .kpi-icon { background: var(--accent-soft); color: var(--accent); }
.kpi-value { font-family: var(--font-ui); font-weight: 600; font-size: 32px; line-height: 1.1; letter-spacing: -.5px; color: var(--text); }
.kpi-sub { font-size: 12.5px; color: var(--text-3); }
.kpi-warn .kpi-icon { background: var(--warn-soft); color: var(--warn); }
.kpi-ok .kpi-icon { background: var(--ok-soft); color: var(--ok); }

.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 12px; font-size: 12.5px; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.swatch-1 { background: var(--series-1); }
.swatch-2 { background: var(--series-2); }
.cat-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.cat-link {
  display: grid; gap: 8px; margin: 0 -10px; padding: 10px; border-radius: var(--r-sm);
  color: inherit; text-decoration: none;
}
.cat-link:hover { background: var(--surface-2); text-decoration: none; }
.cat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cat-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.cat-vals { font-size: 12.5px; color: var(--text-3); }
.cat-vals b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.cat-bar { display: flex; gap: 2px; height: 12px; }
.cat-bar .seg { height: 100%; min-width: 3px; }
.cat-bar .seg:last-of-type { border-radius: 0 4px 4px 0; }
.seg-1 { background: var(--series-1); }
.seg-2 { background: var(--series-2); }
.seg-empty { font-size: 12px; color: var(--text-3); line-height: 12px; }

.ok-state { display: flex; align-items: flex-start; gap: 12px; padding: 18px; }
.ok-state .i { width: 22px; height: 22px; color: var(--ok); }
.ok-state p { margin: 2px 0 0; color: var(--text-3); font-size: 13px; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li + li, .list > .list-row + .list-row { border-top: 1px solid var(--line); }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; color: inherit; text-decoration: none; }
a.list-row:hover { background: var(--surface-2); text-decoration: none; }
.list-lead { flex-shrink: 0; color: var(--text-3); }
.list-lead .badge { min-width: 104px; }
.list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.list-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-sub { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-side { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.list-date { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.list-num { font-size: 16px; }
.list-scroll { max-height: 340px; overflow-y: auto; border-top: 1px solid var(--line); }

.onboarding { border-color: var(--accent-line); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 70%); }
.onboarding .card-body { padding: 20px 22px; }
.steps { counter-reset: step; list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.steps li { counter-increment: step; }
.steps a {
  position: relative; display: flex; flex-direction: column; gap: 4px; height: 100%;
  padding: 40px 14px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  color: var(--text); text-decoration: none; transition: border-color .15s;
}
.steps a::before {
  content: counter(step); position: absolute; top: 12px; left: 14px; display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%; background: var(--accent-fill); color: #fff; font-size: 11.5px; font-weight: 700;
}
.steps a:hover { border-color: var(--accent); text-decoration: none; }
.steps span { color: var(--text-3); font-size: 12.5px; }

.empty { text-align: center; padding: 36px 20px; color: var(--text-3); }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 12px; background: var(--surface-3); }
.empty-icon .i { width: 22px; height: 22px; }
.empty-title { color: var(--text); font-weight: 600; font-size: 15px; }
.empty-text { max-width: 440px; margin: 6px auto 16px; font-size: 13.5px; }
.empty .btn { margin-top: 4px; }

/* ---------- 14. Karta przedmiotu ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-1);
}
.stat-label { font-size: 12.5px; font-weight: 600; color: var(--text-3); }
.stat-value { font-weight: 600; font-size: 24px; line-height: 1.15; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--text-3); }

/* ---------- 15. Wydanie / zwrot / przyjęcie ---------- */
.op-form { display: grid; gap: 18px; }
.op-form .card { margin-bottom: 0; }
.op-fields { grid-template-columns: 1.25fr .75fr; }
.op-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.picker-tools { display: flex; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.picker-tools .search { min-width: 0; }
.picker-tools select { width: auto; max-width: 46%; min-width: 0; flex: 0 1 auto; }
.pick-list { list-style: none; margin: 0; padding: 6px; max-height: 560px; overflow-y: auto; }
.pick {
  width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto 32px; align-items: center; gap: 12px;
  padding: 9px 10px; border: 0; border-radius: var(--r-sm); background: none; text-align: left; color: inherit;
  transition: background .12s;
}
.pick:hover:not(:disabled) { background: var(--surface-2); }
.pick:disabled { opacity: .45; cursor: not-allowed; }
.pick-main { min-width: 0; }
.pick-name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-meta { display: block; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-avail { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.pick-avail b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.pick-avail.is-zero b { color: var(--crit); }
.pick-add {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--line-2); color: var(--text-2); transition: border-color .12s, color .12s, background .12s;
}
.pick-add .i { width: 16px; height: 16px; }
.pick:hover:not(:disabled) .pick-add { border-color: var(--accent); color: var(--accent); }
.pick.in-cart { background: var(--surface-2); }
.pick.in-cart .pick-add { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
.pick-incart { font-size: 12.5px; font-weight: 700; }
.pick-empty { display: flex; align-items: center; gap: 10px; padding: 24px 14px; color: var(--text-3); }
.pick-empty .i { width: 20px; height: 20px; }

.cart { position: sticky; top: 20px; }
.cart-lines { padding: 4px 18px; max-height: 470px; overflow-y: auto; }
.cart-line {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto 32px; align-items: center; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.cart-line:last-child { border-bottom: 0; }
.cart-line-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.cart-line-meta { font-size: 12px; color: var(--text-3); }
.cart-unit { font-size: 12px; color: var(--text-3); min-width: 28px; }
.stepper { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; background: var(--input-bg); }
.stepper button {
  display: grid; place-items: center; width: 32px; height: 34px; border: 0; padding: 0;
  background: var(--surface-2); color: var(--text-2);
}
.stepper button:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.stepper button:disabled { opacity: .4; cursor: not-allowed; }
.stepper button .i { width: 15px; height: 15px; }
.stepper input:not([type=checkbox]) {
  width: 64px; height: 34px; padding: 0 4px; border: 0; border-radius: 0;
  border-left: 1px solid var(--line-2); border-right: 1px solid var(--line-2);
  text-align: center; font-weight: 700; appearance: textfield; -moz-appearance: textfield;
}
.stepper input:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cart-empty { padding: 36px 16px; text-align: center; color: var(--text-3); }
.cart-empty .i { width: 26px; height: 26px; margin: 0 auto 8px; }
.cart-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.cart-total { font-size: 13.5px; color: var(--text-2); }
.cart-total b { color: var(--text); font-size: 16px; }

.success { text-align: center; padding: 6px 0; }
.success-icon { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 12px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.success-icon .i { width: 28px; height: 28px; stroke-width: 2.6; }
.success-title { font-size: 17px; font-weight: 700; margin-bottom: 4px; }

.corr-diff { min-height: 20px; font-weight: 600; }
.corr-diff.is-plus { color: var(--ok); }
.corr-diff.is-minus { color: var(--crit); }

/* ---------- 16. Historia i zestawienia ---------- */
.filters { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; padding: 16px 18px; }
.filters-search { grid-column: 1 / -1; }
.filters-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.load-more { display: flex; justify-content: center; padding: 14px; border-top: 1px solid var(--line); }

.summary-line { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; color: var(--text-2); font-size: 13.5px; }
.summary-line .i { width: 16px; height: 16px; color: var(--text-3); }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.report-grid > .card { margin-bottom: 0; }
.report-grid > .card:only-child { grid-column: 1 / -1; }
.report-card-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.report-card-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.report-card-total { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.report-card-total b { font-size: 20px; line-height: 1.1; font-weight: 600; }
.report-card-total span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.report-empty { margin: 0; padding: 14px 16px; color: var(--text-3); font-size: 13px; }

/* ---------- 17. Ustawienia ---------- */
.profile { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.profile-name { font-size: 17px; font-weight: 600; }
.url-list { list-style: none; margin: 10px 0 14px; padding: 0; display: grid; gap: 8px; }
.url-list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.url-list code { font-size: 15px; padding: 6px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.cred {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 12px 0; padding: 12px 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
}
.cred dt { color: var(--text-3); font-size: 12.5px; align-self: center; }
.cred dd { margin: 0; font-size: 16px; font-weight: 600; user-select: all; }
.path { display: block; margin: 6px 0 4px; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; word-break: break-all; }
.plain-steps { margin: 0; padding-left: 20px; line-height: 1.65; }
.plain-steps li + li { margin-top: 4px; }

.notice {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; padding: 12px 14px;
  border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2); font-size: 13.5px;
}
.notice .i { width: 18px; height: 18px; margin-top: 1px; }
.notice-warn { background: var(--warn-soft); border-color: var(--warn-line); }
.notice-warn .i { color: var(--warn); }
.notice-error { background: var(--crit-soft); border-color: var(--accent-line); }
.notice-error .i { color: var(--crit); }
.del-box .notice { margin-bottom: 0; }
.danger-card .card-title .i { color: var(--crit); }
.del-box { display: grid; gap: 14px; margin-top: 14px; }
.del-box:empty { display: none; }
.del-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.del-summary > div { display: flex; flex-direction: column; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); }
.del-summary span { font-size: 12px; color: var(--text-3); }
.del-summary b { font-size: 16px; }
.confirm-target {
  display: block; padding: 7px 10px; border-radius: 7px; background: var(--surface-3);
  font-family: var(--font-mono); font-weight: 600; color: var(--text); word-break: break-word; user-select: all;
}
input.confirm-input.is-match { border-color: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent); }

.error-box {
  display: flex; gap: 12px; padding: 18px; border-radius: var(--r);
  background: var(--crit-soft); border: 1px solid var(--accent-line);
}
.error-box > .i { width: 22px; height: 22px; color: var(--crit); }
.error-box p { margin: 4px 0 12px; color: var(--text-2); }

/* ---------- 18. Okna, powiadomienia, podpowiedzi ---------- */
body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 16px 24px; overflow-y: auto; background: rgba(6, 8, 12, .55); backdrop-filter: blur(2px);
  animation: fade-in .15s ease-out;
}
.modal {
  width: 100%; max-width: 580px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow-3); animation: modal-in .2s var(--ease);
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: .4; transform: translateY(10px); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }
.modal-sm { max-width: 450px; }
.modal-lg { max-width: 780px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-body { padding: 18px 20px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 14px 20px;
  border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 16px 16px;
}
.confirm-msg .op-lines { margin: 12px 0 14px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--r-sm); }

/* Powiadomienia u góry — nie zasłaniają przycisków na dole (Zapisz, Wypisz zaznaczone). */
.toasts { position: fixed; right: 20px; top: 20px; z-index: 200; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 440px; padding: 11px 15px;
  border-radius: 11px; background: #15171C; color: #fff; box-shadow: var(--shadow-2); font-size: 13.5px;
  border: 1px solid rgba(255, 255, 255, .08);
  animation: toast-in .2s var(--ease); transition: opacity .25s, transform .25s var(--ease);
}
.toast.hide { opacity: 0; transform: translateY(-10px); }
.toast .i { width: 18px; height: 18px; }
.toast-success .i { color: #3CCB8F; }
.toast-error { border-left: 3px solid #FF4855; }
.toast-error .i { color: #FF6F69; }

.tooltip {
  position: fixed; top: 0; left: 0; z-index: 300; pointer-events: none; min-width: 180px;
  padding: 10px 12px; border-radius: 10px; background: #15171C; color: #fff; font-size: 12.5px;
  box-shadow: var(--shadow-2); border: 1px solid rgba(255, 255, 255, .08);
}
.tip-title { font-weight: 600; margin-bottom: 6px; }
.tip-row { display: flex; align-items: center; gap: 7px; }
.tip-row + .tip-row { margin-top: 3px; }
.tip-row b { margin-left: auto; padding-left: 16px; font-variant-numeric: tabular-nums; }
.tip-muted { color: #A0A5AF; }

/* ---------- 18b. Numery seryjne ---------- */
.badge-sn { height: 20px; padding: 0 6px; gap: 4px; font-size: 11px; letter-spacing: .3px; background: var(--t-przyjecie-soft); color: var(--t-przyjecie); }
.badge-sn .i { width: 12px; height: 12px; }
.sn-list { display: flex; flex-wrap: wrap; gap: 4px; }
.sn {
  display: inline-block; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text-2); font-family: var(--font-mono); font-size: 11.5px; line-height: 1.5; white-space: nowrap;
}
.sn-more { font-family: var(--font-ui); font-weight: 600; cursor: help; }
.card-head-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sn-card .sn-notice { margin: 14px 18px 0; }
.sn-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.sn-tools .search { min-width: 240px; }
.chip.active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.chip-count { margin-left: 2px; font-weight: 500; opacity: .8; font-variant-numeric: tabular-nums; }
.sn-table-wrap { max-height: 540px; overflow: auto; }
.sn-table .col-check { width: 44px; text-align: center; padding-right: 4px; }
.sn-table input[type=checkbox], .snp-row input[type=checkbox] {
  width: 17px; height: 17px; margin: 0; vertical-align: middle; accent-color: var(--accent-fill); cursor: pointer;
}
.sn-table tr.is-selectable { cursor: pointer; }
.sn-table tr.is-selectable:hover td { background: var(--surface-2); }
.sn-table tr.is-selected td { background: var(--accent-soft); }
.sn-cell { font-weight: 600; color: var(--text); }
.is-flash td { animation: flash 2.4s ease-out 1; }
@keyframes flash { 0%, 45% { background: var(--warn-soft); } 100% { background: transparent; } }
.sn-bar {
  position: sticky; bottom: 0; z-index: 3; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 18px; background: var(--surface); border-top: 1px solid var(--line);
  border-radius: 0 0 var(--r-lg) var(--r-lg); box-shadow: 0 -10px 24px -14px rgba(0, 0, 0, .3);
}
.sn-bar-info { font-size: 13.5px; color: var(--text-2); }
.sn-bar-info b { color: var(--text); font-size: 15px; }
.sn-bar-spacer { flex: 1; }
.sn-option {
  display: flex; flex-direction: column; gap: 6px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2);
}
.sn-option .check { align-items: flex-start; }
.sn-option .check input { margin-top: 2px; }
.sn-input textarea { font-family: var(--font-mono); font-size: 13px; }
.sn-input-count.is-error { color: var(--crit); font-weight: 600; }
.snp-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.snp-tools .search { min-width: 220px; }
.snp-info { margin: 0 0 8px; color: var(--text-2); font-size: 13px; }
.snp-list {
  list-style: none; margin: 0; padding: 4px; max-height: 360px; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
}
.snp-list .pick-empty { grid-column: 1 / -1; }
.snp-row { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 7px; cursor: pointer; }
.snp-row:hover { background: var(--surface-2); }
.snp-row.is-on { background: var(--accent-soft); }
.cart-line-sn { grid-template-columns: minmax(0, 1fr) auto 32px; align-items: start; }
.cart-line-sn .sn-list { margin-top: 6px; }
.pick-avail-sub { display: block; font-size: 11.5px; color: var(--text-3); text-align: right; }
.success-sn { display: flex; justify-content: center; margin-top: 10px; }
.success-sn .sn-list { justify-content: center; }
.doc-sn { margin-top: 3px; font-family: var(--font-mono); font-size: 8.5pt; color: #333; word-break: break-word; }

/* ---------- 18c. Zestawy ---------- */
.pick-group {
  display: flex; align-items: center; gap: 6px; padding: 10px 10px 4px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--text-3);
}
.pick-group .i { width: 14px; height: 14px; }
.pick-list > .pick-group:not(:first-child) { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.pick-kit .pick-name { white-space: normal; }
.pick-kit .pick-meta { white-space: normal; }
.pick-kit .pick-add { color: var(--accent); border-color: var(--accent-line); }
.pick-meta.is-short { color: var(--warn); font-weight: 600; }
.picker-foot {
  display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 12px 16px;
  border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-3);
}
.picker-foot .i { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.kit-hints { display: grid; gap: 8px; padding: 12px 18px 4px; }
.kit-hints[hidden] { display: none; }
.kit-hint {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 6px 10px 12px;
  border-radius: var(--r-sm); background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.kit-hint-icon .i { display: block; width: 18px; height: 18px; margin-top: 1px; color: var(--accent); }
.kit-hint-main { flex: 1; min-width: 0; font-size: 13px; line-height: 1.45; }
.kit-hint-title { font-weight: 600; }
.kit-hint-text { color: var(--text-2); }
.kit-hint-text b { color: var(--text); font-weight: 600; }
.kit-hint-actions { display: flex; gap: 6px; margin-top: 8px; }
.kit-hint > .icon-btn { margin-top: -4px; flex-shrink: 0; }
.snp-need { margin-bottom: 10px; }
.snp-need .i { color: var(--accent); }
.kit-card .card-title { min-width: 0; }
.kit-notes { margin: 0; padding: 12px 18px 0; color: var(--text-2); font-size: 13px; white-space: pre-wrap; }
.kit-foot, .card-foot {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 14px;
  border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.kit-foot-spacer { flex: 1; }
.table .is-short { color: var(--crit); font-weight: 600; }
.kit-rows { display: grid; gap: 8px; margin-bottom: 4px; }
.kit-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 32px; gap: 8px; align-items: center; }

/* ---------- 18d. Zaległe rozliczenia ---------- */
.since { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.since-days { font-size: 12px; color: var(--text-3); }
.since.is-late .since-days { color: var(--warn); font-weight: 600; }
.sn.sn-late { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); font-weight: 600; }
.stack { display: grid; gap: 18px; align-content: start; min-width: 0; }
.stack > .card { margin-bottom: 0; }
.late-days { color: var(--warn); font-weight: 600; }
.list-more { margin: 0; padding: 10px 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-3); }
.list-note { margin: 0; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--warn-soft); color: var(--text-2); font-size: 12.5px; }
.list-note b { color: var(--warn); }
.report-card-total b.late-days { color: var(--warn); }

/* ---------- 18e. Bezpieczeństwo, weryfikacja dwuetapowa ---------- */
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.code-input { font-size: 22px; letter-spacing: 6px; text-align: center; font-weight: 600; }
.tfa-steps { margin: 4px 0 12px; padding-left: 20px; display: grid; gap: 14px; line-height: 1.55; }
.tfa-qr {
  width: 232px; max-width: 100%; margin: 10px 0 6px; padding: 8px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--r-sm);
}
.tfa-qr svg { display: block; width: 100%; height: auto; }
.tfa-manual { margin-top: 6px; font-size: 13px; }
.tfa-manual summary { cursor: pointer; color: var(--text-2); font-weight: 600; }
.tfa-secret { font-family: var(--font-mono); font-size: 15px; letter-spacing: 1px; padding: 4px 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; word-break: break-all; }
.tfa-verify { margin-top: 8px; }
.tfa-verify .input-row input { max-width: 200px; }
.tfa-done { display: grid; gap: 12px; text-align: left; }
.tfa-done .success-icon { margin: 0; }
.tfa-done-title { font-size: 17px; font-weight: 700; }
.rc-list { list-style: none; margin: 0; padding: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); font-size: 15px; }
.rc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sec-checks .list-lead .i { width: 20px; height: 20px; }
.sec-ok { color: var(--ok); }
.sec-warn { color: var(--warn); }
.sec-events { max-height: 520px; overflow: auto; }
.cert-page .plain-steps { font-size: 14px; }
.cert-h { margin: 18px 0 6px; font-size: 15px; font-weight: 700; }

/* ---------- 19. Responsywność ---------- */
@media (max-width: 1280px) {
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-2-wide { grid-template-columns: 1fr; }
  .op-grid { grid-template-columns: 1fr; }
  .cart { position: static; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s var(--ease); box-shadow: none; }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-3); }
  .shell.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .5); }
  .main { margin-left: 0; }
  .topbar {
    position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 10px;
    height: 56px; padding: 0 12px; background: var(--sidebar-bg); border-bottom: 1px solid var(--sidebar-line);
  }
  .topbar-menu { color: #fff; }
  .topbar-menu:hover { background: rgba(255, 255, 255, .08); color: #fff; }
  .topbar-brand img { height: 26px; width: auto; }
  .view { padding: 20px 16px 48px; }
  .toasts { top: 66px; }
}
@media (max-width: 640px) {
  .page-title { font-size: 23px; }
  .page-head { align-items: stretch; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 26px; }
  .form-grid, .op-fields, .radio-cards, .del-summary { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr 1fr; padding: 14px; }
  .toolbar > select, .toolbar .check-pill { flex: 1 1 auto; }
  .segmented { display: flex; width: 100%; }
  .seg-btn { flex: 1 1 auto; justify-content: center; padding: 0 10px; }
  .table td, .table tbody th, .table thead th { padding-left: 12px; padding-right: 12px; }
  .report-grid { grid-template-columns: 1fr; }
  .sn-tools .search, .snp-tools .search { min-width: 0; flex-basis: 100%; }
  .snp-list { grid-template-columns: 1fr; }
  .sn-bar .btn { flex: 1 1 auto; }
  .picker-tools { flex-wrap: wrap; }
  .picker-tools .search { flex-basis: 100%; }
  .picker-tools select { width: 100%; max-width: none; }
  .cart-line { grid-template-columns: minmax(0, 1fr) auto 32px; }
  .cart-unit { display: none; }
  .kit-hints { padding: 12px 14px 4px; }
  .kit-row { grid-template-columns: minmax(0, 1fr) 76px 32px; }
  .cart-foot .btn { width: 100%; }
  .modal-backdrop { padding: 16px 10px; }
  .list-lead .badge { min-width: 0; }
  .auth-card { padding: 22px 18px; }
  .person-head { align-items: flex-start; }
  .toasts { left: 12px; right: 12px; align-items: stretch; }
}

/* ---------- 20. Wydruki ---------- */
#print-area { display: none; }
.doc {
  font-family: var(--font-ui); color: #111; font-size: 10.5pt; line-height: 1.4;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.doc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 10px; margin-bottom: 16px; border-bottom: 2px solid #111; }
.doc-logo { height: 34px; width: auto; }
.doc-head-right { text-align: right; font-size: 10pt; }
.doc-no { font-family: var(--font-mono); font-size: 13pt; font-weight: 700; margin-bottom: 2px; }
.doc-title { font-family: var(--font-cond); font-size: 18pt; font-weight: 600; margin: 0 0 12px; }
.doc-cancelled { margin-bottom: 12px; padding: 6px 10px; border: 2px solid #C00; color: #C00; font-weight: 700; }
.doc-info { border-collapse: collapse; margin-bottom: 14px; }
.doc-info th { text-align: left; padding: 3px 18px 3px 0; color: #555; font-weight: 600; white-space: nowrap; vertical-align: top; }
.doc-info td { padding: 3px 0; }
.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; font-size: 10pt; }
.doc-table th, .doc-table td { border: 1px solid #9A9A9A; padding: 5px 7px; text-align: left; vertical-align: top; }
.doc-table thead th { background: #ECECEC; font-weight: 600; }
.doc-table .num { text-align: right; white-space: nowrap; }
.doc-table .lp { width: 34px; text-align: center; }
.doc-table tfoot td { font-weight: 700; background: #F5F5F5; }
.doc-table .indent { padding-left: 18px; }
.doc-group td { background: #F2F2F2; }
.doc-note { margin: 8px 0 14px; padding: 8px 10px; border: 1px solid #BBB; white-space: pre-wrap; }
.doc-statement { margin: 14px 0 0; font-style: italic; }
.doc-empty { color: #555; font-style: italic; }
.doc-signs { display: flex; gap: 40px; margin-top: 56px; }
.doc-sign { flex: 1; padding-top: 6px; border-top: 1px solid #333; text-align: center; font-size: 9.5pt; color: #444; }
.doc-section { margin-bottom: 16px; break-inside: avoid; page-break-inside: avoid; }
.doc-section h2 { display: flex; align-items: baseline; gap: 8px; margin: 0 0 6px; font-size: 12pt; }
.doc-section h2 small { font-weight: 400; color: #555; font-size: 10pt; }
.doc-section-total { margin-left: auto; font-size: 9.5pt; font-weight: 600; }
.doc-foot { margin-top: 28px; padding-top: 6px; border-top: 1px solid #DDD; font-size: 8.5pt; color: #777; }
.doc-late { margin-top: 2px; font-size: 8.5pt; font-weight: 700; color: #8A5300; }

@media print {
  @page { size: A4; margin: 14mm 12mm; }
  html, body { background: #fff !important; color: #000 !important; }
  body.printing-doc > *:not(#print-area) { display: none !important; }
  body.printing-doc #print-area { display: block !important; }
  body:not(.printing-doc) .sidebar,
  body:not(.printing-doc) .topbar,
  body:not(.printing-doc) .page-actions,
  body:not(.printing-doc) .toolbar,
  body:not(.printing-doc) .tabs,
  body:not(.printing-doc) .actions,
  body:not(.printing-doc) .toasts { display: none !important; }
  body:not(.printing-doc) .main { margin-left: 0 !important; }
  .card { box-shadow: none !important; break-inside: avoid; }
}
