/* ITSR Vision. Tokens first; components are written against roles, not hex. */
:root {
  color-scheme: light;
  --page: #f4f4f1; --surface: #fcfcfb; --surface-2: #f1f0ec; --surface-3: #e8e7e2;
  --ink: #0b0b0b; --ink-2: #52514e; --muted: #7d7b75;
  --line: #e1e0d9; --line-strong: #c3c2b7; --ring: rgba(11,11,11,.10);
  --accent: #2a78d6; --accent-ink: #1c5cab; --accent-wash: rgba(42,120,214,.10);
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4;
  --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --good: #0ca30c; --warn: #fab219; --serious: #ec835a; --crit: #d03b3b;
  --up: #006300; --down: #b42318;
  --seq-0: #eef4fc; --seq-1: #cde2fb; --seq-2: #9ec5f4; --seq-3: #6da7ec; --seq-4: #3987e5; --seq-5: #256abf; --seq-6: #104281;
  --shadow: 0 1px 2px rgba(11,11,11,.04), 0 8px 24px rgba(11,11,11,.05);
  --client: #2a78d6;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232322; --surface-3: #2c2c2a;
  --ink: #f0efec; --ink-2: #c3c2b7; --muted: #8f8d86;
  --line: #2c2c2a; --line-strong: #3d3d3a; --ring: rgba(255,255,255,.10);
  --accent: #3987e5; --accent-ink: #86b6ef; --accent-wash: rgba(57,135,229,.16);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
  --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --up: #0ca30c; --down: #e66767;
  --seq-0: #1f2630; --seq-1: #0d366b; --seq-2: #184f95; --seq-3: #256abf; --seq-4: #3987e5; --seq-5: #6da7ec; --seq-6: #b7d3f6;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 14px/1.5 var(--font); min-height: 100vh; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 22px; } h2 { font-size: 15px; } h3 { font-size: 13px; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); } .small { font-size: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---- top bar ---------------------------------------------------------- */
.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 8px;
  height: 56px; padding: 0 20px; background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; font-size: 15px; margin-right: 14px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { height: 26px; width: auto; display: block; }
.logo-dark { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: block !important; }
:root[data-theme="dark"] .logo-light { display: none !important; }
.brand .v { font-weight: 500; color: var(--muted); }
.tabs { display: flex; align-items: stretch; gap: 2px; height: 100%; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: flex; align-items: center; gap: 7px; padding: 0 13px; color: var(--ink-2); font-weight: 550;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--ink); text-decoration: none; background: var(--accent-wash); }
.tab.on { color: var(--ink); border-bottom-color: var(--client); }
.tab.on svg { color: var(--client); }
.tabs .sep { width: 1px; background: var(--line); margin: 16px 8px; flex: none; }
.bar-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.iconbtn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 550; cursor: pointer; white-space: nowrap; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--client); }
.menu { position: relative; }
.menu > .pop { display: none; position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 60; }
.menu.open > .pop { display: block; }
.pop a, .pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none;
  border-radius: 8px; color: var(--ink); text-align: left; cursor: pointer; }
.pop a:hover, .pop button:hover { background: var(--surface-2); text-decoration: none; }
.pop .head { padding: 8px 10px 6px; color: var(--muted); font-size: 12px; }
.pop hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.banner { display: flex; align-items: center; gap: 12px; justify-content: center; padding: 8px 20px; font-weight: 550;
  background: var(--accent-wash); border-bottom: 1px solid var(--line); }
.banner.preview { background: color-mix(in srgb, var(--warn) 22%, var(--surface)); }
.banner form { display: inline; }
.devtag { font-size: 10px; font-weight: 700; letter-spacing: .08em; padding: 2px 6px; border-radius: 5px; background: var(--surface-3); color: var(--ink-2); }

