/*
 * The starter's styles. Tokens only (css/tokens.css): no colour, size or font literals here.
 * Hooks: classes are for styling; behaviour uses data-ref-* (site.js) and data-x402-* (the engine client).
 * States: [data-x402-state] on the article, [data-ref-status] on every status badge, [data-x402-policy] on the policy.
 *
 * The rule: colour means HTTP status. Everything else is ink on warm near-neutrals.
 */
:root { color-scheme: light dark; }
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--ref-font);
  font-size: var(--ref-text-base);
  line-height: var(--ref-leading);
  color: var(--ref-ink);
  background: var(--ref-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: var(--ref-hairline);
  text-decoration-color: var(--ref-line-strong);
  text-underline-offset: var(--ref-underline-offset);
  transition: text-decoration-color var(--ref-transition), color var(--ref-transition);
}
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: var(--ref-rule) solid var(--ref-focus); outline-offset: var(--ref-rule); }

code, pre { font-family: var(--ref-font-mono); }
code { font-size: var(--ref-text-code-inline); }
output { font: inherit; font-variant-numeric: tabular-nums; }
pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
[hidden] { display: none !important; }

/* Inline code inside running text: a quiet chip, so a path reads as a path without shouting. */
p > code, caption > code {
  padding: var(--ref-chip-pad-y) var(--ref-chip-pad-x);
  border: var(--ref-hairline) solid var(--ref-line);
  border-radius: var(--ref-radius-sm);
  background: var(--ref-sunken);
  color: var(--ref-ink-2);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ── Header and banner ─────────────────────────────────────────────────── */
.site-header {
  background: var(--ref-surface);
  border-bottom: var(--ref-hairline) solid var(--ref-line);
}
.banner {
  margin: 0;
  padding: var(--ref-space-1) var(--ref-space-4);
  border-bottom: var(--ref-hairline) solid var(--ref-line);
  background: var(--ref-sunken);
  color: var(--ref-muted);
  font-size: var(--ref-text-xs);
  letter-spacing: var(--ref-tracking-wide);
  text-align: center;
}
.banner::before {
  content: "";
  display: inline-block;
  width: var(--ref-dot-sm);
  height: var(--ref-dot-sm);
  margin-right: var(--ref-space-2);
  border-radius: 50%;
  background: var(--ref-402-dot);
  vertical-align: var(--ref-dot-nudge);
}
/* The environment's dot (site.js sets data-ref-env from the page's own address): green for Local, blue for Azure dev; an
   unknown place keeps the amber above. */
.banner[data-ref-env="local"]::before { background: var(--ref-200-dot); }
.banner[data-ref-env="azure-dev"]::before { background: var(--ref-401-dot); }
.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ref-space-2) var(--ref-space-5);
  max-width: var(--ref-measure);
  margin: 0 auto;
  padding: var(--ref-space-3) var(--ref-space-5);
  font-size: var(--ref-text-sm);
}
.site-nav a { color: var(--ref-ink-2); text-decoration: none; font-weight: var(--ref-weight-medium); }
.site-nav a:hover { color: var(--ref-ink); }
.site-nav a:first-child { color: var(--ref-ink); font-weight: var(--ref-weight-semibold); }

/* Who you are, from the server: "Signed in as Member · Switch", pushed to the right of the nav. */
.nav-account { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: var(--ref-space-2); margin-left: auto; }
.nav-session { color: var(--ref-muted); }
.nav-session::after { content: "·" / ""; margin-left: var(--ref-space-2); }
.site-nav .nav-account a { color: var(--ref-ink); text-decoration: underline; text-decoration-color: var(--ref-line-strong); }
.site-nav .nav-account a:hover { text-decoration-color: currentColor; }

/* The demo's mock-wallet switch: a quiet pill, never the loudest thing on the page. */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--ref-space-2);
  padding: var(--ref-space-1) var(--ref-space-3);
  border: var(--ref-hairline) solid var(--ref-line-strong);
  border-radius: var(--ref-radius-pill);
  background: var(--ref-surface);
  color: var(--ref-ink-2);
  font: inherit;
  font-size: var(--ref-text-xs);
  cursor: pointer;
  transition: border-color var(--ref-transition), color var(--ref-transition);
}
.toggle::before {
  content: "";
  width: var(--ref-dot-sm);
  height: var(--ref-dot-sm);
  border: var(--ref-hairline) solid var(--ref-muted);
  border-radius: 50%;
}
.toggle[aria-pressed="true"]::before { background: var(--ref-ink); border-color: var(--ref-ink); }
.toggle:hover { border-color: var(--ref-muted); color: var(--ref-ink); }

/* ── Layout ─────────────────────────────────────────────────────────────── */
main {
  max-width: var(--ref-measure);
  margin: 0 auto;
  padding: var(--ref-space-7) var(--ref-space-5) var(--ref-space-8);
}
h1 {
  margin: 0 0 var(--ref-space-3);
  font-family: var(--ref-font-display);
  font-size: var(--ref-text-xl);
  font-weight: var(--ref-weight-bold);
  letter-spacing: var(--ref-tracking-tight);
  line-height: var(--ref-leading-tight);
}
h2 {
  margin: 0;
  font-size: var(--ref-text-md);
  font-weight: var(--ref-weight-semibold);
  line-height: var(--ref-leading-tight);
}
.lede { margin: 0; max-width: var(--ref-measure-reading); color: var(--ref-ink-2); font-size: var(--ref-text-md); }
.page-head { margin-bottom: var(--ref-space-6); }

.panel {
  margin: var(--ref-space-5) 0 0;
  padding: var(--ref-space-5) var(--ref-space-6) var(--ref-space-6);
  background: var(--ref-surface);
  border: var(--ref-hairline) solid var(--ref-line);
  border-radius: var(--ref-radius-lg);
  box-shadow: var(--ref-shadow);
}
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ref-space-2) var(--ref-space-4);
  min-height: var(--ref-panel-head);
  margin-bottom: var(--ref-space-1);
}
/* The panels are a sequence (configured, what an agent gets, what you get, under the hood): a quiet step number. */
.article-page { counter-reset: step; }
.panel-head h2 { counter-increment: step; }
.panel-head h2::before {
  content: counter(step, decimal-leading-zero) / "";
  margin-right: var(--ref-space-3);
  color: var(--ref-muted);
  font-family: var(--ref-font-mono);
  font-size: var(--ref-text-code);
  font-weight: var(--ref-weight-regular);
}
.panel-source { margin: 0 0 var(--ref-space-5); max-width: var(--ref-measure-reading); color: var(--ref-muted); font-size: var(--ref-text-sm); }
.panel-note {
  padding: var(--ref-space-5) var(--ref-space-6);
  background: var(--ref-404-bg);
  border-color: var(--ref-404-line);
  box-shadow: none;
  color: var(--ref-ink-2);
}
.panel-note p { margin: 0; max-width: var(--ref-measure-reading); }

/* ── The status badge: one component wherever a status appears ─────────── */
.status {
  --status-fg: var(--ref-pending-fg);
  --status-bg: var(--ref-pending-bg);
  --status-line: var(--ref-pending-line);
  --status-dot: var(--ref-pending-dot);
  display: inline-flex;
  align-items: center;
  gap: var(--ref-space-2);
  padding: var(--ref-space-1) var(--ref-space-3) var(--ref-space-1) var(--ref-space-2);
  border-radius: var(--ref-radius-pill);
  background: var(--status-bg);
  box-shadow: inset 0 0 0 var(--ref-hairline) var(--status-line);
  color: var(--status-fg);
  font-size: var(--ref-text-sm);
  line-height: var(--ref-leading-snug);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  vertical-align: middle;
}
.status::before {
  content: "";
  flex: none;
  width: var(--ref-dot);
  height: var(--ref-dot);
  margin-left: var(--ref-space-1);
  border-radius: 50%;
  background: var(--status-dot);
}
.status-code { font-weight: var(--ref-weight-bold); letter-spacing: var(--ref-tracking-code); }
.status-code:empty { display: none; }
.status-reason { font-weight: var(--ref-weight-regular); }
.status:not([data-ref-status])::before { animation: ref-pulse 1.4s ease-in-out infinite; }
.status-lg { font-size: var(--ref-text-base); padding-right: var(--ref-space-4); }
.status:empty { display: none; }

/*
 * Pills that share a column or a row are one width: the widest status, "402 Payment Required" (--ref-pill-width, in
 * em so it follows each pill's own size). The code keeps its slot even while empty, so every number starts at the
 * same place and every reason starts at the same place. In a table column the pill fills the cell, and the column is
 * as wide as its widest pill, so nothing depends on the token being exact.
 */
