/* kolory: jasny (domyślnie) i ciemny ([data-mode=dark], ustawiany przez JS: auto / jasny / ciemny) */
:root {
  color-scheme: light;
  --bg: #f3f5f8; --panel: #ffffff; --text: #16191d; --muted: #59626e; --line: #d9dee5; --soft: #eef1f5;
  --accent: #1f6feb; --accent-text: #ffffff;
  --free: #1f9d55; --free-bg: #dcf5e6; --free-text: #0d4d29; --free-on: #ffffff;
  --occ: #e4e8ee; --occ-text: #9aa3ae;
  --c: #7c3aed; --c-bg: #efe7ff; --c-on: #ffffff;
  --err: #b42318; --err-bg: #fdecea; --warn: #7a4f00; --warn-bg: #fff3d6;
  --wm: rgba(22, 25, 29, .045); --backdrop: rgba(15, 18, 22, .45);
}
:root[data-mode="dark"] {
  color-scheme: dark;
  --bg: #0f1216; --panel: #181c22; --text: #e8eaed; --muted: #a0a9b4; --line: #2b313a; --soft: #20252d;
  --accent: #4b8ef5; --accent-text: #0b0d10;
  --free: #3ccf7a; --free-bg: #143823; --free-text: #b9f0cf; --free-on: #062612;
  --occ: #262b33; --occ-text: #5b6470;
  --c: #b794ff; --c-bg: #2a1d45; --c-on: #1a0d33;
  --err: #ffb4a8; --err-bg: #3a1714; --warn: #ffd58a; --warn-bg: #3a2c0d;
  --wm: rgba(232, 234, 237, .022); --backdrop: rgba(0, 0, 0, .6);
}
/* kolor wolnych miejsc (ustawienia) - niebieski i pomarańczowy są czytelne także przy daltonizmie */
:root[data-free="blue"] { --free: #1d6fe0; --free-bg: #dce9ff; --free-text: #0b3a8a; --free-on: #ffffff; }
:root[data-mode="dark"][data-free="blue"] { --free: #5aa2ff; --free-bg: #132a4d; --free-text: #c4dcff; --free-on: #06152e; }
:root[data-free="orange"] { --free: #d9730d; --free-bg: #ffead6; --free-text: #6b3500; --free-on: #ffffff; }
:root[data-mode="dark"][data-free="orange"] { --free: #ff9a3c; --free-bg: #3d2410; --free-text: #ffd9b5; --free-on: #2a1400; }
/* rozmiar widoku (ustawienia) */
:root { --fs: 16px; --cell-h: 22px; --cell-fs: 11px; --rack-w: 200px; }
:root[data-size="small"] { --fs: 14px; --cell-h: 17px; --cell-fs: 10px; --rack-w: 165px; }
:root[data-size="large"] { --fs: 18px; --cell-h: 30px; --cell-fs: 14px; --rack-w: 250px; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: var(--fs)/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--text);
  padding: 7px 12px; border-radius: 8px; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }

/* znak wodny autora: w tle (za panelami) + stopka */
.wm { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.wm span { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-24deg);
  white-space: nowrap; font-size: clamp(28px, 6vw, 72px); font-weight: 800; letter-spacing: .04em; color: var(--wm); user-select: none; }
footer { position: relative; z-index: 1; text-align: center; color: var(--muted); font-size: 13px; padding: 18px 16px 28px; }

header { position: sticky; top: 0; z-index: 3; background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 10px 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h1 { font-size: 19px; margin: 0; flex: 1; min-width: 180px; }
.meta { color: var(--muted); font-size: 13px; }
main { position: relative; z-index: 1; max-width: 1280px; margin: 0 auto; padding: 14px 16px 0; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button { font-weight: 600; padding: 9px 16px; }
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; padding: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field input { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--text); }
.pair { display: flex; gap: 6px; align-items: center; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; flex: 1; padding: 8px 6px; white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 12px 0; }
.stat { padding: 12px 14px; }
.stat .n { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 13px; margin-top: 2px; }
.bar { height: 6px; border-radius: 3px; background: var(--occ); margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--free); }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 10px; }
.toolbar .hint { flex: 1; min-width: 200px; margin: 0; }
.hint { color: var(--muted); font-size: 14px; }
.legend { display: flex; gap: 12px; font-size: 13px; color: var(--muted); align-items: center; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }

.error, .warn { border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.error { background: var(--err-bg); color: var(--err); }
.warn { background: var(--warn-bg); color: var(--warn); }

/* widok regałów */
.racks { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--rack-w), 1fr)); gap: 10px; }
.rack { padding: 10px 12px 12px; }
.rack-h { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.rack-h b { font-size: 18px; font-variant-numeric: tabular-nums; }
.rack-h .cnt { margin-left: auto; font-size: 13px; color: var(--free-text); background: var(--free-bg);
  padding: 1px 8px; border-radius: 10px; font-weight: 600; }
.zone { display: grid; grid-template-columns: 26px 1fr; gap: 6px; align-items: start; }
.zone + .zone { margin-top: 8px; padding-top: 8px; border-top: 2px solid var(--line); }
.zone-l { font-size: 12px; font-weight: 700; color: var(--muted); writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; }
.grid { display: grid; gap: 3px; }
.cell { height: var(--cell-h); border-radius: 4px; border: 0; padding: 0; font-size: var(--cell-fs); font-variant-numeric: tabular-nums;
  background: var(--occ); color: transparent; cursor: default; }
.cell.free { background: var(--free); color: var(--free-on); font-weight: 700; cursor: pointer; }
.cell.free.dim { background: var(--free-bg); color: var(--free-text); }
.cell.none { background: transparent; }
/* regał z rzędu C: fioletowa ramka, pasek z etykietą, fioletowe tło pustych pól */
.rack.rowc { border: 2px solid var(--c); background: linear-gradient(var(--c-bg), var(--c-bg)) top / 100% 4px no-repeat, var(--panel); }
.rack.rowc .grid { background: var(--c-bg); border-radius: 6px; padding: 3px; }
.rack.rowc .cell:not(.free):not(.none) { background: color-mix(in srgb, var(--c) 18%, var(--occ)); }
.rack.rowc .zone-l { color: var(--c); }
.ctag { font-size: 12px; font-weight: 800; color: var(--c-on); background: var(--c); border-radius: 5px; padding: 1px 7px; letter-spacing: .02em; }
.cbadge { display: inline-block; font-size: 11px; font-weight: 800; color: var(--c); background: var(--c-bg);
  border-radius: 4px; padding: 0 6px; }

/* tabela */
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { text-align: left; padding: 9px 12px; border-top: 1px solid var(--line); }
.tbl thead th { border-top: 0; font-size: 13px; color: var(--muted); font-weight: 600; background: var(--soft); }
.tbl thead th:first-child { border-top-left-radius: 12px; } .tbl thead th:last-child { border-top-right-radius: 12px; }
.tbl tbody tr:hover { background: var(--soft); }
.tbl .num { color: var(--muted); width: 1%; }
.loc { font-weight: 700; font-size: 16px; border: 1px solid var(--free); background: var(--free-bg); color: var(--free-text);
  padding: 3px 10px; border-radius: 6px; }
.more { display: block; margin: 10px auto 0; }
@media (max-width: 600px) { .tbl .hide-sm { display: none; } .tbl th, .tbl td { padding: 8px; } }

.empty-state { padding: 24px; color: var(--muted); text-align: center; }
.card { padding: 14px; margin: 12px 0; }
.card h2 { font-size: 20px; margin: 0 0 4px; }
.card .sub { color: var(--muted); font-size: 14px; }
.rule { margin-top: 10px; font-weight: 700; }
.rule.c { color: var(--c); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { background: var(--occ); border-radius: 6px; padding: 3px 9px; font-size: 14px; font-variant-numeric: tabular-nums; }
.search { display: flex; gap: 8px; }
.search input { flex: 1; font-size: 18px; padding: 10px 12px; }
.cands { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.cands button { text-align: left; }
.toast { position: fixed; z-index: 5; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 9px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
/* ustawienia */
.icon-btn { padding: 6px 10px; font-size: 18px; line-height: 1; }
dialog.settings { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px;
  padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
dialog.settings::backdrop { background: var(--backdrop); }
.settings form { padding: 18px; display: grid; gap: 16px; }
.settings h2 { margin: 0; font-size: 19px; }
.settings .field label { margin-bottom: 6px; }
.settings .seg button { padding: 9px 6px; }
.settings .actions { display: flex; justify-content: space-between; gap: 8px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
[hidden] { display: none !important; }

/* ---------- Warehouse Tools v2 ---------- */
:root { --multi: #d97706; --multi-bg: #fde7c7; --bad: #b42318; --bad-bg: #fdecea; --tr: #0e9f9a; --tr-bg: #d9f5f3; --tr-on: #ffffff; }
:root[data-mode="dark"] { --multi: #f59e0b; --multi-bg: #3b2a10; --bad: #ffb4a8; --bad-bg: #3a1714; --tr: #2dd4bf; --tr-bg: #11332f; --tr-on: #04211e; }

/* nawigacja główna */
.mainnav { display: flex; gap: 4px; }
.mainnav a { color: var(--text); text-decoration: none; font-weight: 600; padding: 7px 14px; border-radius: 8px; border: 1px solid transparent; }
.mainnav a:hover { background: var(--soft); }
.mainnav a[aria-current="page"] { background: var(--accent); color: var(--accent-text); }
@media (max-width: 640px) { .mainnav { order: 10; width: 100%; } .mainnav a { flex: 1; text-align: center; padding: 7px 6px; } }

/* pasek świeżości danych */
.freshness { position: sticky; top: 0; z-index: 2; padding: 8px 16px; font-weight: 600; text-align: center; font-size: 14px; }
.freshness.warn { background: var(--warn-bg); color: var(--warn); }
.freshness.bad { background: var(--bad-bg); color: var(--bad); }

/* zakładki wewnątrz modułu */
.subtabs { margin-top: 2px; }

/* zajęte skrzynki są przyciskami (kliknięcie → zawartość) */
button.cell.occ { cursor: pointer; color: var(--occ-text); font-weight: 700; }
button.cell.occ:hover { outline: 2px solid var(--muted); outline-offset: -2px; }
.cell.multi { background: linear-gradient(225deg, var(--multi) 0 7px, transparent 7px), var(--occ); color: var(--multi); }
.cell.multi5 { background: repeating-linear-gradient(135deg, var(--multi-bg) 0 4px, var(--occ) 4px 8px); color: var(--multi);
  outline: 2px solid var(--multi); outline-offset: -2px; }
.rack.rowc .cell.multi { background: linear-gradient(225deg, var(--multi) 0 7px, transparent 7px), color-mix(in srgb, var(--c) 18%, var(--occ)); }
.legend i.lg-multi { background: linear-gradient(225deg, var(--multi) 0 6px, transparent 6px), var(--occ); }

/* okno zawartości skrzynki, podpis autora */
dialog.tray { width: min(640px, calc(100vw - 32px)); }
dialog.tray .tray-body { max-height: 60vh; overflow: auto; }
.credit { margin: 4px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
button.chip { border: 0; cursor: pointer; }

/* KPI */
:root { --s1: #2563eb; --s2: #0d9488; --s3: #d97706; --st0: #94a3b8; --st1: #60a5fa; --st2: #f59e0b; --st3: #22c55e; --st4: #a78bfa; }
:root[data-mode="dark"] { --s1: #60a5fa; --s2: #2dd4bf; --s3: #fbbf24; --st0: #64748b; --st1: #3b82f6; --st2: #d97706; --st3: #16a34a; --st4: #8b5cf6; }
h2.sect { font-size: 17px; margin: 18px 2px 8px; }
.kpi-tile .n { font-size: 34px; }
.stages { display: flex; height: 44px; border-radius: 8px; overflow: hidden; margin-top: 8px; gap: 2px; }
.stage { display: flex; flex-direction: column; justify-content: center; align-items: center; min-width: 36px; color: #fff; line-height: 1.1; overflow: hidden; }
.stage b { font-size: 16px; } .stage span { font-size: 11px; white-space: nowrap; opacity: .9; }
.st0 { background: var(--st0); } .st1 { background: var(--st1); } .st2 { background: var(--st2); } .st3 { background: var(--st3); } .st4 { background: var(--st4); }
.stage-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.stage-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
/* grawery: terminy (po terminie / < 24 h wyróżnione) i lista najpilniejszych */
.kpi-tile.dl-overdue { background: var(--bad-bg); } .kpi-tile.dl-overdue .n { color: var(--bad); }
.kpi-tile.dl-lt24 { background: var(--multi-bg); } .kpi-tile.dl-lt24 .n { color: var(--multi); }
.kpi-tile.held { background: var(--multi-bg); } .kpi-tile.held .n { color: var(--multi); }
.dl-title { color: var(--muted); font-size: 14px; margin: 4px 2px -4px; }
.urgent-wrap { overflow-x: auto; }
.tv-links { font-size: 14px; color: var(--muted); }
.legend-card summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.legend-list { margin: 8px 0 0; padding-left: 18px; font-size: 14px; line-height: 1.5; }
.legend-list li { margin: 3px 0; }
table.urgent { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; margin-top: 6px; }
table.urgent th, table.urgent td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.urgent th { color: var(--muted); font-weight: 600; font-size: 12px; }
table.urgent .num { text-align: right; }
table.urgent tr.dl-overdue td { color: var(--bad); } table.urgent tr.dl-lt24 td:last-child { color: var(--multi); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 10px; }
.chart { padding: 12px; } .chart-box { position: relative; height: 260px; margin-top: 6px; }
@media (max-width: 420px) { .charts { grid-template-columns: 1fr; } .stage span { display: none; } }

/* Tryb TV: jeden ekran, bez przewijania, czytelny z daleka */
body.tv { height: 100vh; overflow: hidden; }
.tv-grid { position: relative; z-index: 1; height: 100vh; display: flex; flex-direction: column; gap: 1.2vh; padding: 1.5vh 1.5vw; }
.tv-grid > * { flex: 0 0 auto; }
.tv-grid > .tv-zones { flex: 1 1 0; } .tv-grid > .tv-orders { flex: 1 1 0; } .tv-grid > .tv-specials { flex: .8 1 0; }
.tv-grid > .tv-bottom { flex: 1.5 1 0; }
.tv-grid > .error { margin: 0; }
.tv-head { display: flex; align-items: baseline; gap: 2vw; }
.tv-head h1 { font-size: clamp(20px, 2.4vw, 44px); flex: 1; }
.tv-db { display: flex; align-items: baseline; gap: .8vw; }  /* w jednej linii - nagłówek tej samej wysokości co z zegarem */
.tv-db small { color: var(--muted); font-size: clamp(12px, 1vw, 18px); }
.tv-db b { font-size: clamp(28px, 3.6vw, 64px); font-weight: 800; font-variant-numeric: tabular-nums; }
.tv .freshness { position: static; border-radius: 10px; font-size: clamp(14px, 1.4vw, 26px); }
.tv-zones { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-auto-flow: column; gap: 1vw; min-height: 0; }
.tv .kpi-tile { display: flex; flex-direction: column; justify-content: center; min-height: 0; padding: 1.2vh 1.2vw; }
.tv .kpi-tile .l { font-size: clamp(13px, 1.3vw, 26px); }
.tv-zones .kpi-tile .n { font-size: clamp(44px, 5.4vw, 110px); line-height: 1; }
.tv-orders { display: grid; grid-template-columns: 1.45fr 1fr; gap: 1vw; min-height: 0; }
.tv-order-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1vw; min-height: 0; }
.tv-order-tiles .kpi-tile .n { font-size: clamp(32px, 3.9vw, 80px); line-height: 1; }
.tv-order-tiles .kpi-tile .l { font-size: clamp(12px, 1.1vw, 22px); }
.tv-stages { margin: 0; display: flex; flex-direction: column; justify-content: center; }
.tv .stages { height: clamp(40px, 6vh, 80px); }
.tv .stage b { font-size: clamp(16px, 1.6vw, 30px); } .tv .stage span { font-size: clamp(11px, .9vw, 16px); }
.tv .stage-legend { font-size: clamp(12px, 1vw, 18px); }
.tv-chart { padding: 1vh 1vw; display: flex; flex-direction: column; min-height: 0; }
.tv-chart-box { position: relative; flex: 1; min-height: 0; }
.kpi-tile .n.pcs { white-space: nowrap; }
.kpi-tile .n .per { font-size: .55em; font-weight: 600; color: var(--muted); }
.tv-specials { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: .6vw; min-height: 0; }
.tv-specials .kpi-tile .n { font-size: clamp(26px, 2.9vw, 64px); line-height: 1; }
.tv-specials .kpi-tile .l { font-size: clamp(10px, .75vw, 16px); line-height: 1.2; }
.tv-specials .kpi-tile { padding: 1vh .7vw; }
.tv-bottom { display: grid; grid-template-columns: 1.15fr 1.15fr 1fr; gap: 1vw; min-height: 0; }
.tv-urgent { padding: 1vh 1vw; overflow: hidden; min-height: 0; }
.tv table.urgent { font-size: clamp(12px, 1vw, 20px); }
.tv table.urgent th, .tv table.urgent td { padding: .4vh .5vw; }
.tv table.urgent .c-ord { display: none; }
.tv-foot { display: flex; align-items: flex-end; gap: 2vw; padding: 0; }
.tv-legend { flex: 1; text-align: left; color: var(--muted); font-size: clamp(11px, .78vw, 16px); line-height: 1.35; }
.tv-foot .tv-credit { flex: 0 0 auto; white-space: nowrap; }
.tv-deadlines { display: none; }
/* /tv?screen=1|2 - dwa telewizory; każdy ekran pokazuje swoją połowę, większą czcionką */
body[data-screen="1"] :is(.tv-specials, .tv-spec, .tv-urgent) { display: none; }
body[data-screen="1"] .tv-grid > .tv-zones { flex: 1.3 1 0; } body[data-screen="1"] .tv-grid > .tv-orders { flex: 1.15 1 0; }
body[data-screen="1"] .tv-grid > .tv-bottom { flex: 1.8 1 0; grid-template-columns: 1fr; }
body[data-screen="1"] .tv-order-tiles .kpi-tile .n { font-size: clamp(32px, 3.9vw, 84px); }
body[data-screen="2"] :is(.tv-zones, .tv-orders, .tv-ship) { display: none; }
body[data-screen="2"] .tv-specials { grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 1vw; }
body[data-screen="2"] .tv-deadlines { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: auto 1fr; gap: .6vh 1vw; min-height: 0; }
body[data-screen="2"] .tv-deadlines > .sub { grid-column: 1 / -1; margin: 0; }
body[data-screen="2"] .tv-grid > .tv-specials { flex: 1 1 0; } body[data-screen="2"] .tv-grid > .tv-deadlines { flex: 1.15 1 0; }
body[data-screen="2"] .tv-grid > .tv-bottom { flex: 2.6 1 0; grid-template-columns: 1.2fr 1fr; }
body[data-screen="2"] :is(.tv-specials, .tv-deadlines) .kpi-tile .n { font-size: clamp(36px, 4.6vw, 100px); line-height: 1; }
body[data-screen="2"] .tv-specials .kpi-tile .l { font-size: clamp(11px, .85vw, 18px); line-height: 1.2; }
body[data-screen="2"] .tv-deadlines .kpi-tile .l { font-size: clamp(12px, 1.1vw, 22px); }
body[data-screen="2"] table.urgent { font-size: clamp(13px, 1.15vw, 22px); }
body[data-screen="2"] table.urgent .c-ord { display: table-cell; }
.tv-credit { text-align: right; color: var(--muted); font-size: clamp(11px, .8vw, 15px); padding: 0; }
.chart-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.seg-sm button { padding: 4px 10px; font-size: 13px; }

/* zajęta skrzynka z jednym SKU - kropka, żeby było widać, że da się kliknąć */
.cell.single { font-size: calc(var(--cell-fs) + 4px); line-height: 1; }
.legend i.lg-occ { background: var(--occ); color: var(--occ-text); font-style: normal; font-weight: 700; text-align: center; line-height: 14px; font-size: 13px; }

/* półki tranzytowe C (W1): turkusowa ramka, etykieta, znacznik w listach */
.rack.transit { border: 2px solid var(--tr); background: linear-gradient(var(--tr-bg), var(--tr-bg)) top / 100% 4px no-repeat, var(--panel); }
.rack.transit .grid { background: var(--tr-bg); border-radius: 6px; padding: 3px; }
.rack.transit .zone-l { color: var(--tr); }
.ctag.transit { background: var(--tr); color: var(--tr-on); }
.cbadge.transit { color: var(--tr); background: var(--tr-bg); }
.chip.transit { outline: 2px solid var(--tr); outline-offset: -2px; }
.tile-transit .bar i { background: var(--tr); }
.tile-rowc .bar i { background: var(--c); }
/* filtr rzędu C / tranzytu: szersze pole, żeby trzy przyciski się mieściły; nagłówek regału zawija etykiety */
.controls .field.wide { grid-column: span 2; }
@media (max-width: 520px) { .controls .field.wide { grid-column: auto; } .controls .field.wide .seg { flex-wrap: wrap; } }
.rack-h { flex-wrap: wrap; row-gap: 4px; }
.rack-h .ctag, .rack-h .cnt { white-space: nowrap; }

/* kolory regałów (tabliczki w hali, config rack_colors) */
.rack.colored { box-shadow: inset 0 6px 0 var(--rk); padding-top: 14px; }
.rk-name { font-size: 12px; font-weight: 800; color: var(--rk-fg, #fff); background: var(--rk); border-radius: 5px; padding: 1px 7px; }
.rdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--rk); margin-right: 5px;
  vertical-align: 0; box-shadow: 0 0 0 1px var(--line); }
/* mapa hali: rzut z góry, front na dole */
.hallmap { padding: 12px; overflow-x: auto; }
.hallmap .legend { flex-wrap: wrap; margin-bottom: 8px; }
.hallmap svg { display: block; width: 100%; min-width: 760px; height: auto; }
.hallmap .aisle { fill: var(--soft); }
.hallmap .aisle-l { fill: var(--muted); font-size: 12px; font-weight: 700; text-anchor: middle; }
/* rząd C na mapie: żółty numer alejki i lekko żółta alejka (żółty nie występuje na tabliczkach) */
.hallmap .aisle.rowc { fill: color-mix(in srgb, #f5c400 22%, var(--soft)); }
.hallmap .aisle-l.rowc { fill: #e0b000; font-size: 14px; font-weight: 800; }
.hallmap .rk rect { fill: var(--rk); stroke: var(--muted); stroke-opacity: .45; stroke-width: 1; }
.hallmap .rk:hover rect { stroke: var(--text); stroke-width: 2; }
.hallmap .rk text { fill: var(--rk-fg, #fff); font-size: 11px; font-weight: 700; text-anchor: middle; pointer-events: none; }
.hallmap .front { fill: var(--muted); font-size: 12px; font-weight: 700; text-anchor: middle; letter-spacing: .06em; }
.hallmap .frontline { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; opacity: .6; }
.hallmap .wall { fill: var(--muted); font-size: 11px; text-anchor: end; }

/* podgląd z zewnątrz: strona logowania i zalogowany użytkownik w nagłówku */
.who { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.who button { padding: 6px 10px; }
.login-wrap { max-width: 420px; padding-top: 8vh; }
.login-card { padding: 22px; }
.login-top { display: flex; align-items: center; justify-content: space-between; }
.login-top h1 { margin: 0; font-size: 20px; }
.login-card h2 { font-size: 16px; font-weight: 600; color: var(--muted); margin: 10px 0 14px; }
.login-card .field { margin-bottom: 12px; }
.login-card .tabs button { flex: 1; }
.login-card button.wide { width: 100%; padding: 11px; margin-top: 4px; }
.foot { position: relative; z-index: 1; text-align: center; color: var(--muted); font-size: 13px; padding: 18px; }
