:root {
  color-scheme: dark;
  font-family: Inter, Geist, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  background: #0b0f14;
  color: #e8eef5;
  --surface: #111720;
  --raised: #181f2a;
  --line: #26313e;
  --muted: #a0adbb;
  --accent: #68ddc0;
  --negative: #f7a1a7;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, input { font: inherit; }
button, .sidebar a { border-radius: 7px; transition: background-color .18s ease, color .18s ease; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip { position: absolute; left: 1rem; top: -5rem; z-index: 2; padding: .75rem; background: var(--raised); color: #fff; }
.skip:focus { top: .5rem; }
.brand { display: inline-flex; align-items: center; gap: .75rem; font-size: 1.05rem; font-weight: 700; color: #f4f7fa; white-space: nowrap; }
.brand-mark { display: inline-grid; place-items: center; width: 33px; height: 33px; border-radius: 8px; background: var(--accent); color: #102824; font-size: 1.45rem; line-height: 1; }
.shell-top { min-height: 69px; padding: .75rem clamp(1rem, 3vw, 2rem); border-bottom: 1px solid var(--line); background: var(--surface); display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.header-status, .toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
.status-text, .last-update, .muted { color: var(--muted); font-size: .86rem; }
.mode-chip { display: inline-block; background: #15302c; border: 1px solid #255049; border-radius: 6px; padding: .24rem .48rem; color: #a7f6e3; letter-spacing: .08em; font-size: .68rem; font-weight: 750; }
.mode-chip.backtest { background: #282441; color: #ddd0ff; border-color: #453966; }
.mode-chip.experimental { background: #32281c; color: #ffe1a9; border-color: #624925; max-width: 100%; letter-spacing: .035em; }
.observation-status { padding: .85rem 1rem; border-radius: 8px; border: 1px solid #32534c; color: #b9f1e2; background: #172b29; font-weight: 650; }
.technical-mode { margin-bottom: 1rem; }
.shell { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: calc(100vh - 69px); }
.sidebar { padding: 1.45rem .9rem; border-right: 1px solid var(--line); background: #0e131a; display: flex; flex-direction: column; align-items: stretch; gap: 2.2rem; }
.sidebar nav { display: flex; flex-direction: column; gap: .32rem; }
.sidebar a { padding: .7rem .8rem; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .88rem; white-space: nowrap; }
.sidebar a:hover, .sidebar a[aria-current] { background: #1a2730; color: #edfbf7; }
.sidebar a[aria-current] { box-shadow: inset 3px 0 0 var(--accent); }
main#content { padding: 2.2rem clamp(1rem, 3.5vw, 3.4rem) 3rem; min-width: 0; width: 100%; max-width: 1480px; }
.page-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .6rem; margin-bottom: 1.35rem; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 3.6vw, 2.45rem); font-weight: 700; line-height: 1.14; letter-spacing: -.04em; }
h2 { font-size: 1rem; letter-spacing: -.01em; font-weight: 680; }
h3 { font-size: .9rem; margin: 0; }
details summary { cursor: pointer; color: var(--muted); }
details[open] summary { margin-bottom: 1rem; }
.notice { padding: .75rem 1rem; margin-bottom: 1rem; background: #29201b; border: 1px solid #6b4d33; border-radius: 8px; color: #ffdcb6; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.12rem; min-width: 0; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; margin: 0 0 1rem; }
.metric { padding: 1rem 1.05rem; }
.metric dt { color: var(--muted); font-size: .83rem; font-weight: 520; }
.metric dd { margin: .48rem 0 0; font-size: clamp(1.05rem, 2.45vw, 1.65rem); line-height: 1.2; font-weight: 670; overflow-wrap: anywhere; }
.tabular, .metric dd, td, .facts dd { font-variant-numeric: tabular-nums; }
.positive { color: var(--accent); }
.negative { color: var(--negative); }
.grid-two { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 1rem; }
.stack { display: grid; gap: 1rem; }
.chart { width: 100%; height: 220px; display: block; }
.facts { margin: 0; }
.facts div { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; border-bottom: 1px solid var(--line); padding: .75rem 0; }
.facts div:first-child { padding-top: 0; }
.facts div:last-child { border: 0; padding-bottom: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; table-layout: auto; font-size: .85rem; }
th, td { text-align: left; white-space: nowrap; padding: .78rem .8rem .78rem 0; border-bottom: 1px solid var(--line); }
th { font-weight: 550; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td:last-child, th:last-child { padding-right: 0; }
.empty { color: var(--muted); font-size: .9rem; padding: .65rem 0; }
.quiet, .primary, .danger { border: 1px solid var(--line); padding: .52rem .75rem; background: var(--raised); color: #e8eef5; font-weight: 600; font-size: .86rem; }
.sidebar .quiet { align-self: flex-start; background: transparent; margin-top: 1.75rem; }
.quiet:hover, .sidebar .quiet:hover { background: #24303d; }
.primary { background: var(--accent); color: #102824; border-color: transparent; }
.primary:hover { background: #9befda; }
.danger { color: #ffbfc4; border-color: #70404a; background: #321e27; }
.danger:hover { background: #4b2a34; }
.login-body { display: grid; min-height: 100vh; place-items: center; padding: 1rem; }
.login-panel { width: min(100%, 420px); padding: 1.7rem; }
.login-panel .brand { margin-bottom: 1.8rem; }
.login-form { margin-top: 1.35rem; display: grid; gap: .65rem; }
.login-form label { color: var(--muted); font-size: .88rem; }
.login-form input { width: 100%; border: 1px solid #384654; color: #eff5fa; background: #0b1118; padding: .7rem; border-radius: 6px; }
.login-form button { margin-top: .4rem; }
.login-error { color: var(--negative); font-size: .86rem; }
.login-error:empty { display: none; }
@media (max-width: 980px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-two { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 670px) {
  .shell { display: block; }
  .sidebar { border: 0; border-bottom: 1px solid var(--line); padding: .55rem .75rem; }
  .sidebar nav { flex-flow: row wrap; align-items: center; gap: .35rem .25rem; }
  .sidebar a, .sidebar .quiet { padding: .48rem .54rem; }
  .sidebar .quiet { margin: 0 0 0 auto; }
  main#content { padding-top: 1.4rem; }
  .last-update { font-size: .75rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