.routes .status, .outcomes .status, .panel-head .status { min-width: var(--ref-pill-width); }
.routes .status { display: flex; width: 100%; }
.routes .status-code, .outcomes .status-code, .panel-head .status-code { min-width: var(--ref-pill-code); }
.routes .status-code:empty, .outcomes .status-code:empty, .panel-head .status-code:empty { display: inline-block; }

.status[data-ref-status^="3"],
.status[data-ref-status^="4"] { --status-fg: var(--ref-404-fg); --status-bg: var(--ref-404-bg); --status-line: var(--ref-404-line); --status-dot: var(--ref-404-dot); }
.status[data-ref-status^="2"] { --status-fg: var(--ref-200-fg); --status-bg: var(--ref-200-bg); --status-line: var(--ref-200-line); --status-dot: var(--ref-200-dot); }
.status[data-ref-status="402"] { --status-fg: var(--ref-402-fg); --status-bg: var(--ref-402-bg); --status-line: var(--ref-402-line); --status-dot: var(--ref-402-dot); }
.status[data-ref-status="401"] { --status-fg: var(--ref-401-fg); --status-bg: var(--ref-401-bg); --status-line: var(--ref-401-line); --status-dot: var(--ref-401-dot); }
.status[data-ref-status="403"] { --status-fg: var(--ref-403-fg); --status-bg: var(--ref-403-bg); --status-line: var(--ref-403-line); --status-dot: var(--ref-403-dot); }
.status[data-ref-status^="5"],
.status[data-ref-status="0"],
.status[data-ref-status="error"] { --status-fg: var(--ref-5xx-fg); --status-bg: var(--ref-5xx-bg); --status-line: var(--ref-5xx-line); --status-dot: var(--ref-5xx-dot); }

@keyframes ref-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .status:not([data-ref-status])::before { animation: none; } }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.button {
  padding: var(--ref-space-2) var(--ref-space-4);
  border: var(--ref-hairline) solid var(--ref-ink);
  border-radius: var(--ref-radius);
  background: var(--ref-ink);
  color: var(--ref-on-ink);
  font: inherit;
  font-weight: var(--ref-weight-medium);
  cursor: pointer;
}
.button-quiet { border-color: var(--ref-line-strong); background: var(--ref-surface); color: var(--ref-ink); }
.button-quiet:hover { border-color: var(--ref-muted); }

/* ── Article page: header ───────────────────────────────────────────────── */
.article-head { margin-bottom: var(--ref-space-6); }
.eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ref-space-2) var(--ref-space-3);
  margin: 0 0 var(--ref-space-3);
  color: var(--ref-muted);
  font-size: var(--ref-text-sm);
}
.eyebrow code { color: var(--ref-ink-2); }
/* The policy is configuration, not an outcome: it stays neutral, so colour keeps meaning status. */
.policy-badge {
  padding: var(--ref-space-0) var(--ref-space-2);
  border: var(--ref-hairline) solid var(--ref-line-strong);
  border-radius: var(--ref-radius-sm);
  background: var(--ref-surface);
  color: var(--ref-ink-2);
  font-family: var(--ref-font-mono);
  font-size: var(--ref-text-code-sm);
  font-weight: var(--ref-weight-medium);
}
.policy-badge:empty { display: none; }

.outcomes { display: flex; flex-wrap: wrap; gap: var(--ref-space-3) var(--ref-space-6); margin: var(--ref-space-5) 0 0; }
.outcomes > div { display: flex; align-items: center; gap: var(--ref-space-3); }
.outcomes dt { font-size: var(--ref-text-sm); }
.outcomes dd { margin: 0; }

/* ── Article page: label/value lists ───────────────────────────────────── */
.config, .agent-headers, .quote-fields { margin: 0; font-size: var(--ref-text-sm); }
.config > div, .quote-fields > div {
  display: grid;
  grid-template-columns: minmax(0, var(--ref-label-col)) minmax(0, 1fr);
  gap: var(--ref-space-4);
  align-items: baseline;
  padding: var(--ref-space-2) 0;
}
.config > div + div, .quote-fields > div + div { border-top: var(--ref-hairline) solid var(--ref-line); }
.quote-fields > div { grid-template-columns: minmax(0, var(--ref-label-col-code)) minmax(0, 1fr); }
/* A long unbroken label (accepts[0].maxTimeoutSeconds) wraps inside its column instead of running into the value. */
dt { color: var(--ref-muted); min-width: 0; overflow-wrap: anywhere; }
dd { margin: 0; overflow-wrap: anywhere; }
dd code, .quote-fields dt { font-size: var(--ref-text-code); }
dd code { color: var(--ref-ink-2); }
.quote-fields dt { font-family: var(--ref-font-mono); }
.aside { margin-left: var(--ref-space-2); color: var(--ref-muted); }

/* Headers and bodies are blocks of code: label above, value full width. */
.agent-headers > div + div { margin-top: var(--ref-space-4); }
.agent-headers dt { margin-bottom: var(--ref-space-2); color: var(--ref-ink-2); font-weight: var(--ref-weight-medium); }

/* ── Code ───────────────────────────────────────────────────────────────── */
.code, .command-text {
  display: block;
  padding: var(--ref-space-3) var(--ref-space-4);
  border: var(--ref-hairline) solid var(--ref-line);
  border-radius: var(--ref-radius);
  background: var(--ref-sunken);
  color: var(--ref-ink-2);
  font-size: var(--ref-text-code);
  line-height: var(--ref-leading-code);
  tab-size: 2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.code-capped { max-height: var(--ref-code-max); overflow: auto; overscroll-behavior: contain; }
/* Pretty-printed JSON keeps its shape: on a narrow screen it scrolls sideways inside the block, never the page. */
.code-pretty { white-space: pre; overflow-wrap: normal; overflow-x: auto; }

.raw { margin-top: var(--ref-space-4); }
.raw summary, .disclosure summary {
  display: inline-flex;
  align-items: center;
  gap: var(--ref-space-2);
  color: var(--ref-ink-2);
  font-size: var(--ref-text-sm);
  font-weight: var(--ref-weight-medium);
  list-style: none;
  cursor: pointer;
}
.raw summary::-webkit-details-marker, .disclosure summary::-webkit-details-marker { display: none; }
.raw summary::before, .disclosure summary::before {
  content: "";
  width: var(--ref-chevron);
  height: var(--ref-chevron);
  border-right: var(--ref-stroke) solid currentColor;
  border-bottom: var(--ref-stroke) solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--ref-transition);
}
.raw[open] summary::before, .disclosure[open] summary::before { transform: rotate(45deg); }
.raw .code { margin-top: var(--ref-space-3); }

.command { margin-top: var(--ref-space-5); }
.command-label { margin: 0 0 var(--ref-space-2); color: var(--ref-ink-2); font-size: var(--ref-text-sm); font-weight: var(--ref-weight-medium); }
.command-text { color: var(--ref-ink); }
.command-text::before { content: "$ " / ""; color: var(--ref-muted); }

/* ── Article page: what you get (the engine's browser client) ───────────── */
.article-body .x402-message:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ref-space-3) var(--ref-space-5);
  padding: var(--ref-space-4) var(--ref-space-5);
  border: var(--ref-hairline) solid var(--ref-line);
  border-radius: var(--ref-radius);
  background: var(--ref-sunken);
}
.article-body .x402-message-text { margin: 0; }
.article-body[data-x402-state="loading"] .x402-message:not([hidden]) { padding: 0; border-color: transparent; background: none; color: var(--ref-muted); }
.article-body[data-x402-state="payment-required"] .x402-message { border-color: var(--ref-402-line); background: var(--ref-402-bg); }
.article-body[data-x402-state="sign-in-required"] .x402-message { border-color: var(--ref-401-line); background: var(--ref-401-bg); }
.article-body[data-x402-state="forbidden"] .x402-message { border-color: var(--ref-403-line); background: var(--ref-403-bg); }
.article-body[data-x402-state="not-found"] .x402-message { border-color: var(--ref-404-line); background: var(--ref-404-bg); }
.article-body[data-x402-state="error"] .x402-message,
.article-body[data-x402-state="unavailable"] .x402-message { border-color: var(--ref-5xx-line); background: var(--ref-5xx-bg); color: var(--ref-ink); }

