:root {
  color-scheme: dark;
  --bg: #07100f;
  --panel: #0c1816;
  --panel-2: #10211e;
  --line: #1e3631;
  --text: #ecf7f3;
  --muted: #809b94;
  --cyan: #5ee7c6;
  --cyan-soft: #153a32;
  --amber: #f6bd60;
  --red: #ff6b6b;
  --shadow: 0 24px 70px rgba(0, 0, 0, .28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 86% -10%, #12342d 0, transparent 32rem), var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.shell { width: min(1500px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 64px; }
.topbar, .top-actions, .hero-grid, .control-card, .stream-strip, .content-grid, .panel-head, .dialog-head { display: flex; }
.topbar { align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(2rem, 4vw, 4rem); letter-spacing: -.06em; line-height: .9; }
h1 span { color: var(--cyan); font-weight: 400; }
h2 { margin-bottom: 0; font-size: 1.08rem; font-weight: 600; }
.eyebrow, .section-label { color: var(--cyan); font-size: .7rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow { margin-bottom: 9px; }
.subtitle, .dialog-card > p { margin: 10px 0 0; color: var(--muted); }
.top-actions { align-items: center; gap: 12px; }
.health { display: flex; align-items: center; gap: 9px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(12, 24, 22, .72); }
.health i { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 16px currentColor; }
.health i.ok { background: var(--cyan); }
.health i.bad { background: var(--red); }
.hero-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric, .panel, .control-card, .stream-strip { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(16, 33, 30, .95), rgba(9, 20, 18, .97)); box-shadow: var(--shadow); }
.metric { min-height: 138px; padding: 20px; border-radius: 18px; }
.metric.primary { background: linear-gradient(145deg, #14342d, #0c201c); }
.metric span, .metric small, .stream-strip span { color: var(--muted); }
.metric strong { display: block; margin: 16px 0 9px; font-size: clamp(1.55rem, 3vw, 2.35rem); letter-spacing: -.04em; }
.control-card { display: grid; grid-template-columns: minmax(200px, 1fr) repeat(4, minmax(95px, 140px)) repeat(4, auto); gap: 12px; align-items: end; margin-top: 12px; padding: 18px; border-radius: 18px; }
.control-copy small { display: block; margin-top: 7px; color: var(--muted); }
.control-card label, .dialog-card label { display: grid; gap: 7px; color: var(--muted); font-size: .76rem; }
input, select { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; outline: none; color: var(--text); background: #07110f; }
input:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(94, 231, 198, .1); }
.button { min-height: 44px; padding: 0 15px; border: 1px solid transparent; border-radius: 10px; color: var(--text); background: var(--panel-2); font-weight: 650; white-space: nowrap; }
.button:hover { filter: brightness(1.1); }
.button:disabled { cursor: wait; opacity: .5; }
.button.start { color: #05241d; background: var(--cyan); }
.button.warning { color: #211500; background: var(--amber); }
.button.danger { color: #2a0505; background: var(--red); }
.button.ghost { border-color: var(--line); background: transparent; }
.stream-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; margin: 12px 0; overflow: hidden; border-radius: 14px; }
.stream-strip div { padding: 14px 18px; background: #0b1715; }
.stream-strip span, .stream-strip strong { display: block; }
.stream-strip strong { margin-top: 6px; font-size: 1.05rem; }
.content-grid { display: grid; grid-template-columns: 1.06fr .94fr; gap: 12px; }
.panel { min-width: 0; border-radius: 18px; overflow: hidden; }
.panel-head { align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-head > span, .contract { color: var(--muted); font-size: .75rem; }
.table-wrap { position: relative; overflow: auto; max-height: 410px; }
table { width: 100%; border-collapse: collapse; font-size: .78rem; }
th { position: sticky; top: 0; z-index: 1; color: var(--muted); background: #0b1715; font-weight: 500; text-align: left; }
th, td { padding: 12px 14px; border-bottom: 1px solid rgba(30, 54, 49, .66); white-space: nowrap; }
td strong { font-weight: 650; }
.positive { color: var(--cyan); }
.negative { color: var(--red); }
.muted { color: var(--muted); }
.status-pill { display: inline-block; min-width: 55px; padding: 4px 7px; border-radius: 999px; text-align: center; background: var(--cyan-soft); color: var(--cyan); }
.empty { margin: 0; padding: 28px 20px; color: var(--muted); text-align: center; }
.trades-panel { margin-top: 12px; }
.equity-panel { margin-top: 12px; }
.equity-head { min-height: 78px; }
.equity-summary { display: flex; align-items: center; gap: 24px; }
.equity-summary > div:first-child { min-width: 120px; text-align: right; }
.equity-summary span, .equity-summary strong { display: block; }
.equity-summary span { margin-bottom: 5px; color: var(--muted); font-size: .72rem; }
.equity-summary strong { font-size: 1.35rem; letter-spacing: -.03em; }
.chart-switch { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #07110f; }
.chart-switch button { min-height: 32px; padding: 0 11px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: .74rem; }
.chart-switch button[aria-pressed="true"] { color: #05241d; background: var(--cyan); }
.equity-chart { position: relative; min-height: 310px; padding: 8px 12px 2px; overflow: hidden; background: radial-gradient(circle at 75% 0, rgba(94, 231, 198, .07), transparent 38%); }
.equity-chart svg { display: block; width: 100%; height: 310px; overflow: visible; }
.equity-grid-line { stroke: rgba(128, 155, 148, .13); stroke-width: 1; }
.equity-zero { stroke: rgba(236, 247, 243, .3); stroke-width: 1; stroke-dasharray: 5 5; }
.equity-area { fill: url(#equity-area-gradient); }
.equity-line { fill: none; stroke: url(#equity-line-gradient); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 0 7px rgba(94, 231, 198, .28)); }
.equity-y-label, .equity-x-label { fill: var(--muted); font-size: 11px; }
.equity-guide { stroke: rgba(236, 247, 243, .5); stroke-width: 1; stroke-dasharray: 3 4; pointer-events: none; }
.equity-marker { fill: var(--panel); stroke: var(--cyan); stroke-width: 3; pointer-events: none; }
.equity-guide[hidden], .equity-marker[hidden] { display: none; }
.equity-hit { fill: transparent; cursor: crosshair; touch-action: none; }
.equity-tooltip { position: absolute; z-index: 2; display: grid; gap: 4px; min-width: 148px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--text); background: rgba(7, 16, 15, .96); box-shadow: 0 10px 35px rgba(0, 0, 0, .34); pointer-events: none; transform: translateX(-50%); }
.equity-tooltip span { color: var(--muted); font-size: .69rem; }
.equity-tooltip strong { font-size: .88rem; }
.equity-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); font-size: .82rem; pointer-events: none; }
.equity-empty[hidden], .equity-tooltip[hidden] { display: none; }
.alert { position: fixed; right: 24px; bottom: 24px; z-index: 10; max-width: min(420px, calc(100vw - 48px)); margin: 0; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: #10211e; box-shadow: var(--shadow); }
.alert.error { border-color: var(--red); }
dialog { width: min(520px, calc(100% - 30px)); padding: 0; border: 1px solid var(--line); border-radius: 18px; color: var(--text); background: var(--panel); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, .72); backdrop-filter: blur(4px); }
.dialog-card { display: grid; gap: 16px; padding: 24px; }
.danger-zone { display: grid; gap: 10px; margin-top: 4px; padding-top: 16px; border-top: 1px solid var(--line); }
.danger-zone p { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.45; }
.dialog-head { justify-content: space-between; gap: 20px; }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; color: var(--text); background: transparent; font-size: 1.4rem; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(420px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); box-shadow: var(--shadow); }
.login-card label { display: grid; gap: 8px; margin: 24px 0 14px; color: var(--muted); }
.login-card .button { width: 100%; }
.login-error { color: var(--red); }

@media (max-width: 1380px) {
  .control-card { grid-template-columns: repeat(4, 1fr); }
  .control-copy { grid-column: 1 / -1; }
  .stream-strip { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  .shell { width: min(100% - 24px, 1500px); padding-top: 18px; }
  .topbar { align-items: flex-start; }
  .hero-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .control-card { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .topbar { display: grid; }
  .top-actions { justify-content: space-between; }
  .hero-grid, .control-card, .stream-strip { grid-template-columns: 1fr; }
  .metric { min-height: 112px; }
  .control-card .button { width: 100%; }
  .stream-strip div { display: flex; align-items: center; justify-content: space-between; }
  .stream-strip strong { margin-top: 0; }
  .equity-head { align-items: flex-start; }
  .equity-summary { display: grid; justify-items: end; gap: 8px; }
  .equity-chart { min-height: 240px; padding-inline: 4px; }
  .equity-chart svg { height: 250px; }
}
