/* ============================================================================
   SPDT console shell — shared by index.html (ICCC) and
   digital-twin-simulation.html (3D simulation).

   DESIGN NOTE (travels with the file, same as geotwin-command-center.html):
   Subject is a physical Integrated Command & Control Centre video wall, so
   the layout is a fixed control-room shell rather than panels floating over
   a map: a top bar (identity, page tabs, IST clock, link state), a KPI strip
   an operator can read across in one glance, then three columns — layers on
   the left, the twin in the middle, intelligence (ghats / alerts / decision
   support) on the right. The map is never covered by anything the operator
   did not ask for; the rails collapse to give it the full width.

   Tokens are identical to the Command Center: graphite base, amber as the one
   bold accent (primary actions + active state only), cyan for live links and
   focus, ok/warn/crit strictly functional. Space Grotesk for labels,
   JetBrains Mono with tabular figures for every number and code tag.
   ========================================================================== */
:root {
  --bg: #0a0e14;
  --bg-grid: #0d1219;
  --panel: #111823;
  --panel-2: #0d131c;
  --panel-hover: #161f2c;
  --glass: rgba(13, 19, 28, 0.9);
  --border: #1e2733;
  --border-strong: #2c3847;
  --text: #e8edf2;
  --text-dim: #8b96a5;
  --text-faint: #56627a;
  --amber: #ffb020;
  --amber-ink: #1a1200;
  --cyan: #4dd8ff;
  --ok: #35d488;
  --warn: #ffb020;
  --crit: #ff5470;
  /* Type from the Pushkara Netra design (index.html): Segoe UI for UI text,
     Marcellus SC for display/headline figures, Consolas for data. The palette
     stays dark — a map read for hours wants the dark ground. */
  --mono: Consolas, Menlo, 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --display: 'Marcellus SC', Georgia, serif;
  --saffron: #f59e0b;
  --saffron-dim: #b45309;
  --left: 280px;
  --right: 352px;
  --topbar: 66px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 13px; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---- shell grid ------------------------------------------------------------ */
body.console {
  display: grid;
  grid-template-rows: var(--topbar) auto 1fr;
  height: 100vh;
  overflow: hidden;
}
.workspace {
  display: grid;
  grid-template-columns: var(--left) minmax(0, 1fr) var(--right);
  min-height: 0;
  transition: grid-template-columns .22s ease;
}
body.left-collapsed  { --left: 0px; }
body.right-collapsed { --right: 0px; }

/* ---- top bar: Pushkara Netra identity on the dark console ------------------
   Same structure as the landing page and Command Center — AP emblem, Pushkaralu
   logo, government line, gradient wordmark, pill nav, status pill — rendered in
   the console's dark palette so the workspace below keeps its contrast. */
/* The national strip is drawn by the bar itself rather than as a sibling
   element — a page that omitted the element would otherwise lose a grid row
   and squash its own header. */
.tricolor { display: none; }
.topbar {
  position: relative;
  display: flex; align-items: center; gap: 18px;
  padding: 3px 16px 0; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #121a26 0%, var(--bg) 100%);
}
.topbar::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg,#f59e0b 0%,#f59e0b 33%,#f8fafc 33%,#f8fafc 66%,#16a34a 66%,#16a34a 100%);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 1 auto; overflow: hidden; }
.brand .crest {
  width: 42px; height: 42px; border-radius: 50%; flex: 0 0 auto; padding: 2px;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  animation: pnGlow 3s ease-in-out infinite;
}
.brand .crest img { width: 100%; height: 100%; border-radius: 50%; background: #fff; object-fit: contain; padding: 2px; }
.brand .pushkaralu { width: 42px; height: 42px; object-fit: contain; flex: 0 0 auto; animation: pnFloat 4.5s ease-in-out infinite; }
@keyframes pnGlow { 0%,100% { box-shadow: 0 0 0 0 rgba(251,191,36,.35); } 50% { box-shadow: 0 0 14px 2px rgba(251,191,36,.3); } }
@keyframes pnFloat { 0%,100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-4px) rotate(1.5deg); } }
.brand .leading { display: flex; flex-direction: column; justify-content: center; line-height: 1.15; min-width: 0; overflow: hidden; }
.brand .gov, .brand h1, .brand .sub { overflow: hidden; text-overflow: ellipsis; }
.brand .gov { font-size: 9px; letter-spacing: .24em; color: var(--saffron); font-weight: 600; white-space: nowrap; }
.brand h1 {
  margin: 1px 0 0; font-family: var(--display); font-size: 19px; font-weight: 400;
  letter-spacing: .02em; white-space: nowrap;
  background: linear-gradient(90deg, #fbbf24, #e8edf2 45%, #4dd8ff 75%, #fbbf24);
  background-size: 200% auto; -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: pnTitle 9s linear infinite;
}
@keyframes pnTitle { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }
.brand .sub { color: var(--text-dim); font-size: 11px; white-space: nowrap; }
.tabs { display: flex; align-items: center; gap: 4px; margin-left: 4px; flex: 0 0 auto; }
.tabs a {
  display: flex; align-items: center; padding: 6px 14px; border-radius: 999px;
  color: var(--text-dim); font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
.tabs a:hover { color: var(--text); background: var(--panel-hover); text-decoration: none; }
.tabs a[aria-current="page"] { color: #0a0e14; background: var(--amber); font-weight: 600; }
.topbar .status { margin-left: auto; display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 12px; color: var(--text-dim); }
.conn {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 13px; border-radius: 999px; font-family: var(--sans); font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--text-dim);
  letter-spacing: .04em; text-transform: uppercase;
}
.conn.live { border-color: rgba(53,212,136,.4); background: rgba(53,212,136,.1); color: var(--ok); }
.conn.wait { border-color: rgba(255,176,32,.4); background: rgba(255,176,32,.1); color: var(--warn); }
.conn.down { border-color: rgba(255,84,112,.4); background: rgba(255,84,112,.1); color: var(--crit); }
.conn .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); transition: background .4s, box-shadow .4s; animation: pnPulse 1.6s ease-in-out infinite; }
@keyframes pnPulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.conn.live .dot { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.conn.down .dot { background: var(--crit); }
.conn.wait .dot { background: var(--warn); }

/* ---- KPI strip ---------------------------------------------------------------- */
.kpis {
  display: flex; border-bottom: 1px solid var(--border); background: var(--panel-2);
  overflow-x: auto; scrollbar-width: none;
}
.kpis::-webkit-scrollbar { display: none; }
.kpi { flex: 1 0 auto; padding: 9px 14px 10px; border-right: 1px solid var(--border); min-width: 96px; }
.kpi:last-child { border-right: 0; }
.kpi .l { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; color: var(--text-faint); text-transform: uppercase; white-space: nowrap; }
.kpi .v { font-family: var(--display); font-variant-numeric: tabular-nums; font-size: 21px; font-weight: 400; margin-top: 1px; white-space: nowrap; letter-spacing: .01em; }
.kpi .v small { font-size: 11px; font-weight: 400; color: var(--text-dim); margin-left: 4px; }
.kpi.wide { flex-grow: 2; }
.kpi .v.sm { font-size: 13px; font-weight: 500; padding-top: 4px; }
.ok-t { color: var(--ok); } .warn-t { color: var(--warn); } .crit-t { color: var(--crit); } .dim-t { color: var(--text-dim); }

/* ---- rails -------------------------------------------------------------------- */
.rail { background: var(--panel); display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; }
.rail.left { border-right: 1px solid var(--border); }
.rail.right { border-left: 1px solid var(--border); }
body.left-collapsed .rail.left, body.right-collapsed .rail.right { border: 0; }
.rail-head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  border-bottom: 1px solid var(--border);
}
.rail-head h2 { margin: 0; font-family: var(--display); font-size: 14px; font-weight: 400; letter-spacing: .02em; }
.rail-head .meta { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.rail-body { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.rail-body::-webkit-scrollbar, .scroll::-webkit-scrollbar { width: 8px; }
.rail-body::-webkit-scrollbar-thumb, .scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; border: 2px solid var(--panel); }

.section { border-bottom: 1px solid var(--border); padding: 14px; }
.section:last-child { border-bottom: 0; }
.section-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 0 0 10px; font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim);
}
.section-title .aside { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text-faint); }