/* Pay and Sign in are siblings: the same action, in the 402 gold and the 401 blue. */
.article-body .x402-pay-btn,
.article-body .x402-sign-in-link {
  display: inline-flex;
  align-items: center;
  padding: var(--ref-space-2) var(--ref-space-5);
  border: 0;
  border-radius: var(--ref-radius);
  font: inherit;
  font-size: var(--ref-text-sm);
  font-weight: var(--ref-weight-semibold);
  text-decoration: none;
  cursor: pointer;
}
.article-body .x402-pay-btn { background: var(--ref-402-solid); box-shadow: inset 0 0 0 var(--ref-hairline) var(--ref-402-edge); color: var(--ref-on-402); }
.article-body .x402-sign-in-link { background: var(--ref-401-solid); box-shadow: inset 0 0 0 var(--ref-hairline) var(--ref-401-edge); color: var(--ref-on-401); }
.article-body .x402-pay-btn:hover, .article-body .x402-sign-in-link:hover { filter: brightness(1.05); }

/* The content itself reads as a publication: a reading serif at a comfortable measure. */
.article-body .x402-content {
  max-width: var(--ref-measure-reading);
  font-family: var(--ref-font-reading);
  font-size: var(--ref-text-reading);
  line-height: var(--ref-leading-reading);
}
.article-body .x402-content:not(:empty) { margin-top: var(--ref-space-2); }
.x402-content h1, .x402-content h2, .x402-content h3 {
  font-family: var(--ref-font-reading);
  font-weight: var(--ref-weight-semibold);
  letter-spacing: normal;
  line-height: var(--ref-leading-tight);
}
.x402-content h1 { margin: 0 0 var(--ref-space-4); font-size: var(--ref-text-lg); }
.x402-content h2 { margin: var(--ref-space-6) 0 var(--ref-space-3); font-size: var(--ref-text-reading); }
.x402-content h3 { margin: var(--ref-space-5) 0 var(--ref-space-2); font-size: var(--ref-text-base); }
.x402-content p { margin: 0 0 var(--ref-space-4); }
.x402-content blockquote {
  margin: var(--ref-space-5) 0;
  padding-left: var(--ref-space-5);
  border-left: var(--ref-rule) solid var(--ref-line-strong);
  color: var(--ref-ink-2);
  font-style: italic;
}

/* ── Index ──────────────────────────────────────────────────────────────── */
.page-index { --ref-measure: var(--ref-measure-wide); }
.table-card {
  overflow: hidden;
  background: var(--ref-surface);
  border: var(--ref-hairline) solid var(--ref-line);
  border-radius: var(--ref-radius-lg);
  box-shadow: var(--ref-shadow);
}
.routes { width: 100%; border-collapse: collapse; }
.routes caption {
  padding: var(--ref-space-4) var(--ref-space-5);
  border-bottom: var(--ref-hairline) solid var(--ref-line);
  color: var(--ref-muted);
  font-size: var(--ref-text-sm);
  text-align: left;
}
.routes th {
  padding: var(--ref-space-2) var(--ref-space-4);
  border-bottom: var(--ref-hairline) solid var(--ref-line);
  background: var(--ref-sunken);
  color: var(--ref-muted);
  font-size: var(--ref-text-xs);
  font-weight: var(--ref-weight-semibold);
  letter-spacing: var(--ref-tracking-caps);
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.routes td {
  padding: var(--ref-space-4);
  border-bottom: var(--ref-hairline) solid var(--ref-line);
  vertical-align: baseline;
}
.routes tbody tr:last-child td { border-bottom: 0; }
.routes th:first-child, .routes td:first-child { padding-left: var(--ref-space-5); }
.routes th:last-child, .routes td:last-child { padding-right: var(--ref-space-5); }
.routes .col-status { width: var(--ref-shrink); }
/* Anonymous and You sit side by side, closer to each other than to the article, so the difference reads at a glance. */
.routes .col-anon, .routes .cell-anon { padding-right: var(--ref-space-2); }
.routes .col-you, .routes .cell-you { padding-left: var(--ref-space-2); padding-right: var(--ref-space-5); }
/* Your agent (personas phase A, read-only): the third status column, beside You, the same pill at the same width. */
.routes .col-agent, .routes .cell-agent { padding-left: var(--ref-space-2); padding-right: var(--ref-space-5); }
.routes .col-agent:not([hidden]) ~ .col-article, .routes .cell-agent + .cell-article { padding-left: var(--ref-space-2); }
.routes .cell-agent .cell-sub { margin-top: var(--ref-space-1); }
.routes .cell-label { display: none; }
.routes .col-price, .routes .cell-price { text-align: right; }
.routes tbody tr { position: relative; transition: background-color var(--ref-transition); }
.routes tbody tr:hover { background: var(--ref-hover); }
.routes .routes-loading { color: var(--ref-muted); }

.cell-sub { display: block; margin-top: var(--ref-space-0); color: var(--ref-muted); font-size: var(--ref-text-xs); }
code.cell-sub { font-size: var(--ref-text-code-sm); }
.cell-price, .cell-policy { font-size: var(--ref-text-sm); white-space: nowrap; }
.cell-price { font-variant-numeric: tabular-nums; }
.cell-empty { color: var(--ref-muted); }
.route-link { color: var(--ref-ink); font-weight: var(--ref-weight-semibold); text-decoration: none; }
.route-link:hover { text-decoration: underline; text-decoration-color: var(--ref-line-strong); }
/* The whole row opens the article. */
.route-link::after { content: ""; position: absolute; inset: 0; }


.page-notes {
  max-width: var(--ref-measure-reading);
  margin-top: var(--ref-space-7);
  padding-top: var(--ref-space-5);
  border-top: var(--ref-hairline) solid var(--ref-line);
  color: var(--ref-muted);
  font-size: var(--ref-text-sm);
}
.page-notes p { margin: 0 0 var(--ref-space-2); }

/* ── The front door's card (/door only: the engine fills index.html's marker with it) ── */
.why-card {
  max-width: var(--ref-measure-reading);
  margin: 0 0 var(--ref-space-5);
  padding: var(--ref-space-4) var(--ref-space-5);
  background: var(--ref-surface);
  border: var(--ref-hairline) solid var(--ref-line);
  border-radius: var(--ref-radius-lg);
}
.why-card .why-title { margin: 0 0 var(--ref-space-2); font-size: var(--ref-text-sm); }
.why-card .why-sentence { margin: 0 0 var(--ref-space-2); }
.why-card .why-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ref-space-2) var(--ref-space-4);
  margin: var(--ref-space-3) 0;
  font-size: var(--ref-text-sm);
}
.why-card .why-tokens div { display: flex; gap: var(--ref-space-1); }
.why-card .why-tokens dt { color: var(--ref-muted); }
.why-card .why-tokens dd { margin: 0; }
.why-card .why-gloss, .why-card .why-formats { margin: 0; color: var(--ref-muted); font-size: var(--ref-text-sm); }
.site-footer {
  max-width: var(--ref-measure);
  margin: 0 auto;
  padding: 0 var(--ref-space-5) var(--ref-space-7);
  color: var(--ref-muted);
  font-size: var(--ref-text-sm);
}

/* ── Sign-in and denied pages ───────────────────────────────────────────── */
/* Narrow content, aligned with the nav: the column narrows, the page frame does not. */
.signin > *, .denied > * { max-width: var(--ref-measure-narrow); }
.signin > p, .denied > p { color: var(--ref-ink-2); }
.signin-current {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ref-space-3);
  margin: var(--ref-space-5) 0;
  padding: var(--ref-space-3) var(--ref-space-3) var(--ref-space-3) var(--ref-space-4);
  border: var(--ref-hairline) solid var(--ref-line);
  border-radius: var(--ref-radius);
  background: var(--ref-sunken);
}
.signin-current p, .signin-out { margin: 0; }
.signin-current .button { font-size: var(--ref-text-sm); padding: var(--ref-space-1) var(--ref-space-3); }
.persona-list { display: grid; gap: var(--ref-space-3); margin: var(--ref-space-5) 0 0; padding: 0; list-style: none; }
.button.persona {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--ref-space-0);
  width: 100%;
  padding: var(--ref-space-4) var(--ref-space-7) var(--ref-space-4) var(--ref-space-5);
  border-color: var(--ref-line-strong);
  background: var(--ref-surface);
  box-shadow: var(--ref-shadow);
  color: var(--ref-ink);
  text-align: left;
  transition: border-color var(--ref-transition);
}
.button.persona::after {
  content: "→" / "";
  position: absolute;
  top: 50%;
  right: var(--ref-space-5);
  color: var(--ref-muted);
  transform: translateY(-50%);
}
.button.persona:hover { border-color: var(--ref-ink-2); }
.persona-name { font-weight: var(--ref-weight-semibold); }

