/*
 * VPIN model execution terminal.
 *
 * Colour has one job throughout this surface:
 *   amber  = editable / selectable           blue   = current chart selection
 *   green  = positive / live                 blue   = system information
 *   red    = negative / destructive          yellow = attention
 *   white  = data                            grey   = supporting context
 */

:root {
  color-scheme: dark;

  --bg-primary: #000000;
  --bg-secondary: #000000;
  --bg-raised: #000000;
  --bg-hover: #171717;
  --bg-selected: #123B68;

  --text-primary: #FFFFFF;
  --text-data: #FFFFFF;
  --text-secondary: #D0D0D0;
  --text-muted: #999999;
  --text-disabled: #626262;
  --text-label: #FFB000;

  --terminal-orange: #FF9900;
  --terminal-orange-bright: #FFB000;
  --terminal-orange-muted: #C97800;
  --terminal-orange-dark: #754800;

  --positive: #00D26A;
  --positive-bright: #00FF7F;
  --positive-muted: #008F4C;
  --positive-bg: rgba(0, 210, 106, 0.10);

  --negative: #FF3B3B;
  --negative-bright: #FF5555;
  --negative-muted: #B52A2A;
  --negative-bg: rgba(255, 59, 59, 0.10);

  --interactive: #35AFFF;
  --interactive-bright: #7ACBFF;
  --interactive-muted: #155A9C;
  --interactive-bg: rgba(21, 90, 156, 0.35);
  --system: #5B8DEF;
  --system-dark: #2F5598;
  --warning: #FFD43B;
  --warning-muted: #A98D19;
  --blockchain: #B66DFF;

  --border: #3B3B3B;
  --border-subtle: #202020;
  --border-strong: #666666;
  --border-active: #FFFFFF;

  /* Compact aliases retained for the chart client and existing selectors. */
  --bg: var(--bg-primary);
  --panel: var(--bg-secondary);
  --panel2: var(--bg-raised);
  --raised: var(--bg-raised);
  --line: var(--border);
  --line-bright: var(--border-strong);
  --amber: var(--terminal-orange);
  --amber-dim: var(--terminal-orange-muted);
  --amber-bg: rgba(255, 153, 0, 0.08);
  --white: var(--text-primary);
  --grey: var(--text-secondary);
  --dim: var(--text-muted);
  --dimmer: var(--text-disabled);
  --green: var(--positive);
  --green-bright: var(--positive-bright);
  --green-bg: var(--positive-bg);
  --red: var(--negative);
  --red-bright: var(--negative-bright);
  --red-bg: var(--negative-bg);
  --cyan: var(--interactive);
  --yellow: var(--warning);
  --blue: var(--system);

  --ui: Arial, Helvetica, sans-serif;
  --mono: "Consolas", "Cascadia Mono", "Lucida Console", monospace;
  --row: 30px;
}

* { box-sizing: border-box; }

html { background: var(--bg-primary); }

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  color: var(--text-data);
  font: 13px/1.45 var(--ui);
  font-variant-numeric: tabular-nums slashed-zero;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--terminal-orange); color: #000000; }
:focus-visible { outline: 1px solid var(--border-active); outline-offset: -1px; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums slashed-zero; }
.dim { color: var(--text-muted); }
.hidden { display: none !important; }
.num { text-align: right; }
.pos { color: var(--positive); }
.neg { color: var(--negative); }
.pending { color: var(--warning); }
.ident { color: var(--interactive); }
.system { color: var(--system); }

/* ---- terminal command bar -------------------------------------------- */

#hdr {
  flex: 0 0 auto;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
}

.command-bar {
  min-height: 38px;
  display: flex;
  align-items: stretch;
  border-top: 0;
  border-bottom: 1px solid #4B4B4B;
  background: #0B0B0B;
}

.terminal-id {
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 235px;
  padding: 0 14px;
  border-right: 0;
  white-space: nowrap;
}

.terminal-mark {
  display: none;
}

.terminal-copy { display: flex; flex-direction: column; justify-content: center; line-height: 1.2; }

.terminal-name {
  color: var(--terminal-orange);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
}

.terminal-product {
  color: var(--text-secondary);
  margin-top: 1px;
  font-size: 10px;
  letter-spacing: 0;
}

.command-nav {
  display: flex;
  align-items: stretch;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.command-nav::-webkit-scrollbar { display: none; }

.nav-btn {
  position: relative;
  height: 37px;
  min-height: 37px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}
.nav-btn .hotkey {
  min-width: 0;
  height: auto;
  margin-right: 4px;
  display: inline;
  border: 0;
  color: var(--terminal-orange-bright);
  font-size: inherit;
  line-height: 1;
}
.nav-btn .hotkey::after { content: ")"; }
.nav-btn:hover:not(:disabled) { background: #202020; color: var(--terminal-orange-bright); outline: 1px solid #FFFFFF; outline-offset: -2px; }
.nav-btn.active {
  background: #242424;
  color: var(--terminal-orange-bright);
}
.nav-btn.active::after { display: none; }
.nav-btn.active .hotkey {
  border: 0;
  background: transparent;
  color: var(--terminal-orange-bright);
}
.nav-btn.utility { margin-left: 8px; border-left: 0; }

.terminal-context {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px;
  border-left: 0;
  color: var(--text-muted);
  font-size: 10.5px;
  letter-spacing: 0;
  white-space: nowrap;
}
.context-item { display: flex; align-items: center; gap: 5px; }
.context-key { color: var(--terminal-orange); font-size: 10px; }
.terminal-context .network { color: var(--system); }
.terminal-context .mode { color: var(--positive); }

/* ---- system strip ----------------------------------------------------- */

.hdr-row {
  min-height: 52px;
  display: grid;
  grid-template-columns: 82px minmax(620px, auto) minmax(320px, 1fr);
  align-items: stretch;
  background: #000000;
}

.strip-title {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 0;
  background: #A80F26;
  color: #FFFFFF;
  font-size: 11px;
  letter-spacing: 0;
  line-height: 1.2;
}
.strip-title strong { color: #FFFFFF; font-size: 11px; font-weight: 400; }
.status-cluster,
.progress-cluster { min-width: 0; display: flex; align-items: stretch; }
.status-cluster { border-right: 0; }

.stat {
  min-width: 120px;
  padding: 8px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-right: 0;
  background: #000000;
}
.stat.stat-wide { min-width: 170px; }
.stat.grow { min-width: 0; flex: 1 1 280px; border-right: 0; }
.stat.grow:last-child { border-right: 0; }

.stat .lbl,
.kpi .lbl,
.ctl-row .lbl,
.lg-cell .lbl {
  color: var(--terminal-orange-bright);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}
.stat .lbl > span { color: var(--text-muted); letter-spacing: 0; }

.inbox-popout {
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin-left: 3px;
  padding: 0;
  border: 1px solid var(--terminal-orange-muted);
  color: var(--terminal-orange-bright);
  font: 11px/14px var(--mono);
  vertical-align: -2px;
}
.inbox-popout:hover:not(:disabled) {
  border-color: #FFFFFF;
  background: var(--terminal-orange);
  color: #000000;
}

.stat .val {
  min-height: 20px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-primary);
  font-size: 12.5px;
  white-space: nowrap;
}
.status-cluster .stat .val { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.stat .job-row { gap: 8px; }
.stat-actions { margin-left: auto; display: inline-flex; gap: 3px; }

.dot { width: 7px; height: 7px; flex: 0 0 auto; background: var(--text-disabled); }
.dot.live { background: var(--positive); }
.dot.stale { background: var(--warning); }
.dot.down { background: var(--negative); }

.bar {
  flex: 1 1 auto;
  min-width: 70px;
  height: 9px;
  overflow: hidden;
  border: 1px solid var(--terminal-orange-muted);
  background: var(--bg-primary);
}
.bar > i { display: block; width: 0; height: 100%; background: var(--terminal-orange); }

.banner {
  padding: 5px 10px;
  border: 0;
  background: #B00020;
  color: #FFFFFF;
  font-size: 12px;
}
.banner.warn { border: 0; background: var(--terminal-orange); color: #000000; }

/* ---- layout ----------------------------------------------------------- */

main {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 30fr) minmax(0, 30fr) minmax(380px, 40fr);
  grid-template-rows: minmax(280px, 58fr) minmax(220px, 42fr);
}

#chart-panel {
  position: relative;
  flex: 1 1 58%;
  grid-column: 1 / 3;
  grid-row: 1;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border-strong);
  background: var(--bg-primary);
}
#chart { flex: 1 1 auto; min-height: 0; cursor: crosshair; }
#chart.panning { cursor: grabbing; }

#bottom {
  min-width: 0;
  min-height: 0;
  grid-column: 1 / 3;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: 32px minmax(0, 1fr);
}