/* right-rail tabs */
.rtabs { flex: 0 0 auto; display: flex; border-bottom: 1px solid var(--border); }
.rtabs button {
  flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  padding: 11px 6px 10px; font-size: 12px; font-weight: 500; color: var(--text-dim); cursor: pointer;
}
.rtabs button:hover { color: var(--text); }
.rtabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--amber); }
.rtabs .badge { font-family: var(--mono); font-size: 10px; margin-left: 5px; padding: 1px 5px; border-radius: 8px; background: var(--border-strong); color: var(--text-dim); }
.rtabs .badge.crit { background: rgba(255,84,112,.18); color: var(--crit); }
.tabpanel { flex: 1 1 auto; overflow-y: auto; min-height: 0; }

/* ---- controls ------------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 12px; border-radius: 3px; border: 1px solid var(--border-strong);
  background: var(--panel-2); font-size: 12px; cursor: pointer; transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--text-faint); background: var(--panel-hover); }
.btn.primary { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.block { width: 100%; }
.btn.sm { padding: 4px 8px; font-size: 11px; }
.btn:disabled { opacity: .5; cursor: default; }
.seg { display: flex; border: 1px solid var(--border-strong); border-radius: 3px; overflow: hidden; }
.seg button { flex: 1; background: var(--panel-2); border: 0; border-right: 1px solid var(--border-strong); padding: 6px 8px; font-size: 11.5px; font-family: var(--mono); cursor: pointer; color: var(--text-dim); }
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--amber); color: var(--amber-ink); font-weight: 600; }
.input {
  width: 100%; padding: 7px 10px; background: var(--panel-2); border: 1px solid var(--border-strong);
  border-radius: 3px; font-size: 12px;
}
.input::placeholder { color: var(--text-faint); }

/* toggle switch built on a real checkbox */
.switch { position: relative; flex: 0 0 auto; width: 26px; height: 14px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 7px; background: var(--border-strong); transition: background .15s; pointer-events: none; }
.switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--text-dim); transition: transform .15s, background .15s; }
.switch input:checked + i { background: rgba(77,216,255,.28); }
.switch input:checked + i::after { transform: translateX(12px); background: var(--cyan); }
.switch input:focus-visible + i { outline: 2px solid var(--cyan); outline-offset: 1px; }

