/* Trading-terminal look: black screen, amber labels, dense monospace grids, function keys,
   command line, tick flashes. Dark only, on purpose. */
:root {
  --bg: #000;
  --panel: #070707;
  --row-alt: #0c0c0c;
  --line: #2a2a2a;
  --amber: #ff9f1c;
  --amber-dim: #a8660f;
  --text: #e8e8e8;
  --muted: #8c8c8c;
  --faint: #555;
  --key: #ffd21f;
  --bar: #11305c;
  --bar-text: #d6e4ff;
  --pos: #19e06a;
  --pos-strong: #5dff9b;
  --neg: #ff4040;
  --neg-strong: #ff7a7a;
  --pos-bg: rgba(25, 224, 106, .12);
  --hl: #1c2a3d;
  --mono: "Cascadia Mono", "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; border-radius: 0 !important; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0 auto; max-width: 1640px; padding: 0 12px 16px;
  background: var(--bg); color: var(--text);
  font: 12.5px/1.4 var(--mono); font-variant-numeric: tabular-nums;
}
button, input { font: inherit; color: inherit; }
::selection { background: var(--amber); color: #000; }
b { color: var(--key); font-weight: 700; }

/* ---- command bar ---- */
.top { display: flex; align-items: stretch; margin-top: 8px; border: 1px solid var(--line); background: var(--panel); }
.logo { background: var(--amber); color: #000; font-weight: 800; padding: 0 10px; display: flex; align-items: center; letter-spacing: .06em; }
.cmdwrap { position: relative; display: flex; align-items: center; flex: 1; min-width: 0; padding: 0 8px; gap: 6px; }
.prompt { color: var(--amber); font-weight: 700; }
#cmd { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--key); font-weight: 700; text-transform: uppercase; padding: 6px 0; caret-color: var(--amber); }
#cmd::placeholder { color: #4a4a4a; font-weight: 400; }
.cmdwrap:focus-within { background: #0f0900; box-shadow: inset 0 -1px 0 var(--amber); }
.go { color: #000; background: var(--key); padding: 0 5px; font-weight: 800; font-size: 11px; cursor: pointer; }
.suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: #050505; border: 1px solid var(--amber-dim); max-height: 300px; overflow: auto; }
.suggest div { display: flex; gap: 12px; padding: 3px 10px; cursor: pointer; }
.suggest div.on, .suggest div:hover { background: var(--amber); color: #000; }
.suggest div.on span, .suggest div:hover span { color: #000; }
.suggest b { min-width: 120px; }
.suggest div.on b, .suggest div:hover b { color: #000; }
.suggest span { color: var(--muted); text-transform: uppercase; }
.clock { display: flex; align-items: center; padding: 0 12px; border-left: 1px solid var(--line); color: var(--key); font-weight: 700; white-space: nowrap; }
.status { display: flex; align-items: center; gap: 7px; padding: 0 12px; border-left: 1px solid var(--line); color: var(--muted); text-transform: uppercase; font-size: 11.5px; white-space: nowrap; }
.dot { width: 8px; height: 8px; background: var(--faint); border-radius: 50% !important; flex: none; }
.status.live .dot { background: var(--pos); box-shadow: 0 0 6px var(--pos); animation: blink 2s steps(1) infinite; }
.status.live { color: var(--pos); }
.status.down .dot { background: var(--neg); }
.status.down { color: var(--neg); }
@keyframes blink { 50% { opacity: .35; } }

/* ---- ticker tape ---- */
.ticker { border: 1px solid var(--line); border-top: 0; background: #000; overflow: hidden; white-space: nowrap; height: 22px; }
.ticker-track { display: inline-flex; animation: tape 80s linear infinite; padding-top: 3px; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.tk { padding: 0 14px; border-right: 1px solid #1a1a1a; }
.tk b { color: var(--amber); margin-right: 6px; }
@keyframes tape { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---- function keys ---- */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin-top: 8px; }
.tabs button { background: #1a1a1a; border: 0; padding: 4px 10px 4px 0; cursor: pointer; color: var(--text); white-space: nowrap; font-weight: 700; text-transform: uppercase; font-size: 11.5px; display: inline-flex; align-items: center; gap: 7px; }
.tabs button::before { content: attr(data-key); background: var(--key); color: #000; padding: 4px 6px; margin: -4px 0; }
.tabs button:hover { background: #262626; }
.tabs button[aria-selected=true] { background: var(--amber); color: #000; }
.tabs .sub { color: var(--muted); font-weight: 400; }
.tabs button[aria-selected=true] .sub { color: #3d2500; }

/* ---- KPIs ---- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 8px 0; border: 1px solid var(--line); }
.kpi { background: var(--panel); padding: 6px 10px; min-width: 0; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: 0; }
.kpi .label { color: var(--amber); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.kpi .value { font-size: 22px; font-weight: 700; line-height: 1.25; }
.kpi .detail { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; }

/* ---- layout + cost panel ---- */
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 8px; align-items: start; }
.costs details { background: var(--panel); border: 1px solid var(--line); position: sticky; top: 8px; }
.costs summary { cursor: pointer; list-style: none; background: var(--bar); color: var(--bar-text); padding: 3px 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: 11.5px; }
.costs summary::-webkit-details-marker { display: none; }
.costs summary::after { content: "[−]"; float: right; color: var(--key); }
.costs details:not([open]) summary::after { content: "[+]"; }
.hint { color: #8fb0e6; font-weight: 400; }
#costs { display: grid; gap: 6px; padding: 8px 8px 0; }
.field label { display: block; font-size: 10.5px; color: var(--amber); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 1px; }
.field input[type=number], .field input[type=text] { width: 100%; padding: 2px 6px; background: #000; border: 1px solid var(--line); color: var(--key); font-size: 12.5px; font-weight: 700; }
.field input::placeholder { color: var(--faint); font-weight: 400; }
.field input:focus, #filter:focus { outline: 1px solid var(--amber); outline-offset: -1px; background: #120b00; }
.checks { display: flex; flex-wrap: wrap; gap: 3px 12px; }
.check { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; text-transform: uppercase; font-size: 11.5px; }
.check input { accent-color: var(--amber); margin: 0; }
.cost-actions { padding: 8px; }
.cost-actions button { background: #000; border: 1px solid var(--amber-dim); color: var(--amber); padding: 2px 8px; cursor: pointer; text-transform: uppercase; font-size: 11px; }
.cost-actions button:hover { background: var(--amber); color: #000; }
.fine { color: var(--faint); font-size: 10.5px; margin: 0; padding: 0 8px 8px; text-transform: uppercase; }

.toolbar { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; }
.toolbar::before { content: "FILTER>"; color: var(--amber); font-weight: 700; }
#filter { flex: 1; max-width: 320px; padding: 2px 6px; background: #000; border: 1px solid var(--line); color: var(--key); text-transform: uppercase; }
#filter::placeholder { color: var(--faint); }
.count { color: var(--muted); text-transform: uppercase; font-size: 11.5px; }
.notice { border: 1px solid var(--amber-dim); background: #140c00; color: var(--amber); padding: 3px 8px; margin-bottom: 6px; text-transform: uppercase; font-size: 11.5px; }
.notice::before { content: "▲ "; }
.panel { display: none; }
.panel.on { display: block; }
.path { color: var(--muted); margin: 0 0 6px; font-size: 11.5px; text-transform: uppercase; }

/* ---- grids ---- */
.tw { overflow-x: auto; border: 1px solid var(--line); background: var(--panel); }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 2px 9px; text-align: right; white-space: nowrap; }
th { position: sticky; top: 0; background: var(--bar); color: var(--bar-text); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
td { border-bottom: 1px solid #141414; }
tbody tr:nth-child(even) td { background: var(--row-alt); }
th.l, td.l { text-align: left; }
td.ccy { color: var(--amber); font-weight: 700; }
td.ctry { color: var(--muted); text-transform: uppercase; font-size: 11.5px; }
td.src { color: var(--faint); font-size: 11px; }
tr[data-ccy] { cursor: pointer; }
tbody tr:hover td { background: var(--hl); }
tr.grp td { border-top: 1px solid #333; }
tr.cont td.ccy, tr.cont td.ctry, tr.cont td.fx { color: transparent; }
.dim { color: var(--faint); }
.pos { color: var(--pos); }
.pos2 { color: var(--pos-strong); font-weight: 700; }
.neg { color: var(--neg); }
.neg2 { color: var(--neg-strong); font-weight: 700; }
td.net-pos { background: var(--pos-bg) !important; }
.ov { color: var(--key); }
.empty { padding: 20px; text-align: center; color: var(--amber); text-transform: uppercase; }
td.spark { padding: 0 6px; }
.spark svg { display: block; width: 90px; height: 16px; }

/* tick flash: price moved up / down since the previous poll */
td.up { animation: flash-up 1.6s ease-out; }
td.dn { animation: flash-dn 1.6s ease-out; }
@keyframes flash-up { 0%, 25% { background: #0b5d2c; color: #fff; } 100% { background: transparent; } }
@keyframes flash-dn { 0%, 25% { background: #7a1414; color: #fff; } 100% { background: transparent; } }

/* ---- heat map ---- */
.hmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 2px; }
.tile { padding: 6px 8px; cursor: pointer; border: 1px solid #000; min-width: 0; }
.tile:hover { outline: 1px solid var(--key); outline-offset: -1px; }
.tile .c { font-weight: 800; color: #fff; font-size: 14px; }
.tile .v { font-weight: 700; color: #fff; font-size: 15px; }
.tile .n { color: rgba(255, 255, 255, .62); font-size: 10.5px; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- currency page (DES) ---- */
.deshead { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line); background: var(--panel); margin-bottom: 8px; }
.deshead > div { padding: 5px 12px; border-right: 1px solid var(--line); }
.deshead .k { color: var(--amber); font-size: 10.5px; text-transform: uppercase; display: block; }
.deshead .v { font-size: 16px; font-weight: 700; }
.deshead .sec { background: var(--amber); color: #000; }
.deshead .sec .k, .deshead .sec .v { color: #000; }
.desgrid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 8px; }
.box { border: 1px solid var(--line); background: var(--panel); min-width: 0; margin-bottom: 8px; }
.box h3 { margin: 0; background: var(--bar); color: var(--bar-text); font-size: 11px; padding: 3px 8px; text-transform: uppercase; letter-spacing: .05em; display: flex; justify-content: space-between; gap: 8px; }
.box h3 span { color: #8fb0e6; font-weight: 400; }
.chart { display: block; width: 100%; height: auto; }
.chart .grid { stroke: #1d1d1d; }
.chart .zero { stroke: var(--amber-dim); stroke-dasharray: 3 3; }
.chart .ax { fill: var(--muted); font: 10px var(--mono); }
.chart .ln { fill: none; stroke: var(--key); stroke-width: 1.5; }
.chart .area { stroke: none; }
.chart .last { fill: #000; font: 700 10.5px var(--mono); }
.wf td:first-child { text-align: left; color: var(--muted); text-transform: uppercase; font-size: 11.5px; }
.wf td.unit { color: var(--amber); text-align: left; font-size: 11px; }
.wf tr.total td { border-top: 1px solid var(--amber-dim); font-weight: 700; }
.wf tr.total td:first-child { color: var(--amber); }

/* ---- feeds ---- */
.feeds { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); border: 1px solid var(--line); border-right: 0; border-bottom: 0; }
.feed { background: var(--panel); padding: 5px 9px; min-width: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.feed .name { display: flex; align-items: center; gap: 7px; font-weight: 700; color: var(--amber); text-transform: uppercase; }
.feed .kind { margin-left: auto; color: #000; background: var(--muted); font-size: 10px; padding: 0 4px; }
.feed .meta { color: var(--muted); font-size: 11.5px; margin-top: 2px; text-transform: uppercase; }
.feed .err { color: var(--neg); font-size: 11px; margin-top: 2px; word-break: break-word; }
.feed .dot.ok { background: var(--pos); }
.feed .dot.bad { background: var(--neg); }
.feed .dot.idle { background: var(--key); }

/* ---- help ---- */
.about { max-width: 860px; }
.about h2 { font-size: 11.5px; margin: 14px 0 5px; background: var(--bar); color: var(--bar-text); padding: 3px 8px; text-transform: uppercase; letter-spacing: .05em; }
.about h2:first-child { margin-top: 0; }
.about p, .about li, .about dd { color: #c4c4c4; }
.formula { background: #000; border: 1px solid var(--line); padding: 8px 10px; font: 12px/1.5 var(--mono); color: var(--key); overflow-x: auto; margin: 0; }
.about dt { color: var(--amber); font-weight: 700; margin-top: 6px; text-transform: uppercase; }
.about dd { margin: 1px 0 0 16px; }
.about ul { padding-left: 18px; }
.cmds td { text-align: left; border-bottom: 1px solid #141414; }
.cmds td:first-child { color: var(--key); font-weight: 700; width: 200px; }
.cmds td:last-child { color: #c4c4c4; text-transform: uppercase; font-size: 11.5px; }

/* ---- message log ---- */
.msgs { display: flex; margin-top: 8px; border: 1px solid var(--line); background: var(--panel); min-height: 24px; }
.msghead { background: var(--neg); color: #fff; font-weight: 800; padding: 3px 8px; flex: none; align-self: stretch; }
#log { list-style: none; margin: 0; padding: 3px 10px; flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
#log li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; font-size: 11.5px; }
#log time { color: var(--key); margin-right: 8px; }
#log li.err { color: var(--neg); }
#log li.ok { color: var(--pos); }
#log li.hot { color: var(--amber); }

/* ---- static, crawlable content (published site only) ---- */
.seo { margin-top: 8px; border: 1px solid var(--line); background: var(--panel); padding: 10px 14px 14px; }
.seo h1 { margin: 0 0 6px; font-size: 15px; color: var(--amber); text-transform: uppercase; letter-spacing: .04em; }
.seo h2 { margin: 16px 0 6px; font-size: 11.5px; background: var(--bar); color: var(--bar-text); padding: 3px 8px; text-transform: uppercase; letter-spacing: .05em; }
.seo p, .seo li { color: #c4c4c4; max-width: 900px; }
.seo a { color: var(--key); text-decoration: none; }
.seo a:hover { text-decoration: underline; }
.seo .crumbs { color: var(--muted); font-size: 11px; text-transform: uppercase; margin-bottom: 6px; }
.dir { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.dir a { display: block; padding: 3px 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dir a b { color: var(--amber); margin-right: 8px; }
.dir a span { color: var(--muted); text-transform: uppercase; font-size: 11px; }
.faq dt { color: var(--amber); font-weight: 700; margin-top: 8px; }
.faq dd { margin: 2px 0 0; color: #c4c4c4; max-width: 900px; }
.foot a { color: var(--muted); }

.foot { display: flex; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; margin-top: 8px; padding: 4px 8px; border: 1px solid var(--line); background: var(--panel); color: var(--faint); font-size: 10.5px; text-transform: uppercase; }

/* ---- CRT mode (command: CRT) ---- */
body.crt { text-shadow: 0 0 2px rgba(255, 159, 28, .45); }
body.crt::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 2px, rgba(0, 0, 0, .28) 3px);
  box-shadow: inset 0 0 140px rgba(0, 0, 0, .85);
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track, td.up, td.dn, .status.live .dot { animation: none; }
}
@media (max-width: 1100px) { .desgrid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .costs details { position: static; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(2) { border-right: 0; }
  .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  #costs { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  #log { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 620px) {
  body { padding: 0 8px 12px; }
  .top { flex-wrap: wrap; }
  .cmdwrap { order: 3; flex-basis: 100%; border-top: 1px solid var(--line); }
  .clock { margin-left: auto; }
  .kpi .value { font-size: 18px; }
}

/* =====================================================================================
   THEME 1 "ascii" (default): ops-terminal look — warm black, orange box-drawing frames
   with [ TITLES ], cyan values, green status, function-key bar and status line at the bottom.
   THEME 2 "classic" is everything above; these extra elements are hidden there.
   ===================================================================================== */
:root:not([data-theme="ascii"]) .sysbar,
:root:not([data-theme="ascii"]) .banner,
:root:not([data-theme="ascii"]) .statusline { display: none; }

:root[data-theme="ascii"] {
  --bg: #000;
  --panel: transparent;
  --row-alt: rgba(255, 140, 0, .025);
  --line: #5a3a10;
  --amber: #ff8c00;
  --amber-dim: #8a5a14;
  --text: #e6e6e6;
  --muted: #b07a2c;
  --faint: #6b4a1c;
  --key: #ff8c00;
  --cyan: #00ffff;
  --bar: transparent;
  --bar-text: #ff8c00;
  --pos: #4afc4a;
  --pos-strong: #4afc4a;
  --neg: #ff3939;
  --neg-strong: #ff3939;
  --pos-bg: rgba(74, 252, 74, .07);
  --hl: rgba(255, 140, 0, .09);
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --glow-amber: 0 0 1px #ff8c00, 0 0 4px rgba(255, 140, 0, .45), 0 0 10px rgba(255, 140, 0, .18);
  --glow-green: 0 0 1px #4afc4a, 0 0 4px rgba(74, 252, 74, .55), 0 0 10px rgba(74, 252, 74, .2);
  --glow-red: 0 0 1px #ff3939, 0 0 4px rgba(255, 57, 57, .55), 0 0 10px rgba(255, 57, 57, .2);
  --glow-cyan: 0 0 1px #00ffff, 0 0 4px rgba(0, 255, 255, .45), 0 0 10px rgba(0, 255, 255, .18);
}
[data-theme="ascii"] body { padding-bottom: 64px; }

/* top system bar */
[data-theme="ascii"] .sysbar { display: flex; flex-wrap: wrap; align-items: center; margin: 0 -12px; padding: 4px 12px; border-bottom: 1px solid var(--line); font-size: 12px; text-transform: uppercase; color: var(--muted); }
[data-theme="ascii"] .sysbar > span, [data-theme="ascii"] .sb-right > * { padding: 0 12px; border-right: 1px solid var(--line); white-space: nowrap; }
[data-theme="ascii"] .sb-brand { color: var(--amber); font-weight: 700; padding-left: 0 !important; letter-spacing: .04em; }
[data-theme="ascii"] .sysbar > span:nth-child(2) { color: var(--cyan); }
.sb-ok { color: var(--pos); } .sb-bad { color: var(--neg); } .sb-wait { color: var(--key); }
[data-theme="ascii"] .sysbar > .sb-right { margin-left: auto; display: flex; border: 0; padding: 0; }
[data-theme="ascii"] .sb-right > *:last-child { border-right: 0; padding-right: 0; color: var(--text); font-weight: 700; }

/* command line + ticker */
[data-theme="ascii"] .top { border: 1px solid var(--line); margin-top: 6px; background: transparent; }
[data-theme="ascii"] .logo { background: transparent; color: var(--amber); border-right: 1px solid var(--line); }
[data-theme="ascii"] .logo::before { content: "["; margin-right: 4px; color: var(--amber-dim); }
[data-theme="ascii"] .logo::after { content: "]"; margin-left: 4px; color: var(--amber-dim); }
[data-theme="ascii"] .cmdwrap:focus-within { background: rgba(255, 154, 46, .05); }
[data-theme="ascii"] #cmd { color: var(--cyan); }
[data-theme="ascii"] .go { background: transparent; color: var(--key); border: 1px solid var(--amber-dim); }
[data-theme="ascii"] .clock { display: none; }
[data-theme="ascii"] .status { border-left-color: var(--line); }
[data-theme="ascii"] .suggest { background: #110c08; }
[data-theme="ascii"] .ticker { border-color: var(--line); background: transparent; position: relative; padding-left: 132px; }
[data-theme="ascii"] .ticker::before { content: "USDT/FIAT >>"; position: absolute; left: 0; top: 0; bottom: 0; z-index: 2; display: flex; align-items: center; padding: 0 10px; background: var(--bg); color: var(--cyan); border-right: 1px solid var(--line); }
[data-theme="ascii"] .tk { border-right-color: var(--line); }
[data-theme="ascii"] .tk b { color: var(--text); font-weight: 400; }

/* banner: box-drawing characters, like a printed header */
[data-theme="ascii"] .banner { margin: 22px 0 6px; }
/* drawn with borders, not box-drawing glyphs: IBM Plex Mono has none and fallback fonts misalign */
[data-theme="ascii"] .banner-box .b1, [data-theme="ascii"] .banner-box .b2 { white-space: pre; }
[data-theme="ascii"] .banner-box { display: inline-block; max-width: 100%; overflow-x: auto; border: 1px solid var(--amber-dim); box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 4px var(--line); padding: 10px 22px; color: var(--amber); text-shadow: var(--glow-amber); letter-spacing: .06em; line-height: 1.5; }
[data-theme="ascii"] .banner-box .b1 { padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--amber-dim); }
[data-theme="ascii"] .chips { display: flex; flex-wrap: wrap; gap: 4px 28px; margin-top: 12px; text-transform: uppercase; font-size: 12.5px; }
.chips span::before { content: "> "; }
.chips .c-ok { color: var(--pos); } .chips .c-warn { color: var(--amber); } .chips .c-info { color: var(--cyan); } .chips .c-bad { color: var(--neg); } .chips .c-plain { color: var(--text); font-weight: 700; }

/* framed boxes with [ TITLE ] cut into the top border */
[data-theme="ascii"] .panel[data-title], [data-theme="ascii"] .box, [data-theme="ascii"] .costs details,
[data-theme="ascii"] .msgs, [data-theme="ascii"] .seo, [data-theme="ascii"] .kpi {
  position: relative; border: 1px solid var(--line); background: transparent; margin-top: 16px;
}
[data-theme="ascii"] .panel[data-title] { padding: 16px 12px 12px; }
[data-theme="ascii"] .panel[data-title]::before {
  content: "─[ " attr(data-title) " ]─"; position: absolute; top: -.8em; left: 10px; padding: 0 4px;
  background: var(--bg); color: var(--amber); text-transform: uppercase; letter-spacing: .05em; font-size: 12.5px;
}
[data-theme="ascii"] .box h3, [data-theme="ascii"] .costs summary, [data-theme="ascii"] .msghead {
  position: absolute; top: -.8em; left: 10px; margin: 0; padding: 0 4px; background: var(--bg);
  color: var(--amber); font-weight: 400; font-size: 12.5px; letter-spacing: .05em;
}
[data-theme="ascii"] .box h3::before, [data-theme="ascii"] .costs summary::before, [data-theme="ascii"] .msghead::before { content: "─[ "; }
[data-theme="ascii"] .box h3 { display: inline-flex; }
[data-theme="ascii"] .box h3::after, [data-theme="ascii"] .msghead::after { content: " ]─"; }
[data-theme="ascii"] .box h3 span { margin-left: 10px; color: var(--muted); }
[data-theme="ascii"] .box { padding-top: 12px; }
[data-theme="ascii"] .costs details { padding-top: 10px; }
[data-theme="ascii"] .costs summary::after { content: " ]─"; float: none; color: var(--amber); }
[data-theme="ascii"] .costs details:not([open]) summary::after { content: " ]─ [+]"; }
[data-theme="ascii"] .costs details:not([open]) { min-height: 22px; }
[data-theme="ascii"] .hint { color: var(--muted); }
[data-theme="ascii"] .msgs { padding-top: 6px; }
[data-theme="ascii"] .msghead { color: var(--neg); }
[data-theme="ascii"] .tw { border: 0; background: transparent; }

/* KPIs: big glowing figures */
[data-theme="ascii"] .kpis { border: 0; gap: 14px; margin-top: 8px; }
[data-theme="ascii"] .kpi { border-bottom: 1px solid var(--line) !important; padding: 16px 16px 12px; }
[data-theme="ascii"] .kpi:last-child, [data-theme="ascii"] .kpi:nth-child(2) { border-right: 1px solid var(--line); }
[data-theme="ascii"] .kpi .label { position: absolute; top: -.8em; left: 10px; padding: 0 4px; background: var(--bg); color: var(--cyan); font-size: 12px; }
[data-theme="ascii"] .kpi .label::before { content: "> "; }
[data-theme="ascii"] .kpi .value { font-size: 40px; line-height: 1.05; color: var(--cyan); text-shadow: 0 0 14px rgba(47, 211, 232, .45); }
[data-theme="ascii"] .kpi .value .pos, [data-theme="ascii"] .kpi .value .pos2 { text-shadow: 0 0 14px rgba(63, 220, 110, .5); }
[data-theme="ascii"] .kpi .value .neg, [data-theme="ascii"] .kpi .value .neg2 { text-shadow: 0 0 14px rgba(255, 90, 77, .5); }
[data-theme="ascii"] .kpi .detail { text-transform: none; }

/* function-key bar fixed at the bottom, status line under it */
/* function keys fixed at the bottom, above the status line (the user's choice, like expresswallet) */
[data-theme="ascii"] .tabs { position: fixed; left: 0; right: 0; bottom: 22px; z-index: 30; margin: 0; gap: 0; background: var(--bg); border-top: 1px solid var(--line); overflow-x: auto; }
[data-theme="ascii"] .tabs button { flex: 1; background: transparent; border-right: 1px solid var(--line); padding: 6px 12px; color: var(--muted); font-weight: 400; justify-content: flex-start; font-size: 13px; }
[data-theme="ascii"] .tabs button::before { content: "F" attr(data-key); background: transparent; color: var(--amber); padding: 0; margin: 0; font-weight: 700; }
[data-theme="ascii"] .tabs button:hover { background: var(--hl); color: var(--text); }
[data-theme="ascii"] .tabs button[aria-selected=true] { background: rgba(255, 154, 46, .14); color: var(--text); box-shadow: inset 0 2px 0 var(--amber); }
[data-theme="ascii"] .tabs .sub, [data-theme="ascii"] .tabs button[aria-selected=true] .sub { color: var(--faint); }
[data-theme="ascii"] .statusline { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; padding: 3px 12px; background: var(--bg); border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); text-transform: uppercase; white-space: nowrap; overflow: hidden; }
.statusline > span, .sl-right > span { padding-right: 18px; }
.sl-right { margin-left: auto; display: flex; }
#sl-link.ok { color: var(--pos); } #sl-link.bad { color: var(--neg); }

/* grids */
[data-theme="ascii"] th { background: var(--bg); color: var(--amber); font-weight: 400; border-bottom: 1px dashed var(--amber-dim); }
[data-theme="ascii"] td { border-bottom-color: rgba(255, 154, 46, .07); }
[data-theme="ascii"] td.fx, [data-theme="ascii"] .deshead .v { color: var(--cyan); }
[data-theme="ascii"] tr.cont td.fx { color: transparent; }
[data-theme="ascii"] tr.grp td { border-top-color: var(--line); }
[data-theme="ascii"] .path { color: var(--amber); text-transform: none; }
[data-theme="ascii"] .path::before { content: "> "; }
[data-theme="ascii"] .path b { color: var(--cyan); }
[data-theme="ascii"] .toolbar::before { color: var(--cyan); content: "FILTER >"; }
[data-theme="ascii"] #filter, [data-theme="ascii"] .field input[type=number], [data-theme="ascii"] .field input[type=text] { background: transparent; border-color: var(--line); color: var(--cyan); }
[data-theme="ascii"] .field label { color: var(--muted); }
[data-theme="ascii"] .field > label:not(.check)::before { content: "[i] "; color: var(--cyan); text-transform: none; }
[data-theme="ascii"] .notice { background: transparent; border-color: var(--amber-dim); }
[data-theme="ascii"] .notice::before { content: "[!] "; }
[data-theme="ascii"] .cost-actions button { background: transparent; }

/* DES, heat map, feeds, help, log, seo */
[data-theme="ascii"] .deshead { border: 1px solid var(--line); background: transparent; }
[data-theme="ascii"] .deshead > div { border-right-color: var(--line); }
[data-theme="ascii"] .deshead .sec { background: transparent; }
[data-theme="ascii"] .deshead .sec .v { color: var(--amber); text-shadow: 0 0 10px rgba(255, 154, 46, .4); }
[data-theme="ascii"] .deshead .sec .k { color: var(--muted); }
[data-theme="ascii"] .chart .grid { stroke: rgba(255, 154, 46, .08); }
[data-theme="ascii"] .chart .ln { stroke: var(--cyan); }
[data-theme="ascii"] .tile { border-color: var(--bg); }
[data-theme="ascii"] .feeds, [data-theme="ascii"] .feed { border-color: var(--line); background: transparent; }
[data-theme="ascii"] .feed .name { color: var(--text); font-weight: 400; }
[data-theme="ascii"] .feed .kind { background: transparent; color: var(--cyan); border: 1px solid var(--line); }
[data-theme="ascii"] .about h2, [data-theme="ascii"] .seo h2 { background: transparent; color: var(--amber); padding: 0; border-bottom: 1px dashed var(--amber-dim); font-weight: 400; }
[data-theme="ascii"] .about h2::before, [data-theme="ascii"] .seo h2::before { content: "> "; color: var(--cyan); }
[data-theme="ascii"] .formula { background: transparent; border-color: var(--line); color: var(--amber); }
[data-theme="ascii"] .about dt, [data-theme="ascii"] .faq dt, [data-theme="ascii"] .cmds td:first-child { color: var(--cyan); }
[data-theme="ascii"] .seo { padding: 16px 14px 14px; }
[data-theme="ascii"] .seo h1 { text-shadow: 0 0 10px rgba(255, 154, 46, .3); }
[data-theme="ascii"] .seo a, [data-theme="ascii"] b { color: var(--cyan); }
[data-theme="ascii"] .dir, [data-theme="ascii"] .dir a { border-color: var(--line); }
[data-theme="ascii"] .dir a b { color: var(--amber); }
[data-theme="ascii"] #log time { color: var(--cyan); }
[data-theme="ascii"] .foot { border: 0; border-top: 1px solid var(--line); background: transparent; }

@media (max-width: 980px) {
  [data-theme="ascii"] .tabs button .sub { display: none; }
  [data-theme="ascii"] .kpi .value { font-size: 30px; }
}
@media (max-width: 620px) {
  [data-theme="ascii"] .sysbar > span:nth-child(2), [data-theme="ascii"] #sb-session { display: none; }
  [data-theme="ascii"] .sl-right { display: none; }
  [data-theme="ascii"] .tabs button { flex: none; }
  [data-theme="ascii"] .banner-box { font-size: 9px; padding: 8px 10px; }
}

/* ---- theme switch button: in the command bar, visible in both themes ---- */
.themebtn { background: none; border: 0; border-left: 1px solid var(--line); padding: 0 12px; color: var(--key); cursor: pointer; font: inherit; font-weight: 700; text-transform: uppercase; white-space: nowrap; }
.themebtn:hover { color: #fff; }

/* ---- status list with leader dots (theme 1 only) ---- */
:root:not([data-theme="ascii"]) .sysbox { display: none; }
.sysbox ul { list-style: none; margin: 0; padding: 2px 10px 10px; }
.sysbox li { display: flex; align-items: baseline; gap: 6px; text-transform: uppercase; font-size: 12px; line-height: 1.75; white-space: nowrap; }
.sysbox .k { color: var(--text); }
.sysbox .dots { flex: 1; min-width: 12px; border-bottom: 2px dotted var(--faint); transform: translateY(-4px); }
.sysbox .m-ok, .sysbox .v-ok { color: var(--pos); text-shadow: var(--glow-green); }
.sysbox .m-bad, .sysbox .v-bad { color: var(--neg); text-shadow: var(--glow-red); }
.sysbox .m-warn, .sysbox .v-warn { color: var(--amber); text-shadow: var(--glow-amber); }
.sysbox .m-info, .sysbox .v-info { color: var(--cyan); text-shadow: var(--glow-cyan); }
.sysbox .v { font-weight: 700; }
[data-theme="ascii"] .sysbox { position: relative; border: 1px solid var(--line); padding-top: 12px; margin-top: 16px; }
[data-theme="ascii"] .sysbox h3 { position: absolute; top: -.8em; left: 10px; margin: 0; padding: 0 4px; background: var(--bg); color: var(--amber); font-weight: 400; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; }
[data-theme="ascii"] .sysbox h3::before { content: "┌─[ "; }
[data-theme="ascii"] .sysbox h3::after { content: " ]─"; }

/* ---- expresswallet-style finish for theme 1: font, glow, CRT overlay, giant numerals ---- */
[data-theme="ascii"] body { font-family: var(--mono); font-size: 13px; color: var(--text); -webkit-font-smoothing: none; text-rendering: geometricPrecision; }
[data-theme="ascii"] body *, [data-theme="ascii"] button, [data-theme="ascii"] input { font-family: var(--mono); }
[data-theme="ascii"]::before { content: ""; position: fixed; inset: 0; z-index: 60; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .03) 0, rgba(255, 255, 255, .03) 1px, transparent 1px, transparent 3px); mix-blend-mode: screen; }
[data-theme="ascii"]::after { content: ""; position: fixed; inset: 0; z-index: 55; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .55) 100%), rgba(255, 140, 0, .012); animation: crt-flicker 3s infinite steps(2); }
@keyframes crt-flicker { 0% { opacity: .85; } 25% { opacity: 1; } 50% { opacity: .8; } 75% { opacity: 1; } 100% { opacity: .9; } }
[data-theme="ascii"] .panel[data-title]::before, [data-theme="ascii"] .box h3, [data-theme="ascii"] .costs summary,
[data-theme="ascii"] .sb-brand, [data-theme="ascii"] .logo, [data-theme="ascii"] td.ccy, [data-theme="ascii"] th,
[data-theme="ascii"] .path, [data-theme="ascii"] .seo h1, [data-theme="ascii"] .tabs button::before { text-shadow: var(--glow-amber); }
[data-theme="ascii"] .panel[data-title]::before { content: "┌─[ " attr(data-title) " ]─"; }
[data-theme="ascii"] .box h3::before, [data-theme="ascii"] .costs summary::before, [data-theme="ascii"] .msghead::before { content: "┌─[ "; }
[data-theme="ascii"] .pos, [data-theme="ascii"] .pos2, [data-theme="ascii"] .sb-ok, [data-theme="ascii"] #sl-link.ok, [data-theme="ascii"] .chips .c-ok { text-shadow: var(--glow-green); }
[data-theme="ascii"] .neg, [data-theme="ascii"] .neg2, [data-theme="ascii"] .sb-bad, [data-theme="ascii"] #sl-link.bad, [data-theme="ascii"] .chips .c-bad { text-shadow: var(--glow-red); }
[data-theme="ascii"] .kpi .label, [data-theme="ascii"] .chips .c-info, [data-theme="ascii"] td.fx, [data-theme="ascii"] #cmd { text-shadow: var(--glow-cyan); }
[data-theme="ascii"] .kpi .label::before { content: "> "; }
[data-theme="ascii"] .kpi { padding: 18px 18px 14px; }
[data-theme="ascii"] .kpi .value { font-weight: 700; font-size: clamp(40px, 4.6vw, 72px); line-height: 1; letter-spacing: -2px; margin: 6px 0 8px; text-shadow: var(--glow-cyan); }
[data-theme="ascii"] .kpi .value .pos, [data-theme="ascii"] .kpi .value .pos2 { text-shadow: var(--glow-green); }
[data-theme="ascii"] .kpi .value .neg, [data-theme="ascii"] .kpi .value .neg2 { text-shadow: var(--glow-red); }
[data-theme="ascii"] .kpi .detail { color: var(--text); font-size: 12px; }
[data-theme="ascii"] .msghead { background: transparent; color: var(--neg); font-weight: 400; }
[data-theme="ascii"] .tabs { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
[data-theme="ascii"] .tabs button { color: var(--text); }
[data-theme="ascii"] .tabs .sub { display: none; }
[data-theme="ascii"] ::-webkit-scrollbar { width: 10px; height: 10px; }
[data-theme="ascii"] ::-webkit-scrollbar-track { background: #000; }
[data-theme="ascii"] ::-webkit-scrollbar-thumb { background: var(--line); }
[data-theme="ascii"] ::-webkit-scrollbar-thumb:hover { background: var(--amber); }
[data-theme="ascii"] .themebtn { color: var(--amber); font-weight: 400; }
@media (max-width: 620px) { [data-theme="ascii"] .tabs { grid-template-columns: repeat(7, auto); } }
@media (prefers-reduced-motion: reduce) { [data-theme="ascii"]::after { animation: none; } }
