/* TERNOH — JARVIS HUD theme (jarvis ui mode only; classic rides
   style-2018.css and never loads this sheet).
   Palette per the 2026-07 redesign spec: true-black stage, green
   instrument glass on top. Class names from the old terminal sheet
   (.grid, .btn, .stat, .note, #tabs, #titlebar) are preserved so every
   template keeps working in both ui modes. */

:root {
  --bg-0: #000000;
  --bg-1: #030f09;
  --bg-2: #072016;
  --line: #0e3a28;
  --line-bright: #1d6b4a;
  --txt-dim: #4e8f70;
  --txt: #7ddfae;
  --txt-bright: #b8ffd9;
  --accent: #2ee88e;
  --accent-glow: color-mix(in srgb, var(--accent) 45%, transparent);
  --red: #ff5c5c;
  --red-glow: color-mix(in srgb, var(--red) 40%, transparent);
  --amber: #ffb454;
  --cyan: #57d7ff;
  --mono: "SF Mono", Menlo, ui-monospace, monospace;
  /* aliases: legacy var names still referenced by odd corners
     (charts workbench overrides, inline styles) */
  --atmo: var(--bg-0);
  --surface: var(--bg-1);
  --panel: var(--bg-1);
  --base: var(--bg-2);
  --mid: var(--line-bright);
  --active: var(--accent);
  --glow: var(--txt-bright);
  --text: var(--txt);
  --bright: var(--txt-bright);
  --muted: var(--txt-dim);
  --edge: var(--line-bright);
  --dn: var(--red);
  --up: var(--accent);
  --phthalo: #0b3d26;
  --phthalo-mid: var(--line-bright);
  --phthalo-dark: var(--line);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--txt);
  background-color: var(--bg-0);
  background-image:
    repeating-linear-gradient(0deg, transparent 0 1px,
      color-mix(in srgb, var(--accent) 2%, transparent) 1px 2px, transparent 2px 4px),
    linear-gradient(0deg, color-mix(in srgb, var(--accent) 3%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 3%, transparent) 1px, transparent 1px),
    radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--bg-2) 40%, var(--bg-0)) 0%, var(--bg-0) 60%);
  background-size: auto, 28px 28px, 28px 28px, auto;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--txt-bright); text-shadow: 0 0 8px var(--accent-glow); }
::selection { background: var(--line-bright); color: var(--bg-1); }

@font-face {
  font-family: 'Kenvior';
  src: url('/static/fonts/kenvior.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Kenvior'; font-weight: 500;
  src: url('/static/fonts/Kenvior-Medium.ttf') format('truetype');
}

/* ════ the clipped HUD frame ════════════════════════════
   .hframe = outer shell whose background paints the 1px border,
   clipped to the notched polygon; .hframe-i = inner face, same
   polygon, inset 1px via padding on the shell. Default notches:
   top-right + bottom-left. Variant .alt flips them. */
.hframe {
  --notch: 14px;
  background: var(--line);
  padding: 1px;
  clip-path: polygon(0 0, calc(100% - var(--notch)) 0,
                     100% var(--notch), 100% 100%,
                     var(--notch) 100%, 0 calc(100% - var(--notch)));
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 6%, transparent));
}
.hframe > .hframe-i {
  background: var(--bg-1);
  clip-path: polygon(0 0, calc(100% - var(--notch)) 0,
                     100% var(--notch), 100% 100%,
                     var(--notch) 100%, 0 calc(100% - var(--notch)));
  box-shadow: inset 0 0 24px color-mix(in srgb, var(--accent) 4%, transparent);
  padding: 12px 14px;
  height: 100%;
}
.hframe.alt {
  clip-path: polygon(var(--notch) 0, 100% 0,
                     100% calc(100% - var(--notch)),
                     calc(100% - var(--notch)) 100%, 0 100%, 0 var(--notch));
}
.hframe.alt > .hframe-i {
  clip-path: polygon(var(--notch) 0, 100% 0,
                     100% calc(100% - var(--notch)),
                     calc(100% - var(--notch)) 100%, 0 100%, 0 var(--notch));
}
.hframe.tight { --notch: 8px; }
.hframe.tight > .hframe-i { padding: 8px 10px; }
.hframe.bright { background: var(--line-bright); }