/* ---- layout ----------------------------------------------------------- */
main { max-width: 1480px; margin: 0 auto; padding: 22px 20px 60px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.pagehead p { margin: 2px 0 0; color: var(--ink-2); }
.grid { display: grid; gap: 14px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-12 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.kpis { grid-template-columns: minmax(0, 1.5fr) repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; min-height: 28px; flex-wrap: wrap; }
.card > header p { margin: 0; color: var(--muted); font-size: 12px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > header { padding: 14px 18px 0; }
.chart { width: 100%; height: 320px; }
.chart.sm { height: 230px; } .chart.xs { height: 150px; }
.loading { opacity: .45; transition: opacity .15s; }
.empty { display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); min-height: 120px; padding: 20px; }
.err { color: var(--crit); }

/* ---- controls --------------------------------------------------------- */
.filters { position: sticky; top: 56px; z-index: 40; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 0; margin: -6px 0 8px; background: color-mix(in srgb, var(--page) 90%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 11px; border-radius: 8px; color: var(--ink-2); cursor: pointer; font-weight: 550; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-weight: 550; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 40%, var(--line)); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12px; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: none; color: var(--ink-2); }
input[type=text], input[type=password], input[type=email], input[type=date], input[type=search], input[type=number], select, textarea {
  height: 34px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); min-width: 0; }
textarea { height: auto; padding: 8px 10px; }
input[type=color] { width: 44px; height: 34px; padding: 2px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); font-weight: 550; }
label.f > span.hint { font-weight: 400; color: var(--muted); }
label.ck { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 550; }
.crumbs button { border: 0; background: none; color: var(--accent-ink); cursor: pointer; padding: 2px 4px; border-radius: 6px; font-weight: 550; }
.crumbs button:hover { background: var(--accent-wash); }
.crumbs .cur { color: var(--ink); padding: 2px 4px; }
.crumbs .gt { color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); font-size: 12px; }
.status .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent); animation: pulse 2s infinite; }
.status.closed .pulse { background: var(--muted); animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .status .pulse { animation: none; } }

