/* Seventeen Bots dashboard. System fonts only; no third-party assets. */
/* Text tokens (--ink-2, --muted, --critical, --link) meet WCAG AA 4.5:1 on
   --surface, --page and the Failed row in both modes (test/contrast.test.mjs). */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6b6a65;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --good: #006300;
  --critical: #b42318;
  --critical-bg: rgba(208, 59, 59, 0.10);
  --link: #1f5fb4;
  --banner-bg: #fff4d6;
  /* Categorical slots 1-4 for the chart only; links use --link. */
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #13855c;
  --series-4: #9a6500;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --good: #0ca30c;
    --critical: #ff7b7b;
    --critical-bg: rgba(208, 59, 59, 0.22);
    --link: #7fb0f0;
    --banner-bg: #3a2f10;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0 auto;
  max-width: 1100px;
  padding: 1rem;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem; }
h1 { font-size: 1.4rem; margin: .25rem 0 0; }
.tagline { margin: 0 0 .25rem; color: var(--ink-2); font-size: .95rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .4rem; color: var(--ink-2); }
a { color: var(--link); }
nav a, summary { display: inline-block; min-height: 44px; padding: 10px 6px; line-height: 24px; }
summary { display: list-item; cursor: pointer; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.banner { background: var(--banner-bg); border: 1px solid var(--border); border-radius: 6px; padding: .5rem .75rem; }

.answer { font-size: 1.15rem; font-weight: 600; margin: .75rem 0; }
.sticky-summary { display: none; }
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin: 1rem 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .75rem; }
.tile-label { color: var(--ink-2); font-size: .85rem; }
.tile-value { font-size: 1.5rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile-value.hours { font-size: 1.1rem; display: flex; flex-direction: column; }
.tile-note { color: var(--muted); font-size: .8rem; }
/* RD-2: the owner-stated label, on the page background right under the strip. */
.strip-note { color: var(--ink-2); font-size: .85rem; margin: -.25rem 0 1rem; }
.pos { color: var(--good); }
.neg { color: var(--critical); }
.date { white-space: nowrap; }

.scroll { overflow-x: auto; }
.scroll:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.scroll-cue { display: none; }
table { border-collapse: collapse; width: 100%; background: var(--surface); }
caption { text-align: left; font-weight: 600; padding: .3rem 0; }
th, td { text-align: left; vertical-align: top; padding: .45rem .6rem; border-bottom: 1px solid var(--grid); }
th { color: var(--ink-2); font-weight: 600; font-size: .85rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.idea, .muted, .fineprint { color: var(--ink-2); font-size: .85rem; }
.fineprint { margin-top: .4rem; }

.status { font-weight: 600; white-space: nowrap; }
tr.status-row-failed { background: var(--critical-bg); }
tr.status-row-failed td { border-bottom-color: var(--critical); }
.status-failed { color: var(--critical); }

.same-line { white-space: nowrap; }
.disclosure { color: var(--ink-2); }

.chart { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .75rem; }
.chart figcaption { font-weight: 600; }
.chart svg { width: 100%; height: auto; display: block; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 1rem; padding: 0; margin: .4rem 0; font-size: .85rem; color: var(--ink-2); }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.swatch.series-1 { background: var(--series-1); }
.swatch.series-2 { background: var(--series-2); }
.swatch.series-3 { background: var(--series-3); }
.swatch.series-4 { background: var(--series-4); }
svg .grid { stroke: var(--grid); stroke-width: 1; }
svg .axis { stroke: var(--axis); stroke-width: 1; }
svg .tick { fill: var(--muted); font-size: 11px; }
svg .direct-label { fill: var(--ink-2); font-size: 12px; }
svg.compact .tick { font-size: 12px; }
svg.compact .direct-label { font-size: 13px; }
svg polyline { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg .dot { stroke: var(--surface); stroke-width: 2; }
svg .series-1 polyline { stroke: var(--series-1); } svg .series-1 .dot { fill: var(--series-1); }
svg .series-2 polyline { stroke: var(--series-2); } svg .series-2 .dot { fill: var(--series-2); }
svg .series-3 polyline { stroke: var(--series-3); } svg .series-3 .dot { fill: var(--series-3); }
svg .series-4 polyline { stroke: var(--series-4); } svg .series-4 .dot { fill: var(--series-4); }
svg .dot:hover { r: 6; }
details { margin-top: .5rem; font-size: .9rem; }

footer { margin: 2rem 0 1rem; color: var(--muted); font-size: .8rem; }

@media (max-width: 640px) {
  .same-line { white-space: normal; }
  .scroll-cue { display: block; margin: .25rem 0 0; color: var(--ink-2); font-size: .85rem; }

  /* PX-15: compact sticky summary, Net and hours only. */
  .sticky-summary {
    display: block; position: sticky; top: 0; z-index: 1;
    margin: 0 -1rem; padding: .4rem 1rem;
    background: var(--page); border-bottom: 1px solid var(--border);
    font-weight: 600; font-variant-numeric: tabular-nums;
  }

  /* PX-6: two-column top strip; PX-R1: dense flow so no tile sits beside an empty cell. */
  .strip { grid-template-columns: 1fr 1fr; grid-auto-flow: row dense; gap: .5rem; }
  .tile { padding: .5rem .6rem; }
  .tile-value { font-size: 1.25rem; }
  .tile:nth-of-type(4) { grid-column: span 2; } /* the hours tile (the strip's h2 comes first) */

  /* PX-4: experiments rows as cards. */
  [data-section="experiments"] thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  [data-section="experiments"] table, [data-section="experiments"] tbody,
  [data-section="experiments"] tr, [data-section="experiments"] td { display: block; width: 100%; }
  [data-section="experiments"] tr { border-bottom: 1px solid var(--grid); padding: .4rem 0; }
  [data-section="experiments"] td { border: 0; padding: .15rem .6rem; text-align: left; }
  [data-section="experiments"] td[data-label]::before { content: attr(data-label) ": "; font-weight: 600; color: var(--ink-2); font-size: .85rem; }
  [data-section="experiments"] tr.status-row-failed { border-left: 4px solid var(--critical); }
  /* PX-R3: 44 px tap targets for episode links in the cards. */
  [data-section="experiments"] td[data-label="Episode"] a { display: inline-block; min-height: 44px; padding: 10px 0; line-height: 24px; }
}
