:root {
  color-scheme: light;
  --surface-0: #f4f4f1;
  --surface-1: #fcfcfb;
  --border: #e3e2dd;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #7a7974;
  --tab-active-bg: #0b0b0b;
  --tab-active-text: #ffffff;
  --series-sub: #2a78d6;
  --series-non: #eb6834;
  --warn-bg: #fff4e0;
  --warn-text: #7a4a00;
  --status-good: #0ca30c;
  --status-critical: #d03b3b;
  --radius: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #111110;
    --surface-1: #1a1a19;
    --border: #2e2e2b;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #8f8e86;
    --tab-active-bg: #ffffff;
    --tab-active-text: #0b0b0b;
    --series-sub: #3987e5;
    --series-non: #d95926;
    --warn-bg: #3a2a0c;
    --warn-text: #f5c77a;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #111110;
  --surface-1: #1a1a19;
  --border: #2e2e2b;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #8f8e86;
  --tab-active-bg: #ffffff;
  --tab-active-text: #0b0b0b;
  --series-sub: #3987e5;
  --series-non: #d95926;
  --warn-bg: #3a2a0c;
  --warn-text: #f5c77a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: var(--font);
  line-height: 1.4;
}

p { margin: 0; }

.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 16px 56px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

h1 {
  margin: 2px 0 0;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.updated { font-size: 13px; color: var(--text-secondary); }

.banner {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 14px;
}

.controls {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tabs {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-1);
}

.tabs button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
}

.tabs button:hover { color: var(--text-primary); }

.tabs button[aria-selected="true"] {
  background: var(--tab-active-bg);
  color: var(--tab-active-text);
}

.tabs button:focus-visible {
  outline: 2px solid var(--series-sub);
  outline-offset: 2px;
}

.panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.range { font-size: 14px; color: var(--text-secondary); margin-bottom: 20px; }

.label {
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.muted { color: var(--text-muted); }

.hero {
  font-size: 56px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 4px 0 6px;
}

.top-delta { font-size: 14px; color: var(--text-muted); margin-top: 6px; }
.panel > .top-delta { margin: 0 0 24px; }
.top-delta .delta { display: inline; font-size: inherit; font-weight: 600; margin: 0 4px 0 0; }

.split {
  position: relative;
  display: flex;
  gap: 2px;
  height: 14px;
  margin-bottom: 24px;
}

.seg {
  height: 100%;
  min-width: 0;
  border-radius: 4px;
  transition: flex-grow 0.25s ease;
}

.seg-sub { background: var(--series-sub); }
.seg-non { background: var(--series-non); }

.tip {
  position: absolute;
  top: 22px;
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--text-primary);
  color: var(--surface-1);
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 1;
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}

.swatch-sub { background: var(--series-sub); }
.swatch-non { background: var(--series-non); }

.value {
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-top: 6px;
}

.share { font-size: 14px; color: var(--text-secondary); margin-top: 2px; }

.compare { margin-top: 16px; padding-bottom: 20px; }

.compare h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
}

.hint { font-size: 13px; color: var(--text-muted); margin: 2px 0 16px; }

.table-wrap {
  overflow-x: auto;
  margin: 0 -28px;
  padding: 0 28px;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}

th, td {
  padding: 10px 12px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

thead th {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  vertical-align: bottom;
}

th[scope="row"], thead th:first-child {
  text-align: left;
  font-weight: 550;
  color: var(--text-secondary);
  position: sticky;
  left: 0;
  background: var(--surface-1);
  z-index: 1;
}

tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody tr.group-start th, tbody tr.group-start td { border-top: 2px solid var(--border); }

.col-current { background: var(--surface-0); }
thead .col-current { color: var(--text-primary); }

.tag {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.cell-value { display: block; color: var(--text-primary); font-weight: 550; }

.delta { display: block; font-size: 12px; margin-top: 2px; color: var(--text-muted); }
.delta-up { color: var(--status-good); }
.delta-down { color: var(--status-critical); }

.footnote {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
  max-width: 70ch;
}

@media (max-width: 560px) {
  .shell { padding-top: 24px; }
  .panel { padding: 20px; }
  .table-wrap { margin: 0 -20px; padding: 0 20px; }
  .hero { font-size: 44px; }
  .cards { grid-template-columns: 1fr; }
  .controls { flex-direction: column; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; padding: 7px 8px; }
}

tbody tr.row-muted th, tbody tr.row-muted td { color: var(--text-muted); font-weight: 400; }
#ads-error { margin: 0 0 12px; }

/* Clarion handshake failed or page opened outside Clarion: show only the banner. */
.locked .controls, .locked .panel, .locked .footnote { display: none; }
