/* Dashboard layout on top of the Cumulus tokens (cumulus.css). Cumulus is
   light mode only by law, which is also the rule here. */
*, *::before, *::after { box-sizing: border-box; }

/* The hidden attribute must always win. Without this, any element whose class
   sets its own display (the gate, the login card) stays visible after the app
   hides it — which kept the login screen painted on top of a fully logged in
   dashboard. */
[hidden] { display: none !important; }

html { background: var(--canvas); }
body { margin: 0; min-width: 0; }
button, input { font: inherit; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

/* ---- Type shims: the markup keeps its class names, Cumulus supplies the
   voice. Display face for headers, system text face for everything else. ---- */
.body { font: 400 13.5px/1.5 var(--font); }
.body-bold { font: 600 13.5px/1.5 var(--font); }
.heading-md { font: 650 17px/1.25 var(--font-display); letter-spacing: -.01em; }
.headline6-bold { font: 650 15.5px/1.25 var(--font-display); letter-spacing: -.01em; }
.label { font: 500 12px/1.45 var(--font); }
.label-bold { font: 600 12px/1.45 var(--font); }
.label-medium { font: 500 12.5px/1 var(--font); }
.label-sm { font: 500 11px/1.35 var(--font); }
.color-secondary { color: var(--ink-2); }
.color-tertiary { color: var(--ink-3); }
.color-brand { color: var(--blue); }
.color-error { color: var(--bad); }

.wordmark {
  font: 700 17px/1 var(--font-display);
  letter-spacing: -.01em;
  color: var(--blue);
}

.linklike {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  color: var(--ink-2);
  transition: color var(--t-fast) var(--ease);
}
.linklike:hover { color: var(--ink); text-decoration: none; }

/* ---- The gate (Cumulus front door: dawn wash, drifting clouds) ---- */
.gate { min-height: 100dvh; }
.gate-cloud--one { width: 21rem; height: 7.5rem; top: 9%; left: -4rem; }
.gate-cloud--two { width: 26rem; height: 9rem; right: -5rem; bottom: 7%; }
.gate-cloud--three { width: 14rem; height: 5rem; top: 56%; left: 12%; }
.gate-stack {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  width: 372px; max-width: 100%;
}
.gate-card { width: 100%; }
.gate-copy { max-width: 30ch; color: var(--ink-2); }
.gate-card .input { width: 100%; text-align: center; }
.gate-card .btn { width: 100%; }
.btn:disabled { cursor: wait; opacity: .58; transform: none; box-shadow: none; }

/* ---- Top bar and shell ---- */
.topbar { justify-content: space-between; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }

.shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 26px 22px 80px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* The range picker rides the Cumulus segmented pill; the app toggles
   .is-active, which maps onto the .on look. */
.seg button.is-active { background: var(--sheet); color: var(--ink); box-shadow: var(--shadow-pop); }
.custom-range { display: flex; align-items: center; gap: 8px; }
.input-date { width: auto; padding: 8px 10px; font-size: 12.5px; }

/* ---- Sections and cards ---- */
.section { display: flex; flex-direction: column; gap: 12px; }
.section-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head .label { color: var(--ink-2); }

.card { display: flex; flex-direction: column; gap: 16px; padding: 20px; }

/* Quiet labels: muted tags and pills carry state by tint alone, no dots. */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  border: 0; cursor: default;
  font: 600 11.5px/1 var(--font);
  border-radius: var(--r-pill);
  padding: 5px 10px;
  background: var(--well); color: var(--ink-2);
}
.chip:hover { border: 0; color: var(--ink-2); }
.chip-brand { background: var(--blue-soft); color: var(--blue); }
.chip-brand:hover { color: var(--blue); }
.chip-warn { background: var(--butter-tint); color: var(--butter-deep); }
.chip-warn:hover { color: var(--butter-deep); }

