/* ════════════════════════════════════════════════════════════════════════════
   Filler — arkusz stylów panelu redakcyjnego.

   Bez frameworka i bez etapu budowania. Powody, nie lenistwo:
     * jeden plik ładuje się natychmiast i działa niezależnie od Cloudflare,
     * panel jest gęstym narzędziem do tabel, gdzie kontrola nad każdym
       pikselem odstępu jest ważniejsza niż biblioteka klas,
     * obraz Dockera zostaje chudy, co na 2 vCPU ma znaczenie.

   Typografia to stos systemowy — świadomie. Polskie znaki diakrytyczne
   renderują się poprawnie na każdej platformie, nie ma pobierania fontu,
   a dla narzędzia operacyjnego neutralny krój jest zaletą. Monospace dostają
   dane liczbowe: wymiary, identyfikatory, znaczniki czasu.

   Konwencja selektorów: pojedyncze klasy, bez zagnieżdżeń typu `.a .b`
   dla layoutu. Odstępy robi grid/flex z `gap`, nie marginesy elementów —
   inaczej zaczynają się kolizje kaskady, w których spacing cicho się znosi.
   ════════════════════════════════════════════════════════════════════════════ */

/* ───────────────────────────────────────────────────────────── TOKENY ────── */
:root {
  color-scheme: light dark;

  /* Neutralne z odchyleniem w niebieski — dobrane, nie odziedziczone.
     Czysta szarość czyta się jak brak decyzji. */
  --paper:        #f6f7f9;
  --surface:      #ffffff;
  --surface-2:    #f0f2f5;
  --surface-sunk: #e8ebef;
  --line:         #dde1e7;
  --line-strong:  #c3cad3;

  --ink:          #131922;
  --ink-2:        #414c59;
  --ink-3:        #6b7683;
  --ink-faint:    #949dab;

  /* Akcent: instytucjonalny azur. Materiał źródłowy to komunikaty urzędowe,
     więc paleta trzyma ten rejestr. */
  --accent:       #1a4f9c;
  --accent-hover: #143f7e;
  --accent-soft:  #e8eff9;
  --accent-line:  #b9cdea;

  /* Semantyka stanu — osobno od akcentu, zgodnie z tym, że kolor stanu
     nie jest kolorem marki. */
  --good:         #1c7a4a;
  --good-soft:    #e4f2ea;
  --warn:         #a8630c;
  --warn-soft:    #fbf0dd;
  --bad:          #a32828;
  --bad-soft:     #fae9e9;
  --neutral-soft: #eceff3;

  --radius:    6px;
  --radius-sm: 4px;
  --shadow:    0 1px 2px rgb(19 25 34 / 6%), 0 4px 12px rgb(19 25 34 / 4%);
  --shadow-lg: 0 2px 4px rgb(19 25 34 / 8%), 0 12px 32px rgb(19 25 34 / 10%);

  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
             Arial, "Noto Sans", sans-serif;
  --font-data: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono",
               Menlo, Consolas, monospace;

  --sidebar-w: 232px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:        #10141a;
    --surface:      #171c24;
    --surface-2:    #1e242e;
    --surface-sunk: #232a35;
    --line:         #2b333f;
    --line-strong:  #3b4553;

    --ink:          #e7eaef;
    --ink-2:        #b6bec9;
    --ink-3:        #8b95a3;
    --ink-faint:    #6b7683;

    --accent:       #5c9bf0;
    --accent-hover: #7cb0f5;
    --accent-soft:  #1a2634;
    --accent-line:  #2e4a6d;

    --good:         #4bbd80;
    --good-soft:    #16281f;
    --warn:         #db9b3d;
    --warn-soft:    #2b2216;
    --bad:          #e6706b;
    --bad-soft:     #2c1a1a;
    --neutral-soft: #222932;

    --shadow:    0 1px 2px rgb(0 0 0 / 40%), 0 4px 12px rgb(0 0 0 / 25%);
    --shadow-lg: 0 2px 4px rgb(0 0 0 / 45%), 0 12px 32px rgb(0 0 0 / 35%);
  }
}

