/* Lumana dark design tokens (from the reference mockup) + page components.
   Logical properties throughout so the same CSS serves Hebrew (RTL) and English (LTR). */

:root {
  --font-sans: "Inter", "Heebo", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;

  --blue-100: #DDE3FD;
  --blue-200: #BDC7F9;
  --blue-300: #9BADF2;
  --blue-400: #748CED;
  --blue-500: #4367F7;
  --blue-700: #1F37B8;
  --blue-800: #112FA3;

  --navy-950: #0B1220;
  --navy-900: #0F1828;
  --navy-850: #141E30;
  --navy-800: #182336;
  --navy-700: #222D40;
  --navy-600: #2A3447;
  --navy-500: #354055;
  --navy-400: #485468;
  --navy-300: #5E6B82;
  --navy-200: #8A95A8;
  --navy-150: #9AA4B8;
  --navy-100: #C3CAD6;
  --off-white: #F9FAFB;

  --success: #22C55F;
  --success-bg: #123524;
  --success-tile: #1F8F4E;
  --warning: #F5A524;
  --warning-bg: #3A2A0E;
  --danger: #F0455B;
  --danger-bg: #3A1620;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 14px;
  --glow-accent: 0 0 0 3px rgba(67, 103, 247, .45);
  --shadow-pop: 0 8px 28px rgba(8, 12, 24, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--navy-950); color: var(--off-white); font-family: var(--font-sans); font-size: 14px; line-height: 1.45; }
#app { max-width: 1400px; margin: 0 auto; padding: 24px 28px 56px; display: flex; flex-direction: column; gap: 20px; }
#header { display: flex; flex-direction: column; gap: 14px; }
#main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible { outline: none; box-shadow: var(--glow-accent); }
h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
h2, h3 { margin: 0; }
p { margin: 0; }
pre { margin: 0; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.muted { color: var(--navy-150); font-size: 12px; }
.nowrap { white-space: nowrap; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row-sb { display: flex; align-items: center; justify-content: space-between; gap: 10px; inline-size: 100%; }
.wrap { flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[dir="rtl"] .ic.flip { transform: scaleX(-1); }
.ic { flex: 0 0 auto; }

/* Tones: containers read --tone; inline text takes the colour directly. */
.tone-ok { --tone: var(--success); --tone-bg: var(--success-bg); }
.tone-warn { --tone: var(--warning); --tone-bg: var(--warning-bg); }
.tone-bad { --tone: var(--danger); --tone-bg: var(--danger-bg); }
.tone-muted { --tone: var(--navy-300); --tone-bg: var(--navy-800); }
.tone-line { --tone: var(--navy-600); --tone-bg: transparent; }
b[class*="tone-"], span[class*="tone-"], td[class*="tone-"], li[class*="tone-"], .txt-tone, .donut-v { color: var(--tone); }
/* Before .fill-*, so "dot fill-bad" is red even outside a tone container. */
.dot { inline-size: 8px; block-size: 8px; border-radius: 999px; display: inline-block; flex: 0 0 8px; background: var(--tone, var(--navy-400)); }
.fill-ok { background: var(--success); }
.fill-warn { background: var(--warning); }
.fill-bad { background: var(--danger); }
.fill-muted { background: var(--navy-400); }
.stroke-ok { stroke: var(--success); }
.stroke-warn { stroke: var(--warning); }
.stroke-bad { stroke: var(--danger); }
.stroke-track { stroke: var(--navy-700); }

/* ---------- Controls ---------- */
.btn { min-height: 40px; padding: 0 14px; border-radius: var(--r-md); border: 1px solid var(--navy-500); background: var(--navy-800); color: var(--off-white);
  font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--blue-400); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--blue-400); border-color: var(--blue-400); color: var(--navy-950); }
.btn.primary:hover:not(:disabled) { background: var(--blue-300); }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 12.5px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--navy-100); }
.btn.ghost-danger { background: transparent; border-color: rgba(240, 69, 91, .5); color: #F6B8C2; }
#org-load .spinner { display: none; }
#org-load.busy .spinner { display: inline-block; }
.icon-btn { inline-size: 40px; block-size: 40px; border-radius: var(--r-md); border: 1px solid var(--navy-600); background: transparent; color: var(--navy-100);
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.link { background: none; border: 0; padding: 0; color: var(--off-white); font-weight: 600; text-align: start; text-decoration: underline; text-decoration-color: var(--navy-400); text-underline-offset: 3px; }
.link:hover { text-decoration-color: var(--blue-400); }
.sel, .search input { min-height: 40px; padding: 0 12px; background: var(--navy-800); color: var(--off-white); border: 1px solid var(--navy-500); border-radius: 10px; font-size: 14px; }
.sel.sm { min-height: 34px; font-size: 13px; padding: 0 8px; }
.lbl { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--navy-150); }
.search { position: relative; display: inline-flex; align-items: center; color: var(--navy-200); }
.search .ic { position: absolute; inset-inline-start: 11px; pointer-events: none; }
.search input { padding-inline-start: 34px; min-inline-size: 220px; inline-size: 100%; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--navy-100); cursor: pointer; }
.check input { inline-size: 16px; block-size: 16px; accent-color: var(--blue-400); }
.seg { display: inline-flex; background: var(--navy-800); border: 1px solid var(--navy-600); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { min-height: 32px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--navy-150); font-size: 13px; font-weight: 700; }
.seg button.on { background: var(--blue-800); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { min-height: 34px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid var(--navy-500); background: transparent; color: var(--navy-100);
  display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--blue-800); border-color: var(--blue-400); color: #fff; }
.chip-n { font-size: 11.5px; color: var(--navy-150); }
.chip:disabled { opacity: .45; cursor: default; }
.chip.on .chip-n { color: var(--blue-100); }
.tag { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: var(--r-sm); background: var(--tone-bg, var(--navy-700)); color: var(--tone, var(--navy-100)); white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--tone-bg); white-space: nowrap; }
.pill.sm { font-size: 12px; padding: 3px 9px; gap: 6px; }
.spinner { inline-size: 16px; block-size: 16px; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; display: inline-block;
  animation: spin .8s linear infinite; flex: 0 0 auto; vertical-align: -3px; }
