:root {
  --bg: #08090a;
  --panel: rgba(255,255,255,0.035);
  --panel-strong: rgba(255,255,255,0.055);
  --border: rgba(255,255,255,0.08);
  --border-soft: rgba(255,255,255,0.05);
  --text: #f7f8f8;
  --muted: #8a8f98;
  --soft: #d0d6e0;
  --accent: #7170ff;
  --accent-bg: #5e6ad2;
  --green: #10b981;
  --orange: #f59e0b;
  --pink: #ef5da8;
  --cyan: #22d3ee;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(113,112,255,0.18), transparent 34rem),
    radial-gradient(circle at 80% 15%, rgba(34,211,238,0.10), transparent 28rem),
    var(--bg);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: "cv01", "ss03";
}

.hidden { display: none !important; }
.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  background: linear-gradient(180deg, rgba(255,255,255,0.065), rgba(255,255,255,0.025));
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 24px 90px rgba(0,0,0,0.34);
}
.auth-card h2 { font-size: 28px; margin: 0; letter-spacing: -0.04em; }
.auth-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.auth-card input, .auth-card button { width: 100%; height: 44px; }
.auth-error { min-height: 18px; color: #fca5a5; font-size: 13px; }
.shell { width: min(1480px, calc(100vw - 32px)); margin: 0 auto; padding: 48px 0; }
.hero { display: grid; grid-template-columns: 1fr minmax(280px, 480px); gap: 24px; align-items: end; margin-bottom: 28px; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 600; margin: 0 0 12px; }
h1 { font-size: clamp(42px, 7vw, 82px); line-height: .95; letter-spacing: -0.055em; font-weight: 510; margin: 0; }
.subhead { max-width: 760px; color: var(--muted); font-size: 18px; line-height: 1.6; margin: 18px 0 0; }
.panel, .db-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.025));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 20px 80px rgba(0,0,0,0.26);
}
.db-card { padding: 18px; display: grid; gap: 8px; color: var(--muted); }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; color: var(--soft); overflow-wrap: anywhere; }
.muted { color: var(--muted); }

.controls { display: flex; gap: 14px; align-items: end; padding: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.controls label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.controls .grow { flex: 1 1 280px; }
select, input, button {
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.045);
  color: var(--text);
  padding: 0 12px;
  outline: none;
  font: inherit;
}
select option { background: #111214; color: var(--text); }
input::placeholder { color: #62666d; }
button { cursor: pointer; background: rgba(113,112,255,0.15); border-color: rgba(113,112,255,0.35); color: #f4f4ff; font-weight: 510; }
button:hover { background: rgba(113,112,255,0.25); }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { padding: 16px; border: 1px solid var(--border-soft); border-radius: 14px; background: rgba(255,255,255,0.025); }
.stat .name { color: var(--muted); font-size: 12px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: clamp(20px, 2.2vw, 30px); letter-spacing: -0.035em; font-weight: 510; }
.stat-detail { margin-top: 6px; color: #62666d; font-size: 12px; }
.info-dot { display: inline-grid; place-items: center; width: 16px; height: 16px; border: 1px solid var(--border); border-radius: 50%; font-size: 10px; color: var(--soft); background: rgba(255,255,255,0.04); }

.grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; }
.wide { grid-column: 1 / -1; }
.chart-panel { padding: 18px; min-height: 380px; }
.panel-head { display: flex; align-items: start; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
h2 { font-size: 18px; margin: 0 0 6px; letter-spacing: -0.02em; }
.selection-summary { margin-top: 8px; color: var(--soft); font-size: 12px; border: 1px solid var(--border-soft); border-radius: 999px; display: inline-flex; padding: 6px 9px; background: rgba(255,255,255,0.03); }
.panel-head p { margin: 0; color: var(--muted); font-size: 13px; }
.legend-note { color: var(--muted); font-size: 12px; border: 1px solid var(--border-soft); border-radius: 999px; padding: 7px 10px; white-space: nowrap; }
canvas { width: 100% !important; max-height: 420px; }
.sessions-panel { margin-top: 18px; padding: 18px; }
.session-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; max-height: 560px; overflow: auto; padding-right: 4px; }
.session-item { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--border-soft); border-radius: 12px; background: rgba(255,255,255,0.022); }
.session-item input { width: 16px; height: 16px; }
.session-title { font-size: 13px; color: var(--soft); font-weight: 510; line-height: 1.25; }
.session-id { font-family: 'JetBrains Mono', ui-monospace, monospace; color: #62666d; }
.session-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.session-tokens { color: var(--text); font-size: 13px; font-weight: 510; }

@media (max-width: 980px) {
  .hero, .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .shell { width: min(100vw - 20px, 1480px); padding-top: 28px; }
}
