/*
 * One stylesheet, no framework, no build step.
 *
 * The dashboard is a dense table of numbers, so the priorities are: figures that line up
 * (tabular numerals, right-aligned), enough contrast to read a percentage at a glance, and a
 * table that scrolls inside its own container rather than pushing the page sideways.
 *
 * Both themes are defined from tokens on :root, with the dark set behind
 * prefers-color-scheme, so the page follows the reader's system setting.
 */

:root {
  color-scheme: light dark;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #d9dde3;
  --text: #14181f;
  --text-dim: #5b6472;
  --accent: #0b5cad;
  --accent-text: #ffffff;

  --ok: #17694a;
  --ok-bg: #e2f3ea;
  --warn: #7a4a06;
  --warn-bg: #fdf0dc;
  --danger: #8c2323;
  --danger-bg: #fbe6e6;

  --radius: 8px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101317;
    --surface: #181c22;
    --surface-2: #1f242b;
    --border: #2c333c;
    --text: #e8ecf1;
    --text-dim: #98a3b1;
    --accent: #4d9fe8;
    --accent-text: #0b1017;

    --ok: #6fd3a4;
    --ok-bg: #14312a;
    --warn: #e8bc72;
    --warn-bg: #33280f;
    --danger: #f09090;
    --danger-bg: #3a1c1c;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}

code, pre { font-family: var(--mono); font-size: 0.9em; }

/* ---------------------------------------------------------------- chrome */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { font-weight: 650; color: var(--text); text-decoration: none; letter-spacing: -0.01em; }

.topbar nav { display: flex; gap: 1rem; }
.topbar nav a { color: var(--text-dim); text-decoration: none; font-size: 0.9rem; }
.topbar nav a:hover, .topbar nav a.active { color: var(--text); }

main { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }

footer {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--text-dim);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ---------------------------------------------------------------- blocks */

h1 { font-size: 1.5rem; margin: 0 0 0.25rem; letter-spacing: -0.02em; }
h2 { font-size: 1.05rem; margin: 0 0 0.5rem; }
h4 { font-size: 0.85rem; margin: 0.9rem 0 0.25rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
}

details.panel > summary { cursor: pointer; }

.runbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.split > .panel { margin-bottom: 1.25rem; }

.hero { padding: 3rem 0; }
.hero.narrow { max-width: 44rem; }
.lede { color: var(--text-dim); font-size: 1.05rem; }

.note { color: var(--text-dim); font-size: 0.85rem; }
.note.warn, .notice.warn {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
}

.notice {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.85rem;
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
}

.sub { color: var(--text-dim); font-size: 0.78rem; }
.strong { font-weight: 650; }

ul.plain { margin: 0.25rem 0; padding-left: 1.1rem; }
ul.plain li { margin-bottom: 0.3rem; font-size: 0.88rem; }

/* ---------------------------------------------------------------- cards */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.card-label { color: var(--text-dim); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
.card-value { font-size: 1.5rem; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.card-note { color: var(--text-dim); font-size: 0.78rem; }

/* ---------------------------------------------------------------- tables */

/* Wide content scrolls inside its own box; the page body never scrolls sideways. */
.scroll { overflow-x: auto; }

table { border-collapse: collapse; width: 100%; }

.grid th, .grid td {
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0.6rem;
  text-align: left;
  vertical-align: top;
  font-size: 0.86rem;
}

.grid th {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--surface);
}

.grid tbody tr:hover { background: var(--surface-2); }

.mini td { padding: 0.35rem 0.4rem; border-bottom: 1px solid var(--border); font-size: 0.88rem; }

.right { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.detail { padding: 0.5rem 0 0.75rem; max-width: 60rem; }
.detail p { font-size: 0.88rem; }

summary { cursor: pointer; }
summary::marker { color: var(--text-dim); }

/* ---------------------------------------------------------------- pills */

.pill {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.pill.action { background: var(--surface-2); color: var(--text-dim); border-color: var(--border); }

.conf-high, .risk-low { background: var(--ok-bg); color: var(--ok); }
.conf-medium, .risk-medium { background: var(--warn-bg); color: var(--warn); }
.conf-low, .risk-high { background: var(--danger-bg); color: var(--danger); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--ok-bg);
  color: var(--ok);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge.muted { background: var(--surface-2); color: var(--text-dim); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------------------------------------------------------------- forms */

.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-text);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.actions { margin-top: 1.25rem; }

.inline-form, .ask-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.ask-form { margin: 0.75rem 0; }
.ask-form input { flex: 1 1 24rem; }

input, select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.6rem;
  font: inherit;
  font-size: 0.9rem;
}

input:focus-visible, select:focus-visible, .btn:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------- answer */

.answer {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-top: 0.75rem;
}

.answer pre {
  margin: 0 0 0.5rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--sans);
  font-size: 0.92rem;
}