/* status pill + tag */
.pill { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 10.5px; padding: 2px 7px; border-radius: 10px; border: 1px solid; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); border-color: rgba(53,212,136,.35); }
.pill.warn { color: var(--warn); border-color: rgba(255,176,32,.35); }
.pill.crit { color: var(--crit); border-color: rgba(255,84,112,.4); }
.tag { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .06em; color: var(--text-dim); border: 1px solid var(--border-strong); border-radius: 3px; padding: 1px 5px; white-space: nowrap; }

/* ---- layer list ------------------------------------------------------------------ */
.layer-tools { display: flex; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.layer-group { border-bottom: 1px solid var(--border); }
.group-head {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  background: none; border: 0; cursor: pointer; text-align: left;
}
.group-head:hover { background: var(--panel-hover); }
.group-head .chev { width: 10px; color: var(--text-faint); transition: transform .15s; font-size: 10px; }
.layer-group.collapsed .chev { transform: rotate(-90deg); }
.layer-group.collapsed .group-body { display: none; }
.group-head .gt { font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); }
.group-head .gm { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); }
.group-body { padding: 0 6px 8px; }
.layer {
  display: grid; grid-template-columns: 26px 1fr auto auto; align-items: center; gap: 9px;
  padding: 6px 8px; border-radius: 3px;
}
.layer:hover { background: var(--panel-hover); }
.layer .ln { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.layer .ln .code { font-family: var(--mono); font-size: 10px; color: var(--text-faint); margin-left: 6px; }
.layer.off .ln { color: var(--text-faint); }
.layer .lc { font-family: var(--mono); font-size: 11px; color: var(--text-faint); min-width: 34px; text-align: right; }
.layer .lc b { font-weight: 600; }
.layer .lz { background: none; border: 0; color: var(--text-faint); cursor: pointer; padding: 2px 3px; border-radius: 3px; font-size: 13px; line-height: 1; opacity: 0; }
.layer:hover .lz, .layer .lz:focus-visible { opacity: 1; }
.layer .lz:hover { color: var(--cyan); }

/* ---- stage (map column) --------------------------------------------------------- */
.stage { position: relative; min-width: 0; min-height: 0; background: var(--bg); overflow: hidden; }
#cesiumContainer { position: absolute; inset: 0; }
.overlay { position: absolute; z-index: 5; }
.glass { background: var(--glass); border: 1px solid var(--border-strong); border-radius: 4px; backdrop-filter: blur(8px); }
.map-tl { top: 12px; left: 12px; display: flex; gap: 8px; align-items: center; }
.map-tr { top: 12px; right: 12px; display: flex; gap: 6px; }
.map-tr .btn, .map-tl .btn { background: var(--glass); backdrop-filter: blur(8px); }
.basemap .seg button { background: transparent; }
.basemap { padding: 3px; }
.basemap .seg { border: 0; gap: 2px; }
.basemap .seg button { border: 0; border-radius: 2px; padding: 5px 10px; font-family: var(--sans); }
.basemap .seg button.active { background: var(--amber); color: var(--amber-ink); }


/* map controls: zoom / tilt / compass / home, clear of the rail toggle at right:0 */
.map-ctl { right: 34px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 7px; }
.map-ctl .ctl-group { display: flex; flex-direction: column; overflow: hidden; }
.map-ctl button {
  width: 32px; height: 30px; display: grid; place-items: center; padding: 0;
  background: transparent; border: 0; border-bottom: 1px solid var(--border);
  color: var(--text-dim); cursor: pointer; line-height: 1;
}
.map-ctl button:last-child { border-bottom: 0; }
.map-ctl button:hover { color: var(--text); background: var(--panel-hover); }
.map-ctl button:active { background: var(--amber); color: var(--amber-ink); }
.map-ctl button:focus-visible { outline: 1px solid var(--amber); outline-offset: -1px; }
.map-ctl .pm { font-family: var(--sans); font-size: 17px; font-weight: 400; }
.map-ctl svg { width: 17px; height: 17px; }
.map-ctl .compass { height: 34px; }
.map-ctl .compass svg { width: 19px; height: 19px; transition: transform .12s linear; }
.map-ctl .scale { padding: 5px 6px 6px; text-align: center; font-family: var(--mono); font-size: 9.5px; color: var(--text-faint); }
.map-ctl .scale .bar { height: 4px; border: 1px solid var(--text-faint); border-top: 0; margin: 0 auto 3px; min-width: 18px; max-width: 92px; }
.map-ctl .scale .alt { margin-top: 2px; opacity: .8; }

.rail-toggle {
  position: absolute; z-index: 6; top: 50%; transform: translateY(-50%);
  width: 16px; height: 48px; padding: 0; border: 1px solid var(--border-strong);
  background: var(--glass); color: var(--text-dim); cursor: pointer; font-size: 10px;
}
.rail-toggle:hover { color: var(--text); border-color: var(--text-faint); }
.rail-toggle.l { left: 0; border-left: 0; border-radius: 0 4px 4px 0; }
.rail-toggle.r { right: 0; border-right: 0; border-radius: 4px 0 0 4px; }

.legend { bottom: 30px; right: 12px; padding: 8px 12px; display: flex; gap: 14px; font-size: 11.5px; color: var(--text-dim); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* entity detail card */
.detail { top: 60px; left: 12px; width: 300px; padding: 14px; }
.detail .d-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.detail .d-layer { font-size: 11.5px; color: var(--text-dim); }
.detail .close { margin-left: auto; background: none; border: 0; color: var(--text-faint); cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 4px; }
.detail .close:hover { color: var(--text); }
.detail .d-name { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.detail .d-readout { font-family: var(--mono); font-size: 12px; color: var(--text); line-height: 1.55; margin: 10px 0; padding: 9px 10px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 3px; }
.detail .d-meta { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); line-height: 1.6; }
.detail .d-actions { display: flex; gap: 6px; margin-top: 12px; }

/* assistant command bar */
.assistant { left: 50%; transform: translateX(-50%); bottom: 30px; width: min(720px, calc(100% - 200px)); }
.assistant .answer { margin-bottom: 8px; padding: 11px 36px 11px 13px; font-family: var(--mono); font-size: 12px; line-height: 1.55; position: relative; max-height: 160px; overflow-y: auto; }
.assistant .answer .close { position: absolute; top: 6px; right: 6px; background: none; border: 0; color: var(--text-faint); cursor: pointer; font-size: 15px; }
.assistant .bar { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; }
.assistant .bar .prompt { font-family: var(--mono); color: var(--amber); font-weight: 700; }
.assistant .bar input { flex: 1; background: none; border: 0; outline: none; padding: 6px 0; font-size: 13px; }
.assistant .bar input::placeholder { color: var(--text-faint); }
.assistant .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; justify-content: center; }
.chip { background: var(--glass); border: 1px solid var(--border-strong); border-radius: 12px; padding: 3px 9px; font-size: 10.5px; color: var(--text-dim); cursor: pointer; backdrop-filter: blur(8px); }
.chip:hover { color: var(--text); border-color: var(--text-faint); }

/* ---- feeds & cards ------------------------------------------------------------------ */
.filters { display: flex; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.filters .chip { background: var(--panel-2); backdrop-filter: none; }
.filters .chip.active { color: var(--text); border-color: var(--cyan); }
.feed { padding: 6px 8px 10px; }
.feed-empty { padding: 26px 14px; text-align: center; color: var(--text-faint); font-size: 12px; }
.alert {
  display: grid; grid-template-columns: 3px 1fr; gap: 10px; padding: 9px 8px; border-radius: 3px; cursor: default;
}
/* Only the newly arrived alert animates — the list is re-rendered on every
   event, and animating every row each time made the whole feed flicker. */
.alert.fresh { animation: slidein .25s ease; }
.alert.locatable { cursor: pointer; }
.alert:hover { background: var(--panel-hover); }
.alert .sev { border-radius: 2px; background: var(--text-faint); }
.alert.crit .sev { background: var(--crit); } .alert.warn .sev { background: var(--warn); } .alert.ok .sev { background: var(--ok); }
.alert .msg { font-size: 12.5px; line-height: 1.4; }
.alert .meta { display: flex; gap: 8px; align-items: center; margin-top: 4px; font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); }
@keyframes slidein { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.ghat { padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.ghat:hover { background: var(--panel-hover); }
.ghat:last-child { border-bottom: 0; }
.ghat .g-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.ghat .g-name { font-size: 12.5px; font-weight: 500; }
.ghat .g-meta { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); margin-top: 6px; }
.meter { position: relative; height: 5px; background: var(--border-strong); border-radius: 3px; overflow: visible; }
.meter > span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--ok); transition: width .6s ease, background .4s; }
.meter > span.warn { background: var(--warn); } .meter > span.crit { background: var(--crit); }
.meter > i { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--text-faint); }
.meter.dual > span.base { background: var(--text-faint); opacity: .55; z-index: 1; }

