:root {
  --bg: #0a0c11;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, rgba(124,108,255,0.06), transparent 60%);
  --panel: #14181f;
  --panel2: #1b212c;
  --panel3: #20283a;
  --line: #232a37;
  --line2: #2e3747;
  --text: #e8edf5;
  --muted: #8c95a8;
  --faint: #5a6275;
  --accent: #7c6cff;
  --accent2: #9a8cff;
  --accent-bg: rgba(124,108,255,0.13);
  --good: #2ed391;
  --good-bg: rgba(46,211,145,0.12);
  --bad: #ff5c7a;
  --bad-bg: rgba(255,92,122,0.12);
  --warn: #f5b14c;
  --warn-bg: rgba(245,177,76,0.12);
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 12px 32px rgba(0,0,0,.22);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: 400; }
.error { color: var(--bad); margin-top: 10px; min-height: 18px; font-size: 13px; }
h1, h2, h3 { letter-spacing: -0.02em; }

/* ── Login ─────────────────────────────────────────── */
.login { display: flex; align-items: center; justify-content: center; height: 100vh; padding: 20px; }
.login .card { width: 340px; text-align: center; padding: 32px; }
.login h1 { font-size: 20px; margin: 0 0 4px; }
.login input { width: 100%; margin: 16px 0; padding: 11px 13px; }
.login button { width: 100%; padding: 11px; }

/* ── Layout / sidebar ──────────────────────────────── */
.layout { display: flex; align-items: stretch; min-height: 100vh; }
.sidebar {
  width: 244px; flex: 0 0 244px;
  background: linear-gradient(180deg, #12161d, #0e1117);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 20px 14px; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  font-weight: 700; font-size: 17px; padding: 4px 10px 18px;
  display: flex; align-items: center; gap: 8px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.nav-group {
  font-size: 10px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--faint); font-weight: 600; margin: 18px 10px 6px;
}
.tab {
  position: relative; text-align: left; width: 100%;
  background: transparent; color: var(--muted);
  border: 0; padding: 9px 12px; border-radius: 9px;
  cursor: pointer; font-weight: 500; font-size: 13.5px;
  transition: background .14s, color .14s;
}
.tab:hover { background: var(--panel2); color: var(--text); }
.tab.active { background: var(--accent-bg); color: var(--text); font-weight: 600; }
.tab.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.sidebar-footer {
  display: flex; flex-direction: column; gap: 12px;
  padding-top: 16px; margin-top: 10px; border-top: 1px solid var(--line);
}
.period-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--faint); font-weight: 600; padding: 0 2px;
}
.period {
  display: flex; gap: 3px; padding: 3px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
}
.seg {
  flex: 1; background: transparent; color: var(--muted);
  border: 0; padding: 7px 6px; border-radius: 7px;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all .14s;
}
.seg:hover { color: var(--text); }
.seg.active { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(124,108,255,.35); }

.content { flex: 1; min-width: 0; }
.tab-panel { padding: 30px 34px; max-width: 1180px; margin: 0 auto; }
.legend { color: var(--muted); margin-bottom: 20px; font-size: 13px; }
.legend b { color: var(--text); }

/* ── Cards ─────────────────────────────────────────── */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 16px; font-size: 15px; font-weight: 650; }
.card h3 { margin: 14px 0 8px; font-size: 13px; font-weight: 600; }

/* ── Buttons / inputs ──────────────────────────────── */
button {
  background: var(--accent); color: #fff; border: 0; border-radius: 9px;
  padding: 9px 16px; font-weight: 600; font-size: 13px; cursor: pointer;
  font-family: inherit; transition: background .15s, transform .04s, box-shadow .15s;
}
button:hover { background: var(--accent2); box-shadow: 0 4px 14px rgba(124,108,255,.3); }
button:active { transform: translateY(1px); }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line2); box-shadow: none; }
button.ghost:hover { background: var(--panel2); color: var(--text); box-shadow: none; }
input, select {
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--line2); border-radius: 9px; padding: 9px 11px;
  font-family: inherit; font-size: 13px; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: end; }
.grid button { grid-column: 1 / -1; justify-self: start; }
.row { display: flex; gap: 12px; align-items: end; margin-top: 14px; flex-wrap: wrap; }
.check { flex-direction: row; align-items: center; gap: 7px; }

/* ── Tables ────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 12px 14px; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th {
  color: var(--faint); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--line);
}
td { border-bottom: 1px solid var(--line); font-size: 13.5px; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--panel2); }
tbody tr:last-child td { border-bottom: 0; }
.val { font-weight: 600; }
.val.good { color: var(--good); }
.val.bad { color: var(--bad); }
.val.neutral { color: var(--text); }

/* ── Tags / chips / verdicts ───────────────────────── */
.tag {
  display: inline-block; font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: 999px; margin-left: 7px;
  border: 1px solid var(--line2); color: var(--muted); letter-spacing: .03em;
}
.tag.bio { color: var(--accent2); border-color: rgba(124,108,255,.5); background: var(--accent-bg); }
.tag.thin { color: var(--warn); border-color: rgba(245,177,76,.4); background: var(--warn-bg); }
.verdict {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 3px 11px; border-radius: 999px; letter-spacing: .01em;
}
.verdict.healthy { background: var(--good-bg); color: var(--good); }
.verdict.watch { background: var(--warn-bg); color: var(--warn); }
.verdict.problem { background: var(--bad-bg); color: var(--bad); }
.verdict.unknown, .verdict.unfit { background: var(--panel2); color: var(--muted); }
.chip { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.neutral { background: var(--panel2); color: var(--muted); }

/* ── Diagnosis nodes ───────────────────────────────── */
.tree { display: flex; flex-direction: column; gap: 12px; margin-bottom: 6px; }
.node {
  background: var(--panel2); border: 1px solid var(--line);
  border-left: 3px solid var(--line2); border-radius: 11px; padding: 14px 16px;
}
.node.cost { border-left-color: var(--bad); }
.node.value { border-left-color: var(--warn); }
.node h3 { margin: 0 0 5px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.node .big { font-size: 26px; font-weight: 700; margin: 2px 0; }
.node p { margin: 8px 0 0; }
.alert {
  background: var(--bad-bg); color: var(--bad); border: 1px solid rgba(255,92,122,.25);
  border-radius: 10px; padding: 11px 15px; margin: 12px 0; font-size: 13px;
}
.stage-table td.label { color: var(--muted); }

/* ── Champions boards ──────────────────────────────── */
.boards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: start; margin-bottom: 20px; }
.card.decider { border-color: rgba(46,211,145,.4); box-shadow: var(--shadow), 0 0 0 1px rgba(46,211,145,.25); }
.boards-grid table th, .boards-grid table td { padding: 8px 9px; font-size: 12.5px; }
svg { max-width: 100%; height: auto; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; }
@media (max-width: 920px) { .boards-grid { grid-template-columns: 1fr; } .grid { grid-template-columns: repeat(2,1fr); } }