/* ---- stat tiles ------------------------------------------------------- */
.tile { display: flex; flex-direction: column; gap: 2px; }
.tile .lab { display: flex; align-items: center; gap: 7px; color: var(--ink-2); font-size: 12px; font-weight: 550; }
.tile .val { font-size: 26px; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; }
.tile.hero .val { font-size: 52px; line-height: 1.05; }
.tile .sub { color: var(--muted); font-size: 12px; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.key.line { height: 3px; width: 14px; border-radius: 2px; }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 650; }
.delta { color: var(--ink); } .delta.flat { color: var(--muted); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--ink-2); font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.segbar { display: flex; gap: 2px; height: 8px; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.segbar i { display: block; min-width: 2px; }

/* ---- tables ----------------------------------------------------------- */
.tablewrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover, table.t tbody tr.sel { background: var(--accent-wash); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 650;
  background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.pill.good { background: color-mix(in srgb, var(--good) 16%, var(--surface)); color: var(--up); }
.pill.warn { background: color-mix(in srgb, var(--warn) 24%, var(--surface)); color: var(--ink); }
.pill.bad { background: color-mix(in srgb, var(--crit) 16%, var(--surface)); color: var(--down); }
.barcell { position: relative; min-width: 120px; }
.barcell i { position: absolute; left: 0; top: 50%; height: 6px; margin-top: -3px; border-radius: 0 4px 4px 0; background: var(--accent); opacity: .85; }

/* ---- lane diagram ----------------------------------------------------- */
.lanes { display: flex; gap: 28px; justify-content: center; align-items: flex-end; padding: 6px 0 2px; flex-wrap: wrap; }
.lanegroup { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lanegroup .gl { font-size: 12px; font-weight: 650; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.lanerow { display: flex; gap: 2px; padding: 0 6px; border-left: 3px solid var(--line-strong); border-right: 3px solid var(--line-strong); }
.lane { position: relative; width: 46px; height: 176px; border: 0; border-radius: 4px; cursor: pointer; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; color: var(--ink); }
.lane:hover, .lane.sel { outline: 2px solid var(--ink); outline-offset: 1px; z-index: 1; }
.lane .ln { font-size: 11px; font-weight: 700; padding-top: 6px; }
.lane .lv { font-size: 11px; font-weight: 650; padding-bottom: 6px; font-variant-numeric: tabular-nums; }
.lane .arrow { font-size: 18px; opacity: .55; }
.lane.dark-ink { color: #0b0b0b; } .lane.light-ink { color: #fff; }

/* ---- video ------------------------------------------------------------ */
.cam { position: relative; background: #000; border-radius: 10px; overflow: hidden; aspect-ratio: 16 / 9; }
.cam img, .cam svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.cam .ph { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; color: #c3c2b7; text-align: center; padding: 16px; }
.cam .tag { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; align-items: center; background: rgba(0,0,0,.6); color: #fff; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 650; }
.cam .tag .rec { width: 7px; height: 7px; border-radius: 50%; background: #e34948; }
.camgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.camcard h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 2px 2px; }

/* ---- map -------------------------------------------------------------- */
.map { height: 420px; border-radius: 10px; overflow: hidden; background: var(--surface-2); z-index: 0; }
.map.tall { height: calc(100vh - 210px); min-height: 480px; }
.leaflet-container { font: inherit; background: var(--surface-2); }
:root[data-theme="dark"] .leaflet-layer.tiles-street { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.9) saturate(.5); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 12px 14px; min-width: 200px; }
.campin { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg);
  background: var(--pin, #2a78d6); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.campin svg { transform: rotate(45deg); width: 14px; height: 14px; stroke: #fff; fill: none; stroke-width: 2; }
.campin.off { background: #898781; }

/* ---- auth pages ------------------------------------------------------- */
.authwrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.authart { position: relative; background: #0d1522; color: #fff; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 48px; }
.authart svg.bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.authart h1 { font-size: 34px; line-height: 1.15; max-width: 14ch; position: relative; }
.authart p { color: #b7c3d6; max-width: 44ch; position: relative; font-size: 15px; }
.authform { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.authform form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }
.authform img { height: 40px; align-self: flex-start; margin-bottom: 8px; }
.authform .btn { height: 42px; justify-content: center; }
.authform input { height: 42px; }
.notice { padding: 10px 12px; border-radius: 10px; font-weight: 550; border: 1px solid var(--line); background: var(--surface-2); }
.notice.error { border-color: color-mix(in srgb, var(--crit) 40%, var(--line)); background: color-mix(in srgb, var(--crit) 10%, var(--surface)); }
.notice.ok { border-color: color-mix(in srgb, var(--good) 40%, var(--line)); background: color-mix(in srgb, var(--good) 10%, var(--surface)); }
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.secret { font: 600 15px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 4px 8px; border-radius: 6px; background: var(--surface-3); user-select: all; }

/* ---- overview --------------------------------------------------------- */
.pcard { display: flex; flex-direction: column; gap: 12px; color: var(--ink); transition: transform .12s, box-shadow .12s, border-color .12s; }
a.pcard:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.pcard .top { display: flex; align-items: center; justify-content: space-between; }
.pcard .ic { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: var(--accent-wash); color: var(--accent-ink); }
.pcard .go { color: var(--muted); display: inline-flex; align-items: center; gap: 4px; font-weight: 550; font-size: 12px; }

/* ---- wiki ------------------------------------------------------------- */
.wiki { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; }
.wikinav { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 4px; max-height: calc(100vh - 100px); overflow: auto; }
.wikinav h3 { margin: 14px 0 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.wikinav a { padding: 6px 10px; border-radius: 8px; color: var(--ink-2); font-weight: 550; }
.wikinav a:hover { background: var(--surface-2); text-decoration: none; }
.wikinav a.on { background: var(--accent-wash); color: var(--ink); }
.prose { max-width: 74ch; font-size: 15px; line-height: 1.65; }
.prose h1 { font-size: 28px; margin-bottom: 10px; }
.prose h2 { font-size: 19px; margin: 30px 0 8px; padding-top: 6px; }
.prose h3 { font-size: 15px; margin: 22px 0 6px; }
.prose p, .prose ul, .prose ol { margin: 0 0 14px; }
.prose li { margin-bottom: 5px; }
.prose code { font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }
.prose table { border-collapse: collapse; width: 100%; margin: 0 0 16px; font-size: 14px; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 7px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { color: var(--muted); font-size: 12px; }
.prose blockquote { margin: 0 0 16px; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--accent-wash); border-radius: 0 10px 10px 0; }
.prose blockquote p:last-child { margin: 0; }
.wikifoot { display: flex; justify-content: space-between; gap: 12px; margin-top: 34px; padding-top: 16px; border-top: 1px solid var(--line); max-width: 74ch; }
.searchres { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; z-index: 30; }
.searchres a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--ink); }
.searchres a:hover { background: var(--surface-2); text-decoration: none; }
.searchres small { display: block; color: var(--muted); }
.helpdot { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line-strong);
  color: var(--muted); font-size: 11px; font-weight: 700; cursor: help; }
.helpdot:hover { color: var(--ink); text-decoration: none; background: var(--surface-2); }

details.box { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
details.box > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
details.box > summary::-webkit-details-marker { display: none; }
details.box[open] > summary { border-bottom: 1px solid var(--line); }
details.box > .in { padding: 14px 16px; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > .hero { grid-column: 1 / -1; }
  .g-21, .g-12, .g-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .topbar { padding: 0 12px; height: auto; flex-wrap: wrap; row-gap: 0; }
  .brand { height: 52px; }
  .tabs { order: 3; flex: 0 0 100%; height: 42px; border-top: 1px solid var(--line); margin: 0 -12px; padding: 0 6px; flex-basis: calc(100% + 24px); }
  .filters { position: static; }
  .filters .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .brand .v, .chip .cn { display: none; }
  .tab { padding: 0 11px; }
  main { padding: 16px 16px 48px; }
  .g-2 { grid-template-columns: minmax(0, 1fr); }
  .tile.hero .val { font-size: 40px; }
  .authwrap { grid-template-columns: 1fr; } .authart { display: none; }
  .wiki { grid-template-columns: 1fr; } .wikinav { position: static; max-height: none; }
  .camgrid { grid-template-columns: 1fr; }
  .lane { width: 34px; height: 140px; }
}
@media print { .topbar, .filters, .banner { display: none; } body { background: #fff; } }

.g-21 > .card.flush { align-self: start; position: sticky; top: 76px; }
.leaflet-control-layers, .leaflet-bar a { background: var(--surface) !important; color: var(--ink) !important; border-color: var(--line) !important; }
.leaflet-control-layers { border-radius: 10px !important; padding: 8px 10px !important; }
@media (max-width: 1100px) { .g-21 > .card.flush { position: static; } .map.tall { height: 60vh; } }

/* ---- password fields -------------------------------------------------- */
.pwwrap { position: relative; display: block; }
.pwwrap input { width: 100%; padding-right: 62px; }
.pwtoggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--accent-ink);
  font-size: 12px; font-weight: 650; padding: 4px 8px; border-radius: 6px; cursor: pointer; }
.pwtoggle:hover { background: var(--accent-wash); }
.pwmeter { margin-top: 6px; font-weight: 400; }
.pwbar { height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-bottom: 4px; }
.pwbar i { display: block; height: 100%; width: 0; transition: width .15s; border-radius: 99px; }
.pwrules { list-style: none; margin: 6px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 2px 12px; font-size: 12px; color: var(--muted); }
.pwrules li::before { content: attr(data-mark) "  "; }
.pwrules li.ok { color: var(--ink-2); }
.codeinput { font: 600 26px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .35em; text-align: center; height: 56px !important; }

[hidden] { display: none !important; }
.leaflet-control-layers-toggle { background-color: var(--surface) !important; border-radius: 8px; }
.leaflet-control-layers-separator { border-top-color: var(--line) !important; }

/* ---- reports ---------------------------------------------------------- */
.report { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 32px; }
.rephead { display: flex; align-items: center; gap: 18px; padding-bottom: 16px; border-bottom: 2px solid var(--ink); }
.rephead img { height: 42px; }
.reptitle { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.repsub { color: var(--ink-2); }
.repmeta { margin-left: auto; text-align: right; color: var(--muted); font-size: 12px; white-space: nowrap; }
.repsec { padding: 20px 0 6px; border-bottom: 1px solid var(--line); break-inside: auto; }
.repsec > h2 { font-size: 18px; margin-bottom: 10px; }
.repsec h3 { font-size: 13px; margin: 0 0 6px; color: var(--ink-2); }
.repkpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 16px; }
.repkpis .lab { font-size: 12px; color: var(--ink-2); font-weight: 550; }
.repkpis .val { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.repkpis > div:first-child .val { font-size: 34px; }
.repkpis .sub { font-size: 12px; color: var(--muted); }
.repchart { margin-bottom: 14px; break-inside: avoid; }
.repchart svg text { fill: var(--muted); }
.repchart svg line { stroke: var(--line); }
.reptables { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 28px; }
.reptables > div { break-inside: avoid; min-width: 0; overflow-x: auto; }
.reptables > .wide { grid-column: 1 / -1; break-inside: auto; }
.repnote { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.repfoot { color: var(--muted); font-size: 12px; padding-top: 14px; }
@media (max-width: 900px) { .reptables { grid-template-columns: 1fr; } .report { padding: 18px 16px; } .rephead { flex-wrap: wrap; } .repmeta { margin-left: 0; text-align: left; } }
@media print {
  @page { margin: 14mm; }
  .noprint, .flashes { display: none !important; }
  :root, :root[data-theme="dark"] { --page: #fff; --surface: #fff; --ink: #000; --ink-2: #333; --muted: #555; --line: #ccc; }
  main { max-width: none; padding: 0; }
  .report { border: 0; padding: 0; border-radius: 0; }
  .logo-dark { display: none !important; } .logo-light { display: block !important; }
  .repchart svg text { fill: #444; } .repchart svg line { stroke: #ccc; }
  table.t td, table.t th { padding: 4px 8px; font-size: 11px; }
  .repsec { break-before: auto; } .repsec + .repsec { break-before: page; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---- report branding and print (overrides) ---------------------------- */
.rephead { border-bottom: 3px solid #e8c84a; }
.rephead .brandtxt { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.repfoot { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); margin-top: 6px; }
@media print {
  /* Paper is white whatever theme is on screen: always print the dark-ink logo. */
  html:root .logo-dark, html:root[data-theme="dark"] .logo-dark { display: none !important; }
  html:root .logo-light, html:root[data-theme="dark"] .logo-light { display: block !important; }
  html, body { background: #fff !important; color: #000; }
  :root, :root[data-theme="dark"] { color-scheme: light; --surface-2: #f3f3f0; --surface-3: #e9e9e4; --line-strong: #999; }
  .rephead { flex-wrap: nowrap !important; align-items: flex-end; }
  .rephead img { height: 46px; }
  .repmeta { margin-left: auto !important; text-align: right !important; }
  .repkpis { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
  .repkpis .val { font-size: 19px; } .repkpis > div:first-child .val { font-size: 24px; }
  .reptables { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px 22px; }
  .repsec > h2 { font-size: 16px; border-left: 4px solid #e8c84a; padding-left: 8px; }
  .repfoot { font-size: 10px; }
  a[href]::after { content: none !important; }
}

.reppies { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 10px 28px; margin: 6px 0 14px; break-inside: avoid; }
.reppies svg text { fill: var(--ink-2); }
.reppies svg text[font-weight="700"] { fill: var(--ink); }
.reppies svg path { stroke: var(--surface); }
@media print { .reppies svg text { fill: #333; } .reppies svg path { stroke: #fff; } }
.donuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; }
.donut { height: 230px; }
.chartgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .chartgrid { grid-template-columns: minmax(0, 1fr); } }

/* Phone width: nothing may push the page sideways. Wide tables scroll inside themselves. */
@media (max-width: 700px) {
  main table { display: block; overflow-x: auto; max-width: 100%; }
  .seg { flex-wrap: wrap; max-width: 100%; }
  details.box > summary { flex-wrap: wrap; }
  .pill { white-space: normal; }
}

/* Many tabs on a laptop screen: tighten them so every tab stays in view, and fade the
   edge when the row still has to scroll. */
@media (max-width: 1700px) and (min-width: 901px) {
  .tab { padding: 0 9px; gap: 6px; }
  .tab .devtag { font-size: 9px; padding: 1px 4px; letter-spacing: .04em; }
  .tabs .sep { margin: 16px 4px; }
}
@media (max-width: 1400px) and (min-width: 901px) {
  .tab { padding: 0 7px; }
  .tab .devtag { display: none; }          /* the page itself says Coming soon */
}
@media (max-width: 1650px) and (min-width: 901px) {
  .tab > svg { display: none; }
  .tab.on > svg { display: block; }
}
.tabs { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent); }

/* Phone: a Menu button lists every page; the tab strip below it still swipes sideways. */
.navmenu { display: none; }
.navmenu .pop a.cur { font-weight: 700; color: var(--ink); background: var(--accent-wash); }
@media (max-width: 760px) {
  .navmenu { display: block; }
  .navmenu > .pop { position: fixed; left: 12px; right: 12px; top: 56px; max-height: calc(100vh - 80px); overflow-y: auto; }
  .navmenu > .pop a { padding-top: 11px; padding-bottom: 11px; font-size: 15px; }
}
