/* Szpital Pogoria — ALERT 2026
 * Identyfikacja wizualna z logo akcji: amber (#f5a93f) + błękit (#5aa9dc) na bieli.
 * Domyślnie tryb jasny — czytelny w słońcu; tryb nocny do pracy po zmroku.
 * Wszystkie cele dotykowe min. 44 px — obsługa w rękawiczkach. */

:root {
  --bg: #f1f6fa;
  --surface: #ffffff;
  --surface-2: #f5f9fc;
  --line: #dae5ee;
  --text: #16232e;
  --muted: #62798b;
  --accent: #2f89c4;
  --accent-soft: #2f89c414;
  --amber: #e79422;
  --amber-bright: #f5a93f;
  --amber-soft: #f5a93f1f;
  --danger: #c0392b;
  --ok: #1f7a52;
  --shadow: 0 8px 26px rgba(22, 47, 68, .08);
  --radius: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

/* Tryb nocny */
:root[data-theme="night"] {
  --bg: #0f1a22;
  --surface: #16242f;
  --surface-2: #1d303d;
  --line: #2a4152;
  --text: #e9f1f7;
  --muted: #92a8b8;
  --accent: #5aa9dc;
  --accent-soft: #5aa9dc22;
  --amber: #f7b969;
  --amber-bright: #f7b969;
  --amber-soft: #f7b96922;
  --danger: #ff7a6b;
  --ok: #4fc79a;
  --shadow: 0 12px 34px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-text-size-adjust: 100%;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { border: 0; cursor: pointer; background: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
p { line-height: 1.5; margin: 0 0 10px; }
a { color: var(--accent); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.center { text-align: center; }

/* ————— Formularze ————— */
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }

input, textarea, select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 13px;
  min-height: 46px;
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field-row.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ————— Przyciski ————— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff;
  padding: 12px 18px; min-height: 46px;
  border-radius: 10px; font-weight: 700; border: 1px solid transparent;
  transition: filter .12s ease, transform .08s ease;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--accent); }
.btn.amber { background: var(--amber-bright); color: #3b2607; }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.block { width: 100%; }
.btn.big { min-height: 56px; font-size: 16px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ————— Powłoka aplikacji ————— */
.shell { display: grid; grid-template-columns: 258px 1fr; min-height: 100vh; min-height: 100dvh; }

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

.brand { display: flex; align-items: center; gap: 11px; margin-bottom: 16px; }
.brand-logo { width: 52px; height: 52px; flex: none; object-fit: contain; border-radius: 10px; background: #fff; }
.brand-name { font-size: 15px; font-weight: 900; letter-spacing: .02em; line-height: 1.15; }
.brand-name em { font-style: normal; color: var(--accent); }
.brand-name b { color: var(--amber); font-weight: 900; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-top: 3px; }

.nav { display: grid; gap: 3px; }
.nav button {
  display: flex; align-items: center; gap: 11px;
  text-align: left; color: var(--muted); padding: 12px 13px; min-height: 46px;
  border-radius: 10px; font-weight: 700; width: 100%;
  transition: background .12s, color .12s;
}
.nav button:hover { color: var(--text); background: var(--surface-2); }
.nav button.active { color: var(--accent); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--amber-bright); }
.nav-ico { width: 19px; height: 19px; flex: none; }
.nav button > span:first-of-type { flex: 1; }
.nav-count { background: var(--amber-bright); color: #3b2607; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 999px; }

.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); line-height: 1.5; }

.content { padding: 0 24px 90px; max-width: 1280px; width: 100%; }

/* ————— Górny pasek ————— */
.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 13px 0; margin-bottom: 18px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.appbar h2 { font-size: 22px; flex: 1; min-width: 140px; }
.appbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); flex: none; font-size: 17px;
}
.icon-btn:hover { border-color: var(--accent); }

/* Wskaźnik połączenia i kolejki synchronizacji */
.sync-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 13px; min-height: 42px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; font-weight: 700; white-space: nowrap;
}
.sync-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--muted); }
.sync-pill.online { color: var(--ok); border-color: var(--ok); }
.sync-pill.online .sync-dot { background: var(--ok); animation: pulseDot 2.4s infinite; }
.sync-pill.offline { border-color: var(--muted); color: var(--muted); }
.sync-pill.pending { border-color: var(--amber); color: var(--amber); }
.sync-pill.pending .sync-dot { background: var(--amber-bright); }
@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(31, 122, 82, .5); }
  70% { box-shadow: 0 0 0 7px rgba(31, 122, 82, 0); }
  100% { box-shadow: 0 0 0 0 rgba(31, 122, 82, 0); }
}