#p-open { grid-column: 1; grid-row: 2; }
#p-closed { grid-column: 2; grid-row: 2; }
#p-stats { grid-column: 3; grid-row: 1 / 3; }

.activity-head {
  min-width: 0;
  grid-column: 1 / 3;
  grid-row: 1;
  padding: 3px 7px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--border);
  background: #1A1A1A;
  color: var(--text-secondary);
  font-size: 10.5px;
}
.activity-title { color: var(--terminal-orange-bright); text-transform: uppercase; letter-spacing: .06em; }
#activity-live-status { margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-secondary);
}
.panel:last-child { border-right: 0; }
.panel.terminal-focus,
#chart-panel.terminal-focus { box-shadow: inset 0 0 0 1px var(--interactive); }

.panel-head {
  min-height: 30px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 8px;
  border-bottom: 0;
  background: #A80F26;
}
.panel-head h2 {
  min-width: 0;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
.panel-head h2::before { display: none; content: none; }
.panel-head h2 .sub {
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
#chart-panel .panel-head h2 { flex: 1 1 auto; overflow: hidden; }
#chart-panel .panel-head h2 .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exit-score {
  margin-left: auto;
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, .45);
  color: #FFFFFF;
  font-size: 11px;
  white-space: nowrap;
}
.exit-score .exit-hold { color: var(--positive-bright); }
.exit-score .exit-triggered { color: var(--negative-bright); }
.panel-head h2 .ident { padding: 2px 6px; background: var(--terminal-orange); color: #000000; }
/* the mint label is a link inside that orange badge; the default cyan is
   unreadable on orange, so it takes the badge's colour and keeps the hover
   underline as the only affordance. */
.panel-head h2 .ident .mint-link { color: inherit; }
.unit-badge {
  padding: 0;
  border: 0;
  background: transparent;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  white-space: nowrap;
}

.count {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #FFFFFF;
  text-align: center;
  letter-spacing: 0;
  text-transform: none;
}
.function-title { margin-left: auto; color: #FFFFFF; font-size: 13px; white-space: nowrap; }
.attrib { color: #F2B7C0; font-size: 10px; text-decoration: none; }
.attrib:hover { color: #FFFFFF; text-decoration: underline; }

.panel-foot {
  min-height: 29px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 6px;
  border-top: 1px solid var(--border);
  background: #000000;
}

.scroll {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  scrollbar-color: #6A6A6A #000000;
  scrollbar-width: thin;
}
.scroll::-webkit-scrollbar { width: 7px; height: 7px; }
.scroll::-webkit-scrollbar-track { background: #000000; }
.scroll::-webkit-scrollbar-thumb { background: #5A5A5A; }
.scroll::-webkit-scrollbar-thumb:hover { background: #888888; }

/* ---- tables ----------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; background: var(--bg-primary); font-size: 12.5px; }
thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  background: #1D1D1D;
  color: #FFFFFF;
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
  white-space: nowrap;
}
thead th.num { text-align: right; }
tbody td {
  height: var(--row);
  padding: 3px 8px;
  overflow: hidden;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-data);
  text-overflow: ellipsis;
  white-space: nowrap;
}
tbody tr:nth-child(even) { background: #000000; }
tbody tr:hover { background: #151515; outline: 1px solid #FFFFFF; outline-offset: -1px; }
tbody tr.selected { background: var(--bg-selected); box-shadow: none; }
tbody tr.selected td:first-child { color: #FFFFFF; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable td:nth-child(2) { color: #FFFFFF; }

.empty { max-width: 46rem; padding: 12px; color: var(--terminal-orange-bright); font-size: 12px; line-height: 1.55; }
#chart-empty {
  position: absolute;
  inset: 65px 0 0;
  display: grid;
  place-items: center;
  text-align: center;
  pointer-events: none;
}

/* ---- controls --------------------------------------------------------- */

button {
  min-height: 30px;
  padding: 3px 10px;
  border: 1px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text-data);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: #FFFFFF; background: #202020; color: #FFFFFF; }
button:disabled { border-color: transparent; color: var(--text-disabled); cursor: not-allowed; opacity: 1; }
button.primary { border-color: #00B85C; background: #00B85C; color: #000000; }
button.primary:hover:not(:disabled) { border-color: #FFFFFF; background: var(--positive-bright); color: #000000; }
button.ghost { background: transparent; }
button.danger { border-color: #C60025; background: #C60025; color: #FFFFFF; }
button.danger.ghost { border-color: transparent; background: transparent; color: var(--negative-bright); }
button.danger:hover:not(:disabled) { border-color: #D93636; background: #D93636; color: #FFFFFF; }
button.tiny { min-height: 24px; padding: 1px 7px; font-size: 10.5px; }
button.on { border-color: #155A9C; background: #155A9C; color: #FFFFFF; font-weight: 400; }

/* ---- chart toolbar ---------------------------------------------------- */

#chart-bar {
  min-height: 34px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 7px;
  border-bottom: 1px solid #4B4B4B;
  background: #1A1A1A;
  flex-wrap: wrap;
}
.tb-section {
  min-width: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  border-right: 0;
  background: transparent;
}
.tb-section:last-of-type { border-right: 0; }
.tb-group { display: flex; align-items: center; gap: 0; }
.tb-label {
  display: inline;
  margin: 0 2px 0 0;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}
.tb-label::after { content: ":"; }
.tb-section:first-child .tb-label { display: none; }
.tb-btn {
  min-height: 25px;
  flex: 0 0 auto;
  padding: 2px 7px;
  border-color: transparent;
  background: transparent;
  color: #FFFFFF;
  font-size: 11.5px;
}
.tb-btn:hover:not(:disabled) { border-color: #FFFFFF; background: #202020; color: #FFFFFF; }
.tb-btn.on { border-color: #155A9C; background: #155A9C; color: #FFFFFF; font-weight: 400; }
#tb-study .tb-btn.on { border-color: transparent; background: transparent; color: var(--terminal-orange-bright); }
#tb-study .tb-btn.on::before { content: "■ "; font-size: 8px; }
#tb-hint { display: none; }

.chart-picker { position: relative; flex: 0 0 auto; }
.chart-picker > summary {
  min-height: 25px;
  min-width: 108px;
  padding: 3px 7px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  background: var(--terminal-orange);
  color: #000000;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.chart-picker > summary::-webkit-details-marker { display: none; }
.chart-picker > summary span::after { content: ":"; }
.chart-picker > summary strong { margin-left: auto; font-weight: 600; }
.chart-picker > summary::after { content: "▼"; margin-left: 2px; font-size: 8px; }
.chart-picker[open] > summary,
.chart-picker > summary:hover { border-color: #FFFFFF; }
.picker-menu {
  position: absolute;
  top: calc(100% + 1px);
  left: 0;
  z-index: 12;
  min-width: 150px;
  padding: 3px;
  display: flex;
  flex-direction: column;
  border: 1px solid #8A8A8A;
  background: #000000;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .8);
}
.picker-menu .tb-btn {
  width: 100%;
  min-height: 27px;
  padding: 3px 7px;
  text-align: left;
}

body.chart-expanded #chart-panel { flex: 1 1 auto; grid-column: 1 / -1; grid-row: 1 / -1; border-bottom: 0; }
body.chart-expanded #bottom { display: none; }
body.chart-expanded #market-status { border-top-color: var(--border-strong); }

#chart-legend {
  position: absolute;
  left: 9px;
  top: 57px;
  z-index: 3;
  padding: 3px 7px;
  border: 1px solid var(--border-strong);
  background: rgba(0, 0, 0, .88);
  color: var(--text-data);
  font-size: 10px;
  line-height: 1.5;
  white-space: pre;
  pointer-events: none;
}
#chart-legend .k { color: var(--interactive); }

/* ---- performance panel ------------------------------------------------ */

.stats-grid {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 18px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  background: #000000;
}
.kpi {
  min-height: 35px;
  padding: 5px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 8px;
  border-bottom: 1px dotted #555555;
  background: #000000;
}
.kpi .val { color: var(--text-primary); font: 15px/1.25 var(--mono); }
.kpi .val.pos { color: var(--positive); }
.kpi .val.neg { color: var(--negative); }
.kpi .hint { display: none; }
/* A KPI carrying two figures takes the whole row rather than truncating one. */
.kpi-span { grid-column: 1 / -1; }
.net-pair { white-space: nowrap; }
/* Each side keeps its own sign colour; the separator stays white so the pair
   reads as two independent numbers rather than one expression. */
.net-pair .pos { color: var(--positive); }
.net-pair .neg { color: var(--negative); }
.net-slash { padding: 0 6px; color: #FFFFFF; }

.controls { flex: 0 0 auto; padding: 6px 8px; border-bottom: 1px solid var(--border); background: #000000; }
.ctl-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pill {
  padding: 2px 6px;
  border: 0;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 10px;
}
.pill.on { border: 0; background: var(--positive); color: #000000; }
.pill.soft { border-color: var(--warning); background: var(--warning); color: #000000; }
.pill.off { color: var(--text-muted); }
.financial-mode-label { margin-left: 8px; }
.pill.financial-mode.paper { background: var(--warning); color: #000000; }
.pill.financial-mode.cash { background: var(--positive); color: #000000; }
.ctl-note { margin-top: 4px; color: var(--text-muted); font-size: 10.5px; line-height: 1.4; }
.cmd { margin-top: 5px; padding: 4px 7px; border: 0; background: #242424; color: #FFFFFF; font-size: 11px; }
.cmd.pending { border: 0; background: var(--terminal-orange); color: #000000; }
.cmd.ok { border: 0; background: var(--positive); color: #000000; }
.cmd.err { border: 0; background: #B00020; color: #FFFFFF; }
.cmd ul { margin: 3px 0 0; padding-left: 14px; }

.chart-tabs { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 0; padding: 0 4px; border-bottom: 0; background: #A80F26; }
.tab { min-height: 27px; padding: 2px 7px; border-color: transparent; background: transparent; color: #FFFFFF; font-size: 11px; }
.tab:hover:not(:disabled) { border-color: #FFFFFF; background: #730719; color: #FFFFFF; }
.tab.active { border-color: transparent; background: #730719; color: #FFFFFF; font-weight: 400; }

.mini-wrap { position: relative; flex: 1 1 auto; min-height: 168px; padding: 0 6px 6px; }
#mini { width: 100%; height: 100%; display: block; cursor: crosshair; }
.mini-cap { position: absolute; left: 8px; top: 0; color: var(--text-disabled); font-size: 9px; pointer-events: none; }

/* ---- status bar ------------------------------------------------------- */

#market-status {
  min-height: 22px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 15px;
  overflow-x: auto;
  border-top: 1px solid var(--border-strong);
  background: #000000;
  color: var(--text-secondary);
  font-size: 10.5px;
  letter-spacing: 0;
  white-space: nowrap;
  scrollbar-width: none;
}
#market-status::-webkit-scrollbar { display: none; }
.status-item { padding: 2px 0; border-right: 0; }
.status-item:first-child { padding-left: 8px; }
.status-label { margin-right: 5px; color: var(--terminal-orange-bright); }
#sse-status.live { color: var(--positive); }
#sse-status.down { color: var(--negative); }
#terminal-clock { color: var(--text-data); }

/* ---- modals ----------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, .62);
}
.modal-box {
  width: min(1180px, 97vw);
  max-height: 84vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid #8A8A8A;
  background: #000000;
  box-shadow: 0 10px 32px rgba(0, 0, 0, .8);
}
.modal-box.small { width: min(470px, 94vw); padding: 10px; gap: 8px; background: #D0D0D0; color: #000000; }
.modal-box.small h2 { margin: -10px -10px 2px; padding: 5px 8px; background: #454545; color: #FFFFFF; font-size: 12.5px; font-weight: 400; letter-spacing: 0; text-transform: none; }
.modal-box.small p { margin: 0; color: #111111; font-size: 12px; line-height: 1.5; }
.modal-box.small button { border-color: #666666; background: #E5E5E5; color: #000000; }
.modal-box.small button:hover:not(:disabled) { border-color: #000000; background: #FFFFFF; color: #000000; }
.modal-box.small button.danger { border-color: #9C001D; background: #C60025; color: #FFFFFF; }
.modal-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 4px; }
.panel-head-actions { display: flex; align-items: center; gap: 4px; }

/* ---- financials ----------------------------------------------------- */

.financials-box { width: min(1180px, 97vw); min-height: min(620px, 84vh); }
.financials-lock {
  padding: 7px 10px;
  border-bottom: 1px solid var(--warning-muted);
  background: rgba(255, 212, 59, .14);
  color: var(--warning);
  font-size: 11px;
}
.financials-controls {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
}
.financial-setting {
  min-height: 58px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-right: 1px solid var(--border);
}
.financial-setting:last-child { border-right: 0; }
.setting-title { display: block; color: var(--text-primary); font-weight: 600; }
.setting-note { display: block; margin-top: 2px; color: var(--text-muted); font-size: 10.5px; }
.switch { display: inline-flex; align-items: center; gap: 7px; color: var(--text-primary); white-space: nowrap; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.switch-track {
  width: 34px;
  height: 18px;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  background: #1A1A1A;
  cursor: pointer;
}
.switch-thumb { width: 12px; height: 12px; background: var(--warning); transition: transform .12s ease; }
.switch input:checked + .switch-track { background: var(--positive-muted); border-color: var(--positive); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(16px); background: #FFFFFF; }
.switch input:disabled + .switch-track { cursor: not-allowed; opacity: .45; }
.segment { display: inline-flex; border: 1px solid var(--border-strong); }
.segment-btn { min-height: 26px; border: 0; border-right: 1px solid var(--border-strong); background: #0E0E0E; color: var(--text-secondary); }
.segment-btn:last-child { border-right: 0; }
.segment-btn.on { background: var(--terminal-orange); color: #000000; }
.financial-execution-segment { flex: 0 0 auto; }
.financial-execution-segment .segment-btn { white-space: nowrap; }
.financials-body { min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.wallet-summary { flex: 0 0 auto; padding: 9px 10px; border-bottom: 1px solid var(--border); }
.wallet-address-row { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.wallet-address { overflow: hidden; text-overflow: ellipsis; color: var(--interactive-bright); }
.wallet-facts { display: flex; align-items: center; gap: 18px; margin-top: 7px; color: var(--text-secondary); }
.wallet-facts #financial-refresh { margin-left: auto; }
.financial-error { margin: 7px 0 0; color: var(--negative); font-size: 11px; }
.financial-sizing {
  flex: 0 0 auto;
  min-height: 54px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--border);
  background: #0D0D0D;
}
.financial-size-editor { display: flex; align-items: center; gap: 0; }
.financial-size-editor input {
  width: 128px;
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid var(--border-strong);
  background: #000000;
  color: var(--text-primary);
  text-align: right;
}
.financial-size-editor input:focus { outline: 1px solid var(--interactive-bright); outline-offset: -1px; }
.financial-size-editor input:disabled { color: var(--text-disabled); cursor: not-allowed; }
.financial-size-unit {
  min-height: 28px;
  padding: 6px 8px;
  border-top: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-size: 10px;
}
.financial-size-editor button { min-height: 28px; }
.reserve-holdings {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border-bottom: 1px solid var(--border);
  background: var(--border);
}
.reserve-card {
  min-width: 0;
  padding: 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "symbol name amount" "symbol name usd";
  align-items: center;
  column-gap: 10px;
  background: #101010;
}
.reserve-symbol {
  grid-area: symbol;
  min-width: 48px;
  padding: 7px 6px;
  background: var(--terminal-orange);
  color: #000000;
  font-weight: 700;
  text-align: center;
}
.reserve-total-card .reserve-symbol { background: var(--positive); }
.reserve-name { grid-area: name; color: var(--text-muted); font-size: 10.5px; }
.reserve-card strong { grid-area: amount; color: var(--text-primary); text-align: right; }
.reserve-usd { grid-area: usd; color: var(--positive); text-align: right; }
.financial-table-title {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.financial-assets-scroll { flex: 1 1 auto; max-height: none; }
.financials-advanced { flex: 1 1 auto; display: grid; place-content: center; gap: 6px; text-align: center; color: var(--text-muted); }
.financials-advanced strong { color: var(--text-primary); }

/* ---- activity transaction tables ------------------------------------ */

.activity-tx-table { min-width: 660px; }
.activity-tx-table td { height: 38px; }
.activity-tx-table tbody tr { cursor: pointer; }
.activity-tx-table tbody tr:hover,
.activity-tx-table tbody tr:focus-visible { background: #181818; outline: 1px solid var(--interactive); outline-offset: -1px; }
.tx-cell-stack { display: grid; gap: 1px; }
.tx-cell-stack small { color: var(--text-muted); font-size: 9.5px; }
.tx-status {
  width: max-content;
  padding: 1px 5px;
  display: inline-block;
  font-size: 9.5px;
  text-transform: uppercase;
}
.tx-status.inflight { background: var(--warning); color: #000000; }
.tx-status.sent { background: var(--interactive); color: #000000; }
.tx-status.confirmed { background: var(--positive); color: #000000; }
.tx-status.processed { background: #67D5FF; color: #000000; }
.tx-status.error { background: var(--negative); color: #FFFFFF; }
.tx-status.unknown { background: #666666; color: #FFFFFF; }
.tx-signature { color: var(--interactive-bright); text-decoration: none; }
.tx-signature:hover { text-decoration: underline; }
.tx-id-unbroadcast { color: var(--text-muted); }
.activity-ledger-filter { margin-left: auto; min-height: 23px; }

/* Full transaction detail is fetched on demand. Keeping it out of the 1.5s
   activity payload is what makes this a useful inspector rather than Solscan's
   weight reproduced inside the terminal. */
#tx-detail-modal { z-index: 58; }
.tx-detail-box { width: min(1040px, 96vw); height: min(800px, 90vh); }
.tx-detail-updated { margin-left: auto; white-space: nowrap; }
.tx-detail-external { min-height: 23px; padding: 3px 7px; text-decoration: none; }
.tx-detail-scroll { padding: 0; }
.tx-detail-summary {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-strong);
  background: #111111;
  color: var(--text-primary);
  line-height: 1.45;
}
.tx-detail-summary.pos { border-left: 4px solid var(--positive); }
.tx-detail-summary.pending { border-left: 4px solid var(--warning); }
.tx-detail-summary.neg { border-left: 4px solid var(--negative); }
.tx-detail-error {
  padding: 9px 12px;
  border-bottom: 1px solid #6A1725;
  background: #29070D;
  color: var(--negative-bright);
  font: 11px/1.5 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.tx-detail-section { border-bottom: 1px solid var(--border-strong); }
.tx-detail-section > h3,
.tx-detail-disclosure > summary {
  min-height: 28px;
  margin: 0;
  padding: 6px 10px;
  background: #262626;
  color: var(--terminal-orange-bright);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.tx-detail-disclosure > summary { cursor: pointer; list-style-position: inside; }
.tx-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--border);
  gap: 1px;
}
.tx-detail-grid-wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tx-detail-field { min-width: 0; padding: 8px 10px; background: #080808; }
.tx-detail-field .lbl { display: block; margin-bottom: 3px; color: var(--text-muted); font-size: 9.5px; }
.tx-detail-field .val { display: block; overflow-wrap: anywhere; color: var(--text-primary); }
.tx-detail-field .val.pos { color: var(--positive); }
.tx-detail-field .val.neg { color: var(--negative); }
.tx-detail-flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--border); }
.tx-detail-flow-card { position: relative; min-width: 0; padding: 10px; background: #080808; }
.tx-detail-flow-card:not(:last-child)::after {
  content: '\2192';
  position: absolute;
  right: -7px;
  top: 50%;
  z-index: 1;
  width: 14px;
  margin-top: -8px;
  background: var(--terminal-orange);
  color: #000000;
  text-align: center;
}
.tx-detail-flow-card .lbl { display: block; color: var(--terminal-orange-bright); font-size: 9.5px; text-transform: uppercase; }
.tx-detail-flow-card strong { display: block; margin-top: 4px; color: var(--text-primary); overflow-wrap: anywhere; }
.tx-detail-flow-card small { display: block; margin-top: 3px; color: var(--text-muted); }
.tx-detail-identifiers { margin: 0; }
.tx-detail-identifiers > div {
  min-height: 31px;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}
.tx-detail-identifiers > div:last-child { border-bottom: 0; }
.tx-detail-identifiers dt { padding: 6px 10px; color: var(--text-muted); }
.tx-detail-identifiers dd { min-width: 0; margin: 0; padding: 6px 10px; color: var(--text-primary); overflow-wrap: anywhere; }
.tx-detail-identifiers a { color: var(--interactive-bright); }
.tx-detail-copy { margin-right: 7px; min-height: 21px; padding: 1px 6px; }
.tx-detail-diagnostics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--border); }
.tx-detail-logs { margin: 0; padding: 7px 7px 7px 42px; background: #050505; color: var(--text-secondary); font: 10px/1.5 var(--mono); }
.tx-detail-logs li { padding: 1px 6px; border-bottom: 1px dotted #292929; overflow-wrap: anywhere; }
.tx-detail-logs li::marker { color: var(--text-disabled); }

@media (max-width: 760px) {
  .tx-detail-box { width: 98vw; height: 94vh; }
  .tx-detail-updated { display: none; }
  .tx-detail-grid, .tx-detail-grid-wide, .tx-detail-flow, .tx-detail-diagnostics { grid-template-columns: 1fr; }
  .tx-detail-flow-card:not(:last-child)::after { display: none; }
  .tx-detail-identifiers > div { grid-template-columns: 1fr auto; }
  .tx-detail-identifiers dt { grid-column: 1 / 3; padding-bottom: 0; }
}

.launch-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border: 1px solid #777777; background: #777777; }
.lg-cell { padding: 5px 7px; display: flex; flex-direction: column; gap: 2px; background: #FFFFFF; }
.lg-cell .lbl { color: #555555; }
.lg-cell .val { color: #000000; font-size: 18px; line-height: 1.15; }
.lg-cell .val.neg { color: var(--negative); }
#lm-state { color: var(--warning); }
.rpc-note { margin-left: auto; margin-right: 12px; color: #F2B7C0; font-size: 10px; letter-spacing: 0; text-transform: none; white-space: nowrap; }

/* Live durable-inbox monitor. Black, high-contrast terminal chrome rather
   than the light confirmation-dialog treatment; this is an operating panel,
   not a warning that blocks the rest of the screen. */
#inbox-modal { z-index: 55; }
#inbox-modal .inbox-box { width: min(720px, 94vw); }
.inbox-state {
  margin-left: 5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #FFFFFF;
  font-size: 11px;
}
.inbox-live { margin-left: auto; color: #F2B7C0; font-size: 10px; white-space: nowrap; }
.inbox-body { padding: 8px; background: #000000; }
.inbox-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--border-strong);
  background: var(--border-strong);
  gap: 1px;
}
.inbox-cell {
  min-width: 0;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #000000;
}
.inbox-cell .lbl { color: var(--terminal-orange-bright); font-size: 10px; white-space: nowrap; }
.inbox-cell .val { color: #FFFFFF; font-size: 18px; line-height: 1.2; }
.inbox-detail { margin: 8px 0 0; border-top: 1px solid var(--border); }
.inbox-detail > div {
  min-height: 28px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr);
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
}
.inbox-detail dt { padding: 4px 7px; color: var(--terminal-orange-bright); font-size: 10.5px; }
.inbox-detail dd { margin: 0; padding: 4px 7px; color: #FFFFFF; text-align: right; }
.inbox-note {
  margin: 8px 0 0;
  padding: 6px 7px;
  border-left: 3px solid var(--interactive);
  background: #101010;
  color: var(--text-secondary);
  font-size: 11px;
}
.inbox-note.pos { border-left-color: var(--positive); color: var(--positive-bright); }
.inbox-note.pending { border-left-color: var(--warning); color: var(--warning); }
.inbox-note.neg { border-left-color: var(--negative); color: var(--negative-bright); }

select {
  min-height: 25px;
  padding: 2px 7px;
  border: 0;
  border-radius: 0;
  background: var(--terminal-orange);
  color: #000000;
  font: 11.5px/1.3 var(--ui);
}

/* ---- responsive ------------------------------------------------------- */

@media (max-width: 1100px) {
  body { height: auto; min-height: 100vh; overflow: auto; }
  main { height: auto; display: flex; flex-direction: column; }
  #bottom { min-height: 0; display: grid; grid-template-columns: 1fr; grid-template-rows: auto; }
  .activity-head { grid-column: 1; grid-row: auto; }
  #p-open, #p-closed, #p-stats { grid-column: auto; grid-row: auto; }
  .panel { min-height: 280px; border-right: 0; border-bottom: 1px solid var(--border); }
  #chart-panel { height: 50vh; min-height: 340px; flex: 0 0 auto; }
  .scroll { max-height: 46vh; }
  .terminal-context { display: none; }
  .hdr-row { grid-template-columns: 82px minmax(0, 1fr); }
  .progress-cluster { grid-column: 1 / -1; border-top: 1px solid var(--border); }
  #chart-bar { gap: 5px 10px; }
}

@media (max-width: 720px) {
  .command-bar { flex-wrap: wrap; }
  .terminal-id { min-width: 100%; min-height: 27px; border-right: 0; border-bottom: 1px solid var(--border); }
  .command-nav { width: 100%; }
  .nav-btn { flex: 1 0 auto; }
  .hdr-row { display: flex; flex-wrap: wrap; }
  .strip-title { width: 100%; min-height: 24px; flex-direction: row; justify-content: flex-start; align-items: center; gap: 5px; border-right: 0; border-bottom: 1px solid var(--border-strong); }
  .status-cluster { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-right: 0; }
  .status-cluster .stat:last-child { grid-column: 1 / -1; }
  .progress-cluster { width: 100%; display: block; border-top: 1px solid var(--border); }
  .stat { min-width: 0; border-bottom: 1px solid var(--border); }
  .stat.stat-wide { min-width: 0; }
  .stat.grow { min-width: 100%; }
  #chart-bar { align-items: flex-start; }
  .tb-section { border-right: 0; border-bottom: 0; }
  #tb-hint { display: none; }
  .rpc-note { display: none; }
  .launch-grid { grid-template-columns: 1fr; }
  .inbox-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inbox-detail > div { grid-template-columns: 1fr; }
  .inbox-detail dd { padding-top: 0; text-align: left; }
  .financials-controls { grid-template-columns: 1fr; }
  .financial-setting { border-right: 0; border-bottom: 1px solid var(--border); }
  .wallet-facts { flex-wrap: wrap; gap: 7px 14px; }
  .financial-sizing { align-items: flex-start; flex-direction: column; gap: 7px; }
  .reserve-holdings { grid-template-columns: 1fr; }
  .activity-head { flex-wrap: wrap; min-height: 54px; }
  #activity-live-status { width: 100%; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}

/* ---- backtest token viewer -------------------------------------------------
   The footer row carries paging and the summary. It reuses .panel-head so the
   modal has the same chrome top and bottom rather than a second bar style. */
.bt-foot { border-top: 1px solid var(--line, #223); border-bottom: none; gap: .5rem; }
#bt-modal .modal-box { width: min(1180px, 96vw); }
#bt-modal thead th { user-select: none; white-space: nowrap; }
#bt-modal thead th[data-sort]:hover { color: var(--fg, #cfe); }
#bt-stage { margin-left: auto; }

/* ---- backtest day selector -------------------------------------------------
   One chip per UTC day of the chosen split, showing what that day won or lost.
   Horizontally scrollable rather than wrapping, so the strip stays one row
   however long the evaluation window gets. */
.bt-days {
  display: flex; gap: 0; padding: .25rem .4rem;
  overflow-x: auto; white-space: nowrap;
  border-bottom: 1px solid #4B4B4B;
  background: #1A1A1A;
}
.bt-day {
  display: flex; flex-direction: column; align-items: center; gap: .1rem;
  padding: .25rem .5rem; min-width: 4.2rem;
  background: transparent; border: 1px solid transparent; border-radius: 0;
  color: #FFFFFF; font: inherit; font-size: .74rem; cursor: pointer;
}
.bt-day:hover { border-color: #FFFFFF; }
.bt-day.on { border-color: #155A9C; color: #FFFFFF; background: #155A9C; }
.bt-day-l { font-size: .7rem; letter-spacing: .02em; }
.bt-day-v { font-variant-numeric: tabular-nums; font-weight: 600; }
.bt-day.pos .bt-day-v { color: var(--pos, #3c9); }
.bt-day.neg .bt-day-v { color: var(--neg, #e56); }
#bt-rows tr { cursor: pointer; }
#bt-rows tr:hover { background: #151515; }

/* ---- backtest token chart --------------------------------------------------
   Its own chart instance in its own modal, so opening a backtest token does not
   disturb whatever the market panel is showing. */
/* ABOVE the backtest table it was opened from. `.modal` is z-index 50 and both
   are modals, so without this the chart renders behind the list that spawned
   it — same stacking context, later element wins only if the z-index ties. */
#btc-modal { z-index: 60; }
#btc-modal .modal-box { width: min(1100px, 94vw); }
/* the mint is a link out to the explorer; it must not look like plain text */
.mint-link { color: var(--interactive, #3abfe7); text-decoration: none; cursor: pointer; }
.mint-link:hover { text-decoration: underline; }
.btc-chart { height: min(58vh, 520px); width: 100%; }
:root .trading-pad-control select {
  background: #15202d;
  color: #e6edf3;
  border: 1px solid #3b5068;
  border-radius: 4px;
  padding: 5px 8px;
  font: inherit;
}
.trading-pad-control { flex-shrink: 0; margin-left: auto; }
:root .trading-pad-control select:focus-visible { outline: 2px solid #54bddb; outline-offset: 2px; }

/* Compact trading workspace. */
.command-nav .nav-btn .hotkey { display: none; }
:root {
  --ui: 'Arial Narrow', 'Segoe UI', Arial, sans-serif;
  --mono: 'Arial Narrow', 'Segoe UI', Arial, sans-serif;
  --positive: #49ba8d;
  --negative: #ff3163;
  --terminal-orange: #d0d0d0;
  --terminal-orange-bright: #ededed;
  --text-label: #aaa;
  --border: #303030;
  --border-strong: #3a3a3a;
  --bg-selected: #222;
  --row: 24px;
}
body { font-size: 12px; }
.command-bar { min-height: 47px; align-items: center; background: #000; border-bottom: 1px solid #202020; gap: 5px; }
.terminal-id { min-width: auto; padding: 0 14px; }
.terminal-name { color: #f4f4f4; font-size: 27px; font-weight: 750; letter-spacing: .02em; }
.terminal-product, .hotkey, .context-key { display: none; }
.command-nav { align-items: center; gap: 4px; padding: 0; }
.command-nav .nav-btn, .terminal-tools button { min-height: 24px; height: 24px; padding: 2px 15px; border: 1px solid #292929; border-radius: 16px; background: linear-gradient(#292929, #191919); color: #ddd; font-size: 12px; }
.nav-btn.utility { margin-left: 0; }
.command-nav .nav-btn.active { color: #fff; background: #303030; }
.terminal-tools { display: flex; margin-left: 5px; }
.terminal-tools button { background: #080808; padding: 2px 12px; }
.terminal-context { margin-left: 5px; padding: 0 10px; gap: 14px; font-size: 10px; }
.terminal-context .mode { text-transform: uppercase; }
.command-bar .stats-grid { display: flex; align-items: center; margin-left: auto; padding: 2px 8px; gap: 20px; border: 0; }
.command-bar .kpi { min-height: 0; display: flex; flex-direction: column; gap: 0; padding: 0; border: 0; white-space: nowrap; }
.command-bar .kpi:has(#k-pos) { display: none; }
.command-bar .kpi .lbl { font-size: 12px; color: #999; }
.command-bar .kpi .val { font-size: 15px; line-height: 1.3; }
.net-slash { padding: 0 4px; }
.workspace-tabs { display: flex; height: 35px; flex: 0 0 auto; padding: 0 12px; border: 1px solid #262626; gap: 9px; }
.workspace-tabs .nav-btn { min-height: 0; padding: 4px 12px; background: none; color: #aaa; border: 0; border-bottom: 2px solid transparent; }
.workspace-tabs .nav-btn.active { color: #fff; border-bottom-color: #eee; }
main { gap: 5px; padding: 4px; grid-template-columns: minmax(255px, 21.5fr) minmax(400px, 41fr) minmax(400px, 37.5fr); grid-template-rows: minmax(400px, 67fr) minmax(210px, 33fr); }
#market-sidebar { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; gap: 5px; min-height: 0; min-width: 0; }
#market-activity { flex: 1 1 auto; }
#market-activity .panel-head { gap: 7px; }
#market-activity h2 { white-space: nowrap; flex: 0 0 auto; }
#market-search { width: 100%; min-width: 50px; height: 23px; padding: 2px 7px; border: 1px solid #363636; border-radius: 2px; background: #1b1b1b; color: #eee; font: inherit; }
#market-activity table { table-layout: fixed; }
#market-activity th:first-child { width: 32%; }
#market-activity th:last-child { width: 22%; }
#market-activity td { height: 28px; padding: 3px 8px; }
#system-status { flex: 0 0 auto; }
#system-status .hdr-row { display: block; min-height: 0; }
#system-status .strip-title { display: none; }
#system-status .status-cluster, #system-status .progress-cluster { display: flex; flex-direction: column; border: 0; }
#system-status .stat { min-width: 0; min-height: 27px; padding: 3px 8px; display: grid; grid-template-columns: 38% minmax(0, 1fr); align-items: center; gap: 5px; border-bottom: 1px solid #202020; }
#system-status .stat.grow { flex: none; }
#system-status .stat .lbl { white-space: normal; font-size: 12px; color: #999; }
#system-status .stat .val { min-height: 18px; font-size: 12px; gap: 6px; }
#system-status .stat .val > span:not(.bar) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#system-status .stat-actions { display: none; }
#system-status #s-backfill { border-bottom: 0; }
#system-status #feed-toggle { margin-left: auto; padding: 0 3px; font-size: 9px; }
#system-status #inbox-popout { border: 0; }
#system-status .bar { height: 8px; min-width: 20px; }
#chart-panel { grid-column: 2; grid-row: 1; min-width: 0; min-height: 0; border: 1px solid var(--border); }
.panel { border: 1px solid var(--border); }
.panel:last-child { border-right: 1px solid var(--border); }
.panel-head { min-height: 30px; padding: 3px 9px; background: #000; border-bottom: 1px solid var(--border); }
.panel-head h2 { font-weight: 650; font-size: 14px; }
.panel-head h2 .sub { color: #aaa; font-size: 11px; }
#chart-panel .panel-head h2 { align-items: center; gap: 10px; }
.function-title { margin-left: 0; font-size: 14px; }
#chart-mint { font-size: 12px; font-weight: 400; white-space: nowrap; }
#chart-unit { display: none; }
.attrib { font-size: 8px; color: #666; }
#chart-bar { padding: 4px; gap: 5px; background: #000; border-bottom: 1px solid #202020; flex-wrap: wrap; }
.tb-label, #tb-hint { display: none; }
.tb-section { border: 0; padding: 0; }
.tb-btn { padding: 2px 7px; min-height: 24px; color: #ddd; background: #181818; border: 1px solid #292929; }
.tb-btn.on { color: white; background: #087ebd; }
.chart-picker summary { background: linear-gradient(#292929, #181818); color: #ddd; border: 1px solid #353535; padding: 3px 7px; }
.chart-picker summary span { color: #ccc; }
.chart-picker summary strong { color: #eee; }
#analytics-sidebar { grid-column: 3; grid-row: 1; min-height: 0; min-width: 0; display: grid; grid-template-rows: minmax(160px, 1.75fr) minmax(120px, 1fr) auto; gap: 5px; }
#p-stats { grid-column: auto; grid-row: auto; }
.chart-tabs { background: #000; border-bottom: 1px solid #303030; gap: 7px; padding: 0 8px; }
.tab, .tab:hover:not(:disabled) { min-height: 30px; padding: 3px 7px; background: #000; color: #999; border: 0; border-bottom: 2px solid transparent; }
.tab.active { background: #000; color: #fff; border-bottom: 2px solid #eee; }
.mini-wrap { min-height: 0; padding: 0 5px 4px; }
.mini-cap { display: none; }
.drawdown-wrap { flex: 1; min-height: 0; padding: 0 5px; }
#drawdown-chart { display: block; width: 100%; height: 100%; }
.controls { border: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
.ctl-row { flex-shrink: 0; gap: 9px; }
.ctl-row .lbl { color: #aaa; }
.ctl-note { flex: 1; min-width: 130px; margin: 0; font-size: 10px; line-height: 1.4; max-height: 43px; overflow: auto; }
.pill { background: #222; border: 1px solid #333; border-radius: 2px; }
button.primary { background: #49b98c; color: #07170f; border: 1px solid #61c59b; border-radius: 3px; min-width: 58px; }
#btn-stop { background: #222; border: 1px solid #333; border-radius: 3px; min-width: 58px; }
#bottom { grid-column: 1 / -1; grid-row: 2; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: 31px minmax(0, 1fr); border: 1px solid var(--border); }
.activity-head { grid-column: 1 / -1; min-height: 0; padding: 3px 9px; background: #000; gap: 6px; }
.activity-title { text-transform: none; letter-spacing: 0; color: #eee; font-size: 14px; font-weight: 650; margin-right: 12px; }
.activity-head .segment { border: 0; }
.activity-head .segment-btn { padding: 3px 13px; background: #222; color: #aaa; border: 0; border-bottom: 2px solid transparent; border-radius: 2px; }
.activity-head .segment-btn.on { color: #fff; background: #292929; border-bottom-color: #eee; }
.activity-head .segment-btn span { margin-left: 8px; }
#activity-view-note { display: none; }
.activity-head .segment { display: flex; align-items: center; gap: 8px; }
#market-activity th:first-child { width: 44%; }
#market-activity th:last-child { width: 28%; }
#market-activity td.radar-status { text-align: center; font-weight: 650; }
#market-activity td.radar-entry { color: #70dfad; background: #103323; border-bottom-color: #164d34; }
#market-activity td.radar-reject { color: #ff6688; background: #37101a; border-bottom-color: #551529; }
#market-activity td.radar-watching { color: #999; }
#market-activity th:first-child { width: 35%; }
#market-activity th:last-child { width: 33%; }
#market-activity td { height: 42px; padding: 4px 8px; }
.radar-feed { flex: 0 0 auto; padding: 7px 9px; border-bottom: 1px solid #292929; color: #9dafb7; font-size: 10px; }
.radar-feed::before { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #64cda4; margin-right: 6px; }
.radar-feed.stale { color: #e4b265; }
.radar-feed.stale::before { background: #e4b265; }
.radar-row { transition: background-color .2s; }
.radar-row:hover { background: #11212a; }
.radar-row:focus-visible { outline: 1px solid #42bfe8; outline-offset: -1px; }
.radar-row.selected .radar-token { box-shadow: inset 3px 0 #42bfe8; }
.radar-token { overflow: hidden; text-overflow: ellipsis; }
.radar-token small, .radar-score small, .radar-status small { display: block; margin-top: 4px; font-size: 10px; line-height: 1.2; }
.radar-token small, .radar-score small { color: #879299; font-weight: 400; }
.radar-score strong { font-size: 12px; font-weight: 550; font-variant-numeric: tabular-nums; }
.radar-phase-label { font-size: 11px; font-weight: 500; color: #c1c9ce; }
.radar-phase-label::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 4px; border-radius: 50%; background: currentColor; }
.radar-outcome { letter-spacing: .02em; }
.radar-phase-waiting .radar-phase-label { color: #8d999f; }
.radar-phase-evaluating .radar-phase-label { color: #67d7ff; }
.radar-phase-evaluating .radar-phase-label::before { animation: radar-pulse .6s ease-in-out infinite alternate; }
.radar-phase-evaluating .radar-score { background: #102c3a; color: #8ee2ff; }
.radar-detail { flex: 0 0 auto; padding: 8px 10px; max-height: 120px; overflow-y: auto; border-top: 1px solid #333; background: #080d10; color: #92a3ad; font-size: 11px; line-height: 1.4; }
.radar-detail > strong { color: #d7e8ef; font-size: 12px; }
.radar-detail p { margin: 4px 0; }
.radar-detail > small { display: block; margin-top: 6px; color: #829099; }
.radar-history { display: flex; gap: 4px; flex-wrap: wrap; }
.radar-history span { padding: 2px 5px; border: 1px solid #294039; border-radius: 3px; font-variant-numeric: tabular-nums; cursor: help; }
.radar-history .pass { color: #70dfad; background: #103323; }
.radar-history .fail { color: #ff829e; background: #2b1119; border-color: #512031; }
.radar-history span:hover { border-color: #91b9cf; }
@keyframes radar-pulse { from { opacity: .35; } to { opacity: 1; box-shadow: 0 0 6px #67d7ff; } }
@media (prefers-reduced-motion: reduce) {
  .radar-row { transition: none; }
  .radar-phase-evaluating .radar-phase-label::before { animation: none; }
}
#p-open, #p-closed { grid-column: 1; grid-row: 2; border: 0; }
#p-open > .panel-head, #p-closed > .panel-head { display: flex; }
#bottom #p-closed { grid-column: 2; border-left: 1px solid var(--border); }
thead th { background: #000; color: #aaa; font-size: 12px; border-right: 1px solid #191919; padding: 4px 10px; }
tbody td { border-right: 1px solid #151515; font-size: 12px; padding: 2px 10px; }
tbody td.pos { color: var(--positive); }
tbody td.neg { color: var(--negative); }
tbody tr:hover { outline: none; background: #1b1b1b; }
.panel-foot { min-height: 32px; padding: 3px 9px; background: #000; border-top: 1px solid #303030; }
#trade-live-foot { justify-content: flex-end; }
#close-all { color: var(--negative); }
#market-status { min-height: 32px; gap: 0; }
.status-item { padding: 2px 17px; border-right: 1px solid #202020; }
.status-label { color: #999; margin-right: 10px; }
.financials-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.launchpad-setting select { background: #222; color: #eee; border: 1px solid #444; border-radius: 3px; min-width: 130px; }
body.chart-expanded #market-sidebar, body.chart-expanded #analytics-sidebar { display: none; }
body.chart-expanded #chart-panel { grid-column: 1 / -1; }
@media (max-width: 1450px) {
  .command-nav .nav-btn { padding: 2px 9px; }
  .command-bar .stats-grid { gap: 12px; }
  .terminal-context { display: none; }
  .chart-tabs { gap: 0; padding: 0 3px; }
  .tab { padding: 3px 5px; font-size: 10px; }
}
@media (max-width: 1100px) {
  .command-bar { flex-wrap: wrap; padding: 6px 0; }
  .command-bar .stats-grid { margin: 4px 0 0; width: 100%; justify-content: space-around; }
  main { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(0, 2fr); grid-template-rows: 480px 400px 300px; }
  #market-sidebar { grid-column: 1; grid-row: 1; }
  #chart-panel { grid-column: 2; grid-row: 1; height: auto; min-height: 0; }
  #analytics-sidebar { grid-column: 1 / -1; grid-row: 2; }
  #bottom { grid-column: 1 / -1; grid-row: 3; display: grid; }
  .panel { min-height: 0; }
  .scroll { max-height: none; }
}
@media (max-width: 720px) {
  .terminal-id { min-width: auto; border: 0; }
  .terminal-name { font-size: 23px; }
  .command-nav { width: auto; flex-wrap: wrap; }
  .command-nav .nav-btn { font-size: 11px; padding: 2px 8px; }
  .command-bar .stats-grid { gap: 8px; flex-wrap: wrap; justify-content: flex-start; }
  .command-bar .kpi .val { font-size: 13px; }
  .workspace-tabs { overflow-x: auto; padding: 0; gap: 0; }
  main { display: flex; flex-direction: column; }
  #market-sidebar { min-height: 380px; }
  #market-activity { min-height: 170px; max-height: 250px; }
  #chart-panel { height: 420px; }
  #analytics-sidebar { min-height: 440px; }
  #bottom { display: grid; min-height: 290px; }
  .activity-head { flex-wrap: nowrap; overflow-x: auto; }
  .activity-title { margin-right: 0; }
  .activity-head .segment-btn { white-space: nowrap; padding: 3px 9px; }
  #system-status .status-cluster { width: 100%; }
  #bottom { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: 31px minmax(230px, 1fr); }
  #bottom #p-closed { grid-column: 2; grid-row: 2; }
  .financials-controls { grid-template-columns: 1fr; }
}