.card { background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; padding: 11px 12px; }
.rec { display: grid; grid-template-columns: 3px 1fr; gap: 10px; padding: 11px 8px; border-radius: 3px; cursor: pointer; }
.rec:hover { background: var(--panel-hover); }
.rec .sev { border-radius: 2px; background: var(--text-faint); }
.rec.critical .sev { background: var(--crit); } .rec.warning .sev { background: var(--warn); }
.rec .r-top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.rec .r-name { font-weight: 600; font-size: 12.5px; }
.rec .r-eta { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--crit); white-space: nowrap; }
.rec .r-finding { font-size: 12px; color: var(--text); line-height: 1.4; }
.rec .r-action { font-size: 11.5px; color: var(--text-dim); margin-top: 5px; line-height: 1.4; }
.rec .r-action::before { content: '→ '; color: var(--amber); }

.foot-note { padding: 12px 14px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-dim); line-height: 1.45; }
.foot-note .l { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); display: block; margin-bottom: 4px; }

/* ---- Cesium chrome, re-skinned to the console tokens ------------------------------------- */
.cesium-viewer-bottom { opacity: .55; }
.cesium-viewer-bottom:hover { opacity: 1; }
.cesium-credit-textContainer, .cesium-credit-textContainer a { font-family: var(--mono) !important; font-size: 10px !important; color: var(--text-dim) !important; }
.cesium-credit-logoContainer { display: none !important; }
.cesium-viewer-toolbar { display: none; }
.cesium-viewer-timelineContainer { background: var(--panel-2); border-top: 1px solid var(--border); height: 26px; }
.cesium-timeline-main { border: 0 !important; background: transparent; }
.cesium-timeline-bar { background: var(--panel-2) !important; height: 1.4em; }
.cesium-timeline-ticLabel { color: var(--text-faint) !important; font-family: var(--mono) !important; font-size: 10px !important; }
.cesium-timeline-ticMain, .cesium-timeline-ticSub { background: var(--border-strong) !important; }
.cesium-timeline-needle { background: var(--amber) !important; }
.cesium-timeline-icon16 { filter: hue-rotate(160deg) saturate(1.4); }
.cesium-widget-credits { font-family: var(--mono); }