/* corner accent ticks on important panels */
.hcorner { position: relative; }
.hcorner:before, .hcorner:after {
  content: ""; position: absolute; width: 16px; height: 16px;
  border: 1px solid var(--line-bright); pointer-events: none; z-index: 2;
}
.hcorner:before { top: -3px; left: -3px; border-right: 0; border-bottom: 0; }
.hcorner:after { bottom: -3px; right: -3px; border-left: 0; border-top: 0; }

/* panel header */
.hpanel-h {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 10px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--txt-bright);
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px; margin-bottom: 9px;
  text-shadow: 0 0 10px color-mix(in srgb, var(--accent) 25%, transparent);
}
.hpanel-h .orn { color: var(--line-bright); font-size: 8px; letter-spacing: .3em; }

/* layout scaffolding */
.hud-cols { display: grid; gap: 14px; align-items: start; }
.hud-cols.c3 { grid-template-columns: 225px minmax(0, 1fr) 255px; }
.hud-cols.c2l { grid-template-columns: 225px minmax(0, 1fr); }
.hud-cols.c2r { grid-template-columns: minmax(0, 1fr) 275px; }
.hud-rail { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hud-main { min-width: 0; }
@media (max-width: 1180px) {
  .hud-cols.c3, .hud-cols.c2l, .hud-cols.c2r { grid-template-columns: 1fr; }
}

/* ════ chrome: single HUD bar (wordmark | nav | controls) ═ */
#hudbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: stretch;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-2) 90%, transparent), color-mix(in srgb, var(--bg-0) 96%, transparent));
  border-bottom: 1px solid var(--line-bright);
  position: sticky;
  top: 0;
  z-index: 40;
}
#hudbar:after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: .5; pointer-events: none;
}
#titlebar {
  padding: 8px 26px 6px 22px;
  /* beat the inline position:relative so the gear/theme buttons and the
     settings panel anchor to the full-width sticky bar, not this cell */
  position: static !important;
  border-right: 1px solid var(--line);
}
#titlebar:before {
  content: ""; position: absolute; top: 5px; left: 5px;
  width: 18px; height: 18px; opacity: .8; pointer-events: none;
  border: 1px solid var(--line-bright); border-right: 0; border-bottom: 0;
}
#titlebar h1 {
  font-family: 'Kenvior', serif;
  font-size: 19px;
  letter-spacing: 6px;
  display: block;
  line-height: 1.15;
  color: var(--txt-bright);
  text-shadow: 0 0 16px var(--accent-glow);
}
#titlebar .sub {
  display: block;
  color: var(--txt-dim);
  font-size: 8px;
  margin-left: 1px;
  letter-spacing: 3.2px;
  text-transform: uppercase;
}

/* nav shares the bar */
#tabs {
  background: transparent;
  padding: 0 8px 0 14px;
  margin-right: 88px; /* keep the scroll area clear of the gear buttons */
  align-self: end;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
#tabs::-webkit-scrollbar { display: none; }
#tabs a {
  display: inline-block;
  padding: 15px 11px 10px;
  margin: 0 1px;
  border-bottom: 2px solid transparent;
  color: var(--txt-dim);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  transition: color .12s, border-color .12s, text-shadow .12s;
}
#tabs a:hover {
  color: var(--txt-bright);
  text-decoration: none;
  text-shadow: 0 0 8px var(--accent-glow);
}
#tabs a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-shadow: 0 0 10px var(--accent-glow);
  box-shadow: 0 6px 12px -8px var(--accent-glow);
}
#tabs select, #tabs button[type="submit"] {
  border: 1px solid var(--line-bright);
  border-radius: 0;
  background: var(--bg-1);
  color: var(--txt);
  padding: 3px 8px;
  font-size: 10px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 7px !important;
  cursor: pointer;
}
#tabs select:hover, #tabs button[type="submit"]:hover {
  border-color: var(--accent);
  color: var(--txt-bright);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 25%, transparent);
}