/* The sign-in page: one centred card. Heading, what signing in is for, the error, the provider buttons (quiet, equal,
   full width, each with its provider's mark), the notices as fine print, then the session. */
.signin-card {
  margin: 0 auto;
  padding: var(--ref-space-6);
  background: var(--ref-surface);
  border: var(--ref-hairline) solid var(--ref-line);
  border-radius: var(--ref-radius-lg);
  box-shadow: var(--ref-shadow);
}
.signin-card h1 { text-align: center; }
.signin-purpose { margin: 0 0 var(--ref-space-5); color: var(--ref-ink-2); text-align: center; }
.signin-card .form-error { max-width: none; margin: 0 0 var(--ref-space-5); }
.signin-providers { display: grid; gap: var(--ref-space-3); margin: 0; padding: 0; list-style: none; }
/* Block, not flex: a label that wraps (Microsoft's, on a phone) keeps its mark beside its first line, both centred. */
.signin-provider {
  display: block;
  width: 100%;
  padding: var(--ref-space-3) var(--ref-space-4);
  text-align: center;
  text-decoration: none;
  transition: border-color var(--ref-transition), background-color var(--ref-transition);
}
.signin-provider:hover { border-color: var(--ref-ink-2); background: var(--ref-hover); }
.signin-provider:focus-visible { outline: var(--ref-rule) solid var(--ref-focus); outline-offset: var(--ref-rule); }
.signin-mark { width: var(--ref-mark); height: var(--ref-mark); margin-right: var(--ref-space-3); vertical-align: middle; }
.signin-fine {
  display: grid;
  gap: var(--ref-space-3);
  margin-top: var(--ref-space-5);
  padding-top: var(--ref-space-4);
  border-top: var(--ref-hairline) solid var(--ref-line);
}
.signin-fine .panel-source { margin: 0; max-width: none; font-size: var(--ref-text-xs); line-height: var(--ref-leading-snug); }
/* The pair that overlaps stays together in the markup; on the page every fine-print paragraph is .signin-fine's own item, one gap apart. */
.signin-fine-group { display: contents; }
.signin-card .signin-current { margin: var(--ref-space-5) 0 0; }
.persona-summary { color: var(--ref-muted); font-family: var(--ref-font-mono); font-size: var(--ref-text-code); font-weight: var(--ref-weight-regular); }

/* ── Demo controls and "My agents" (personas phase A) ──────────────────── */
/* The demo banner says the demo controls are on. It is the quiet banner's twin, in ink: a fact, not a status. */
.banner-demo { color: var(--ref-ink); font-weight: var(--ref-weight-semibold); }
.agents-page .agents-notes { max-width: var(--ref-measure-reading); color: var(--ref-ink-2); font-size: var(--ref-text-sm); }
.agents-page .agents-notes p { margin: 0 0 var(--ref-space-2); }
.form-error {
  max-width: var(--ref-measure-reading);
  margin: var(--ref-space-5) 0 0;
  padding: var(--ref-space-3) var(--ref-space-4);
  border: var(--ref-hairline) solid var(--ref-5xx-line);
  border-radius: var(--ref-radius);
  background: var(--ref-5xx-bg);
  color: var(--ref-ink);
}
.agent-mint .field { margin: 0 0 var(--ref-space-3); }
.agent-mint label { color: var(--ref-ink-2); font-size: var(--ref-text-sm); }
.agent-mint input[type="text"] {
  min-width: 0;
  max-width: 100%;
  padding: var(--ref-space-2) var(--ref-space-3);
  border: var(--ref-hairline) solid var(--ref-line-strong);
  border-radius: var(--ref-radius);
  background: var(--ref-surface);
  color: var(--ref-ink);
  font: inherit;
}
.agent-mint .field-check { display: flex; align-items: baseline; gap: var(--ref-space-2); max-width: var(--ref-measure-reading); }
.key-once .key-value { margin-bottom: var(--ref-space-4); font-weight: var(--ref-weight-semibold); }
.curl-list { display: grid; gap: var(--ref-space-2); margin: 0; padding: 0; list-style: none; }
.table-scroll { overflow-x: auto; }
.agent-list { width: 100%; border-collapse: collapse; font-size: var(--ref-text-sm); }
.agent-list th {
  padding: var(--ref-space-2) var(--ref-space-3);
  border-bottom: var(--ref-hairline) solid var(--ref-line);
  color: var(--ref-muted);
  font-size: var(--ref-text-xs);
  font-weight: var(--ref-weight-semibold);
  letter-spacing: var(--ref-tracking-caps);
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.agent-list td { padding: var(--ref-space-3); border-bottom: var(--ref-hairline) solid var(--ref-line); vertical-align: baseline; }
.agent-list tbody tr:last-child td { border-bottom: 0; }
.agent-revoke { margin: 0; }
.agent-revoke .button { padding: var(--ref-space-1) var(--ref-space-3); font-size: var(--ref-text-sm); }
/* A key's state is not an HTTP status, so it stays neutral, like the policy badge. */
.key-state {
  padding: var(--ref-space-0) var(--ref-space-2);
  border: var(--ref-hairline) solid var(--ref-line-strong);
  border-radius: var(--ref-radius-sm);
  color: var(--ref-ink-2);
  font-size: var(--ref-text-xs);
  font-weight: var(--ref-weight-medium);
}
.key-state[data-ref-key-state="revoked"], .key-state[data-ref-key-state="expired"] { color: var(--ref-muted); border-style: dashed; }

/* ── My agents (platform, P3a): one card per agent; its facts, its controls, the terms it runs under ── */
.agent-cards { display: grid; gap: var(--ref-space-4); }
.agent-card {
  padding: var(--ref-space-4) var(--ref-space-5) var(--ref-space-5);
  border: var(--ref-hairline) solid var(--ref-line);
  border-radius: var(--ref-radius);
  background: var(--ref-sunken);
}
.agent-card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--ref-space-2) var(--ref-space-4); }
.agent-name { margin: 0; font-size: var(--ref-text-base); font-weight: var(--ref-weight-semibold); }
.agent-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--ref-cell-label), 1fr));
  gap: var(--ref-space-2) var(--ref-space-4);
  margin: var(--ref-space-3) 0 0;
  font-size: var(--ref-text-sm);
}
.agent-facts dt { color: var(--ref-muted); font-size: var(--ref-text-xs); font-weight: var(--ref-weight-semibold); letter-spacing: var(--ref-tracking-caps); text-transform: uppercase; }
.agent-facts dd { margin: 0; color: var(--ref-ink); font-variant-numeric: tabular-nums; }
.agent-card .agent-revoke { margin-top: var(--ref-space-4); }