.spinner.sm { inline-size: 12px; block-size: 12px; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* ---------- Header ---------- */
.hdr { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.ttl { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo { inline-size: 44px; block-size: 44px; border-radius: 12px; background: var(--navy-800); border: 1px solid var(--navy-600); display: flex; align-items: center; justify-content: center; color: var(--success); flex: 0 0 auto; }
.sub { font-size: 13px; color: var(--navy-150); }
.ctrls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.demo { font-size: 12px; font-weight: 600; color: var(--warning); background: var(--warning-bg); padding: 6px 12px; border-radius: 999px; }
.picker { position: relative; }
.picker-btn { min-inline-size: 230px; display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 600; }
.picker-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-inline-size: 260px; }
.picker-pop { position: absolute; inset-block-start: calc(100% + 6px); inset-inline-start: 0; z-index: 30; inline-size: max(100%, 300px); max-inline-size: calc(100vw - 32px);
  background: var(--navy-850); border: 1px solid var(--navy-500); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.picker-pop input { min-height: 38px; padding: 0 10px; background: var(--navy-800); border: 1px solid var(--navy-500); border-radius: var(--r-md); }
.picker-list { max-block-size: 340px; overflow-y: auto; display: flex; flex-direction: column; }
.picker-opt { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: transparent; text-align: start; }
.picker-opt:hover, .picker-opt:focus-visible { background: var(--navy-700); }
.picker-opt .muted { margin-inline-start: auto; }
.picker-empty { padding: 10px; }
.tabs { display: flex; gap: 4px; border-block-end: 1px solid var(--navy-600); }
.tabs button { min-height: 40px; padding: 0 16px; border: 0; background: transparent; color: var(--navy-150); font-weight: 600; border-block-end: 2px solid transparent; margin-block-end: -1px;
  display: inline-flex; align-items: center; gap: 8px; }
.tabs button.on { color: #fff; border-block-end-color: var(--blue-400); }
.tab-n { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--navy-700); color: var(--navy-100); }
.tab-n.bad { background: var(--danger-bg); color: var(--danger); }
.notice { padding: 10px 14px; border-radius: 10px; background: rgba(245, 165, 36, .08); border: 1px solid rgba(245, 165, 36, .35); color: #F7CD87; font-size: 13px; }
.notice.bad { background: rgba(240, 69, 91, .08); border-color: rgba(240, 69, 91, .45); color: #F6B8C2; }

/* ---------- Overview ---------- */
.crit { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; padding: 14px 18px; border-radius: var(--r-lg); background: linear-gradient(90deg, #5A1222, #3A1620); border: 1px solid var(--danger); }
[dir="rtl"] .crit { background: linear-gradient(270deg, #5A1222, #3A1620); }
.crit-ic { inline-size: 36px; block-size: 36px; border-radius: 999px; background: rgba(240, 69, 91, .18); display: flex; align-items: center; justify-content: center; color: var(--danger); }
.crit-tag { font-size: 11px; font-weight: 700; color: #1B0A0F; background: var(--danger); padding: 3px 8px; border-radius: 4px; }
.crit-tag.sm { font-size: 10px; padding: 2px 6px; margin-inline-start: auto; }
.crit-txt { flex: 1 1 260px; font-size: 14px; }
.crit-txt span { color: #F6B8C2; }
.crit-n { font-size: 12px; color: #F6B8C2; background: none; border: 0; display: inline-flex; align-items: center; gap: 4px; padding: 4px; }
.ghost.light { min-height: 36px; padding: 0 14px; border: 1px solid #F6B8C2; background: transparent; color: var(--off-white); border-radius: var(--r-md); font-size: 13px; font-weight: 600; }
.grid-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.tile { background: var(--navy-900); border: 1px solid color-mix(in srgb, var(--tone) 45%, transparent); border-radius: var(--r-xl); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; min-height: 140px; }
.tlabel { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--navy-150); }
.tval { display: flex; align-items: baseline; gap: 6px; color: var(--tone); direction: ltr; }
[dir="rtl"] .tval { justify-content: flex-end; }
.tval span { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.tval small { font-size: 18px; font-weight: 700; }
.bar { block-size: 6px; background: var(--navy-700); border-radius: 999px; overflow: hidden; inline-size: 100%; }
.bar > div { block-size: 100%; border-radius: 999px; }
.card { background: var(--navy-900); border: 1px solid var(--navy-600); border-radius: var(--r-xl); padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.h2 { font-size: 13px; font-weight: 700; letter-spacing: .05em; color: var(--navy-100); }
.h3 { font-size: 14px; font-weight: 700; color: var(--navy-100); }
.big { font-size: 22px; font-weight: 800; }
.page-title { font-size: 22px; font-weight: 700; }

/* Collapsible sections (PLAN-drilldown.md §4): the whole header band opens and closes. A closed one keeps
   its frame and title and shows a summary; in the three-card row the summary takes its own line. */
.card.sec { display: block; padding: 0; }
.sec-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: 52px; padding: 16px 20px; cursor: pointer; list-style: none;
  border-radius: calc(var(--r-xl) - 1px); }
.sec-head::-webkit-details-marker { display: none; }
.sec-head:hover { background: var(--navy-800); }
.sec[open] > .sec-head { border-end-start-radius: 0; border-end-end-radius: 0; }
.sec-chev { color: var(--navy-100); }
.sec:not([open]) .sec-chev { transform: rotate(-90deg); }
[dir="rtl"] .sec:not([open]) .sec-chev { transform: rotate(90deg); }
.sec-aside { margin-inline-start: auto; }
.sec-aside .big { line-height: 1; }
.sec-sum { display: flex; align-items: flex-start; gap: 8px; min-width: 0; font-size: 12.5px; color: var(--navy-100); }
.sec-sum .dot { margin-block-start: 5px; }
.sec.in-row .sec-sum { flex-basis: 100%; padding-inline-start: 26px; }
.sec[open] .sec-sum, .sec:not([open]) .sec-aside { display: none; }
.sec-body { display: flex; flex-direction: column; gap: 14px; padding: 0 20px 18px; min-width: 0; }
.grid3 > .sec:not([open]) { align-self: start; }

/* Clickable numbers (PLAN-drilldown.md §2): one target each, a faint chevron at the end that slides 2 px the
   reading way on hover, a lighter background, and a blue outline on keyboard focus. Zero counts stay plain. */
a.drill, button.drill { color: inherit; text-decoration: none; font: inherit; text-align: start; cursor: pointer; }
.drill:focus-visible { outline: 2px solid var(--blue-400); outline-offset: 2px; box-shadow: none; }
.chev { color: var(--navy-300); }
.drill:hover .chev { transform: translateX(2px); }
[dir="rtl"] .drill:hover .chev { transform: scaleX(-1) translateX(2px); }
@media (prefers-reduced-motion: no-preference) { .chev { transition: transform .12s; } }
.tile.drill:hover { border-color: color-mix(in srgb, var(--tone) 80%, transparent); background: var(--navy-850); }
.tile.drill[aria-pressed="true"] { border-color: var(--tone); box-shadow: inset 0 0 0 1px var(--tone); }
.tsub { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.leg { display: block; }
.leg.drill, .stale-link { border-radius: var(--r-md); padding: 4px 8px; margin: -4px -8px; }
.leg-v { display: flex; align-items: center; gap: 6px; }
.donut-row:has(.leg.drill:hover) circle:not(.stroke-track) { opacity: .3; }
.donut-row:has(.leg-ok:hover) circle.stroke-ok, .donut-row:has(.leg-warn:hover) circle.stroke-warn, .donut-row:has(.leg-bad:hover) circle.stroke-bad { opacity: 1; }
.hbar.drill { min-height: 44px; justify-content: center; padding: 6px 8px; margin-inline: -8px; border-radius: var(--r-md); }
.qrow.drill { min-height: 44px; padding-inline: 8px; margin-inline: -8px; border-radius: var(--r-md); }
.hbar.drill:hover, .qrow.drill:hover, .leg.drill:hover, .stale-link:hover { background: var(--navy-800); }
.hv { display: inline-flex; align-items: center; gap: 6px; }
.stale-link { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; }
.donut-row { display: flex; align-items: center; justify-content: space-around; gap: 16px; flex-wrap: wrap; }
.donut { position: relative; flex: 0 0 auto; }
.donut-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-v { font-size: 28px; font-weight: 800; }
.legend { display: flex; flex-direction: column; gap: 10px; }
.leg-l { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--navy-150); }
.leg-v { font-size: 22px; font-weight: 800; padding-inline-start: 16px; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.hbar.zero { color: var(--navy-300); }
.qrows { display: flex; flex-direction: column; gap: 4px; }
.qrow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-block-end: 1px solid var(--navy-700); font-size: 13px; }
.qrow:last-child { border-block-end: 0; }
.q-l { flex: 1 1 auto; }
.qrow b { font-size: 15px; }
.top-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 6px 28px; }
.topb { display: flex; flex-direction: column; gap: 6px; background: none; border: 0; padding: 8px 0; color: inherit; text-align: start; inline-size: 100%; }
.topb:hover .tb-n { text-decoration: underline; text-decoration-color: var(--navy-400); }
.tb-n { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; min-width: 0; }
.loc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 12px; }
.loc-card { display: flex; flex-direction: column; gap: 6px; text-align: start; background: var(--navy-850); border: 1px solid var(--navy-600); border-inline-start: 4px solid var(--tone);
  border-radius: 10px; padding: 12px 14px; color: inherit; min-width: 0; }
.loc-card:hover { border-color: var(--navy-400); border-inline-start-color: var(--tone); background: var(--navy-800); }
.loc-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.loc-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loc-stats { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--navy-100); }
.loc-stats b { font-weight: 700; }
.loc-note { font-size: 11.5px; color: var(--warning); }
.stack { display: flex; block-size: 6px; border-radius: 999px; overflow: hidden; background: var(--navy-700); }
.empty { padding: 22px; text-align: center; font-size: 14px; color: var(--navy-150); }
.empty.ok { color: var(--success); }
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 60px 0; color: var(--navy-150); }
.welcome { align-items: flex-start; padding: 28px; gap: 12px; max-inline-size: 640px; }
.legend-row { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--navy-150); }
.legend-row span { display: flex; align-items: center; gap: 6px; }
.legend-row i { inline-size: 12px; block-size: 12px; border-radius: 3px; display: inline-block; }
.legend-row i.fill-ok, .sq.fill-ok { background: var(--success-tile); }
.stale-key { outline: 2px dashed var(--warning); outline-offset: -2px; }

/* ---------- Location page ---------- */
.loc-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.loc-title { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.back { min-height: 40px; padding: 0 14px; border: 1px solid var(--navy-500); background: var(--navy-900); color: var(--navy-100); border-radius: var(--r-md); font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px; }
.grid-tiles.four { grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.cores { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 12px; }
.core { background: var(--navy-850); border: 1px solid var(--tone); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.core.tone-line { border-color: var(--navy-600); }
.core.flash { outline: 2px solid var(--blue-400); outline-offset: 2px; }
.core-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 13px; }
.core-name { display: inline-flex; align-items: center; gap: 8px; inline-size: 100%; }
.core-load { display: inline-flex; align-items: center; gap: 6px; }
.core-load .bar { inline-size: 70px; }
.sqs { display: flex; flex-wrap: wrap; gap: 5px; }
.sq { inline-size: 26px; block-size: 26px; border-radius: 5px; border: 0; padding: 0; }
.sq:hover, .sq:focus-visible { outline: 2px solid var(--off-white); outline-offset: 1px; box-shadow: none; }
.sq.stale { outline: 2px dashed var(--warning); outline-offset: 1px; }
.tbl-wrap { position: relative; overflow-x: auto; margin-inline: -4px; }
.tbl { inline-size: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: start; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; color: var(--navy-150); padding: 8px; border-block-end: 1px solid var(--navy-600); white-space: nowrap; }
.tbl td { padding: 8px; border-block-end: 1px solid var(--navy-700); vertical-align: middle; white-space: nowrap; }
.tbl tr:hover td { background: var(--navy-850); }
.tbl td.issues { min-inline-size: 180px; color: var(--navy-100); white-space: normal; }
.th-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; letter-spacing: inherit; white-space: nowrap; }
.cstat { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.toolbar { gap: 10px; }

/* ---------- Cameras and Cores lists (PLAN-drilldown.md §2) ---------- */
.list .toolbar .search { flex: 1 1 300px; max-inline-size: 420px; }
.chips-l { font-size: 12px; font-weight: 700; color: var(--navy-150); margin-inline-end: 2px; }
.chip .ic { margin-inline-start: 2px; }
.more { justify-content: center; gap: 12px; }
.row.center { justify-content: center; }
h2[tabindex="-1"]:focus { outline: none; }   /* headings take focus only to start reading there */
.mlink { background: none; border: 0; padding: 0; color: var(--navy-150); font-size: 12px; text-decoration: underline; text-decoration-color: var(--navy-400); text-underline-offset: 3px; }
.mlink:hover { color: var(--off-white); text-decoration-color: var(--blue-400); }

/* ---------- Camera panel ---------- */
dialog { color: var(--off-white); }
dialog::backdrop { background: rgba(5, 8, 16, .62); }
.drawer { position: fixed; margin: 0; inset-block: 0; inset-inline-start: auto; inset-inline-end: 0; block-size: 100%; max-block-size: none; inline-size: min(580px, 100vw); max-inline-size: 100vw;
  padding: 0; border: 0; border-inline-start: 1px solid var(--navy-600); background: var(--navy-900); box-shadow: var(--shadow-pop); overflow-y: auto; }
.panel-head { position: sticky; inset-block-start: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px; background: var(--navy-900); border-block-end: 1px solid var(--navy-600); }
.panel-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; }
.panel-title h2 { font-size: 19px; overflow-wrap: anywhere; }
.panel-body { padding: 4px 20px 28px; display: flex; flex-direction: column; }
.panel-sec { display: flex; flex-direction: column; gap: 12px; padding: 18px 0; border-block-end: 1px solid var(--navy-700); }
.panel-sec:last-child { border-block-end: 0; }
.panel-sec.ping.highlight { margin-block-start: 12px; padding: 16px; border: 1px solid rgba(240, 69, 91, .55); border-radius: var(--r-lg); background: rgba(240, 69, 91, .05); }
.issues-list { margin: 0; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.kvs { display: flex; flex-direction: column; gap: 2px; }
.kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 5px 0; font-size: 13px; }
.kv > span:last-child { text-align: end; overflow-wrap: anywhere; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.comps { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 8px; }
.comp { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--navy-850); border: 1px solid color-mix(in srgb, var(--tone) 40%, transparent); }
.comp.excluded { opacity: .7; border-style: dashed; }
.comp-name { font-size: 12px; color: var(--navy-150); font-weight: 600; }
.comp .cstat { font-weight: 700; color: var(--tone); }
.comp-why { font-size: 11.5px; color: var(--navy-200); }
.streams { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; }
.stream { background: var(--navy-850); border-radius: 10px; padding: 10px 12px; }
.stream-t { font-size: 12px; font-weight: 700; color: var(--navy-100); padding-block-end: 4px; }
.loads { display: flex; flex-direction: column; gap: 6px; }
.ping-res { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 10px; background: var(--tone-bg); border: 1px solid color-mix(in srgb, var(--tone) 50%, transparent); }
.ping-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--tone); }
.ping-head b { font-size: 15px; }
.ping-head .muted { margin-inline-start: auto; }
.ping-detail { font-size: 13px; }
.verdict { font-size: 13px; padding: 10px 12px; border-radius: var(--r-md); background: rgba(11, 18, 32, .55); color: var(--off-white); }
details.raw summary { cursor: pointer; font-size: 12.5px; color: var(--navy-150); }
details.raw pre { margin-block-start: 8px; }

/* ---------- API log ---------- */
pre { white-space: pre-wrap; word-break: break-all; font-family: var(--font-mono); font-size: 12px; line-height: 1.5; background: var(--navy-950); border: 1px solid var(--navy-700);
  border-radius: var(--r-md); padding: 10px 12px; max-block-size: 360px; overflow: auto; direction: ltr; text-align: left; }
pre.body { max-block-size: 480px; }
.log-head, .log-line { display: grid; grid-template-columns: 70px 52px minmax(0, 1.6fr) 74px 64px 64px minmax(0, 1fr); gap: 10px; align-items: center; }
.log-head { padding: 0 12px; font-size: 11.5px; font-weight: 700; color: var(--navy-150); letter-spacing: .03em; }
.log-group { border: 1px solid var(--navy-700); border-radius: 10px; overflow: hidden; }
.log-group.single { border-style: dashed; }
.log-gt { padding: 8px 12px; font-size: 12px; font-weight: 700; color: var(--navy-100); background: var(--navy-850); border-block-end: 1px solid var(--navy-700); }
.log-row + .log-row { border-block-start: 1px solid var(--navy-700); }
.log-line { inline-size: 100%; padding: 8px 12px; border: 0; background: transparent; text-align: start; font-size: 12.5px; }
.log-line:hover, .log-row.open .log-line { background: var(--navy-850); }
.log-row.failed .log-line { box-shadow: inset 3px 0 0 var(--danger); }
[dir="rtl"] .log-row.failed .log-line { box-shadow: inset -3px 0 0 var(--danger); }
.l-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.l-method { font-weight: 700; }
.m-get { color: var(--blue-300); }
.m-post { color: var(--warning); }
.l-sum { color: var(--navy-100); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-detail { padding: 4px 12px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--navy-850); }
.ld-sec { display: flex; flex-direction: column; gap: 6px; }
.ld-t { font-size: 11.5px; font-weight: 700; color: var(--navy-150); letter-spacing: .03em; }

/* ---------- Load org dialog ---------- */
.dlg { inline-size: min(460px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--navy-500); border-radius: 16px; background: var(--navy-900); box-shadow: var(--shadow-pop); }
.dlg form { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.dlg h2 { font-size: 19px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--navy-100); }
.field input { min-height: 42px; padding: 0 12px; background: var(--navy-800); border: 1px solid var(--navy-500); border-radius: 10px; font-size: 14px; font-weight: 400; }
.field input::placeholder { color: var(--navy-300); }
.form-error { padding: 10px 12px; border-radius: var(--r-md); background: var(--danger-bg); color: #F6B8C2; font-size: 13px; }
.note { font-size: 12px; color: #F7CD87; background: rgba(245, 165, 36, .08); border: 1px solid rgba(245, 165, 36, .3); border-radius: var(--r-md); padding: 8px 10px; }
.dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 4px; }

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  #app { padding: 16px; gap: 16px; }
  .ctrls { inline-size: 100%; }
  .picker { flex: 1 1 100%; }
  .picker-btn { inline-size: 100%; min-inline-size: 0; }
  .search, .search input { min-inline-size: 0; inline-size: 100%; }
  .tval span { font-size: 34px; }
  .log-head { display: none; }
  .log-line { grid-template-columns: auto auto 1fr auto; grid-template-areas: "time method status dur" "path path path path" "sum sum sum sum"; row-gap: 4px; }
  .l-time { grid-area: time; } .l-method { grid-area: method; } .l-status { grid-area: status; justify-self: end; } .l-dur { grid-area: dur; }
  .l-path { grid-area: path; } .l-sum { grid-area: sum; } .l-size { display: none; }
  .panel-body { padding-inline: 16px; }
  .panel-head { padding: 14px 16px; }
  /* Lists: issue chips scroll sideways, and table rows become cards. */
  .chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-block-end: 4px; }
  .chips.scroll > * { flex: 0 0 auto; }
  .ltbl thead { display: none; }
  .ltbl, .ltbl tbody { display: block; }
  .ltbl tr { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 10px; padding: 12px 4px; border-block-end: 1px solid var(--navy-700); }
  .ltbl tr::before { content: ''; flex-basis: 100%; order: 4; }
  .ltbl td { display: block; padding: 0; border: 0; white-space: normal; }
  .ltbl tr:hover td { background: none; }
  .ltbl .c-state { order: 1; }
  .ltbl .c-name { order: 2; flex: 1 1 0; min-width: 0; }
  .ltbl .c-act { order: 3; }
  .ltbl .c-loc { order: 5; }
  .ltbl .c-core { order: 6; }
  .ltbl .c-core::before { content: '· '; color: var(--navy-300); }
  .ltbl .c-issues, .ltbl .c-last { flex-basis: 100%; min-inline-size: 0; }
  .ltbl .c-issues { order: 7; }
  .ltbl .c-last { order: 8; }
  .ltbl .c-fps, .ltbl .c-drop, .ltbl .c-issues.none { display: none; }
  .ctbl .c-loc { flex-basis: 100%; }
  .ltbl .c-cams, .ltbl .c-load, .ltbl .c-link { order: 6; }
}
@media (min-width: 721px) {
  .ltbl .c-link .muted { display: none; }   /* the column header names it */
}

/* ---------- The hosted edition (PLAN-hosted.md §2) ---------- */
/* Sign-in and access: a centred card, with the language switch in the corner. */
.gate-top { display: flex; justify-content: flex-end; }
.gate { align-self: center; inline-size: min(440px, 100%); margin-block-start: 6vh; padding: 28px; gap: 16px; }
.gate-ttl { display: flex; align-items: center; gap: 12px; }
.gate-ttl h1:focus { outline: none; }
.gate-msg { font-size: 15px; font-weight: 600; }
.gate-who { overflow-wrap: anywhere; }
/* Google's sign-in button, dark theme (Google's branding guidelines): its own colours and "G". */
.gbtn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding: 0 16px; border-radius: 4px;
  background: #131314; border: 1px solid #8E918F; color: #E3E3E3; font: 500 14px/20px Roboto, Arial, sans-serif; text-decoration: none; align-self: flex-start; }
.gbtn:hover { background: #1E1F20; }
.gbtn:focus-visible { outline: none; box-shadow: var(--glow-accent); }
.field textarea { min-height: 64px; padding: 10px 12px; background: var(--navy-800); border: 1px solid var(--navy-500); border-radius: 10px; font: inherit; font-size: 14px; font-weight: 400; color: inherit; resize: vertical; }
.field.inline { flex-direction: row; }
.field.inline input { min-inline-size: 240px; }
/* The header: freshness and the account menu. */
.late { display: inline-flex; align-items: center; gap: 6px; color: var(--warning); }
.acct { position: relative; }
.acct-btn { gap: 8px; padding-inline: 6px 12px; }
.acct-i { inline-size: 28px; block-size: 28px; border-radius: 999px; background: var(--blue-800); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.acct-email { max-inline-size: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-pop { position: absolute; inset-block-start: calc(100% + 6px); inset-inline-end: 0; z-index: 30; min-inline-size: 240px; max-inline-size: calc(100vw - 32px);
  display: flex; flex-direction: column; gap: 6px; padding: 14px; background: var(--navy-900); border: 1px solid var(--navy-500); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); }
.acct-pop .btn { margin-block-start: 8px; }
.acct-name { font-weight: 700; overflow-wrap: anywhere; }
.acct-pop .muted { overflow-wrap: anywhere; }
.tabs a { min-height: 40px; padding: 0 16px; display: inline-flex; align-items: center; gap: 6px; color: var(--navy-150); font-weight: 600; text-decoration: none;
  border-block-end: 2px solid transparent; margin-block-end: -1px; }
.tabs a.on { color: #fff; border-block-end-color: var(--blue-400); }
.tabs a:focus-visible { outline: none; box-shadow: var(--glow-accent); }
.tab-n.warn { background: var(--warning-bg); color: var(--warning); }
/* The admin tabs. */
.chip[aria-pressed="true"] { background: var(--blue-800); border-color: var(--blue-400); color: #fff; }
.dchip { gap: 4px; padding-inline-end: 4px; }
.icon-btn.xs { inline-size: 26px; block-size: 26px; border: 0; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn.xs:hover { color: var(--danger); }
.confirm { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 10px;
  background: rgba(240, 69, 91, .08); border: 1px solid rgba(240, 69, 91, .45); }
.alist { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.alist li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding-block: 4px; border-block-end: 1px solid var(--navy-700); }
.alist .btn { margin-inline-start: auto; }
.atbl td.a-note, .atbl td.a-how { white-space: normal; min-inline-size: 160px; }
.atbl tr.a-out td { color: var(--navy-200); }
.u-line { font-size: 14px; font-weight: 600; }
.ucalls { font-size: 12.5px; }
.ucalls td.u-sum { white-space: normal; color: var(--navy-100); }
.ucalls tr.u-bad td { background: rgba(240, 69, 91, .06); }
.uruns tr.u-calls > td { background: var(--navy-850); white-space: normal; padding: 10px 12px 14px; }
@media (max-width: 720px) {
  .acct-email { display: none; }
  .acct-btn { padding-inline: 6px; }
  .gate { margin-block-start: 2vh; padding: 22px; }
  .field.inline, .field.inline input { min-inline-size: 0; flex: 1 1 auto; }
}
/* Below 600 px the admin tables become cards, like the lists. */
@media (max-width: 600px) {
  .atbl thead { display: none; }
  .atbl, .atbl tbody { display: block; }
  .atbl tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 12px 4px; border-block-end: 1px solid var(--navy-700); }
  .atbl td { display: block; padding: 0; border: 0; white-space: normal; }
  .atbl tr:hover td { background: none; }
  .atbl td.a-name { font-weight: 700; flex: 1 1 auto; }
  .atbl td.a-email, .atbl td.a-note, .atbl td.a-how, .atbl td.a-when { flex-basis: 100%; min-inline-size: 0; }
  .atbl td.a-act { flex-basis: 100%; }
  .uruns tr.u-calls { display: block; }
  .uruns tr.u-calls > td { flex-basis: 100%; }
}