/* ════ content stage ════════════════════════════════════ */
#content {
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-1) 75%, transparent), color-mix(in srgb, var(--bg-0) 40%, transparent));
  border: 1px solid var(--line);
  margin: 16px 16px 18px;
  padding: 20px 24px 26px;
  min-height: 520px;
  position: relative;
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px),
                     calc(100% - 14px) 100%, 0 100%, 0 14px);
  box-shadow: inset 0 0 60px color-mix(in srgb, var(--accent) 4%, transparent);
}
#content:before, #content:after {
  content: ""; position: absolute; width: 22px; height: 22px;
  border: 1px solid var(--line-bright); opacity: .8; pointer-events: none;
}
#content:before { top: 6px; right: 6px; border-left: 0; border-bottom: 0; }
#content:after { bottom: 6px; left: 6px; border-right: 0; border-top: 0; }

h2 {
  font-family: 'Kenvior', serif;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--txt-bright);
  text-shadow: 0 0 12px var(--accent-glow);
  margin: 2px 0 14px;
}
h3 {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--txt-bright);
  margin: 20px 0 8px;
  text-transform: uppercase;
  letter-spacing: .16em;
}
h3:before { content: "▸ "; color: var(--accent); }

/* ════ stat cards ═══════════════════════════════════════ */
.statrow { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 18px; }
.stat {
  min-width: 122px;
  padding: 10px 14px 9px;
  border: 1px solid var(--line);
  background: var(--bg-1);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%,
                     10px 100%, 0 calc(100% - 10px));
  transition: border-color .12s, box-shadow .12s;
}
.stat:hover {
  border-color: var(--line-bright);
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 15%, transparent);
}
.stat .num {
  font-size: 18px;
  font-weight: 700;
  color: var(--txt-bright);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 10px var(--accent-glow);
}
.stat .lbl {
  font-size: 9px;
  color: var(--txt-dim);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-top: 3px;
}

/* ════ tables ═══════════════════════════════════════════ */
table.grid {
  border-collapse: collapse;
  width: 100%;
  margin: 6px 0 18px;
  font-size: 11.5px;
}
table.grid th {
  background: var(--bg-2);
  border: none;
  border-bottom: 1px solid var(--line-bright);
  color: var(--txt-dim);
  padding: 7px 10px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  text-align: left;
  position: sticky;
  top: 47px; /* height of the single #hudbar */
  z-index: 5;
}
table.grid td {
  border: none;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
  padding: 6px 10px;
  color: var(--txt);
}
table.grid tr:hover td {
  background: var(--bg-2);
  color: var(--txt-bright);
}
table.grid tr:hover td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
/* inside a framed panel the page-level sticky offset is meaningless and
   punches a gap — headers there are static */
.hframe table.grid th { position: static; }
td.num, th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}

.pass { color: var(--accent); font-weight: 600; }
.fail { color: var(--red); }

/* status chips */
.chip {
  display: inline-block; padding: 1px 8px; font-size: 9px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  border: 1px solid currentColor; background: transparent;
}
.chip.pass { color: var(--accent); box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 25%, transparent); }
.chip.fail { color: var(--red); box-shadow: 0 0 8px var(--red-glow); }
.chip.watch { color: var(--amber); box-shadow: 0 0 8px color-mix(in srgb, var(--amber) 25%, transparent); }

/* ════ buttons ══════════════════════════════════════════ */
.btn {
  display: inline-block;
  padding: 7px 16px;
  border: 1px solid var(--line-bright);
  background: transparent;
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px),
                     calc(100% - 7px) 100%, 0 100%, 0 7px);
  transition: background .12s, box-shadow .12s, color .12s;
}
.btn:hover {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--txt-bright);
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 35%, transparent);
  text-decoration: none;
}
.btn[disabled] { opacity: .4; cursor: default; }
.btn.small { padding: 3px 10px; font-size: 9.5px; }
.btn.secondary {
  background: transparent;
  color: var(--txt-dim);
  border-color: var(--line);
}
.btn.secondary:hover {
  color: var(--txt-bright); border-color: var(--line-bright);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.danger:hover { background: color-mix(in srgb, var(--red) 12%, transparent);
  box-shadow: 0 0 16px var(--red-glow); }

/* ════ inputs ═══════════════════════════════════════════ */
input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
select, textarea {
  font-family: var(--mono);
  border: 1px solid var(--line-bright);
  border-radius: 0;
  padding: 6px 10px;
  font-size: 11.5px;
  color: var(--txt-bright);
  background: color-mix(in srgb, var(--bg-0) 70%, transparent);
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 30%, transparent);
}
option { background: var(--bg-1); }