/* The terms snapshot: the sentence, then the exact words, folded; DRAFT is a fact about the words, so it stays neutral. */
.agent-terms { margin-top: var(--ref-space-4); padding-top: var(--ref-space-3); border-top: var(--ref-hairline) solid var(--ref-line); }
.terms-statement { margin: 0; max-width: var(--ref-measure-reading); color: var(--ref-ink-2); font-size: var(--ref-text-sm); }
.terms-read { margin-top: var(--ref-space-2); }
.terms-version { font-family: var(--ref-font-mono); font-size: var(--ref-text-code); }
.terms-draft {
  margin-left: var(--ref-space-2);
  padding: var(--ref-space-0) var(--ref-space-2);
  border: var(--ref-hairline) dashed var(--ref-line-strong);
  border-radius: var(--ref-radius-sm);
  color: var(--ref-ink);
  font-size: var(--ref-text-xs);
  font-weight: var(--ref-weight-bold);
  letter-spacing: var(--ref-tracking-caps);
}
.terms-text {
  max-width: var(--ref-measure-reading);
  margin: var(--ref-space-3) 0 0;
  padding: var(--ref-space-4);
  border: var(--ref-hairline) solid var(--ref-line);
  border-radius: var(--ref-radius);
  background: var(--ref-surface);
  color: var(--ref-ink);
  font-family: var(--ref-font-reading);
  font-size: var(--ref-text-sm);
  line-height: var(--ref-leading-reading);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.terms-hash { margin: var(--ref-space-2) 0 0; color: var(--ref-muted); font-size: var(--ref-text-xs); overflow-wrap: anywhere; }
.terms-offer { max-width: var(--ref-measure-reading); margin: 0 0 var(--ref-space-3); }
.terms-accept { margin-top: var(--ref-space-3); }
.terms-entry + .terms-entry { margin-top: var(--ref-space-5); }

/* An agent's controls at a glance: equal-width pills (the same width rule as the status pills). Neutral: a control is a
   choice the owner made, not an HTTP status. */
.control-pills {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--ref-pill-width)), 1fr));
  gap: var(--ref-space-2);
  margin: var(--ref-space-4) 0 0;
  padding: 0;
  list-style: none;
}
.control-pill {
  padding: var(--ref-space-1) var(--ref-space-3);
  border: var(--ref-hairline) solid var(--ref-line-strong);
  border-radius: var(--ref-radius-pill);
  background: var(--ref-surface);
  color: var(--ref-ink-2);
  font-size: var(--ref-text-sm);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.control-pill[data-ref-control="expires"] { font-family: var(--ref-font-mono); font-size: var(--ref-text-code); }
.agent-edit { margin-top: var(--ref-space-4); }
.agent-controls-form { margin-top: var(--ref-space-3); }

/* The controls as a form: one fieldset per control; choices are equal-width pills (radio buttons underneath). */
.controls { max-width: var(--ref-measure-reading); }
.control-group { min-width: 0; margin: 0 0 var(--ref-space-4); padding: 0; border: 0; }
.control-group legend { margin-bottom: var(--ref-space-2); padding: 0; color: var(--ref-ink); font-size: var(--ref-text-sm); font-weight: var(--ref-weight-semibold); }
.control-help { margin: var(--ref-space-2) 0 0; color: var(--ref-muted); font-size: var(--ref-text-xs); }
.choice-pills { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--ref-choice-min)), 1fr)); gap: var(--ref-space-2); }
.choice-pills + .field, .field + .choice-pills { margin-top: var(--ref-space-2); }
.choice { position: relative; display: block; }
.choice input { position: absolute; width: var(--ref-hairline); height: var(--ref-hairline); opacity: 0; }
.choice span {
  display: block;
  padding: var(--ref-space-2) var(--ref-space-3);
  border: var(--ref-hairline) solid var(--ref-line-strong);
  border-radius: var(--ref-radius-pill);
  background: var(--ref-surface);
  color: var(--ref-ink-2);
  font-size: var(--ref-text-sm);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--ref-transition), background-color var(--ref-transition), color var(--ref-transition);
}
.choice span:hover { border-color: var(--ref-ink-2); }
.choice input:checked + span { border-color: var(--ref-ink); background: var(--ref-ink); color: var(--ref-on-ink); font-weight: var(--ref-weight-medium); }
.choice input:focus-visible + span { outline: var(--ref-rule) solid var(--ref-focus); outline-offset: var(--ref-rule); }
.agent-mint input.amount { width: var(--ref-amount-width); font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute;
  width: var(--ref-hairline);
  height: var(--ref-hairline);
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── Narrow screens: no horizontal page scroll; the table becomes one card per route ── */
@media (max-width: 44rem) {
  main { padding: var(--ref-space-6) var(--ref-space-4) var(--ref-space-7); }
  .signin-card { padding: var(--ref-space-5) var(--ref-space-4); }
  .site-nav { padding: var(--ref-space-3) var(--ref-space-4); gap: var(--ref-space-2) var(--ref-space-4); }
  .panel { padding: var(--ref-space-4) var(--ref-space-4) var(--ref-space-5); border-radius: var(--ref-radius); }
  .config > div, .quote-fields > div { grid-template-columns: minmax(0, 1fr); gap: var(--ref-space-0); }
  .outcomes { flex-direction: column; gap: var(--ref-space-2); }
  .outcomes dt { min-width: var(--ref-outcome-label); }
  .panel-note { padding: var(--ref-space-4); }
  .status-lg { font-size: var(--ref-text-sm); padding-right: var(--ref-space-3); }
  .routes .status { display: inline-flex; width: auto; }
  .article-body .x402-message:not([hidden]) { padding: var(--ref-space-4); }
  .routes caption { padding: var(--ref-space-3) var(--ref-space-4); }

  .routes, .routes tbody, .routes caption { display: block; }
  .routes thead {
    position: absolute;
    width: var(--ref-hairline);
    height: var(--ref-hairline);
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .routes tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--ref-space-1) var(--ref-space-3);
    padding: var(--ref-space-4);
    border-bottom: var(--ref-hairline) solid var(--ref-line);
  }
  .routes tbody tr:last-child { border-bottom: 0; }
  .routes td, .routes td:first-child, .routes td:last-child { display: block; padding: 0; border: 0; }
  .routes .cell-status, .routes .cell-article { grid-column: 1 / -1; }
  .routes td.cell-status { display: flex; align-items: center; gap: var(--ref-space-3); padding: 0; }
  .routes .cell-you, .routes .cell-agent { margin-bottom: var(--ref-space-2); }
  .routes td.cell-agent { flex-wrap: wrap; }
  .routes .cell-agent .cell-sub { flex-basis: 100%; margin-top: 0; padding-left: var(--ref-cell-label); }
  .routes .cell-label { display: block; flex: none; width: var(--ref-cell-label); color: var(--ref-muted); font-size: var(--ref-text-xs); overflow-wrap: anywhere; }
  .routes .cell-policy .cell-sub { display: inline; margin-left: var(--ref-space-1); }
}

/* ── The Request Lab's reader pages (/account/lab*, Northwoods readers only) ─────────────────────────────────────
   The account pages' frame, type, panels and buttons; the classes below are constants (Phalanx LC-4: the pages carry no
   style of their own). Colour still means HTTP status: the safety line, the purpose block and Compare's highlight are ink
   on the neutrals. The pages are tables of evidence, so they take the index's wide measure, the header's navigation with
   them (the shared frame's body has no page class: :has finds the page); prose keeps the reading measure. */
body:has(> main.lab-page), .lab-page { --ref-measure: var(--ref-measure-wide); }
.lab-safety {
  max-width: var(--ref-measure-reading);
  margin: var(--ref-space-4) 0 0;
  padding: var(--ref-space-2) var(--ref-space-4);
  border-left: var(--ref-rule) solid var(--ref-ink-2);
  background: var(--ref-sunken);
  color: var(--ref-ink-2);
  font-size: var(--ref-text-sm);
}
.lab-status { max-width: var(--ref-measure-reading); margin: var(--ref-space-3) 0 0; color: var(--ref-ink-2); font-size: var(--ref-text-sm); }
.lab-status .aside, .lab-actions .aside { margin-left: var(--ref-space-1); }

/* What the page is for: a quiet intro panel, read once. */
.lab-purpose {
  margin: var(--ref-space-5) 0 0;
  padding: var(--ref-space-4) var(--ref-space-5);
  border: var(--ref-hairline) solid var(--ref-line);
  border-radius: var(--ref-radius-lg);
  background: var(--ref-sunken);
  color: var(--ref-ink-2);
  font-size: var(--ref-text-sm);
}
.lab-purpose p, .lab-purpose ol, .lab-purpose ul { max-width: var(--ref-measure-reading); margin: 0 0 var(--ref-space-3); }
.lab-purpose p:has(+ ol), .lab-purpose p:has(+ ul) { margin-bottom: var(--ref-space-1); }
.lab-purpose ol, .lab-purpose ul { padding-left: var(--ref-space-5); }
.lab-purpose li + li { margin-top: var(--ref-space-1); }
.lab-purpose > :last-child { margin-bottom: 0; }
.lab-purpose strong { color: var(--ref-ink); font-weight: var(--ref-weight-semibold); }

.lab-note {
  max-width: var(--ref-measure-reading);
  margin: var(--ref-space-5) 0 0;
  padding: var(--ref-space-3) var(--ref-space-4);
  border: var(--ref-hairline) solid var(--ref-line-strong);
  border-radius: var(--ref-radius);
  background: var(--ref-surface);
  color: var(--ref-ink);
}

/* Panels: an unnumbered heading, its help line, then the content. */
.lab-heading { margin: 0 0 var(--ref-space-2); }
.lab-heading + .panel-source { margin-top: 0; }
.lab-heading + :not(.panel-source) { margin-top: var(--ref-space-4); }
.lab-subhead { margin: var(--ref-space-5) 0 var(--ref-space-2); font-size: var(--ref-text-sm); font-weight: var(--ref-weight-semibold); }
.lab-subhead:first-of-type { margin-top: var(--ref-space-4); }
.lab-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ref-space-2) var(--ref-space-3); margin: var(--ref-space-4) 0 0; }
.panel > .control-help { max-width: var(--ref-measure-reading); }

