/* Colors are tokens; dark values are declared for the OS setting and for an explicit data-theme. */
:root {
  color-scheme: light;
  --page: #f9f9f7;  --surface: #fcfcfb;
  --ink: #0b0b0b;  --ink-2: #52514e;  --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7;    --border: rgba(11, 11, 11, .10);
  --cur: #2a78d6;  --ref: #eb6834;     /* categorical slots 1 and 2 of the validated palette */
  --good: #0ca30c; --bad: #d03b3b;     --warn: #fab219;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;  --surface: #1a1a19;
    --ink: #ffffff;   --ink-2: #c3c2b7;
    --grid: #2c2c2a;  --axis: #383835;  --border: rgba(255, 255, 255, .10);
    --cur: #3987e5;   --ref: #d95926;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;  --surface: #1a1a19;
  --ink: #ffffff;   --ink-2: #c3c2b7;
  --grid: #2c2c2a;  --axis: #383835;  --border: rgba(255, 255, 255, .10);
  --cur: #3987e5;   --ref: #d95926;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink);
       font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: inherit; }
header { display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
         padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.brand { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; font-size: 16px; text-decoration: none; }
.brand img { display: block; }
.about { margin-left: auto; font-size: 13px; }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
h2 { font-size: 15px; margin: 28px 0 8px; }
.muted { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 12px 0; }
.stats .card { padding: 10px 12px; }
.stats .label { color: var(--ink-2); font-size: 12px; }
.stats .value { font-size: 18px; font-weight: 600; }

table { border-collapse: collapse; width: 100%; }
th, td { padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--ink-2); font-weight: 500; font-size: 12px; }
td.wrap { white-space: normal; }
td.branch { overflow-wrap: anywhere; min-width: 14em; }
tbody tr:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.scroll { overflow-x: auto; }

/* Status is always icon + word, never color alone. */
.badge { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; }
.badge::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.badge.passed::before { background: var(--good); }
.badge.failed::before, .badge.crashed::before { background: var(--bad); }
.badge.broken::before { background: var(--warn); }
.icon { font-weight: 700; }

/* Latest run of one architecture in the branch list: dot + icon + short architecture name. */
.chips { display: flex; gap: 6px; }                   /* one line; long branch names wrap instead */
.chip { display: inline-flex; gap: 4px; align-items: center; padding: 1px 8px 1px 6px; border: 1px solid var(--border);
        border-radius: 999px; font-size: 12px; text-decoration: none; white-space: nowrap; }
.chip:hover { border-color: var(--axis); }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.chip.passed::before { background: var(--good); }
.chip.failed::before, .chip.crashed::before { background: var(--bad); }
.chip.broken::before { background: var(--warn); }

.filters { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 8px 0 12px; }

.section-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 28px 0 8px; }
.section-head h2, .section-head .filters { margin: 0; }
h2.branch-title { font-size: 18px; overflow-wrap: anywhere; }
.small { font-size: 12px; }

.archcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
/* The architecture link covers the whole card (it opens the run); commit and time sit above it. */
.archcard { position: relative; padding: 10px 12px; }
.archcard:hover { border-color: var(--axis); }
.archcard .arch { display: block; font-weight: 600; margin-bottom: 4px; text-decoration: none; }
.archcard .arch::after { content: ""; position: absolute; inset: 0; }
.archcard .commit, .archcard time { position: relative; z-index: 1; }
.archcard dl { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; margin: 8px 0; font-size: 13px; }
.archcard dt { color: var(--ink-2); }
.archcard dd { margin: 0; font-weight: 600; }
.archcard.stale { opacity: .55; }

.pager { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 12px 0; }
.pager nav { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; }
.pager nav > * { padding: 3px 9px; border-radius: 6px; }
.pager nav a:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.pager .current { font-weight: 700; border: 1px solid var(--axis); }
.pager .gap { color: var(--muted); }
input[type=search], select { background: var(--surface); color: var(--ink); border: 1px solid var(--axis);
                             border-radius: 6px; padding: 5px 8px; font: inherit; }

details.sim { margin-bottom: 8px; }
details.sim > summary { display: flex; gap: 14px; align-items: baseline; padding: 9px 12px; cursor: pointer; list-style: none; }
details.sim > summary::-webkit-details-marker { display: none; }
details.sim > summary::before { content: "\25B8"; color: var(--muted); }
details.sim[open] > summary::before { content: "\25BE"; }
.sim .name { font-weight: 600; min-width: 14em; }
.sim .desc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sim .body { padding: 0 12px 12px; }
/* Beam tabs of a multi-beam test: the selected tab is bold and joins the panel below it. */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; border-bottom: 1px solid var(--axis); }
.tab { display: inline-flex; gap: 6px; align-items: center; margin-bottom: -1px; padding: 6px 12px; white-space: nowrap;
       font: inherit; font-size: 13px; color: var(--ink-2); background: none; cursor: pointer;
       border: 1px solid transparent; border-radius: 6px 6px 0 0; }
.tab:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 4%, transparent); }
.tab[aria-selected="true"] { color: var(--ink); font-weight: 600; background: var(--surface);
                             border-color: var(--axis) var(--axis) var(--surface); }
.tab:focus-visible { outline: 2px solid var(--cur); outline-offset: -2px; }
.tab.passed .icon { color: var(--good); }
.tab.failed .icon, .tab.crashed .icon { color: var(--bad); }
.tab.broken .icon { color: var(--warn); }
.panel { padding-top: 4px; }

pre.log { background: var(--page); border: 1px solid var(--border); border-radius: 6px; padding: 8px; overflow-x: auto; max-height: 260px; }

.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 12px; margin-top: 12px; }
.chart { border: 1px solid var(--border); border-radius: 6px; padding: 8px 8px 4px; min-width: 0; }
.chart h4 { margin: 0 0 4px; font-size: 13px; display: flex; justify-content: space-between; gap: 8px; }
.chart .hint { color: var(--muted); font-size: 11px; margin: 2px 0 0; }

/* uPlot legend doubles as the hover readout: values lead, names follow. */
.u-legend { font-size: 11px; color: var(--ink-2); text-align: left; }
.u-legend .u-series { padding: 1px 6px; }
.u-legend .u-value { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }
.u-legend .u-label { font-weight: 400; }
.chart .lower .u-legend .u-series:first-child { display: none; }  /* x readout is already in the upper panel */
th.num { text-align: right; }
.u-select { background: color-mix(in srgb, var(--ink) 12%, transparent); }

@media (max-width: 560px) {
  .charts { grid-template-columns: 1fr; }
  .sim .desc { display: none; }
  .sim .name { min-width: 0; }
}
