:root {
  --bg: #0A0A0A;
  --bg-elev: #111111;
  --card: #161616;
  --text: #F2F2F2;
  --muted: #A3A3A3;
  --line: #2A2A2A;
  --teal: #00D6AB;
  --violet: #7C3AED;
  --danger: #F07178;
  --warn: #E6C07B;
  --pass: #00D6AB;
  --shadow: 0 0 0 1px var(--line);
  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em; }
h1 { font-size: 2rem; margin: 0; }
h2 { font-size: 1.6rem; margin: 0 0 0.75rem; }
p { margin: 0 0 1rem; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
.eyebrow {
  display: block;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}
.top {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-end;
  padding: 1.25rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  z-index: 5;
}
.top-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.pill {
  border: 1px solid color-mix(in srgb, var(--teal) 50%, var(--line));
  color: var(--teal);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.pill.dim { color: var(--muted); border-color: var(--line); }
.pill.ok { color: var(--teal); }
.pill.off { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.stamp { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
.text-btn {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font: inherit; font-size: 0.85rem; padding: 0.2rem 0.4rem;
}
.text-btn:hover { color: var(--text); }
.toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  padding: 0.7rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.toc a { color: var(--muted); font-size: 0.85rem; }
.toc a:hover { color: var(--teal); }
main { padding: 1.25rem; max-width: 1100px; margin: 0 auto; }
section { margin-bottom: 2.4rem; }
.hint { color: var(--muted); font-size: 0.92rem; }
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.metrics.compact { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.metric {
  background: var(--card);
  box-shadow: var(--shadow);
  border-radius: 14px;
  padding: 0.9rem 1rem;
}
.metric .k { display: block; color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; }
.metric .v { display: block; font-family: var(--mono); font-size: 1.25rem; margin-top: 0.25rem; }
.metric .v.neg { color: var(--danger); }
.metric .v.pos { color: var(--teal); }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 720px) { .grid.two { grid-template-columns: 1fr; } }
.card {
  background: var(--card);
  box-shadow: var(--shadow);
  border-radius: 14px;
  padding: 1rem 1.1rem;
}
.table-wrap { overflow-x: auto; box-shadow: var(--shadow); border-radius: 14px; background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.65rem 0.85rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.num { text-align: right; font-family: var(--mono); }
td.num { font-variant-numeric: tabular-nums; }
.neg { color: var(--danger); }
.pos { color: var(--teal); }
.mono { font-family: var(--mono); font-size: 0.82rem; }
.muted { color: var(--muted); }
.bar {
  height: 8px; background: #222; border-radius: 99px; overflow: hidden; margin: 0.4rem 0 0.8rem;
}
.bar > span { display: block; height: 100%; background: var(--teal); }
.stage {
  display: inline-block; border-radius: 999px; padding: 0.1rem 0.55rem;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
  border: 1px solid var(--line); color: var(--muted);
}
.stage.confirmation, .stage.expansion { color: var(--teal); border-color: color-mix(in srgb, var(--teal) 45%, var(--line)); }
.stage.saturation, .stage.distribution { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); }
.gate { display: flex; justify-content: space-between; gap: 1rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.gate:last-child { border-bottom: 0; }
.feed { list-style: none; padding: 0; margin: 0; }
.feed li {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.feed time { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); display: block; }
#equity-chart { width: 100%; height: auto; display: block; }
footer { padding: 1rem 1.25rem 2.5rem; color: var(--muted); font-size: 0.85rem; max-width: 1100px; margin: 0 auto; }
.login {
  position: fixed; inset: 0; background: var(--bg); z-index: 20;
  display: grid; place-items: center; padding: 1.5rem;
}
.login[hidden] { display: none; }
.login-card { width: min(420px, 100%); }
.login-card h1 { font-size: 2.6rem; margin-bottom: 0.4rem; }
.lede { color: var(--muted); }
.login label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.35rem; }
.login input {
  width: 100%; background: var(--card); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 0.75rem 0.9rem; font: inherit; margin-bottom: 0.8rem;
}
.login button, #login-btn {
  width: 100%; background: var(--teal); color: #04261e; border: 0; border-radius: 10px;
  padding: 0.8rem 1rem; font: inherit; font-weight: 600; cursor: pointer;
}
.error { color: var(--danger); }
.empty { color: var(--muted); font-style: italic; }
#app[hidden] { display: none; }