/* ---- small screens: rails become overlays over the map ------------------------------------ */
@media (max-width: 1400px) {
  .brand .gov { display: none; }
}
@media (max-width: 1240px) {
  :root { --left: 250px; --right: 310px; }
  .brand .sub { display: none; }
}
@media (max-width: 1080px) {
  /* Below this the wordmark and the nav would collide: keep the emblems
     (the identity) and the nav (the function), drop the text. */
  .brand .leading { display: none; }
  .tabs a { padding: 6px 10px; font-size: 12px; }
}
@media (max-width: 860px) {
  .brand .pushkaralu { display: none; }
  .assistant { width: calc(100% - 40px); }
  .topbar .status .mono, .topbar #clock { display: none; }
}

/* ============================================================================
   LIGHT THEME
   The console is dark-first: every colour above is a token, so the light theme
   is a token remap rather than a second stylesheet. Values are taken from the
   Pushkara Netra palette (navy text on a cool paper ground, saffron accent) so
   a light console matches the landing page and Command Center.

   Set by js/theme.js as <html data-theme="light">.
   ========================================================================== */
:root[data-theme="light"] {
  --bg: #eef3fa;
  --bg-grid: #e3ebf5;
  --panel: #ffffff;
  --panel-2: #f6f9fd;
  --panel-hover: #eef4fb;
  --glass: rgba(255, 255, 255, 0.93);
  --border: #dbe4f0;
  --border-strong: #c2d0e4;
  --text: #0f2557;
  --text-dim: #5b6b86;
  --text-faint: #8797ad;
  --amber: #d97706;
  --amber-ink: #ffffff;
  --cyan: #0e7490;
  --ok: #059669;
  --warn: #d97706;
  --crit: #e11d48;
}

