:root {
  --bg: #070b14; --bg-2: #0b1220; --panel: #0f1829; --panel-2: #131e33; --raise: #18253e;
  --line: #1d2a42; --line-2: #2a3a58; --text: #e4eaf4; --muted: #8796b0; --hint: #5b6a86;
  --gold: #d9a441; --gold-soft: rgba(217, 164, 65, .12);
  --blue: #3b82f6; --blue-soft: rgba(59, 130, 246, .14);
  --red: #f05252; --red-soft: rgba(240, 82, 82, .13); --amber: #f5a524; --amber-soft: rgba(245, 165, 36, .13);
  --green: #2fbf71; --green-soft: rgba(47, 191, 113, .13);
  --mono: "Cascadia Mono", "JetBrains Mono", ui-monospace, Consolas, monospace;
  --sans: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, sans-serif;
  --radius: 6px;
  --topbar: rgba(9, 14, 26, .92); --glow: #10203d; --link: #7fb0ff; --sum: #c3cde0; --on-chip: #a9c8ff; --shield-fill: #0d1526;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eceff4; --bg-2: #f5f7fa; --panel: #ffffff; --panel-2: #f2f5f9; --raise: #e7edf6;
  --line: #dce2eb; --line-2: #c5cfdc; --text: #101828; --muted: #475467; --hint: #6b7a90;
  --gold: #9a6a0c; --gold-soft: rgba(176, 124, 20, .1);
  --blue: #1d5fd1; --blue-soft: rgba(29, 95, 209, .1);
  --red: #c42b2b; --red-soft: rgba(196, 43, 43, .09); --amber: #a8640a; --amber-soft: rgba(212, 136, 18, .12);
  --green: #13804a; --green-soft: rgba(19, 128, 74, .1);
  --topbar: rgba(255, 255, 255, .94); --glow: #dfe7f3; --link: #1d5fd1; --sum: #344054; --on-chip: #1d4fa8; --shield-fill: #ffffff;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body { margin: 0; font: 14px/1.5 var(--sans); color: var(--text); background: radial-gradient(1200px 600px at 70% -10%, var(--glow) 0%, transparent 60%), var(--bg); min-height: 100vh; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: .2px; }
h2 { font-size: 15px; font-weight: 600; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); }
.hint { color: var(--hint); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.label { font-size: 11px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.label.gold { color: var(--gold); }

button, .btn { font: inherit; font-size: 13px; font-weight: 500; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
button:hover, .btn:hover { background: var(--raise); border-color: var(--hint); text-decoration: none; }
button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
button.primary:hover { filter: brightness(1.1); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { color: var(--text); background: var(--panel-2); }
button.small, .btn.small { padding: 4px 10px; font-size: 12px; }
button:disabled { opacity: .55; cursor: default; }
input, select, textarea { font: inherit; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--bg-2); width: 100%; color: var(--text); }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
textarea { min-height: 72px; resize: vertical; }
label { display: block; font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.error { color: var(--red); font-size: 13px; margin-top: 8px; }

/* top bar */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 28px; padding: 0 24px; height: 60px; background: var(--topbar); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.shield { width: 28px; height: 32px; }
.wordmark { display: flex; flex-direction: column; line-height: 1.05; }
.wordmark b { font-size: 15px; letter-spacing: 3px; }
.wordmark small { font-size: 10px; letter-spacing: 1.5px; color: var(--gold); text-transform: uppercase; margin-top: 3px; }
.top nav { display: flex; gap: 4px; flex: 1; }
.top nav a { color: var(--muted); font-size: 13px; font-weight: 500; padding: 19px 12px; border-bottom: 2px solid transparent; }
.top nav a:hover { color: var(--text); text-decoration: none; }
.top nav a.on { color: var(--text); border-bottom-color: var(--gold); }
.facility { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.facility span:first-child { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.clock { font-family: var(--mono); font-size: 14px; color: var(--text); }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); padding-left: 16px; border-left: 1px solid var(--line); }
.rank { font-size: 10px; font-weight: 700; letter-spacing: 1px; padding: 2px 6px; border-radius: 4px; background: var(--gold-soft); color: var(--gold); border: 1px solid rgba(217,164,65,.35); text-transform: uppercase; }
.notice { font-size: 11px; letter-spacing: .6px; color: var(--hint); text-align: center; padding: 6px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
main { max-width: 1320px; margin: 0 auto; padding: 22px 24px 48px; }

/* surfaces */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-b { padding: 16px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }

.casehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.crumbs { font-size: 12px; color: var(--hint); margin-bottom: 6px; letter-spacing: .4px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); background: var(--bg-2); display: inline-flex; gap: 6px; align-items: center; }
.chip b { color: var(--text); font-weight: 500; }
.chip.ok { border-color: rgba(47,191,113,.4); color: var(--green); background: var(--green-soft); }
.chip.bad { border-color: rgba(240,82,82,.4); color: var(--red); background: var(--red-soft); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { position: relative; padding: 14px 16px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: var(--line-2); }
.kpi.green::before { background: var(--green); } .kpi.amber::before { background: var(--amber); } .kpi.red::before { background: var(--red); } .kpi.blue::before { background: var(--blue); }
.kpi .num { font-family: var(--mono); font-size: 30px; font-weight: 600; margin: 6px 0 2px; letter-spacing: -.5px; }
.kpi.red .num { color: var(--red); } .kpi.amber .num { color: var(--amber); }
.kpi .sub { font-size: 12px; color: var(--hint); }

.workbench { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; align-items: start; }
.filters { display: flex; gap: 4px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.filters button { padding: 4px 9px; font-size: 12px; background: transparent; border-color: var(--line); color: var(--muted); }
.filters button.on { background: var(--blue-soft); border-color: rgba(59,130,246,.5); color: var(--on-chip); }
.filters button .n { font-family: var(--mono); color: var(--hint); }
.filters button.on .n { color: var(--on-chip); }
.officer-filter { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; background: var(--gold-soft); border-bottom: 1px solid rgba(217,164,65,.3); font-size: 12px; color: var(--gold); }
.queue { max-height: 720px; overflow-y: auto; }
.qi { display: grid; grid-template-columns: 4px 1fr; width: 100%; text-align: left; padding: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; gap: 0; }
.qi:hover { background: var(--panel-2); border-color: var(--line); }
.qi.on { background: var(--raise); }
.qi .sev { align-self: stretch; }
.qi .sev.high { background: var(--red); } .qi .sev.medium { background: var(--amber); } .qi .sev.low { background: var(--line-2); }
.qi .body { padding: 10px 12px; min-width: 0; }
.qi .l1 { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 13px; }
.qi .l2 { display: flex; justify-content: space-between; gap: 8px; margin-top: 3px; font-size: 12px; color: var(--muted); }
.qi .case { font-family: var(--mono); font-size: 11px; color: var(--hint); }
.qi.reviewed .l1 span:first-child::after { content: " · reviewed"; color: var(--green); font-weight: 500; }

.tag { font-size: 10.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; white-space: nowrap; }
.tag.high { background: var(--red-soft); color: var(--red); border: 1px solid rgba(240,82,82,.35); }
.tag.medium { background: var(--amber-soft); color: var(--amber); border: 1px solid rgba(245,165,36,.35); }
.tag.low { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line-2); }
.tag.ok { background: var(--green-soft); color: var(--green); border: 1px solid rgba(47,191,113,.35); }
.badge { font-family: var(--mono); font-size: 12px; padding: 1px 7px; border-radius: 4px; background: var(--gold-soft); color: var(--gold); border: 1px solid rgba(217,164,65,.3); cursor: pointer; }
.badge:hover { background: rgba(217,164,65,.22); }

.ev-head { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.ev-title { font-size: 20px; font-weight: 600; letter-spacing: .3px; margin: 6px 0 4px; }
.ev-sum { color: var(--sum); margin-top: 8px; max-width: 820px; }
.ev-sec { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.ev-sec:last-child { border-bottom: 0; }
.facts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-top: 10px; }
.fact { background: var(--bg-2); padding: 10px 12px; }
.fact:last-child:nth-child(odd) { grid-column: 1 / -1; }
.fact .k { font-size: 11px; letter-spacing: .6px; text-transform: uppercase; color: var(--hint); font-weight: 600; }
.fact .v { font-family: var(--mono); font-size: 14px; margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.fact .v .bad { color: var(--red); } .fact .v .warn { color: var(--amber); }
.fact .n { font-size: 12px; color: var(--muted); margin-top: 3px; }
.tchip { font-family: var(--mono); font-size: 12px; padding: 1px 6px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--line-2); }
.tchip.miss { border-color: rgba(240,82,82,.5); color: var(--red); }
.rowref { font-size: 11px; color: var(--hint); font-family: var(--mono); }

.timeline { width: 100%; height: auto; margin-top: 8px; display: block; }
.legend { display: flex; gap: 16px; font-size: 11px; color: var(--muted); flex-wrap: wrap; margin-top: 6px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.dot.ok { background: var(--green); } .dot.late { background: var(--amber); } .dot.flag { background: var(--red); } .dot.miss { border: 2px solid var(--red); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 10.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--hint); background: var(--bg-2); position: sticky; top: 0; }
td.num, th.num { text-align: right; font-family: var(--mono); }
.logtable td { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.logtable tr.flagged td { background: var(--red-soft); }
.logtable tr.flagged td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.logtable tr.ctx td { color: var(--muted); }
.logtable .bad { color: var(--red); } .logtable .warn { color: var(--amber); } .logtable .ok { color: var(--green); }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; margin-top: 10px; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel-2); }

.officer { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; margin-top: 10px; padding: 14px; border: 1px solid rgba(217,164,65,.25); border-radius: 8px; background: linear-gradient(90deg, rgba(217,164,65,.07), transparent 60%); }
.officer .bn { font-family: var(--mono); font-size: 26px; font-weight: 600; color: var(--gold); padding: 6px 14px; border: 1px solid rgba(217,164,65,.4); border-radius: 8px; text-align: center; }
.officer .bn small { display: block; font-family: var(--sans); font-size: 10px; letter-spacing: 1.4px; color: var(--muted); }
.ostats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.ostats div b { display: block; font-family: var(--mono); font-size: 16px; font-weight: 600; }
.ostats div span { font-size: 11px; color: var(--hint); text-transform: uppercase; letter-spacing: .6px; }

.unit { display: grid; grid-template-columns: 120px 1fr 56px; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.unit:last-child { border-bottom: 0; }
.unit .pct { text-align: right; font-family: var(--mono); }
.bar { height: 8px; border-radius: 2px; background: var(--bg-2); overflow: hidden; border: 1px solid var(--line); }
.bar span { display: block; height: 100%; }

.drop { border: 1.5px dashed var(--line-2); border-radius: 10px; padding: 28px; text-align: center; background: var(--bg-2); }
.drop { transition: border-color .15s, background .15s, transform .15s; }
.drop.over { border-color: var(--blue); border-style: solid; background: var(--blue-soft); transform: scale(1.01); }
.drop.over svg { color: var(--on-chip); }
.drop svg { width: 34px; height: 34px; color: var(--hint); }

.login { max-width: 400px; margin: 9vh auto 0; padding: 30px 28px; }
.login .shield { width: 44px; height: 50px; }
.login .wordmark b { font-size: 20px; }
.login .fine { font-size: 11px; color: var(--hint); border-top: 1px solid var(--line); padding-top: 14px; margin-top: 18px; line-height: 1.5; }

.empty { padding: 28px 16px; text-align: center; color: var(--hint); }

@media (max-width: 1100px) {
  .workbench { grid-template-columns: minmax(0, 1fr); }
  .queue { max-height: 360px; }
  .facility { display: none; }
}
@media (max-width: 760px) {
  .kpis, .facts, .grid2 { grid-template-columns: minmax(0, 1fr); }
  .ostats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top { flex-wrap: wrap; height: auto; padding: 8px 16px; gap: 8px; }
  .top nav a { padding: 8px; }
  main { padding: 16px; }
}

/* theme switch */
.theme { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; }
.theme button { border: 0; border-radius: 0; padding: 4px 9px; font-size: 11px; background: transparent; color: var(--muted); }
.theme button + button { border-left: 1px solid var(--line-2); }
.theme button.on { background: var(--blue-soft); color: var(--on-chip); }

/* timeline marks (classes so both themes work) */
.tl-axis { stroke: var(--line-2); }
.tl-grid { stroke: var(--line); }
.tl-text { fill: var(--hint); font-family: var(--mono); font-size: 11px; }
.tl-lane { fill: var(--hint); font-size: 10px; letter-spacing: 1px; }
.tl-label { fill: var(--muted); font-family: var(--mono); font-size: 10px; }
.tl-label.on { fill: var(--text); }
.tl-due { fill: none; stroke: var(--red); stroke-width: 2; }
.tl-duetext { fill: var(--red); font-size: 10px; }
.tl-dot { stroke: var(--bg); stroke-width: 1.5; }
.tl-dot.ok, .tl-sq.ok { fill: var(--green); } .tl-dot.late, .tl-sq.late { fill: var(--amber); } .tl-dot.flag, .tl-sq.flag { fill: var(--red); }
.tl-link { stroke-opacity: .55; } .tl-link.ok { stroke: var(--green); } .tl-link.late { stroke: var(--amber); } .tl-link.flag { stroke: var(--red); }

/* live board */
.board { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.unitgroup + .unitgroup { margin-top: 18px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-top: 8px; }
.tile { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--panel); position: relative; overflow: hidden; }
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--green); }
.tile.due_soon::before { background: var(--amber); }
.tile.overdue { border-color: var(--red); background: var(--red-soft); }
.tile.overdue::before { background: var(--red); }
.tile.empty { opacity: .55; } .tile.empty::before { background: var(--line-2); }
.tile .code { font-family: var(--mono); font-size: 20px; font-weight: 600; }
.tile .count { font-family: var(--mono); font-size: 15px; margin-top: 2px; }
.tile.overdue .count { color: var(--red); font-weight: 700; animation: pulse 1.2s ease-in-out infinite; }
.tile.due_soon .count { color: var(--amber); }
.tile .meta { font-size: 11px; color: var(--hint); margin-top: 4px; }
.tile .acts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
@keyframes pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .tile.overdue .count { animation: none; } }
.feed { max-height: 640px; overflow-y: auto; }
.fi { padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.fi .when { font-family: var(--mono); color: var(--hint); font-size: 11px; }
.fi .msg { margin-top: 3px; color: var(--sum); white-space: pre-line; }
.fi .ch { font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; padding: 1px 6px; border-radius: 3px; border: 1px solid var(--line-2); color: var(--muted); }
.fi .ch.sms { color: var(--blue); border-color: var(--blue); } .fi .ch.call { color: var(--red); border-color: var(--red); } .fi .ch.email { color: var(--gold); border-color: var(--gold); }
.steps { display: flex; gap: 4px; margin-top: 6px; }
.steps span { flex: 1; height: 4px; border-radius: 2px; background: var(--line-2); }
.steps span.sent { background: var(--red); }
.banner { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 12.5px; color: var(--muted); }
.banner.warn { border-color: var(--amber); background: var(--amber-soft); color: var(--text); }

/* officer rounds + door scan (phone) */
body.mobile main, main.rounds { max-width: 560px; }
.rcell { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.rcell .code { font-family: var(--mono); font-size: 22px; font-weight: 600; }
.rcell .count { font-family: var(--mono); font-size: 16px; text-align: right; }
.rcell.overdue { background: var(--red-soft); } .rcell.overdue .count { color: var(--red); font-weight: 700; }
.rcell.due_soon .count { color: var(--amber); }
.scan { margin: 0 auto; padding: 16px; max-width: 520px; }
.scan-top { margin-bottom: 14px; } .scan-top .rank { margin-left: auto; }
.scan-card { padding: 20px; }
.scan-cell { font-family: var(--mono); font-size: 56px; font-weight: 700; line-height: 1.1; letter-spacing: 1px; }
.scan-time { display: flex; flex-direction: column; gap: 2px; margin: 16px 0 8px; padding: 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg-2); }
.scan-time b { font-size: 28px; }
.obs-label { margin: 18px 0 8px; }
.obs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.obs button { padding: 14px 10px; font-size: 14px; justify-content: center; white-space: normal; text-align: center; }
.obs button.on { background: var(--blue-soft); border-color: var(--blue); color: var(--on-chip); }
.obs button.danger { border-color: var(--red); color: var(--red); grid-column: 1 / -1; }
.obs button.danger.on { background: var(--red); color: #fff; }
button.big, .btn.big { width: 100%; justify-content: center; padding: 14px; font-size: 16px; }
.done { text-align: center; }
.okmark { font-size: 54px; color: var(--green); line-height: 1; }
.done h1 { margin: 8px 0; }
.done .btn { margin-top: 18px; }
@media (max-width: 1100px) { .board { grid-template-columns: minmax(0, 1fr); } }
.steprow { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); } .steprow input { max-width: 70px; }

/* small utilities */
.center { text-align: center; } .center-row { justify-content: center; margin-top: 12px; }
.mt { margin-top: 14px; } .w-auto { width: auto; } .w-fit { width: fit-content; }
.flush { margin: 0; border: 0; border-radius: 0; }
.ctxrow td { color: var(--hint); }
.helpbtn { font-weight: 700; width: 30px; justify-content: center; border: 1px solid var(--line-2); border-radius: 50%; padding: 4px 0; }

/* signup + setup */
.signup { max-width: 620px; margin: 6vh auto 40px; padding: 28px; }
.signup .shield { width: 40px; height: 46px; }
.steps-mini { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 18px; }
.steps-mini span { font-size: 11px; font-weight: 600; letter-spacing: .5px; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--hint); }
.steps-mini span.on { border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }
.steps-mini span.done { color: var(--green); border-color: var(--green); }
.steps-mini.pad { padding: 0 16px; }
.setup { max-width: 860px; margin: 0 auto; }
.setup .foot { border-top: 1px solid var(--line); border-bottom: 0; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.unitlist { border: 1px solid var(--line); border-radius: 8px; }
.unitrow { display: grid; grid-template-columns: 140px 1fr auto; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); align-items: center; }
.unitrow:last-child { border-bottom: 0; }
.cards2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card-link { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--line-2); border-radius: 10px; color: var(--text); background: var(--bg-2); }
.card-link:hover { border-color: var(--gold); text-decoration: none; }
.card-link span { color: var(--muted); font-size: 13px; }
.checklist p { margin: 4px 0; font-family: var(--mono); }
textarea.tall { min-height: 130px; font-family: var(--mono); font-size: 13px; }
.cardsheet { border-top: 1px solid var(--line); padding-top: 14px; }
.logincards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 10px; }
.logincard { border: 1.5px dashed var(--line-2); border-radius: 10px; padding: 14px; background: var(--panel); }
.logincard .shield { width: 18px; height: 20px; }
.logincard p { margin: 6px 0; }
.lc-name { font-weight: 600; font-size: 15px; }
.big-pw { font-size: 17px; letter-spacing: 1px; }
@media print {
  body * { visibility: hidden; }
  .cardsheet, .cardsheet * { visibility: visible; }
  .cardsheet { position: absolute; left: 0; top: 0; width: 100%; border: 0; }
  .noprint { display: none !important; }
  .logincard { break-inside: avoid; color: #000; background: #fff; border-color: #000; }
}

/* tours */
.tour-spot { position: fixed; z-index: 60; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(3, 7, 15, .62); border: 2px solid var(--gold); pointer-events: none; transition: all .25s ease; }
.tour-card { position: fixed; z-index: 61; width: 360px; max-width: calc(100vw - 24px); padding: 16px 18px; box-shadow: 0 18px 40px rgba(0, 0, 0, .35); }
.tour-card h2 { margin: 4px 0 6px; }
@media (prefers-reduced-motion: reduce) { .tour-spot { transition: none; } }
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(3, 7, 15, .6); display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.practice { width: 100%; max-width: 460px; }
.practice .ghost.big { margin-top: 8px; }
#practice { margin-bottom: 4px; border-color: var(--gold); color: var(--gold); background: var(--gold-soft); }

/* floor plan */
.plan { position: relative; margin-top: 10px; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: var(--bg-2); min-height: 360px; touch-action: none; }
.plan img { display: block; width: 100%; height: auto; user-select: none; opacity: .9; }
:root[data-theme="dark"] .plan img { filter: invert(.88) hue-rotate(180deg) contrast(.9); }
.plan-grid { position: absolute; inset: 0; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 40px 40px; }
.plan.has-img { min-height: 0; }
.plan.editing { outline: 2px dashed var(--gold); outline-offset: 2px; }
.plan-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 30px; color: var(--muted); }
.pin { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; padding: 4px 8px; border-radius: 6px; background: var(--panel); border: 2px solid var(--green); font-size: 11px; line-height: 1.2; box-shadow: 0 2px 6px rgba(0,0,0,.25); white-space: nowrap; }
.pin b { font-family: var(--mono); font-size: 13px; }
.pin .count { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.pin.due_soon { border-color: var(--amber); } .pin.due_soon .count { color: var(--amber); }
.pin.overdue { border-color: var(--red); background: var(--red-soft); } .pin.overdue .count { color: var(--red); font-weight: 700; animation: pulse 1.2s ease-in-out infinite; }
.pin.empty { opacity: .5; border-color: var(--line-2); }
.pin.hr::after { content: "HR"; position: absolute; top: -8px; right: -8px; font-size: 9px; font-weight: 700; background: var(--red); color: #fff; border-radius: 3px; padding: 0 3px; }
.plan.editing .pin { cursor: grab; } .plan.editing .pin:active { cursor: grabbing; }
.unplaced { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.pin.mini { position: static; transform: none; cursor: pointer; }

/* paper review */
.reading { max-width: 520px; margin: 8vh auto; padding: 30px; text-align: center; }
.spinner { width: 36px; height: 36px; margin: 0 auto 14px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--gold); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.paperpage { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 16px; align-items: start; }
.pimg img { width: 100%; border-radius: 8px; border: 1px solid var(--line-2); cursor: zoom-in; background: #fff; }
.pimg img.zoomed { position: fixed; inset: 3vh 3vw; width: auto; height: 94vh; max-width: 94vw; margin: auto; z-index: 40; object-fit: contain; cursor: zoom-out; box-shadow: 0 0 0 9999px rgba(3,7,15,.75); }
.pimg { position: sticky; top: 76px; }
.warnt { color: var(--amber); margin-top: 6px; }
.logtable.edit td { padding: 4px; }
.logtable.edit input { padding: 5px 7px; font-family: var(--mono); font-size: 12.5px; min-width: 70px; }
.logtable tr.edited td { background: var(--blue-soft); }
.conf { margin: 0; text-transform: none; letter-spacing: 0; display: inline-flex; gap: 4px; align-items: center; color: var(--red); }
.conf input { width: auto; }
@media (max-width: 900px) { .paperpage, .cards2, .grid3 { grid-template-columns: minmax(0, 1fr); } .pimg { position: static; } }
.top nav { overflow-x: auto; scrollbar-width: none; }
.top nav a { white-space: nowrap; }
.who span#who { white-space: nowrap; }
@media (max-width: 1400px) { .facility { display: none; } .top { gap: 16px; } }
.why { display: block; max-width: 220px; white-space: normal; }
.mb { margin-bottom: 14px; }
.banner.okb { border-color: var(--green); background: var(--green-soft); color: var(--text); }
.scanner { position: fixed; inset: 0; z-index: 70; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 16px; }
.scanner video { width: 100%; max-width: 520px; border-radius: 12px; }
.scanframe { position: absolute; width: min(62vw, 300px); aspect-ratio: 1; border: 3px solid var(--gold); border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0,0,0,.35); pointer-events: none; }
.scanhint { color: #fff; font-weight: 600; z-index: 1; }
.scanner button { max-width: 520px; z-index: 1; }
.gname { min-width: 120px; color: var(--text); } .graces input { max-width: 70px; width: auto; }