/* The observatory's panels fold: a native details, open to start, no script (the CSP); the summary is the panel's heading.
   The browser's triangle would sit on its own line beside a block heading, so a drawn chevron replaces it: right when
   closed, down when open. Keyboard and screen-reader behaviour are the browser's own. */
.lab-fold { min-width: 0; }
.lab-fold > summary {
  display: flex;
  align-items: center;
  gap: var(--ref-space-2);
  list-style: none;
  cursor: pointer;
  border-radius: var(--ref-radius-sm);
}
.lab-fold > summary::-webkit-details-marker { display: none; }
.lab-fold > summary::before {
  content: "";
  flex: none;
  width: var(--ref-chevron);
  height: var(--ref-chevron);
  border-right: var(--ref-rule) solid var(--ref-muted);
  border-bottom: var(--ref-rule) solid var(--ref-muted);
  transform: rotate(-45deg);
  transition: transform var(--ref-transition);
}
.lab-fold[open] > summary::before { transform: rotate(45deg); }
.lab-fold > summary:hover::before { border-color: var(--ref-ink); }
.lab-fold > summary:focus-visible { outline: var(--ref-rule) solid var(--ref-focus); outline-offset: var(--ref-rule); }
.lab-fold > summary .lab-heading { margin: 0; }
.lab-fold[open] > summary { margin-bottom: var(--ref-space-2); }
.lab-fold > summary + .panel-source { margin-top: 0; }
.lab-fold > summary + :not(.panel-source) { margin-top: var(--ref-space-4); }
@media (prefers-reduced-motion: reduce) { .lab-fold > summary::before { transition: none; } }

/* A day's page (the observatory wireframe's #s-day): one head row, the crumb over the day and the previous and next days
   on its right, wrapping at phone width; the two are the wireframe's plain button, a disabled one muted and never a link. */
.lab-day-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ref-space-3) var(--ref-space-4);
  margin-bottom: var(--ref-space-3);
}
.lab-day-head h1 { margin: 0; }
.lab-crumb { margin: 0 0 var(--ref-space-1); color: var(--ref-muted); font-size: var(--ref-text-sm); }
.lab-live { color: var(--ref-live); font-family: var(--ref-font); font-size: var(--ref-text-md); font-weight: var(--ref-weight-medium); letter-spacing: normal; white-space: nowrap; }
.lab-day-nav { display: flex; flex-wrap: wrap; gap: var(--ref-space-2); }
.lab-day-btn {
  display: inline-flex;
  align-items: center;
  min-height: var(--ref-target);
  padding: 0 var(--ref-space-4);
  border: var(--ref-hairline) solid var(--ref-line-strong);
  border-radius: var(--ref-radius-sm);
  background: var(--ref-surface);
  color: var(--ref-ink);
  font-weight: var(--ref-weight-semibold);
  text-decoration: none;
  white-space: nowrap;
}
a.lab-day-btn:hover { border-color: var(--ref-muted); }
.lab-day-btn[aria-disabled="true"] { color: var(--ref-muted); border-color: var(--ref-line); }

/* The Rules page (the observatory wireframe's #s-rules): three summary cards in a row, then a card per rule with its counts
   in a side column; both stack at phone width. Chips are plain text and the pill is neutral (colour means HTTP status). */
.lab-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--ref-space-3); }
/* DayDetail's "This day" (the wireframe's #s-day stat cards): six across, three on a narrower screen; the phone rule below
   stacks them like every Lab card row. */
.lab-day-cards { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 64rem) { .lab-day-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.lab-card {
  display: flex;
  flex-direction: column;
  gap: var(--ref-space-2);
  min-width: 0;
  padding: var(--ref-space-4) var(--ref-space-5);
  border: var(--ref-hairline) solid var(--ref-line-strong);
  border-radius: var(--ref-radius);
  background: var(--ref-surface);
  font-size: var(--ref-text-sm);
}
.lab-card p { margin: 0; }
.lab-card-label { margin: 0; color: var(--ref-muted); font-size: var(--ref-text-sm); font-weight: var(--ref-weight-medium); }
.lab-card-value { color: var(--ref-ink); font-size: var(--ref-text-lg); font-weight: var(--ref-weight-bold); line-height: var(--ref-leading-tight); font-variant-numeric: tabular-nums; }
.lab-card-note { color: var(--ref-ink-2); }
.lab-rules { display: flex; flex-direction: column; gap: var(--ref-space-3); margin-top: var(--ref-space-4); }
.lab-rule {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 1fr);
  gap: var(--ref-space-4);
  padding: var(--ref-space-3) var(--ref-space-4);
  border: var(--ref-hairline) solid var(--ref-line-strong);
  border-radius: var(--ref-radius);
  background: var(--ref-surface);
}
.lab-rule-main { display: flex; flex-direction: column; gap: var(--ref-space-2); min-width: 0; }
.lab-rule-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ref-space-2) var(--ref-space-3); margin: 0; font-size: var(--ref-text-base); }
.lab-rule-order { color: var(--ref-muted); font-size: var(--ref-text-sm); font-weight: var(--ref-weight-medium); }
.lab-rule-id { font-family: var(--ref-font-mono); font-size: var(--ref-text-code); font-weight: var(--ref-weight-bold); overflow-wrap: anywhere; }
.lab-pill {
  padding: var(--ref-chip-pad-y) var(--ref-space-2);
  border: var(--ref-hairline) solid var(--ref-line-strong);
  border-radius: var(--ref-radius-pill);
  background: var(--ref-sunken);
  color: var(--ref-ink-2);
  font-size: var(--ref-text-xs);
  font-weight: var(--ref-weight-semibold);
}
.lab-rule-sentence { margin: 0; color: var(--ref-ink); font-size: var(--ref-text-base); }
.lab-chips { display: flex; flex-wrap: wrap; gap: var(--ref-space-2); margin: 0; padding: 0; list-style: none; }
.lab-chip {
  padding: var(--ref-chip-pad-y) var(--ref-space-2);
  border: var(--ref-hairline) solid var(--ref-line-strong);
  border-radius: var(--ref-radius-pill);
  color: var(--ref-ink-2);
  font-size: var(--ref-text-xs);
  overflow-wrap: anywhere;
}
/* The door's trust chip and raw tokens in the observatory's newest rows (audit 2026-11-24, gaps 2 and 3): the words carry the state, so one neutral pill. */
.lab-trust {
  display: inline-block;
  padding: var(--ref-chip-pad-y) var(--ref-space-2);
  border: var(--ref-hairline) solid var(--ref-line-strong);
  border-radius: var(--ref-radius-pill);
  color: var(--ref-ink-2);
  font-size: var(--ref-text-xs);
  white-space: nowrap;
}
.lab-raw { display: block; margin-top: var(--ref-space-0); color: var(--ref-muted); font-family: var(--ref-font-mono); font-size: var(--ref-text-xs); overflow-wrap: anywhere; }
/* Compare's classifier panel (Gerry 11-24): each field's one-line explanation, always shown, wrapping inside the table's nowrap first column; several values as a plain list. */
.lab-field-means { display: block; min-width: 14rem; max-width: 24rem; margin-top: var(--ref-space-1); color: var(--ref-muted); font-size: var(--ref-text-xs); white-space: normal; }
.lab-dist { margin: 0; padding: 0; list-style: none; }
.lab-dist > li + li { margin-top: var(--ref-space-2); }
.lab-rule-price { margin: 0; color: var(--ref-muted); font-size: var(--ref-text-sm); }
.lab-rule-switch { margin: 0.5rem 0 0; }
.lab-rule-side {
  display: flex;
  flex-direction: column;
  gap: var(--ref-space-1);
  padding-left: var(--ref-space-4);
  border-left: var(--ref-hairline) solid var(--ref-line);
  font-size: var(--ref-text-sm);
}
.lab-rule-side .lab-crumb { margin: 0; }
.lab-rule-n { margin: 0; color: var(--ref-ink-2); }
.lab-rule-link { font-size: var(--ref-text-sm); }
.lab-route-desc { display: block; margin-top: var(--ref-space-0); color: var(--ref-muted); white-space: normal; }
.lab-callout {
  max-width: var(--ref-measure-reading);
  margin: 0;
  padding: var(--ref-space-3) var(--ref-space-4);
  border: var(--ref-hairline) solid var(--ref-line-strong);
  border-radius: var(--ref-radius);
  background: var(--ref-sunken);
  color: var(--ref-ink);
  font-size: var(--ref-text-sm);
}