/* framed callout strips */
.note {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-left: 2px solid var(--line-bright);
  padding: 9px 14px;
  font-size: 10.5px;
  color: var(--txt-dim);
  margin: 10px 0;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px,
                     100% 100%, 0 100%);
}
.note.warn { border-left-color: var(--amber); }
.note.alert { border-left-color: var(--red); }
.running {
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  color: var(--accent);
  padding: 9px 14px;
  font-size: 11px;
  margin: 10px 0;
  font-weight: 600;
  animation: termpulse 2.4s ease-in-out infinite;
}
@keyframes termpulse { 50% { box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 18%, transparent); } }

pre.log {
  background: color-mix(in srgb, var(--bg-0) 80%, transparent);
  border: 1px solid var(--line);
  padding: 12px;
  font: 10px var(--mono);
  overflow: auto;
  max-height: 340px;
  color: var(--txt-dim);
}

img.chart {
  max-width: 100%;
  border: 1px solid var(--line);
  margin: 6px 0 14px;
  filter: none;
}

/* ════ rings & bars (server-rendered SVG gauges) ════════ */
.hring { text-align: center; padding: 4px 0 2px; }
.hring svg { overflow: visible; }
.hring .track { stroke: var(--line); fill: none; }
.hring .arc {
  stroke: var(--accent); fill: none; stroke-linecap: butt;
  filter: drop-shadow(0 0 4px var(--accent-glow));
}
.hring.red .arc { stroke: var(--red); filter: drop-shadow(0 0 4px var(--red-glow)); }
.hring.amber .arc { stroke: var(--amber);
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--amber) 40%, transparent)); }
.hring .tick { stroke: var(--line-bright); }
.hring .val {
  fill: var(--txt-bright); font-family: var(--mono); font-weight: 700;
  text-anchor: middle;
}
.hring .lbl {
  display: block; font-size: 8.5px; color: var(--txt-dim);
  text-transform: uppercase; letter-spacing: .14em; margin-top: 4px;
}

.hbar { margin: 6px 0; }
.hbar .hbar-l {
  display: flex; justify-content: space-between; font-size: 9px;
  color: var(--txt-dim); text-transform: uppercase; letter-spacing: .1em;
  margin-bottom: 2px;
}
.hbar .hbar-l b { color: var(--txt-bright); }
.hbar .track { height: 3px; background: var(--line); position: relative; }
.hbar .fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--accent); box-shadow: 0 0 6px var(--accent-glow);
}
.hbar .fill:after {
  content: ""; position: absolute; right: -2px; top: -1.5px;
  width: 5px; height: 6px; background: var(--txt-bright); border-radius: 50%;
  box-shadow: 0 0 6px var(--accent-glow);
}
.hbar.red .fill { background: var(--red); box-shadow: 0 0 6px var(--red-glow); }
.hbar.red .fill:after { box-shadow: 0 0 6px var(--red-glow); }
.hbar.amber .fill { background: var(--amber);
  box-shadow: 0 0 6px color-mix(in srgb, var(--amber) 40%, transparent); }

/* mini histogram (inline SVG bars) */
.hhist svg rect { fill: var(--accent); opacity: .75;
  filter: drop-shadow(0 0 2px var(--accent-glow)); }
.hhist svg line { stroke: var(--line); }
.hhist .axis {
  display: flex; justify-content: space-between; font-size: 8px;
  color: var(--txt-dim); margin-top: 2px;
}

/* status list rows in rail panels */
.hstat-list { list-style: none; font-size: 10px; }
.hstat-list li {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 3px 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 40%, transparent);
}
.hstat-list li:last-child { border-bottom: 0; }
.hstat-list .k { color: var(--txt-dim); text-transform: uppercase;
  letter-spacing: .08em; }
.hstat-list .v { color: var(--txt-bright); text-align: right;
  font-variant-numeric: tabular-nums; }
.hstat-list .v.up { color: var(--accent); }
.hstat-list .v.dn { color: var(--red); }
.hstat-list .v.wn { color: var(--amber); }

