/* One stylesheet, no framework, no web fonts, no third-party requests.
   Light and dark both defined on :root so the page follows the OS setting. */

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f2f2ef;
  --border: #e2e2dc;
  --text: #1b1b19;
  --muted: #6b6b63;
  --accent: #1b1b19;
  --pass-bg: #edf7ee;
  --pass-border: #bfe0c4;
  --pass-text: #1f5c2c;
  --fail-bg: #fdf0ee;
  --fail-border: #f0c8c1;
  --fail-text: #8a2f1e;
  --warn-bg: #fdf7e7;
  --warn-border: #ecdcae;
  --warn-text: #6d5312;
  --chart-a: #2f6f4e;
  --chart-b: #7a5ea8;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17171a;
    --surface: #1f1f23;
    --surface-2: #26262b;
    --border: #33333a;
    --text: #ececea;
    --muted: #9a9a95;
    --accent: #ececea;
    --pass-bg: #16281a;
    --pass-border: #2f5c39;
    --pass-text: #9fdcaa;
    --fail-bg: #2c1815;
    --fail-border: #6a342a;
    --fail-text: #f0a898;
    --warn-bg: #2b2415;
    --warn-border: #5e4f26;
    --warn-text: #e2c979;
    --chart-a: #6fc294;
    --chart-b: #b39ddb;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 0; letter-spacing: -0.005em; }
h3 { font-size: 15px; margin: 0; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 20px 64px; }
.section-heading { margin: 34px 0 14px; text-transform: uppercase; font-size: 12px; letter-spacing: 0.08em; color: var(--muted); }

/* --- sign in --- */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.signin .card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px; }
.signin h1 { margin-bottom: 8px; }
.signin label { display: block; font-size: 13px; font-weight: 600; margin: 18px 0 6px; }

input, select {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 15px;
  color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 7px;
}
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

button {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 10px 16px; border-radius: 7px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--bg);
}
button:hover { opacity: 0.88; }
button:disabled { opacity: 0.5; cursor: default; }
.signin button { width: 100%; margin-top: 18px; }
button.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
button.ghost { background: none; color: var(--muted); border-color: transparent; }
button.ghost:hover { color: var(--text); }

.notice { margin-top: 16px; padding: 11px 13px; border-radius: 7px; font-size: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.notice.error { background: var(--fail-bg); border-color: var(--fail-border); color: var(--fail-text); }

/* --- top bar --- */
.topbar { border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.topbar-inner { max-width: 1080px; margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar p { margin: 2px 0 0; font-size: 13px; }

/* --- verdict banners --- */
.verdicts { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }

.verdict { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; background: var(--surface); }
.verdict.pass { background: var(--pass-bg); border-color: var(--pass-border); }
.verdict.fail { background: var(--fail-bg); border-color: var(--fail-border); }
.verdict-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.verdict-window { font-size: 13px; font-weight: 700; letter-spacing: 0.04em; }
.verdict-status { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 9px; border-radius: 20px; }
.verdict.pass .verdict-status { background: var(--pass-border); color: var(--pass-text); }
.verdict.fail .verdict-status { background: var(--fail-border); color: var(--fail-text); }
.verdict-pct { font-size: 42px; font-weight: 700; letter-spacing: -0.03em; margin: 10px 0 2px; font-variant-numeric: tabular-nums; }
.verdict.pass .verdict-pct { color: var(--pass-text); }
.verdict.fail .verdict-pct { color: var(--fail-text); }
.verdict-sub { font-size: 13px; }

.meter { height: 7px; border-radius: 4px; background: var(--surface-2); margin: 14px 0 6px; position: relative; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 4px; }
.verdict.pass .meter-fill { background: var(--pass-text); }
.verdict.fail .meter-fill { background: var(--fail-text); }
.meter-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: 0.55; }

.facts { list-style: none; margin: 16px 0 0; padding: 14px 0 0; border-top: 1px solid var(--border); font-size: 13px; }
.facts li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.facts .v { font-variant-numeric: tabular-nums; font-weight: 600; }

.gap { margin: 14px 0 0; padding: 13px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; }
.gap h4 { margin: 0 0 7px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.gap .lead { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* --- tables --- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-top: 12px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 9px 13px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; background: var(--surface-2); position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.name { white-space: normal; min-width: 200px; }
tr.capped td { background: color-mix(in srgb, var(--fail-bg) 55%, transparent); }
tr.hypothetical td { font-style: italic; }

.badge { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 7px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); }
.badge.warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.badge.cap { background: var(--fail-bg); border-color: var(--fail-border); color: var(--fail-text); }
.badge.free { background: var(--pass-bg); border-color: var(--pass-border); color: var(--pass-text); }

.table-caption { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 22px 0 8px; flex-wrap: wrap; }

/* --- what if --- */
.whatif-row { display: grid; gap: 10px; grid-template-columns: 1.4fr 1fr 1fr auto; align-items: end; margin-bottom: 10px; }
.whatif-row label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 5px; }
.whatif-actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
@media (max-width: 620px) { .whatif-row { grid-template-columns: 1fr 1fr; } }

/* --- history --- */
.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 18px; font-size: 13px; margin: 12px 0 0; flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 7px; }
.swatch { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

.events { list-style: none; margin: 0; padding: 0; }
.events li { border-left: 2px solid var(--border); padding: 0 0 18px 16px; margin-left: 5px; }
.events li:last-child { padding-bottom: 0; }
.events .date { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 0.03em; }
.events ul { margin: 7px 0 0; padding-left: 18px; font-size: 14px; }
.events ul li { border: none; padding: 0 0 5px; margin: 0; list-style: disc; }

.warning-block { margin: 0 0 14px; padding: 13px 15px; border-radius: 8px; font-size: 14px; background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text); }
.warning-block ul { margin: 7px 0 0; padding-left: 20px; }
.warning-block.error { background: var(--fail-bg); border-color: var(--fail-border); color: var(--fail-text); }

.empty { padding: 26px; text-align: center; color: var(--muted); font-size: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.footer { margin-top: 42px; padding-top: 18px; border-top: 1px solid var(--border); }