/* Forms: a label over each control, one line of help under it. */
.lab-form { margin: 0; }
.lab-form .field { display: grid; gap: var(--ref-space-1); min-width: 0; margin: 0 0 var(--ref-space-4); }
.panel > .lab-form:last-child .field:last-child { margin-bottom: 0; }
.lab-form label { color: var(--ref-ink); font-size: var(--ref-text-sm); font-weight: var(--ref-weight-medium); }
.lab-form input[type="text"], .lab-form input[type="number"], .lab-form select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: var(--ref-space-2) var(--ref-space-3);
  border: var(--ref-hairline) solid var(--ref-line-strong);
  border-radius: var(--ref-radius);
  background: var(--ref-surface);
  color: var(--ref-ink);
  font: inherit;
}
.lab-form .control-help { max-width: var(--ref-measure-reading); margin: 0; }
.lab-fields-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--ref-field-min)), 1fr)); gap: 0 var(--ref-space-5); }
.lab-form .lab-actions { margin-top: var(--ref-space-1); }
.lab-inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ref-space-2); }
.lab-inline input[type="text"] { flex: 0 1 var(--ref-field-min); width: auto; }
.lab-form .control-group { margin: 0 0 var(--ref-space-5); }
.lab-form .control-group .control-help { margin: 0 0 var(--ref-space-2); }
.lab-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--ref-field-min)), 1fr)); gap: var(--ref-space-1) var(--ref-space-4); }
.lab-form .lab-check { display: flex; align-items: baseline; gap: var(--ref-space-2); color: var(--ref-ink-2); font-weight: var(--ref-weight-regular); }
.lab-form .control-group > .lab-check + .lab-check { margin-top: var(--ref-space-1); }
.lab-check .aside { margin-left: 0; }
/* S7 (Gerry 11-12): the create form's fields line up. Each field spans three rows of the grid (label, control, help) on a
   subgrid, so labels, controls and help sit on shared lines in every column, whatever each help's length. */
.lab-fields-grid > .field { grid-row: span 3; grid-template-rows: subgrid; align-content: start; row-gap: var(--ref-space-1); }
.lab-fields-grid > .field > label { align-self: end; }
/* Compare's sources: a block per group, one source per line, its samples beside it. */
.lab-source-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--ref-field-min)), 1fr)); gap: var(--ref-space-4) var(--ref-space-5); }
.lab-source-group { min-width: 0; }
.lab-source-group .lab-subhead { margin: 0 0 var(--ref-space-1); }
.lab-form .lab-source-group > .lab-check { display: grid; grid-template-columns: auto 1fr; column-gap: var(--ref-space-2); align-items: baseline; }
.lab-form .lab-source-group > .lab-check + .lab-check { margin-top: var(--ref-space-2); }
.lab-source-group .lab-check > .aside { grid-column: 2; }
.lab-needed { margin: 0 0 var(--ref-space-3); color: var(--ref-ink-2); font-size: var(--ref-text-sm); }
/* A link's full address and its copy button (lab-copy.js shows the button; without script it stays hidden). */
.lab-address { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--ref-space-2); }
.lab-address code { overflow-wrap: anywhere; }
.lab-copy { display: inline-flex; align-items: center; gap: var(--ref-space-1); }
.lab-copy[hidden] { display: none; }
.lab-copy-icon { flex: none; }
.lab-copy-label { white-space: nowrap; }

/* Facts as a label column and a value column (a day's figures too: DayDetail's dl had no rule of its own). */
.lab-fields, .lab-terms, .lab-figures {
  display: grid;
  grid-template-columns: minmax(0, var(--ref-label-col)) minmax(0, 1fr);
  gap: var(--ref-space-2) var(--ref-space-5);
  margin: 0;
  font-size: var(--ref-text-sm);
}
.lab-fields dd { color: var(--ref-ink); }
.lab-fields .control-help { display: block; margin-top: var(--ref-space-0); }
.lab-terms { gap: var(--ref-space-3) var(--ref-space-5); }
.lab-terms dt { color: var(--ref-ink); font-weight: var(--ref-weight-semibold); }
.lab-terms dd { color: var(--ref-ink-2); }
.lab-pre {
  padding: var(--ref-space-3) var(--ref-space-4);
  border: var(--ref-hairline) solid var(--ref-line);
  border-radius: var(--ref-radius);
  background: var(--ref-sunken);
  color: var(--ref-ink-2);
  font-size: var(--ref-text-code);
}

/* Tables: the index's look (a card, a sunken header row), scrolling inside the card when the columns are wider than it. */
.lab-table-wrap {
  overflow-x: auto;
  background: var(--ref-surface);
  border: var(--ref-hairline) solid var(--ref-line);
  border-radius: var(--ref-radius-lg);
}
.lab-table { width: 100%; border-collapse: collapse; font-size: var(--ref-text-sm); }
.lab-table th {
  padding: var(--ref-space-2) var(--ref-space-3);
  border-bottom: var(--ref-hairline) solid var(--ref-line);
  background: var(--ref-sunken);
  color: var(--ref-muted);
  font-size: var(--ref-text-xs);
  font-weight: var(--ref-weight-semibold);
  letter-spacing: var(--ref-tracking-caps);
  text-align: left;
  text-transform: uppercase;
  vertical-align: bottom;
}
.lab-table td { padding: var(--ref-space-3); border-bottom: var(--ref-hairline) solid var(--ref-line); vertical-align: baseline; overflow-wrap: break-word; }
.lab-table tbody tr:last-child td { border-bottom: 0; }
.lab-table th:first-child, .lab-table td:first-child { padding-left: var(--ref-space-4); white-space: nowrap; }
.lab-table th:last-child, .lab-table td:last-child { padding-right: var(--ref-space-4); }
.lab-table .signin-out { margin: 0; }
.lab-table .button { padding: var(--ref-space-1) var(--ref-space-3); font-size: var(--ref-text-sm); white-space: nowrap; }

/* Compare: a row where the groups differ (a tint and an ink rule, calm, not a status colour), a name the host adds
   (greyed), a name that is not an HTTP token (a quiet note). */
.lab-table tr.lab-differs td { background: var(--ref-hover); }
.lab-table tr.lab-differs td:first-child { box-shadow: inset var(--ref-rule) 0 0 var(--ref-ink-2); color: var(--ref-ink); font-weight: var(--ref-weight-semibold); }
.lab-table tr.lab-host td { color: var(--ref-muted); }
.lab-odd-name { color: var(--ref-muted); font-size: var(--ref-text-xs); font-style: italic; }

@media (max-width: 44rem) {
  .lab-purpose { padding: var(--ref-space-4); }
  .lab-fields, .lab-terms, .lab-figures { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .lab-fields dd, .lab-terms dd, .lab-figures dd { margin-bottom: var(--ref-space-3); }
  .lab-inline input[type="text"] { flex: 1 1 100%; }
  .lab-cards, .lab-rule { grid-template-columns: minmax(0, 1fr); }
  .lab-rule-side { padding: var(--ref-space-3) 0 0; border-left: 0; border-top: var(--ref-hairline) solid var(--ref-line); }
  /* A phone keeps each cell readable (a date on two lines, not five) and scrolls the table inside its card instead. */
  .lab-table td { min-width: var(--ref-cell-label); }
}

/* ── The Morning Ledger: what a reader sees on / and /read/{slug} ───────────────────────────────────────────────────
   A newspaper in the site's own palette: ink on warm paper, the reading serif for the nameplate and the headlines, rules
   for structure. Its badges stay neutral, so colour keeps meaning HTTP status; the status pills, the route table and the
   configuration live in each page's closed "For developers" section (.ledger-dev). */
.ledger-masthead {
  margin: 0 0 var(--ref-space-6);
  padding: var(--ref-space-3) 0 var(--ref-space-4);
  border-top: var(--ref-hairline) solid var(--ref-ink);
  border-bottom: calc(var(--ref-rule) + var(--ref-hairline)) double var(--ref-ink);
  text-align: center;
}
.ledger-edition {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--ref-space-1) var(--ref-space-2);
  margin: 0 0 var(--ref-space-3);
  color: var(--ref-muted);
  font-size: var(--ref-text-xs);
  letter-spacing: var(--ref-tracking-caps);
  text-transform: uppercase;
}
.ledger-edition > span:empty { display: none; }
.ledger-edition > span:not(:empty) + span::before { content: "·" / ""; margin-right: var(--ref-space-2); }
.ledger-title {
  margin: 0;
  font-family: var(--ref-font-reading);
  font-size: calc(var(--ref-text-xl) + var(--ref-text-base));
  font-weight: var(--ref-weight-bold);
  letter-spacing: var(--ref-tracking-tight);
  line-height: var(--ref-leading-tight);
}
.ledger-tagline {
  margin: var(--ref-space-2) 0 0;
  color: var(--ref-ink-2);
  font-family: var(--ref-font-reading);
  font-size: var(--ref-text-md);
  font-style: italic;
}