/* ════ ornaments ════════════════════════════════════════ */
.horn { pointer-events: none; text-align: center; opacity: .8; }
.horn svg { max-width: 100%; }
.horn .o-line { stroke: var(--line-bright); fill: none; }
.horn .o-dim { stroke: var(--line); fill: none; }
.horn .o-dot { fill: var(--accent); }
.horn .o-dot-dim { fill: var(--line-bright); }
.horn.spin svg { animation: hspin 60s linear infinite; }
@keyframes hspin { to { transform: rotate(360deg); } }
.hdots { color: var(--line-bright); font-size: 8px; letter-spacing: .35em;
  pointer-events: none; user-select: none; }

/* segmented control (tab rows on pages) */
.hseg { display: inline-flex; gap: 0; border: 1px solid var(--line);
  background: var(--bg-1);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px),
                     calc(100% - 8px) 100%, 0 100%, 0 8px); }
.hseg a, .hseg button, .hseg label {
  padding: 5px 14px; font-size: 10px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; color: var(--txt-dim);
  border-right: 1px solid var(--line); cursor: pointer;
  background: transparent; font-family: var(--mono); border-top: 0;
  border-bottom: 0; border-left: 0;
}
.hseg a:last-child, .hseg button:last-child, .hseg label:last-child {
  border-right: 0; }
.hseg a:hover, .hseg button:hover, .hseg label:hover {
  color: var(--txt-bright); text-decoration: none;
  background: color-mix(in srgb, var(--accent) 6%, transparent); }
.hseg .active, .hseg a.active {
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
  text-shadow: 0 0 8px var(--accent-glow); }

/* report markdown body */
.mdbody h1 { font-size: 16px; color: var(--txt-bright); margin: 8px 0;
  letter-spacing: .1em; }
.mdbody h2 { font-size: 13px; margin-top: 16px; }
.mdbody p, .mdbody li { font-size: 11.5px; line-height: 1.6; }
.mdbody table { border-collapse: collapse; margin: 10px 0; }
.mdbody th, .mdbody td { border-bottom: 1px solid var(--line);
  padding: 5px 10px; font-size: 11px; }
.mdbody th { color: var(--txt-bright);
  border-bottom: 1px solid var(--line-bright); }
.mdbody code { background: var(--bg-2); padding: 1px 5px;
  font-size: 10.5px; }
.mdbody ul { margin-left: 20px; }

#footer {
  text-align: center;
  color: var(--txt-dim);
  font-size: 9px;
  letter-spacing: .25em;
  text-transform: uppercase;
  padding: 2px 0 16px;
}
#footer:after { content: " · TERMINAL 7"; color: var(--accent); }

/* ---- settings (gear) ---------------------------------------------------- */
#themebtn {
  position: absolute; right: 46px; top: 12px;
  background: none; border: none; color: var(--txt-dim); font-size: 16px;
  cursor: pointer; padding: 2px 6px; line-height: 1;
  transition: color .12s, text-shadow .12s;
}
#themebtn:hover { color: var(--txt-bright);
  text-shadow: 0 0 10px var(--accent-glow); }
#gearbtn {
  position: absolute; right: 16px; top: 12px;
  background: none; border: none; color: var(--txt-dim); font-size: 17px;
  cursor: pointer; padding: 2px 6px; line-height: 1;
  transition: color .12s, transform .2s;
}
#gearbtn:hover { color: var(--txt-bright); transform: rotate(30deg); }
#settings-panel {
  display: none; position: absolute; right: 12px; top: 44px; z-index: 50;
  background: var(--bg-1); border: 1px solid var(--line-bright);
  box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 25%, transparent); padding: 16px 18px;
  min-width: 270px; font-size: 11px; color: var(--txt);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px),
                     calc(100% - 10px) 100%, 0 100%, 0 10px);
}
#settings-panel h4 {
  margin: 12px 0 6px; font-size: 9.5px; text-transform: uppercase;
  letter-spacing: .12em; color: var(--txt-bright);
}
#settings-panel h4:first-child { margin-top: 0; }
#settings-panel label { display: block; margin: 4px 0; cursor: pointer; }
#settings-panel .hint { font-size: 9.5px; color: var(--txt-dim);
  margin-top: 10px; }
body.compact table.grid th, body.compact table.grid td {
  padding: 3px 7px; font-size: 10px;
}