/* Pieces that can't be expressed as a token swap */
:root[data-theme="light"] .topbar {
  background: linear-gradient(180deg, #ffffff 0%, #f6f9fd 100%);
  box-shadow: 0 1px 3px rgba(15, 37, 87, .06);
}
:root[data-theme="light"] .brand h1 {
  /* The dark gradient wordmark is unreadable on paper; use the ink-on-light
     version from the landing page. */
  background: linear-gradient(90deg, #b45309, #0f2557 45%, #0e7490 75%, #b45309);
  background-size: 200% auto; -webkit-background-clip: text; background-clip: text;
}
:root[data-theme="light"] .brand .crest img { background: #fff; }
:root[data-theme="light"] .tabs a[aria-current="page"] { color: #ffffff; background: #0f2557; }
:root[data-theme="light"] .btn.primary { color: #ffffff; }
:root[data-theme="light"] .seg button.active,
:root[data-theme="light"] .basemap .seg button.active { background: #0f2557; color: #ffffff; }
:root[data-theme="light"] .alert .sev,
:root[data-theme="light"] .rec .sev { opacity: .9; }
:root[data-theme="light"] .switch input:checked + i { background: rgba(14, 116, 144, .25); }
:root[data-theme="light"] .switch input:checked + i::after { background: var(--cyan); }
:root[data-theme="light"] .rail-body::-webkit-scrollbar-thumb,
:root[data-theme="light"] .scroll::-webkit-scrollbar-thumb { background: #c2d0e4; border-color: #ffffff; }
/* Cesium's own chrome */
:root[data-theme="light"] .cesium-viewer-timelineContainer { background: #f6f9fd; border-top-color: #dbe4f0; }
:root[data-theme="light"] .cesium-timeline-bar { background: #f6f9fd !important; }
:root[data-theme="light"] .cesium-timeline-ticLabel { color: #5b6b86 !important; }
:root[data-theme="light"] .cesium-timeline-ticMain,
:root[data-theme="light"] .cesium-timeline-ticSub { background: #c2d0e4 !important; }
:root[data-theme="light"] .cesium-credit-textContainer,
:root[data-theme="light"] .cesium-credit-textContainer a { color: #5b6b86 !important; }

/* ---- theme toggle button (both themes) ------------------------------------ */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--text-dim);
  font-family: var(--sans); font-size: 11.5px; font-weight: 600; letter-spacing: .04em;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text-faint); }
.theme-toggle svg { flex: 0 0 auto; }
@media (max-width: 1080px) { .theme-toggle .t-label { display: none; } }

/* ---- quarry command HUD (V13) ---------------------------------------------------
   The floating panels from the mining command-centre reference. Shown only while
   the Quarry twin is focused, so these numbers never hang over a city they are
   not about. Every card prints where its figure came from — live feed, modelled,
   or fixed site data — because a HUD that hides that is how a modelled number
   ends up quoted as a measurement. */
.quarry-hud { right: 12px; top: 12px; width: 214px; padding: 10px; display: grid; gap: 9px; }
.quarry-hud .qh-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.quarry-hud .qh-head b { font-size: 12px; letter-spacing: .01em; }
.quarry-hud .qh-tick { font-family: var(--mono); font-size: 10px; color: var(--text-faint); }
.quarry-hud .qh-card { padding: 8px 9px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 3px; }
.quarry-hud .qh-l { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; }
.quarry-hud .qh-src { font-style: normal; font-family: var(--mono); font-size: 9px; letter-spacing: 0; text-transform: none; padding: 1px 5px; border-radius: 2px; border: 1px solid var(--border-strong); color: var(--text-faint); }
.quarry-hud .qh-src.live { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.quarry-hud .qh-src.model { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
.quarry-hud .qh-src.plan { color: var(--text-faint); }
.quarry-hud .qh-v { font-family: var(--mono); font-size: 19px; line-height: 1.25; margin: 4px 0 6px; color: var(--text); }
.quarry-hud .qh-v small { font-size: 11px; color: var(--text-dim); }
.quarry-hud .meter { position: relative; height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.quarry-hud .qh-s { margin-top: 6px; font-family: var(--mono); font-size: 9.5px; line-height: 1.5; color: var(--text-faint); }