.ledger-front { margin: 0; }
.ledger-section-head { display: flex; align-items: center; gap: var(--ref-space-4); margin: 0 0 var(--ref-space-2); }
.ledger-section-head::after { content: ""; flex: 1; border-top: var(--ref-hairline) solid var(--ref-line-strong); }
.ledger-section-title {
  margin: 0;
  color: var(--ref-ink-2);
  font-size: var(--ref-text-xs);
  font-weight: var(--ref-weight-bold);
  letter-spacing: var(--ref-tracking-caps);
  text-transform: uppercase;
}
.ledger-note {
  max-width: var(--ref-measure-reading);
  margin: 0 0 var(--ref-space-5);
  color: var(--ref-muted);
  font-size: var(--ref-text-sm);
  font-style: italic;
}

/* The front page: one card per route; the first is the lead story, two columns wide where there are columns to span. */
.ledger-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--ref-field-min)), 1fr));
  gap: var(--ref-space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}
.ledger-loading { color: var(--ref-muted); }
.ledger-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--ref-space-2);
  min-width: 0;
  padding: var(--ref-space-4) var(--ref-space-5) var(--ref-space-4);
  background: var(--ref-surface);
  border: var(--ref-hairline) solid var(--ref-line);
  border-top: var(--ref-rule) solid var(--ref-ink);
  border-radius: var(--ref-radius-sm);
  box-shadow: var(--ref-shadow);
  transition: border-color var(--ref-transition), background-color var(--ref-transition);
}
.ledger-card:first-child { grid-column: span 2; }
.ledger-card:hover { border-color: var(--ref-line-strong); border-top-color: var(--ref-ink); }
.ledger-card-title {
  margin: 0;
  font-family: var(--ref-font-reading);
  font-size: var(--ref-text-lg);
  font-weight: var(--ref-weight-bold);
  letter-spacing: normal;
  line-height: var(--ref-leading-tight);
  overflow-wrap: anywhere;
}
.ledger-card:first-child .ledger-card-title { font-size: var(--ref-text-xl); }
.ledger-card-link { color: var(--ref-ink); text-decoration: none; }
/* The whole card opens the article; the link alone carries its name. */
.ledger-card-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--ref-radius-sm); }
.ledger-card:hover .ledger-card-link { text-decoration: underline; text-decoration-color: var(--ref-line-strong); }
.ledger-card-dek { flex: 1; margin: 0; color: var(--ref-ink-2); font-size: var(--ref-text-sm); }
.ledger-card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--ref-space-2) var(--ref-space-3);
  margin: var(--ref-space-2) 0 0;
  padding-top: var(--ref-space-3);
  border-top: var(--ref-hairline) solid var(--ref-line);
}
.ledger-card-more { color: var(--ref-muted); font-size: var(--ref-text-sm); font-weight: var(--ref-weight-medium); }
.ledger-card-more::after { content: " →" / ""; }
.ledger-card:hover .ledger-card-more { color: var(--ref-ink); }

/* How a story opens, in words: neutral (ink, paper and rules), never a status colour. A price is the one solid tag. */
.ledger-badge {
  display: inline-block;
  padding: var(--ref-space-0) var(--ref-space-2);
  border: var(--ref-hairline) solid var(--ref-line-strong);
  border-radius: var(--ref-radius-sm);
  background: var(--ref-surface);
  color: var(--ref-ink-2);
  font-size: var(--ref-text-xs);
  font-weight: var(--ref-weight-semibold);
  letter-spacing: var(--ref-tracking-wide);
  white-space: nowrap;
}
.ledger-badge[data-ref-ledger-kind="free"] { border-color: var(--ref-line); background: var(--ref-sunken); }
.ledger-badge[data-ref-ledger-kind="paid"] { border-color: var(--ref-ink); background: var(--ref-ink); color: var(--ref-on-ink); font-variant-numeric: tabular-nums; }

/* For developers: closed until someone opens it; inside, the pages as they were. */
.ledger-dev {
  margin-top: var(--ref-space-8);
  border-top: var(--ref-hairline) solid var(--ref-line-strong);
}
.ledger-dev > summary {
  display: inline-flex;
  align-items: center;
  gap: var(--ref-space-2);
  padding: var(--ref-space-4) 0;
  color: var(--ref-muted);
  font-size: var(--ref-text-sm);
  font-weight: var(--ref-weight-medium);
  list-style: none;
  cursor: pointer;
}
.ledger-dev > summary::-webkit-details-marker { display: none; }
.ledger-dev > summary::before {
  content: "";
  width: var(--ref-chevron);
  height: var(--ref-chevron);
  border-right: var(--ref-stroke) solid currentColor;
  border-bottom: var(--ref-stroke) solid currentColor;
  transform: rotate(-45deg);
  transition: transform var(--ref-transition);
}
.ledger-dev[open] > summary::before { transform: rotate(45deg); }
.ledger-dev > summary:hover { color: var(--ref-ink); }
.ledger-dev-body { padding-top: var(--ref-space-3); }
.ledger-dev-title {
  margin: 0 0 var(--ref-space-3);
  font-family: var(--ref-font-display);
  font-size: var(--ref-text-lg);
  font-weight: var(--ref-weight-bold);
  letter-spacing: var(--ref-tracking-tight);
}

/* An article: the paper's nameplate, then a newspaper header (category, headline, standfirst, byline) over the story. */
.ledger-nameplate {
  margin: 0 0 var(--ref-space-6);
  padding-bottom: var(--ref-space-2);
  border-bottom: calc(var(--ref-rule) + var(--ref-hairline)) double var(--ref-ink);
  font-family: var(--ref-font-reading);
  font-size: var(--ref-text-lg);
  font-weight: var(--ref-weight-bold);
  letter-spacing: var(--ref-tracking-tight);
  text-align: center;
}
.ledger-nameplate a { color: var(--ref-ink); text-decoration: none; }
.ledger-article-head { max-width: var(--ref-measure-reading); margin: 0 0 var(--ref-space-5); }
.ledger-kicker {
  margin: 0 0 var(--ref-space-3);
  color: var(--ref-ink-2);
  font-size: var(--ref-text-xs);
  font-weight: var(--ref-weight-bold);
  letter-spacing: var(--ref-tracking-caps);
  text-transform: uppercase;
}
.ledger-headline {
  margin: 0 0 var(--ref-space-3);
  font-family: var(--ref-font-reading);
  font-size: var(--ref-text-xl);
  font-weight: var(--ref-weight-bold);
  letter-spacing: normal;
  line-height: var(--ref-leading-tight);
  overflow-wrap: anywhere;
}
.ledger-standfirst {
  margin: 0 0 var(--ref-space-4);
  color: var(--ref-ink-2);
  font-family: var(--ref-font-reading);
  font-size: var(--ref-text-reading);
  font-style: italic;
  line-height: var(--ref-leading-snug);
}
.ledger-kicker:empty, .ledger-standfirst:empty { display: none; }
.ledger-byline {
  margin: 0;
  padding: var(--ref-space-2) 0;
  border-top: var(--ref-hairline) solid var(--ref-line);
  border-bottom: var(--ref-hairline) solid var(--ref-line);
  color: var(--ref-muted);
  font-size: var(--ref-text-sm);
}
.ledger-story { margin: var(--ref-space-5) 0 0; }
/* Inside the developers section a panel may end on its note. */
.ledger-dev .panel-source:last-child { margin-bottom: 0; }

@media (max-width: 44rem) {
  .ledger-title { font-size: var(--ref-text-xl); }
  .ledger-grid { grid-template-columns: minmax(0, 1fr); gap: var(--ref-space-4); }
  .ledger-card:first-child { grid-column: auto; }
  .ledger-card { padding: var(--ref-space-4); }
  .ledger-dev { margin-top: var(--ref-space-7); }
}
