/* 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; }
}