/* ── charts workbench dark overrides (#cw variables) ── */
body #cw { --ph: var(--accent); --bg: var(--bg-1); --soft: color-mix(in srgb, var(--bg-2) 50%, transparent);
      --edge: var(--line-bright); --txt: var(--txt); --dim: var(--txt-dim);
      --blue: var(--cyan); --orange: var(--amber); --up: var(--accent); --dn: var(--red);
      background: transparent; color: var(--txt); }
body #cw .cw-panel { border-color: var(--line); background: color-mix(in srgb, var(--bg-1) 80%, transparent);
  border-radius: 0; clip-path: polygon(10px 0, 100% 0,
  100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); }
body #cw button.on { background: var(--line-bright); color: #fff; }
body #cw .cw-kn { background: color-mix(in srgb, var(--bg-2) 50%, transparent); border-radius: 0; }
body #cw .cw-tbl th { background: var(--bg-1); }
body #cw .cw-tbl tr.itm td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
body #cw td.strike { background: color-mix(in srgb, var(--bg-2) 70%, transparent); }
body #cw tr.hl td, body #cw .cw-exp.open { background: color-mix(in srgb, var(--accent) 12%, transparent); }
body #cw .cw-modal-box { background: var(--bg-1); }
body #cw .b-CONFIRMED { background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent); }
body #cw .b-UNPROVEN { background: color-mix(in srgb, var(--amber) 15%, transparent); color: var(--amber); }
body #cw .b-REJECTED { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }


/* ════ LIGHT MODE — token redefinitions + treatment ═════
   The entire sheet derives colors from these tokens (color-mix for
   tints/glows), so this block is the whole theme. */
[data-theme="light"] {
  --bg-0: #f2f5f2;
  --bg-1: #ffffff;
  --bg-2: #e6efe9;
  --line: #b9d2c4;
  --line-bright: #2e8f63;
  --txt-dim: #5b7a69;
  --txt: #143d2a;
  --txt-bright: #06170f;
  --accent: #0d8a52;
  --accent-glow: rgba(13, 138, 82, 0.20);
  --red: #c4302f;
  --red-glow: rgba(196, 48, 47, 0.18);
  --amber: #a86a00;
  --cyan: #0e7fae;
}
/* glow becomes shadow; neon on white reads washed-out */
[data-theme="light"] body { -webkit-font-smoothing: auto; }
[data-theme="light"] #titlebar h1,
[data-theme="light"] .hpanel-h,
[data-theme="light"] h2,
[data-theme="light"] .stat .num,
[data-theme="light"] a:hover,
[data-theme="light"] #tabs a.active,
[data-theme="light"] #tabs a:hover,
[data-theme="light"] #themebtn:hover { text-shadow: none; }
[data-theme="light"] .hframe {
  filter: none;
  box-shadow: 0 1px 6px rgba(10, 40, 25, 0.10);
}
[data-theme="light"] .hframe > .hframe-i { box-shadow: none; }
[data-theme="light"] body {
  /* texture down to ~2% dark green so white stays clean */
  background-image:
    linear-gradient(0deg, rgba(13, 80, 45, .02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 80, 45, .02) 1px, transparent 1px);
  background-size: 28px 28px, 28px 28px;
}
/* buttons: unmistakably visible on white */
[data-theme="light"] .btn,
[data-theme="light"] #tabs button[type="submit"] {
  background: var(--bg-2);
  border-color: var(--line-bright);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(10, 40, 25, 0.12);
}
[data-theme="light"] .btn:hover {
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-2));
  color: var(--txt-bright);
}
[data-theme="light"] .btn.secondary {
  background: var(--bg-1);
  color: var(--txt-dim);
  border-color: var(--line);
}
[data-theme="light"] .btn.secondary:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-1));
}
/* chips read as chips: tinted fills */
[data-theme="light"] .chip { box-shadow: none; }
[data-theme="light"] .chip.pass {
  background: color-mix(in srgb, var(--accent) 12%, transparent); }
[data-theme="light"] .chip.fail {
  background: color-mix(in srgb, var(--red) 12%, transparent); }
[data-theme="light"] .chip.watch {
  background: color-mix(in srgb, var(--amber) 12%, transparent); }
