/* Results dashboard. Same tokens as the matplotlib figures and the other
   Wrlog dashboards; the dark values apply with prefers-color-scheme or the
   theme button. */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --sunken: #f2f1ed;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-bg: #eef4fc;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --sunken: #232322;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #95948b;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --accent-bg: #1f2a38;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --sunken: #232322;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #95948b;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5;
  --accent-bg: #1f2a38;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 12px; }
body {
  background: var(--page);
  color: var(--text-primary);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); }
code { font-size: 0.9em; background: var(--sunken); padding: 1px 5px; border-radius: 4px; }

.site-header { border-bottom: 1px solid var(--border); background: var(--surface); padding-top: 24px; }
.topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.eyebrow { margin: 0; color: var(--text-muted); font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; }
h1 { margin: 6px 0 8px; font-size: clamp(22px, 3.2vw, 32px); line-height: 1.2; text-wrap: balance; }
.lede { margin: 0 0 10px; max-width: 780px; color: var(--text-secondary); }
.sim-note { margin: 0 0 16px; max-width: 780px; color: var(--text-secondary); font-size: 13.5px;
  border-left: 3px solid var(--accent); padding: 6px 10px; background: var(--sunken); border-radius: 0 6px 6px 0; }
.theme-btn {
  font: inherit; font-size: 13px; color: var(--text-secondary); background: var(--surface);
  border: 1px solid var(--axis); border-radius: 8px; padding: 4px 10px; cursor: pointer; white-space: nowrap;
}
.theme-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  color: var(--text-secondary); text-decoration: none; font-weight: 600; padding: 10px 12px;
  white-space: nowrap; border-bottom: 2px solid transparent;
}
.tabs a:hover { color: var(--text-primary); border-bottom-color: var(--axis); }
.tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 4px; }

main { padding-top: 24px; padding-bottom: 24px; display: grid; gap: 16px; }
.panel { display: grid; gap: 16px; min-width: 0; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 18px 12px; min-width: 0;
}
.card h2 { margin: 0; font-size: 16px; }
.card h3 { margin: 0 0 4px; font-size: 14px; }
.card .sub { margin: 2px 0 8px; color: var(--text-secondary); font-size: 13.5px; max-width: 900px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 20px; flex-wrap: wrap; }
.card-head > div:first-child { flex: 1 1 420px; min-width: 0; }
.card-foot { color: var(--text-muted); font-size: 13px; margin: 6px 0 4px; }
.controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.control { display: grid; gap: 4px; font-size: 12.5px; color: var(--text-secondary); font-weight: 600; }
select {
  font: inherit; font-size: 14px; color: var(--text-primary); background: var(--surface);
  border: 1px solid var(--axis); border-radius: 8px; padding: 6px 10px; min-width: 170px; max-width: 100%;
}
select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.png { font-size: 13px; }
.table-title { margin-top: 14px !important; color: var(--text-secondary); font-weight: 600; }

.fig { margin: 8px 0 6px; }
.plot { width: 100%; min-height: 240px; }
.fig img { display: block; width: 100%; height: auto; border-radius: 6px; }
.has-plotly .fallback { display: none; }
html:not(.has-plotly) .plot { display: none; }
.plot .modebar { background: none !important; }
.plot .modebar-btn path { fill: var(--text-muted) !important; }
.plot .modebar-btn:hover path { fill: var(--text-primary) !important; }
.note { color: var(--text-muted); font-size: 13px; }

.tiles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; }
.tile .label { color: var(--text-secondary); font-size: 13px; }
.tile .value { font-size: 30px; font-weight: 650; line-height: 1.2; margin-top: 2px; }
.tile .detail { color: var(--text-muted); font-size: 12.5px; }

.mdp { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 8px 0 4px; }
.mdp > div { background: var(--sunken); border-radius: 8px; padding: 12px 14px; }
.mdp p { margin: 0; color: var(--text-secondary); font-size: 13.5px; }
@media (max-width: 900px) { .mdp { grid-template-columns: minmax(0, 1fr); } }

.regimens { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 4px; }
.regimens li { color: var(--text-secondary); font-size: 13px; }
.swatch { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 8px; vertical-align: middle; }

.table-wrap { overflow-x: auto; margin: 6px 0; }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; text-align: right; border-bottom: 1px solid var(--grid); white-space: nowrap; }
thead th { color: var(--text-secondary); font-weight: 600; background: var(--surface); }
tbody th { text-align: left; font-weight: 600; color: var(--text-primary); }
thead th:first-child { text-align: left; }
tbody tr:hover td, tbody tr:hover th { background: var(--accent-bg); }
table.sortable thead th { cursor: pointer; user-select: none; }
table.sortable thead th:hover { color: var(--text-primary); }
table.sortable thead th[aria-sort="ascending"]::after { content: " \2191"; }
table.sortable thead th[aria-sort="descending"]::after { content: " \2193"; }
table.sortable thead th:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.footer { color: var(--text-muted); font-size: 13px; padding-bottom: 32px; }
.footer p { margin: 4px 0; }

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .card { padding: 14px 12px 10px; }
  select { min-width: 0; width: 100%; }
  .controls, .control { width: 100%; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 12px 12px; }
  .tile .value { font-size: 24px; }
  tbody th { white-space: normal; min-width: 150px; }
}