/* Przełącznik motywu musi wygrywać z media query w OBU kierunkach. */
:root[data-theme="dark"] {
  --paper: #10141a; --surface: #171c24; --surface-2: #1e242e;
  --surface-sunk: #232a35; --line: #2b333f; --line-strong: #3b4553;
  --ink: #e7eaef; --ink-2: #b6bec9; --ink-3: #8b95a3; --ink-faint: #6b7683;
  --accent: #5c9bf0; --accent-hover: #7cb0f5; --accent-soft: #1a2634;
  --accent-line: #2e4a6d;
  --good: #4bbd80; --good-soft: #16281f; --warn: #db9b3d; --warn-soft: #2b2216;
  --bad: #e6706b; --bad-soft: #2c1a1a; --neutral-soft: #222932;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 4px 12px rgb(0 0 0 / 25%);
  --shadow-lg: 0 2px 4px rgb(0 0 0 / 45%), 0 12px 32px rgb(0 0 0 / 35%);
}

:root[data-theme="light"] {
  --paper: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5;
  --surface-sunk: #e8ebef; --line: #dde1e7; --line-strong: #c3cad3;
  --ink: #131922; --ink-2: #414c59; --ink-3: #6b7683; --ink-faint: #949dab;
  --accent: #1a4f9c; --accent-hover: #143f7e; --accent-soft: #e8eff9;
  --accent-line: #b9cdea;
  --good: #1c7a4a; --good-soft: #e4f2ea; --warn: #a8630c; --warn-soft: #fbf0dd;
  --bad: #a32828; --bad-soft: #fae9e9; --neutral-soft: #eceff3;
  --shadow: 0 1px 2px rgb(19 25 34 / 6%), 0 4px 12px rgb(19 25 34 / 4%);
  --shadow-lg: 0 2px 4px rgb(19 25 34 / 8%), 0 12px 32px rgb(19 25 34 / 10%);
}

/* ──────────────────────────────────────────────────────────── PODSTAWY ───── */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.011em;
  text-wrap: balance;
}
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }

p { margin: 0 0 0.75em; }
p:last-child { margin-bottom: 0; }

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

code, kbd, .mono { font-family: var(--font-data); font-size: 0.9em; }

.num { font-variant-numeric: tabular-nums; }

hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─────────────────────────────────────────────────────────── SZKIELET ───── */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 8px 16px;
}
.brand-mark {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand-sub {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-faint);
  font-weight: 600;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 14px;
}
.nav-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 650;
  color: var(--ink-faint);
  padding: 6px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-item.is-current { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.nav-count {
  margin-left: auto;
  font-family: var(--font-data);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  border-radius: 20px;
  background: var(--neutral-soft);
  color: var(--ink-3);
}
.nav-count.is-alert { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.nav-count.is-warn  { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.nav-count.is-live  { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.who { padding: 0 8px; }
.who-name { font-weight: 600; font-size: 13px; }
.who-role { font-size: 11px; color: var(--ink-faint); }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.topbar-sub { font-size: 12px; color: var(--ink-3); }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.content { padding: 20px 24px 48px; }
.content-narrow { padding: 20px 24px 48px; max-width: 760px; }

/* ─────────────────────────────────────────────────────────── PRZYCISKI ───── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.3;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

.btn-danger { color: var(--bad); border-color: var(--line-strong); }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }

.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-3); }
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); }

.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-lg { padding: 10px 18px; font-size: 14px; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ──────────────────────────────────────────────────────────── PIGUŁKI ───── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  background: var(--neutral-soft);
  color: var(--ink-3);
  white-space: nowrap;
}
.pill-new       { background: var(--accent-soft); color: var(--accent); }
.pill-claimed   { background: var(--warn-soft);   color: var(--warn); }
.pill-used      { background: var(--good-soft);   color: var(--good); }
.pill-rejected  { background: var(--neutral-soft); color: var(--ink-faint); }
.pill-good      { background: var(--good-soft);   color: var(--good); }
.pill-warn      { background: var(--warn-soft);   color: var(--warn); }
.pill-bad       { background: var(--bad-soft);    color: var(--bad); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunk);
  color: var(--ink-2);
  font-size: 11.5px;
}

/* ───────────────────────────────────────────────────────────── KARTY ───── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-head-actions { margin-left: auto; display: flex; gap: 8px; }
.card-body { padding: 16px; }
.card-body-flush { padding: 0; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-tight { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.spacer { margin-left: auto; }

/* ─────────────────────────────────────────────────── KAFELKI STATYSTYK ──── */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tile-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 650;
  color: var(--ink-faint);
}
.tile-value {
  font-family: var(--font-data);
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.tile-note { font-size: 11.5px; color: var(--ink-3); }
.tile.is-alert { border-color: var(--bad); }
.tile.is-alert .tile-value { color: var(--bad); }
.tile.is-warn { border-color: var(--warn); }
.tile.is-warn .tile-value { color: var(--warn); }

/* ─────────────────────────────────────────────────────────── FILTRY ───── */
.filters {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(200px, 2fr) repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  align-items: end;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.filters-actions { display: flex; gap: 8px; align-items: end; }

/* ─────────────────────────────────────────────────── POLA FORMULARZY ───── */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 650;
  color: var(--ink-3);
}
.field-help { font-size: 12px; color: var(--ink-3); }
.field-error { font-size: 12px; color: var(--bad); font-weight: 550; }

input[type="text"], input[type="search"], input[type="password"], input[type="email"],
input[type="url"], input[type="number"], input[type="datetime-local"],
select, textarea {
  width: 100%;
  padding: 7px 9px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
textarea { resize: vertical; min-height: 70px; }
.input-lg { font-size: 16px; font-weight: 550; padding: 9px 11px; }
.mono-ish { font-family: var(--font-data); font-size: 12.5px; line-height: 1.6; }

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
                    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.checks { display: flex; flex-direction: column; gap: 6px; }
.checks ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.checks label { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.radios ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 14px; flex-wrap: wrap; }
.radios label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }

/* ─────────────────────────────────────────────────────────── TABELE ───── */
.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 650;
  color: var(--ink-faint);
  background: var(--surface-2);
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .col-num { font-family: var(--font-data); font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .col-tight { white-space: nowrap; }
.table .col-actions { text-align: right; white-space: nowrap; }

/* Pasek stanu po lewej krawędzi wiersza. To informacja, nie ozdoba:
   pozwala ocenić stan całej listy bez czytania pigułek. */
.stripe { border-left: 3px solid transparent; }
.stripe-new      { border-left-color: var(--accent); }
.stripe-claimed  { border-left-color: var(--warn); }
.stripe-used     { border-left-color: var(--good); }
.stripe-rejected { border-left-color: var(--line-strong); }
.stripe-bad      { border-left-color: var(--bad); }

/* ── miniatura zdjęcia głównego na liście ──────────────────────────────────
   Wąska kolumna po lewej robi z listy coś, co da się skanować wzrokiem,
   zamiast ściany tekstu. Kafelek ma stały rozmiar i `object-fit: cover`, więc
   pionowe i poziome zdjęcia nie rozjeżdżają wysokości wierszy.               */
.col-thumb { width: 84px; padding-right: 0 !important; }

.row-thumb {
  position: relative;
  display: block;
  width: 72px;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  flex: none;
}
.row-thumb:hover { border-color: var(--accent-line); }

.row-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Zastępnik pokazywany, gdy materiał nie ma zdjęcia ALBO gdy adres nie
   odpowiedział (np. zapora antybotowa źródła). Domyślnie ukryty — włącza go
   klasa .is-missing, którą dokłada szablon lub skrypt w base.html.
   Bez tego przeglądarka pokazywałaby ikonę zepsutego obrazka w każdym wierszu. */
.row-thumb-empty { display: none; }
.row-thumb.is-missing .row-thumb-img { display: none; }
.row-thumb.is-missing .row-thumb-empty {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}
.row-thumb.is-missing .row-thumb-empty::before {
  content: "";
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink-faint);
  opacity: 0.55;
}

.row-thumb-count {
  position: absolute;
  right: 3px;
  bottom: 3px;
  padding: 0 5px;
  border-radius: 10px;
  font-family: var(--font-data);
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: rgb(19 25 34 / 72%);
  line-height: 15px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.row-title { font-weight: 550; color: var(--ink); display: block; margin-bottom: 3px; }
.row-title:hover { color: var(--accent); }
.row-meta { font-size: 11.5px; color: var(--ink-3); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-lead { font-size: 12px; color: var(--ink-3); margin-top: 3px; max-width: 72ch; }

/* ─────────────────────────────────────────────────────────── ZDJĘCIA ───── */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}
.shot {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-sunk);
  display: flex;
  flex-direction: column;
}
.shot.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.shot.is-rejected { opacity: 0.55; }
.shot-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--surface-sunk); }
.shot-none {
  width: 100%; aspect-ratio: 4 / 3;
  display: grid; place-items: center;
  font-size: 11px; color: var(--ink-faint);
}
.shot-body { padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; }
.shot-dims { font-family: var(--font-data); font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.shot-note { font-size: 10.5px; line-height: 1.35; }
.shot-flag {
  position: absolute; top: 6px; left: 6px;
  padding: 1px 6px; border-radius: 20px;
  font-size: 10px; font-weight: 700;
  background: var(--good); color: #fff;
  letter-spacing: 0.03em;
}
.shot-pick { display: flex; align-items: center; gap: 6px; font-size: 11.5px; cursor: pointer; }

/* ────────────────────────────────────────────────────── UKŁAD MATERIAŁU ─── */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 1080px) {
  .split { grid-template-columns: minmax(0, 1fr); }
}

.source-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.preview {
  font-size: 14px;
  line-height: 1.65;
  max-width: 68ch;
}
.preview p { margin: 0 0 0.85em; }
.preview img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }

/* ───────────────────────────────────────────────────────── KOMUNIKATY ───── */
.alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 13px;
}
.alert-success { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.alert-error   { background: var(--bad-soft);  border-color: var(--bad);  color: var(--bad); }
.alert-warning { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.alert-info    { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.alert strong { font-weight: 650; }

.note {
  padding: 11px 13px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--ink-2);
}

.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--ink-3);
}
.empty-title { font-size: 15px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }

/* ────────────────────────────────────────────────────────── STRONICOWANIE ─ */
.pager {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 4px 0;
  font-size: 13px;
  color: var(--ink-3);
}
.pager-links { margin-left: auto; display: flex; gap: 6px; }

/* ──────────────────────────────────────────────────────────── LOGOWANIE ─── */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--paper);
}
.gate-card {
  width: 100%;
  max-width: 372px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 28px;
}
.gate-brand { margin-bottom: 22px; }
.gate-brand .brand-mark { font-size: 22px; display: block; }
.gate-form { display: flex; flex-direction: column; gap: 14px; }

/* ───────────────────────────────────────────────────── STAN WCZYTYWANIA ─── */
.spin {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid var(--accent-line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.htmx-request .hide-busy { display: none; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-flex; }

/* ──────────────────────────────────────────────────────────── DROBNE ───── */
.muted { color: var(--ink-3); }
.faint { color: var(--ink-faint); }
.small { font-size: 12px; }
.tiny  { font-size: 11px; }
.strong { font-weight: 650; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }

.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

details.raw summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--ink-3);
  padding: 4px 0;
}
details.raw pre {
  margin: 6px 0 0;
  padding: 10px;
  background: var(--surface-sunk);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 11.5px;
  line-height: 1.5;
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static; height: auto;
    flex-direction: row; flex-wrap: wrap; align-items: center;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .nav-group { flex-direction: row; flex-wrap: wrap; margin-bottom: 0; }
  .nav-label, .sidebar-foot { display: none; }
  .content, .content-narrow, .topbar { padding-left: 14px; padding-right: 14px; }
}