/* ————— Karty / panele ————— */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h3 { font-size: 17px; flex: 1; }

.section-label {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  color: var(--accent); margin: 22px 0 10px;
}
.section-label::before { content: ''; width: 4px; height: 15px; border-radius: 2px; background: var(--amber-bright); flex: none; }
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.stat { text-align: center; }
.stat strong { display: block; font-size: 34px; font-weight: 900; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }

/* ————— Kolory segregacji ————— */
.triage-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px; }
.triage-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 14px; min-height: 74px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--surface-2);
  font-weight: 800; text-align: left; transition: transform .1s ease, box-shadow .12s ease;
}
.triage-btn small { font-weight: 600; font-size: 12px; color: var(--muted); }
.triage-btn:hover { transform: translateY(-2px); }
.triage-btn.on { color: #fff; box-shadow: var(--shadow); }
.triage-btn[data-c="red"].on    { background: #c62828; border-color: #c62828; }
.triage-btn[data-c="yellow"].on { background: #e0a800; border-color: #e0a800; color: #241a00; }
.triage-btn[data-c="green"].on  { background: #1e7a52; border-color: #1e7a52; }
.triage-btn[data-c="blue"].on   { background: #2f89c4; border-color: #2f89c4; }
.triage-btn[data-c="black"].on  { background: #23262d; border-color: #23262d; }
.triage-btn.on small { color: rgba(255, 255, 255, .85); }
.triage-btn[data-c="yellow"].on small { color: rgba(36, 26, 0, .72); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 800;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
}
.badge.red    { background: #fdecec; color: #a11f1f; border-color: #f0bcbc; }
.badge.yellow { background: #fff5d6; color: #7a5c00; border-color: #e8cf87; }
.badge.green  { background: #e6f6ef; color: #146245; border-color: #a9ddc6; }
.badge.blue   { background: #e8f3fa; color: #1c5f88; border-color: #a9d3ea; }
.badge.black  { background: #23262d; color: #fff; border-color: #23262d; }
:root[data-theme="night"] .badge.red    { background: #3a1a1a; color: #ff9f9f; border-color: #6b3030; }
:root[data-theme="night"] .badge.yellow { background: #3a2f10; color: #f5cf72; border-color: #6b5720; }
:root[data-theme="night"] .badge.green  { background: #12332a; color: #6fe0b8; border-color: #26644f; }
:root[data-theme="night"] .badge.blue   { background: #142d3f; color: #7cc4ee; border-color: #2a5674; }
:root[data-theme="night"] .badge.black  { background: #2a2e37; color: #dfe4ec; border-color: #444b58; }

/* ————— Wybór wielokrotny ————— */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.check {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; min-height: 46px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); font-size: 14px; font-weight: 600;
  cursor: pointer; user-select: none;
  transition: border-color .12s ease, background .12s ease;
}
.check:hover { border-color: var(--accent); }
.check .box {
  width: 22px; height: 22px; flex: none; border-radius: 6px;
  border: 2px solid var(--line); display: grid; place-items: center;
  font-size: 14px; font-weight: 900; color: transparent;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.check.on { border-color: var(--accent); background: var(--accent-soft); }
.check.on .box { background: var(--accent); border-color: var(--accent); color: #fff; }
.check.on .box::after { content: '✓'; }
/* Grupy kluczowe (drogi oddechowe, hipotermia) — zaznaczenie w kolorze marki */
.check-grid.key .check.on { border-color: var(--amber); background: var(--amber-soft); }
.check-grid.key .check.on .box { background: var(--amber-bright); border-color: var(--amber-bright); color: #3b2607; }

/* ————— Kreator karty ————— */
.steps { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 12px; }
.step {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: 9px 14px; min-height: 42px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap;
}
.step.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.step.done { color: var(--ok); border-color: #a9ddc6; }
.step-num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 900; background: var(--surface-2); color: var(--muted); flex: none; }
.step.on .step-num { background: var(--accent); color: #fff; }
.step.done .step-num { background: var(--ok); color: #fff; }

/* Pasek akcji przyklejony do dołu — kciuk zawsze go dosięga.
 * Bez ujemnego marginesu dolnego: on zjadał obszar przewijania i na niskich
 * ekranach nie dało się doscrollować do końca formularza. */
.form-actions {
  position: sticky; bottom: 0; z-index: 15;
  display: flex; gap: 10px; flex-wrap: wrap;
  margin: 18px -24px 0; padding: 14px 24px calc(14px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -6px 20px rgba(22, 47, 68, .06);
}
.form-actions .btn { flex: 1; min-width: 130px; }

/* ————— ATMIST ————— */
.atmist-row { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.atmist-letter {
  width: 44px; height: 44px; flex: none; border-radius: 9px;
  display: grid; place-items: center; font-size: 20px; font-weight: 900;
  background: var(--amber-soft); color: var(--amber); border: 1px solid var(--line);
}
.atmist-body { flex: 1; min-width: 0; }
.atmist-title { font-weight: 800; font-size: 15px; }
.atmist-title span { font-weight: 500; color: var(--muted); font-size: 13px; margin-left: 6px; }
.atmist-desc { color: var(--muted); font-size: 12.5px; margin: 2px 0 7px; }
.atmist-body textarea { min-height: 64px; }
.atmist-motto { border-left: 3px solid var(--amber-bright); padding: 8px 0 8px 12px; color: var(--muted); font-style: italic; font-size: 13px; margin-bottom: 18px; }

/* ————— Tablica poszkodowanych ————— */
.board-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.board-filters input, .board-filters select { max-width: 260px; min-width: 160px; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip { padding: 8px 14px; min-height: 42px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 700; color: var(--muted); }
.filter-chip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.board-card {
  background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--line);
  border-radius: var(--radius); padding: 15px; box-shadow: var(--shadow);
  cursor: pointer; transition: transform .1s ease, border-color .12s ease;
}
.board-card:hover { transform: translateY(-2px); }
.board-card.t-red    { border-left-color: #c62828; }
.board-card.t-yellow { border-left-color: #e0a800; }
.board-card.t-green  { border-left-color: #1e7a52; }
.board-card.t-blue   { border-left-color: #2f89c4; }
.board-card.t-black  { border-left-color: #23262d; }
.board-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.board-tag { font-size: 19px; font-weight: 900; }
.board-task { font-size: 12px; color: var(--muted); font-weight: 700; }
.board-line { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.board-arrow { color: var(--amber); font-weight: 900; }
.board-unsynced { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; color: var(--amber); }

.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty-mark { font-size: 42px; margin-bottom: 10px; opacity: .55; }

/* ————— Logowanie ————— */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 22px; background: linear-gradient(180deg, #e8f2f9, var(--bg)); }
:root[data-theme="night"] .login-wrap { background: linear-gradient(180deg, #16303f, var(--bg)); }
.login-card { width: min(430px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 26px; box-shadow: var(--shadow); }
.login-card .brand { justify-content: center; margin-bottom: 10px; }
.login-logo { width: 128px; height: 128px; object-fit: contain; display: block; margin: 0 auto 6px; }

.notice { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-size: 13.5px; line-height: 1.5; margin: 14px 0 0; color: var(--muted); }
.notice strong { color: var(--text); }
.notice.warn { border-color: var(--amber); background: var(--amber-soft); }
.notice.err { border-color: var(--danger); color: var(--danger); }
.notice.err strong { color: var(--danger); }
.notice.ok { border-color: var(--ok); color: var(--ok); }

/* ————— Modal ————— */
.modal-back { position: fixed; inset: 0; background: rgba(14, 30, 42, .6); display: grid; place-items: center; padding: 18px; z-index: 60; }
.modal { width: min(760px, 100%); max-height: 92vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.modal.narrow { width: min(440px, 100%); }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.modal-actions .btn { flex: 1; min-width: 120px; }

/* ————— Toast ————— */
.toasts { position: fixed; left: 12px; right: 12px; bottom: 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 80; pointer-events: none; }
.toast { padding: 12px 18px; border-radius: 10px; font-weight: 700; font-size: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; max-width: 420px; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { border-color: var(--ok); color: var(--ok); }
.toast.err { border-color: var(--danger); color: var(--danger); }

/* ————— Karta A4 do druku ————— */
.a4 {
  background: #fff; color: #111; width: min(860px, 100%); margin: 0 auto;
  padding: 32px 36px; border-radius: 10px; box-shadow: var(--shadow);
  font-size: 13px; line-height: 1.45;
}
.a4 h1 { font-size: 18px; letter-spacing: .02em; }
.a4-head { display: flex; align-items: center; gap: 14px; border-bottom: 3px solid #5aa9dc; padding-bottom: 10px; margin-bottom: 14px; }
.a4-head-main { flex: 1; }
.a4-head-meta { text-align: right; font-size: 11.5px; color: #555; }
.a4-head-meta strong { font-size: 17px; color: #111; }
.a4-logo { width: 62px; height: 62px; object-fit: contain; flex: none; }
.a4 section { margin-bottom: 12px; break-inside: avoid; }
.a4 h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #1c5f88; border-bottom: 1px solid #dcdcdc; padding-bottom: 3px; margin-bottom: 7px; }
.a4-kv { display: grid; grid-template-columns: 155px 1fr; gap: 4px 10px; margin: 0; }
.a4-kv dt { color: #555; font-size: 11.5px; }
.a4-kv dd { margin: 0; font-weight: 600; }
.a4-vitals { display: flex; flex-wrap: wrap; gap: 6px; }
.a4-vital { border: 1px solid #ccc; border-radius: 6px; padding: 4px 9px; font-size: 12px; }
.a4-atmist { display: grid; grid-template-columns: 24px 104px 1fr; gap: 4px 8px; align-items: baseline; }
.a4-atmist .l { font-weight: 900; color: #e79422; }
.a4-atmist .n { color: #555; font-size: 11.5px; }
.a4-list { margin: 0; padding-left: 17px; }
.a4-list li { margin-bottom: 2px; }
.a4-color { display: inline-block; padding: 3px 12px; border-radius: 4px; font-weight: 900; color: #fff; font-size: 12px; }
.a4-color.red { background: #c62828; }
.a4-color.yellow { background: #e0a800; color: #241a00; }
.a4-color.green { background: #1e7a52; }
.a4-color.blue { background: #2f89c4; }
.a4-color.black { background: #23262d; }
.a4-sign { display: flex; justify-content: space-between; gap: 30px; margin-top: 26px; }
.a4-sign div { flex: 1; border-top: 1px solid #111; padding-top: 5px; font-size: 11px; color: #555; text-align: center; }
.a4-foot { margin-top: 16px; border-top: 1px solid #ddd; padding-top: 6px; font-size: 10.5px; color: #777; display: flex; justify-content: space-between; gap: 12px; }
.a4-empty { color: #999; font-style: italic; }
.a4-note { color: #555; font-size: 11.5px; }

/* ————— Responsywność ————— */
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; height: auto; flex-direction: row; align-items: center;
    gap: 10px; padding: 8px 12px; overflow-x: auto; z-index: 30;
  }
  .sidebar .brand { margin-bottom: 0; flex: none; }
  .brand-logo { width: 40px; height: 40px; }
  .sidebar .brand-sub, .sidebar-foot { display: none; }
  .nav { display: flex; gap: 4px; }
  .nav button { padding: 10px 12px; white-space: nowrap; }
  .nav button > span:first-of-type { flex: none; }
  .content { padding: 0 14px 96px; }
  .form-actions { margin: 18px -14px 0; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .grid.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-row, .field-row.three, .field-row.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .appbar h2 { font-size: 19px; }
}

@media (max-width: 560px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4, .grid.cols-5 { grid-template-columns: 1fr; }
  .field-row, .field-row.three, .field-row.four { grid-template-columns: 1fr; }
  .check-grid { grid-template-columns: 1fr; }
  .board-grid { grid-template-columns: 1fr; }
  .triage-pick { grid-template-columns: repeat(2, 1fr); }
  .modal { padding: 16px; border-radius: 12px; }
  .a4 { padding: 18px; }
  .a4-kv { grid-template-columns: 1fr; }
  .a4-kv dt { margin-top: 5px; }
  .grid.cols-5 { grid-template-columns: repeat(2, 1fr); }
}

/* ————— Druk A4 ————— */
@page { size: A4; margin: 12mm; }

@media print {
  body { background: #fff; color: #111; }
  .sidebar, .appbar, .no-print, .form-actions, .toasts, .modal-back { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  .a4 { width: 186mm; max-width: 186mm; margin: 0; padding: 0; box-shadow: none; border-radius: 0; font-size: 11pt; }
  .a4 section { page-break-inside: avoid; }
}

/* Lista klucz–wartość poza dokumentem A4 (ustawienia, podsumowania) */
.kv { display: grid; grid-template-columns: 190px 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; font-weight: 600; color: var(--text); }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; } }

/* Podpis autora — stopka panelu bocznego i ekranu logowania */
.credit { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.login-card .credit { margin-top: 16px; font-size: 12px; }

/* Lista kont personelu */
.staff-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 13px 0; border-bottom: 1px solid var(--line);
}
.staff-row:last-child { border-bottom: 0; }
.staff-row.off { opacity: .55; }
.staff-main { flex: 1; min-width: 190px; }
.staff-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.staff-actions .btn { min-height: 40px; padding: 8px 14px; font-size: 13px; }

/* ————— Pasek liczników nad tablicą ————— */
.tally-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin-bottom: 14px; }
.tally {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 10px 8px; min-height: 66px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow);
  transition: transform .1s ease, border-color .12s ease;
}
.tally:hover { transform: translateY(-2px); }
.tally strong { font-size: 26px; font-weight: 900; line-height: 1; }
.tally span { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tally.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow); }
.tally.c-red strong    { color: #c62828; }
.tally.c-yellow strong { color: #b58900; }
.tally.c-green strong  { color: #1e7a52; }
.tally.c-black strong  { color: var(--text); }
.tally.c-wait strong   { color: var(--amber); }
:root[data-theme="night"] .tally.c-red strong    { color: #ff8a8a; }
:root[data-theme="night"] .tally.c-yellow strong { color: #f5cf72; }
:root[data-theme="night"] .tally.c-green strong  { color: #6fe0b8; }

/* ————— Karta na tablicy: kolor na nagłówku, duży numer ————— */
.board-card { padding: 0; overflow: hidden; border-left-width: 1px; }
.board-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; color: #fff;
}
.board-head.b-red    { background: #c62828; }
.board-head.b-yellow { background: #e0a800; color: #241a00; }
.board-head.b-green  { background: #1e7a52; }
.board-head.b-black  { background: #23262d; }
.board-head:not([class*="b-"]) { background: var(--surface-2); color: var(--muted); }
.board-tag { font-size: 26px; font-weight: 900; letter-spacing: .01em; line-height: 1.05; }
.board-color { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; opacity: .9; }
.board-body { padding: 12px 14px 14px; }
.board-clock { font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.board-clock.over { color: var(--danger); }
.board-injuries { color: var(--muted); }
.board-alarm { margin-top: 8px; font-size: 12px; font-weight: 800; color: var(--danger); }
.board-todo { margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--amber); }
.board-card.overdue { box-shadow: 0 0 0 2px var(--danger), var(--shadow); }
.board-actions { display: flex; gap: 8px; margin-top: 12px; }
.board-actions .btn { flex: 1; min-height: 40px; padding: 8px 10px; font-size: 13px; }

/* ————— Widok listy (kompaktowy) ————— */
.board-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.board-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-bottom: 1px solid var(--line); cursor: pointer; min-height: 52px;
}
.board-row:last-child { border-bottom: 0; }
.board-row:hover { background: var(--surface-2); }
.board-row.overdue { box-shadow: inset 3px 0 0 var(--danger); }
.row-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--line); }
.row-dot.b-red { background: #c62828; }
.row-dot.b-yellow { background: #e0a800; }
.row-dot.b-green { background: #1e7a52; }
.row-dot.b-black { background: #23262d; }
.row-tag { font-weight: 900; font-size: 16px; min-width: 78px; }
.row-color { flex: none; }
.row-clock { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 62px; color: var(--muted); }
.row-clock.over { color: var(--danger); }
.row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.row-status { color: var(--muted); font-size: 13px; white-space: nowrap; }
.row-btn { min-height: 38px; padding: 6px 12px; font-size: 12.5px; flex: none; }
@media (max-width: 760px) {
  .row-name, .row-status { display: none; }
  .row-btn { margin-left: auto; }
}

/* ————— Ekran szybkiego przyjęcia ————— */
.quick-top { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; align-items: end; }
.quick-tag label { margin-top: 0; }
.quick-tag input { font-size: 24px; font-weight: 900; min-height: 60px; letter-spacing: .02em; }
.quick-time label { margin-top: 0; }
@media (max-width: 560px) { .quick-top { grid-template-columns: 1fr; } }

.panel-more { padding: 0; }
.panel-more > summary {
  list-style: none; cursor: pointer; padding: 16px 18px; font-weight: 700;
  display: flex; align-items: center; gap: 10px; min-height: 52px;
}
.panel-more > summary::-webkit-details-marker { display: none; }
.panel-more > summary::after { content: '›'; margin-left: auto; font-size: 22px; color: var(--muted); transition: transform .15s ease; }
.panel-more[open] > summary::after { transform: rotate(90deg); }
.panel-more[open] > summary { border-bottom: 1px solid var(--line); }
.panel-more > *:not(summary) { margin-left: 18px; margin-right: 18px; }
.panel-more > *:last-child { margin-bottom: 18px; }

/* ————— Bank fraz pod polami ATMIST ————— */
.chip-bank { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip-bank .chip {
  font-size: 12.5px; font-weight: 600; padding: 7px 12px; min-height: 36px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--accent);
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.chip-bank .chip:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-bank .chip.used { border-color: var(--ok); color: var(--ok); }