/* ---- Stat rows: gray wells on the white sheet, display-face numerals ---- */
.stats { display: flex; flex-wrap: wrap; gap: 10px; }
.stat {
  flex: 1 1 150px;
  min-width: 150px;
  background: var(--well);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat .value {
  font: 700 27px/1.05 var(--font-display);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.stat .value.brand { color: var(--blue); }
.stat .name { font: 500 11.5px/1.35 var(--font); color: var(--ink-2); }
.live-name { display: inline-flex; align-items: center; gap: 7px; }

/* ---- Blue banner (baseline verdict): the flood, as a strip ---- */
.banner-blue {
  background: var(--blue);
  color: #fff;
  border-radius: 12px;
  padding: 13px 16px;
  font: 600 13px/1.55 var(--font);
}

.mathline {
  background: var(--well);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.rpm-hero { color: var(--blue); }

/* ---- Tables (Cumulus iOS-list DNA) ---- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left;
  font: 500 11.5px/1.3 var(--font);
  color: var(--ink-3);
  padding: 8px 12px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
table.data td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--hairline);
  font: 400 13px/1.4 var(--font);
  vertical-align: middle;
  white-space: nowrap;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background var(--t-fast) var(--ease); }
table.data tbody tr:hover { background: rgba(24, 25, 27, .025); }
table.data td.num, table.data th.num { text-align: right; }
table.data td.num { font: 600 13px/1.4 var(--font); font-variant-numeric: tabular-nums; }

/* ---- Experiment cards ---- */
.exp-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  cursor: pointer;
  user-select: none;
}
.exp-head .grow { flex: 1; }
.exp-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.exp-caret { transition: transform var(--t-fast) var(--ease); color: var(--ink-4); font-size: 13px; }
.exp-card.is-open .exp-caret { transform: rotate(90deg); }
.exp-body { display: none; flex-direction: column; gap: 16px; }
.exp-card.is-open .exp-body { display: flex; }

/* Honesty notes: a plain quiet well, no colored edge bar. */
.note-banner {
  font: 400 12px/1.5 var(--font);
  color: var(--ink-2);
  background: var(--well);
  border-radius: 10px;
  padding: 9px 13px;
}

/* ---- Sparkline ---- */
.spark-wrap { display: flex; flex-direction: column; gap: 6px; }
.spark { width: 100%; height: 120px; display: block; }
.spark-bar { fill: var(--blue); }
.spark-bar.partial { fill: var(--sky-mid); }
.spark-baseline { stroke: rgba(24, 25, 27, .08); stroke-width: 1; }
.spark-caption { display: flex; justify-content: space-between; color: var(--ink-3); }

/* ---- Changelog ---- */
.changelog { display: flex; flex-direction: column; gap: 7px; }
.changelog-row { display: flex; gap: 12px; align-items: baseline; }
.changelog-date {
  font: 600 11.5px/1.45 var(--font);
  font-variant-numeric: tabular-nums;
  color: var(--blue);
  white-space: nowrap;
}

/* ---- Footnotes ---- */
.footnotes {
  border-top: 1px solid var(--hairline);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.footnotes p { margin: 0; font: 400 11.5px/1.5 var(--font); color: var(--ink-3); }

.pagefoot { text-align: center; }

.tooltip {
  position: fixed;
  z-index: 20;
  background: var(--sheet);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  padding: 8px 12px;
  font: 500 12px/1.5 var(--font);
  pointer-events: none;
  max-width: 260px;
}

.updated { font: 500 11.5px/1 var(--font); color: var(--ink-3); }

/* ---- Loading state: stale content dims under the waves, skeletons stand in
   for cards that have never painted. ---- */
#global-note { display: inline-flex; align-items: center; gap: 7px; }
.card, #experiments { transition: opacity var(--t-med) var(--ease); }
.app-refreshing .card { opacity: .45; pointer-events: none; }
.skel { display: flex; flex-direction: column; gap: 10px; }
.skel .skeleton { height: 14px; }
.skel .skeleton:nth-child(1) { width: 38%; }
.skel .skeleton:nth-child(2) { width: 100%; }
.skel .skeleton:nth-child(3) { width: 62%; }

@media (max-width: 768px) {
  .topbar { padding: 0 14px; }
  .shell { padding: 20px 14px 60px; }
  .card { padding: 16px; }
  .stat .value { font-size: 23px; }
}