/* rings/bars: soft shadows, not neon */
[data-theme="light"] .hring .arc,
[data-theme="light"] .hhist svg rect { filter: none; }
[data-theme="light"] .hbar .fill,
[data-theme="light"] .hbar .fill:after,
[data-theme="light"] .running,
[data-theme="light"] .stat:hover { box-shadow: none; }

/* ════ fund page ════════════════════════════════════════ */
.fstrip { display: flex; }
.fstrip .c {
  flex: 1; padding: 8px 12px 7px; border-right: 1px solid var(--line);
  min-width: 0;
}
.fstrip .c:last-child { border-right: 0; }
.fstrip .l {
  font-size: 8.5px; color: var(--txt-dim); text-transform: uppercase;
  letter-spacing: .12em; margin-bottom: 2px; white-space: nowrap;
}
.fstrip .v {
  font-size: 15px; font-weight: 700; color: var(--txt-bright);
  font-variant-numeric: tabular-nums;
}
.fov { display: grid; grid-template-columns: auto 1fr; gap: 12px;
  align-items: center; }
.fov-grid { display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 8px 14px; }
.fov-grid .l {
  font-size: 8px; color: var(--txt-dim); text-transform: uppercase;
  letter-spacing: .1em;
}
.fov-grid .v {
  font-size: 14px; font-weight: 700; color: var(--txt-bright);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 8px var(--accent-glow);
}
[data-theme="light"] .fov-grid .v { text-shadow: none; }
.fspark { display: flex; align-items: flex-end; gap: 1px; height: 34px;
  margin: 6px 0 2px; }
.fspark i {
  flex: 1; min-width: 2px; background: var(--accent); opacity: .8;
}
.fspark i.dn { background: var(--red); }

/* radar sweep — rotates about the dish center only */
.horn .o-sweep {
  animation: hsweep 7s linear infinite;
  transform-origin: 60px 60px;
}
@keyframes hsweep { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .horn .o-sweep, .horn.spin svg { animation: none; }
}

/* ════ charts workbench (stock-page tabs) — HUD panel treatment ════ */
body #cw .cw-panel {
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-1) 85%, transparent);
}
body #cw .cw-h {
  font-size: 10px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--txt-bright);
  border-bottom: 1px solid var(--line);
  padding-bottom: 5px; margin: 0 0 8px;
}
body #cw .cw-h .cw-open { color: var(--accent); }
body #cw .cw-pills button, body #cw .cw-tabs button {
  font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  background: transparent; color: var(--txt-dim);
  border: 1px solid var(--line); border-radius: 0;
  padding: 3px 10px; cursor: pointer;
  clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px),
                     calc(100% - 5px) 100%, 0 100%, 0 5px);
  transition: color .12s, background .12s, border-color .12s;
}
body #cw .cw-tabs button { font-size: 10.5px; padding: 6px 16px; }
body #cw .cw-pills button:hover, body #cw .cw-tabs button:hover {
  color: var(--txt-bright); border-color: var(--line-bright);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
body #cw .cw-pills button.on, body #cw .cw-tabs button.on {
  color: var(--accent); border-color: var(--line-bright);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 20%, transparent);
  text-shadow: 0 0 8px var(--accent-glow);
}
[data-theme="light"] body #cw .cw-pills button.on,
[data-theme="light"] body #cw .cw-tabs button.on {
  box-shadow: none; text-shadow: none;
}
body #cw .cw-pills select {
  font-size: 9.5px; padding: 3px 6px; text-transform: uppercase;
}

/* orthographic globe ornament — same faint glow as the other ornaments */
.hud-globe { filter: drop-shadow(0 0 6px var(--accent-glow)); }
[data-theme="light"] .hud-globe { filter: none; }

/* dot-matrix globe: canvas dots layered under the SVG cage */
.hud-globe-wrap { position: relative; display: inline-block;
  pointer-events: none; }
.hud-globe-wrap canvas, .hud-globe-wrap svg {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
}

/* Plotly modebar on embedded charts: transparent, token-colored icons —
   no white button chips in either theme */
.js-plotly-plot .modebar,
.js-plotly-plot .modebar-group { background: transparent !important; }
.js-plotly-plot .modebar-btn path { fill: var(--txt-dim) !important; }
.js-plotly-plot .modebar-btn:hover path,
.js-plotly-plot .modebar-btn.active path { fill: var(--accent) !important; }
