/* ==========================================================================
   DAYTRADER // ORBITAL COMMAND
   Phosphor-on-void trading HUD. Cyan = structure, green = profit,
   magenta = loss, amber = caution.
   ========================================================================== */

:root {
  --void: #03060a;
  --deep: #070c13;
  --panel: rgba(9, 17, 27, 0.82);
  --panel-hi: rgba(14, 26, 40, 0.92);
  --line: rgba(0, 240, 255, 0.14);
  --line-hi: rgba(0, 240, 255, 0.38);
  --cyan: #00f0ff;
  --cyan-dim: #0aa7b3;
  --ice: #b8f7ff;
  --text: #cfe8ee;
  --muted: #5f7f8a;
  --faint: #2a4550;
  --gain: #39ff88;
  --gain-dim: rgba(57, 255, 136, 0.14);
  --loss: #ff2e63;
  --loss-dim: rgba(255, 46, 99, 0.14);
  --warn: #ffb000;
  --warn-dim: rgba(255, 176, 0, 0.14);
  --violet: #9d7bff;
  --display: "Chakra Petch", "Rajdhani", sans-serif;
  --mono: "Martian Mono", "IBM Plex Mono", ui-monospace, monospace;
  --cut: 14px;
  --radius: 2px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--void);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* atmosphere: radial reactor glow + blueprint grid + scanlines + grain */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(1200px 600px at 78% -10%, rgba(0, 240, 255, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(157, 123, 255, 0.08), transparent 60%),
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 48px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 48px 100%,
    var(--void);
  mask-image: radial-gradient(ellipse at 50% 30%, #000 40%, rgba(0,0,0,0.35) 100%);
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 100; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--ice); }
::selection { background: var(--cyan); color: var(--void); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--faint); }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------------ top rail */
.rail {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 28px;
  height: 56px; padding: 0 22px;
  background: linear-gradient(180deg, rgba(3,6,10,0.96), rgba(3,6,10,0.78));
  border-bottom: 1px solid var(--line-hi);
  backdrop-filter: blur(8px);
}
.rail::after { /* moving scan highlight along the rail */
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  background-size: 30% 100%; background-repeat: no-repeat;
  animation: sweep 6s linear infinite;
}
@keyframes sweep { from { background-position: -30% 0; } to { background-position: 130% 0; } }

.brand { display: flex; align-items: center; gap: 12px; font-family: var(--display); }
.brand-mark {
  width: 30px; height: 30px; position: relative;
  border: 1px solid var(--cyan); transform: rotate(45deg);
  box-shadow: 0 0 16px rgba(0,240,255,0.45), inset 0 0 10px rgba(0,240,255,0.35);
}
.brand-mark::after { content: ""; position: absolute; inset: 7px; background: var(--cyan); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: 0.22em; color: var(--ice); }
.brand-name em { font-style: normal; color: var(--cyan); }
.brand-sub { font-family: var(--mono); font-size: 9px; letter-spacing: 0.3em; color: var(--muted); display: block; margin-top: -2px; }

.nav { display: flex; gap: 4px; }
.nav a {
  font-family: var(--display); font-size: 13px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted); padding: 8px 14px; position: relative;
}
.nav a:hover { color: var(--ice); }
.nav a.on { color: var(--cyan); text-shadow: 0 0 12px rgba(0,240,255,0.6); }
.nav a.on::before { content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 2px; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }

.rail-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.led { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }
.led i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.led.ok i { background: var(--gain); box-shadow: 0 0 8px var(--gain); }
.led.bad i { background: var(--loss); box-shadow: 0 0 8px var(--loss); animation: pulse 0.8s infinite; }
.led.warn i { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.mode-badge {
  font-family: var(--display); font-weight: 700; letter-spacing: 0.3em; font-size: 11px;
  padding: 5px 10px 5px 12px; color: var(--warn); border: 1px solid var(--warn);
  background: var(--warn-dim); clip-path: polygon(8px 0, 100% 0, 100% 100%, 0 100%, 0 8px);
}
.mode-badge.live { color: var(--loss); border-color: var(--loss); background: var(--loss-dim); }
.clock { font-family: var(--display); font-size: 20px; font-weight: 600; color: var(--ice); letter-spacing: 0.08em; min-width: 108px; text-align: right; }
.clock small { font-size: 9px; color: var(--muted); letter-spacing: 0.2em; margin-left: 4px; }

/* ------------------------------------------------------------------ layout */
main { padding: 18px 22px 40px; }
.grid { display: grid; gap: 14px; }
.page-title { display: flex; align-items: baseline; gap: 16px; margin: 4px 0 16px; }
.page-title h1 { font-family: var(--display); font-weight: 700; font-size: 26px; letter-spacing: 0.18em; text-transform: uppercase; margin: 0; color: var(--ice); }
.page-title .crumb { color: var(--muted); font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase; }

/* ------------------------------------------------------------------ panels */
.panel {
  position: relative; background: var(--panel);
  border: 1px solid var(--line);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  padding: 14px 16px; min-width: 0;
  animation: rise 0.6s cubic-bezier(.2,.8,.2,1) both;
}
.panel::before, .panel::after { /* corner brackets */
  content: ""; position: absolute; width: 16px; height: 16px; pointer-events: none; border-color: var(--cyan); border-style: solid; opacity: 0.8;
}
.panel::before { top: 6px; right: 6px; border-width: 1px 1px 0 0; }
.panel::after { bottom: 6px; left: 6px; border-width: 0 0 1px 1px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.grid > .panel:nth-child(2) { animation-delay: 0.06s; }
.grid > .panel:nth-child(3) { animation-delay: 0.12s; }
.grid > .panel:nth-child(4) { animation-delay: 0.18s; }
.grid > .panel:nth-child(5) { animation-delay: 0.24s; }
.grid > .panel:nth-child(6) { animation-delay: 0.30s; }

.panel-h { display: flex; align-items: center; gap: 10px; margin: -2px 0 12px; }
.panel-h h2 {
  margin: 0; font-family: var(--display); font-size: 12px; font-weight: 700; letter-spacing: 0.26em;
  text-transform: uppercase; color: var(--cyan);
}
.panel-h h2::before { content: "▸ "; color: var(--cyan-dim); }
.panel-h .meta { margin-left: auto; color: var(--muted); font-size: 10px; letter-spacing: 0.12em; }
.panel-h .count { color: var(--void); background: var(--cyan); font-size: 9px; padding: 1px 6px; font-weight: 700; }

/* ------------------------------------------------------------------ HUD strip */
.hud { display: grid; grid-template-columns: 1.6fr repeat(5, 1fr) 190px 1.25fr; gap: 14px; align-items: stretch; }
.stat { display: flex; flex-direction: column; justify-content: center; }
.stat .k { color: var(--muted); font-size: 9px; letter-spacing: 0.28em; text-transform: uppercase; margin-bottom: 6px; }
.stat .v { font-family: var(--display); font-size: 22px; font-weight: 600; color: var(--ice); letter-spacing: 0.02em; white-space: nowrap; }
.stat .s { color: var(--muted); font-size: 10px; margin-top: 4px; }
.stat.hero .v { font-size: 40px; font-weight: 700; line-height: 1; text-shadow: 0 0 24px rgba(184, 247, 255, 0.28); }
.stat.hero .v .cents { font-size: 22px; opacity: 0.7; }
.gain { color: var(--gain) !important; }
.loss { color: var(--loss) !important; }
.warn { color: var(--warn) !important; }
.muted { color: var(--muted) !important; }
.gain-glow { text-shadow: 0 0 18px rgba(57,255,136,0.55) !important; }
.loss-glow { text-shadow: 0 0 18px rgba(255,46,99,0.55) !important; }
.flash-up { animation: flashUp 0.7s ease-out; }
.flash-dn { animation: flashDn 0.7s ease-out; }
@keyframes flashUp { from { background: var(--gain-dim); } to { background: transparent; } }
@keyframes flashDn { from { background: var(--loss-dim); } to { background: transparent; } }

/* the reactor: daily-loss budget consumed */
.reactor { display: grid; place-items: center; position: relative; padding: 6px; }
.reactor svg { width: 150px; height: 150px; overflow: visible; }
.reactor .ring-bg { stroke: var(--faint); }
.reactor .ring { transition: stroke-dashoffset 0.6s ease, stroke 0.3s; filter: drop-shadow(0 0 6px currentColor); }
.reactor .ticks line { stroke: var(--line-hi); }
.reactor .spin { transform-origin: 75px 75px; animation: spin 14s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.reactor .label { position: absolute; text-align: center; }
.reactor .label b { display: block; font-family: var(--display); font-size: 24px; color: var(--ice); }
.reactor .label span { font-size: 8px; letter-spacing: 0.25em; color: var(--muted); text-transform: uppercase; }

/* controls */
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: center; }
.btn {
  font-family: var(--display); font-weight: 700; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--cyan); background: rgba(0, 240, 255, 0.06); border: 1px solid var(--line-hi);
  padding: 10px 12px; cursor: pointer; transition: all 0.15s;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.btn:hover { background: rgba(0, 240, 255, 0.16); color: var(--ice); box-shadow: 0 0 18px rgba(0,240,255,0.25) inset; }
.btn:active { transform: translateY(1px); }
.btn.sm { padding: 5px 9px; font-size: 10px; letter-spacing: 0.14em; }
.btn.warn { color: var(--warn); border-color: rgba(255,176,0,0.5); background: var(--warn-dim); }
.btn.danger { color: var(--loss); border-color: rgba(255,46,99,0.55); background: var(--loss-dim); }
.btn.ghost { background: transparent; }
.btn[disabled] { opacity: 0.35; pointer-events: none; }

.kill {
  grid-column: 1 / -1; position: relative; overflow: hidden;
  font-family: var(--display); font-weight: 700; letter-spacing: 0.4em; font-size: 15px;
  color: var(--void); border: 1px solid var(--loss); padding: 14px; cursor: pointer;
  background: repeating-linear-gradient(-45deg, var(--loss) 0 12px, #1a0209 12px 24px);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  text-shadow: none; transition: filter 0.2s;
}
.kill span { background: var(--loss); padding: 3px 10px; }
.kill:hover { filter: brightness(1.2) saturate(1.2); }
.kill.armed { animation: armed 0.5s steps(2) infinite; }
.kill.armed span { background: var(--void); color: var(--loss); }
@keyframes armed { 50% { filter: brightness(1.6); box-shadow: 0 0 30px var(--loss); } }
.kill.fired { background: #1a0209; color: var(--loss); }

.banner {
  display: none; margin-bottom: 14px; padding: 12px 18px; font-family: var(--display); letter-spacing: 0.2em;
  font-weight: 700; text-transform: uppercase; color: var(--void); background: var(--loss);
  clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%);
}
.banner.show { display: flex; align-items: center; gap: 16px; animation: rise 0.3s both; }
.banner.amber { background: var(--warn); }
.banner .btn { margin-left: auto; color: var(--void); border-color: var(--void); background: rgba(0,0,0,0.12); }

/* ------------------------------------------------------------------ dashboard body */
.deck { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(360px, 1fr); gap: 14px; margin-top: 14px; }
.deck-low { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; }
.stack { display: grid; gap: 14px; align-content: start; min-width: 0; }

.chart-wrap { height: 470px; position: relative; }
.chart-legend { position: absolute; top: 8px; left: 10px; z-index: 3; pointer-events: none; font-size: 11px; display: flex; gap: 14px; }
.chart-legend b { font-family: var(--display); font-size: 16px; color: var(--ice); letter-spacing: 0.1em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 10px; letter-spacing: 0.1em; padding: 4px 9px; cursor: pointer; color: var(--muted);
  border: 1px solid var(--line); background: transparent; font-family: var(--mono);
}
.chip:hover { color: var(--ice); border-color: var(--line-hi); }
.chip.on { color: var(--void); background: var(--cyan); border-color: var(--cyan); }
.chip .dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--gain); margin-right: 5px; vertical-align: middle; }

/* ------------------------------------------------------------------ tables */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th {
  text-align: left; font-weight: 400; color: var(--muted); font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase;
  padding: 0 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 7px 8px; border-bottom: 1px solid rgba(0, 240, 255, 0.05); white-space: nowrap; }
tr:hover td { background: rgba(0, 240, 255, 0.035); }
td.num, th.num { text-align: right; }
td .sym { font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: 0.08em; color: var(--ice); }
.tag { display: inline-block; font-size: 9px; letter-spacing: 0.14em; padding: 2px 6px; text-transform: uppercase; border: 1px solid currentColor; }
.tag.long { color: var(--gain); }
.tag.short { color: var(--loss); }
.tag.dim { color: var(--muted); }
.empty { color: var(--faint); text-align: center; padding: 22px 0; letter-spacing: 0.25em; font-size: 10px; text-transform: uppercase; }
.scroll { max-height: 300px; overflow: auto; }
.scroll.tall { max-height: 560px; }
tr.clickable { cursor: pointer; }

/* r-meter inside position rows */
.rbar { position: relative; width: 54px; height: 6px; background: var(--faint); display: inline-block; vertical-align: middle; }
.rbar i { position: absolute; top: 0; bottom: 0; }
.rbar::after { content: ""; position: absolute; left: 33.33%; top: -3px; bottom: -3px; width: 1px; background: var(--muted); }

/* tape delta mini-bar */
.delta { display: inline-block; width: 60px; height: 5px; background: var(--faint); position: relative; vertical-align: middle; }
.delta i { position: absolute; top: 0; bottom: 0; }

/* ------------------------------------------------------------------ feeds */
.feed { font-size: 11px; line-height: 1.55; max-height: 330px; overflow: auto; }
.feed .row { display: grid; grid-template-columns: 62px 70px 1fr; gap: 8px; padding: 3px 0; border-bottom: 1px dashed rgba(0,240,255,0.06); animation: rise 0.35s both; }
.feed .t { color: var(--muted); }
.feed .kind { color: var(--cyan-dim); text-transform: uppercase; font-size: 9px; letter-spacing: 0.14em; padding-top: 2px; }
.feed .row.warn .msg { color: var(--warn); }
.feed .row.bad .msg, .feed .row.kill .msg { color: var(--loss); }
.feed .row.good .msg { color: var(--gain); }
.feed .row.reject .msg { color: #d08a9c; }
.news-item { padding: 6px 0; border-bottom: 1px dashed rgba(0,240,255,0.06); }
.news-item .syms { color: var(--cyan); font-size: 10px; letter-spacing: 0.1em; }
.news-item.hot { border-left: 2px solid var(--warn); padding-left: 8px; }

.toggles { display: grid; gap: 8px; }
.toggle { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); background: rgba(0,0,0,0.2); }
.toggle .name { font-family: var(--display); font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; font-size: 12px; }
.toggle .desc { color: var(--muted); font-size: 10px; }
.switch { margin-left: auto; width: 42px; height: 20px; border: 1px solid var(--line-hi); position: relative; cursor: pointer; background: transparent; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; background: var(--muted); transition: all 0.2s; }
.switch.on { border-color: var(--gain); box-shadow: 0 0 10px rgba(57,255,136,0.25) inset; }
.switch.on::after { left: 25px; background: var(--gain); box-shadow: 0 0 8px var(--gain); }

/* ------------------------------------------------------------------ forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 16px; }
label.f { display: grid; gap: 5px; color: var(--muted); font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase; }
input, select, textarea {
  font-family: var(--mono); font-size: 12px; color: var(--ice); background: rgba(0,0,0,0.35);
  border: 1px solid var(--line); padding: 8px 10px; outline: none; border-radius: 0; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan), 0 0 16px rgba(0,240,255,0.2); }
input[type=checkbox] { width: auto; accent-color: var(--cyan); }
textarea { min-height: 90px; resize: vertical; }
.row-flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ------------------------------------------------------------------ analytics */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.kpi .v { font-family: var(--display); font-size: 26px; font-weight: 700; color: var(--ice); }
.kpi .k { color: var(--muted); font-size: 9px; letter-spacing: 0.26em; text-transform: uppercase; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.plot { height: 300px; position: relative; }
svg.scatter text { fill: var(--muted); font-size: 9px; font-family: var(--mono); }
svg.scatter .axis { stroke: var(--faint); }
.progress { height: 4px; background: var(--faint); position: relative; overflow: hidden; }
.progress i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); transition: width 0.4s; }
.hint { color: var(--muted); font-size: 11px; line-height: 1.6; }
.hint b { color: var(--ice); font-weight: 400; }
.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 200; padding: 12px 18px; background: var(--panel-hi);
  border: 1px solid var(--cyan); color: var(--ice); font-size: 11px; letter-spacing: 0.1em;
  transform: translateY(20px); opacity: 0; transition: all 0.25s;
}
.toast.show { transform: none; opacity: 1; }
.toast.err { border-color: var(--loss); color: var(--loss); }

.attribution { color: var(--faint); font-size: 9px; letter-spacing: 0.15em; text-align: right; margin-top: 24px; }
.attribution a { color: var(--muted); }

@media (max-width: 1500px) {
  .hud { grid-template-columns: 1.4fr repeat(3, 1fr) 170px 1.2fr; }
  .hud .stat.opt { display: none; }
}
@media (max-width: 1200px) {
  .deck, .deck-low, .two, .three { grid-template-columns: 1fr; }
  .hud { grid-template-columns: repeat(2, 1fr); }
}
