/*
 * Open, the qr-router design language, on the Open Exit tokens (DEC-030). The token block below is
 * a copy of the single source at docs/design/system/tokens.css (DEC-064): the declarations match it
 * exactly, and the backend design token parity test fails the build on drift.
 *
 * Kevin accepted the Open (I2) direction for the landing: one continuous white surface where
 * typography, space and thin rules carry the hierarchy, and no island or card surfaces. This file
 * extends that direction to the whole product. The rules are written out in
 * docs/design/2026-09-23-open-design-language.md; every class here is named there.
 *
 * Colours come only from the variables below. Dark mode follows the Graphite palette: Ink
 * page, Paper text, Mint accent, never Teal on Ink.
 */

@font-face {
  font-family: Manrope;
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;

  /* The one surface, the text on it, and the rules that divide it. */
  --color-page: #FFFFFF;
  --color-text: #172B2A;
  --color-muted: #4F6461;
  --color-line: #DFE1DA;
  --color-line-strong: #84908C;
  --color-tint: #F7F8F4;

  /* The accent and the safe pair for text on it: Teal with White, Mint with Graphite (DEC-030).
     The soft accent is the one tint Open paints: the destination span of the Docs code figures. */
  --color-accent: #087F73;
  --color-accent-ink: #FFFFFF;
  --color-accent-soft: #CBF2DF;
  --color-link: #087F73;
  --color-focus: #087F73;
  --color-mark: #087F73;

  /* The QR image always sits on White in both schemes, so a printed or on-screen QR keeps its
     contrast; the backdrop is the Ink veil behind the one surface allowed to float, a dialog. */
  --color-qr-tile: #FFFFFF;
  --color-backdrop: rgba(23, 43, 42, 0.56);

  /* Functional, not brand (DEC-030): these report state, so they are tuned to stay readable on
     White rather than to match the palette. The soft tints are declared for reference; Open
     draws no tinted boxes, so nothing paints them. */
  --color-ok: #1C6B47;
  --color-ok-soft: #CBF2DF;
  --color-warn: #7C610D;
  --color-warn-soft: #F5EED8;
  --color-bad: #B3352B;
  --color-bad-soft: #F6E3DF;

  /* A filled shape that is not a link or a mark (a solid disc or block) uses color-credit:
     Teal in light, the quieter Teal #50A195 in dark, because Mint as a solid fill is brighter
     than any text on the page (DEC-064). Introduced for the retired change bank credit discs;
     kept as the pattern for any future filled shape. */
  --color-credit: #087F73;
  --color-credit-ink: #FFFFFF;

  /* Chart bars and the archived status have their own names, so a dark palette can tune them
     without moving the accent or the muted text. */
  --color-chart: #087F73;
  --color-chart-muted: #84908C;
  --color-archived: #4F6461;

  --font-sans:
    Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Type scale. Sentence case everywhere; weight is used sparingly, size and space do the work. */
  --text-title: 2rem;        /* 32 / 40, page title, weight 400 */
  --text-heading: 1.25rem;   /* 20 / 28, section heading, weight 500 */
  --text-row: 1rem;          /* 16 / 24, row title, weight 500 */
  --text-body: 0.9375rem;    /* 15 / 24, body */
  --text-small: 0.8125rem;   /* 13 / 20, hints, meta, captions */
  --text-label: 0.75rem;     /* 12 / 16, labels and table headers, weight 600 */
  --text-metric: 2.5rem;     /* 40 / 44, the one large number of a view */

  /* Spacing: a 4 px base with eight steps. Rows breathe at 20 px, sections sit 48 px apart. */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --row-padding: 1.25rem;

  --gutter: 2.5rem;
  --measure: 60rem;          /* 960 px of content, the landing's content width */
  --radius: 3px;             /* controls only; nothing else is rounded */
  --control-height: 2.75rem; /* 44 px, a comfortable touch target */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --color-page: #121514;
    --color-tint: #1B1F1E;
    --color-line: #2B3130;
    --color-line-strong: #687370;
    --color-text: #F1F3F0;
    --color-muted: #A4ADAA;
    --color-accent: #CBF2DF;
    --color-accent-ink: #121514;
    --color-accent-soft: #1B1F1E;
    --color-link: #CBF2DF;
    --color-focus: #CBF2DF;
    --color-mark: #CBF2DF;
    --color-ok: #72D9A4;
    --color-ok-soft: #1F3028;
    --color-warn: #EDC460;
    --color-warn-soft: #2C2A1D;
    --color-bad: #F5A89F;
    --color-bad-soft: #2D2725;
    --color-credit: #50A195;
    --color-credit-ink: #121514;
    --color-archived: #A4ADAA;
    --color-chart: #CBF2DF;
    --color-chart-muted: #687370;
    --color-qr-tile: #FFFFFF;
    --color-backdrop: rgba(6, 8, 7, 0.76);
  }
}

/* The same declarations, for a person who chose Dark on the theme switch. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --color-page: #121514;
  --color-tint: #1B1F1E;
  --color-line: #2B3130;
  --color-line-strong: #687370;
  --color-text: #F1F3F0;
  --color-muted: #A4ADAA;
  --color-accent: #CBF2DF;
  --color-accent-ink: #121514;
  --color-accent-soft: #1B1F1E;
  --color-link: #CBF2DF;
  --color-focus: #CBF2DF;
  --color-mark: #CBF2DF;
  --color-ok: #72D9A4;
  --color-ok-soft: #1F3028;
  --color-warn: #EDC460;
  --color-warn-soft: #2C2A1D;
  --color-bad: #F5A89F;
  --color-bad-soft: #2D2725;
  --color-credit: #50A195;
  --color-credit-ink: #121514;
  --color-archived: #A4ADAA;
  --color-chart: #CBF2DF;
  --color-chart-muted: #687370;
  --color-qr-tile: #FFFFFF;
  --color-backdrop: rgba(6, 8, 7, 0.76);
}


/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--color-page);
  color: var(--color-text);
  font: 400 var(--text-body)/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--color-link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mono { font-family: var(--font-mono); font-size: var(--text-small); overflow-wrap: anywhere; }
.muted { color: var(--color-muted); }
.skip-link { position: absolute; left: var(--space-4); top: -3rem; padding: var(--space-2) var(--space-3); background: var(--color-page); border: 1px solid var(--color-line-strong); z-index: 30; }
.skip-link:focus { top: var(--space-2); }

/* Brand: the supplied lockup, swapped for the reverse lockup on Ink. */
.brand { display: inline-flex; flex-shrink: 0; }
.brand img { width: 150px; height: auto; }
.brand .brand-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand .brand-light { display: none; }
  :root:not([data-theme="light"]) .brand .brand-dark { display: block; }
}
:root[data-theme="dark"] .brand .brand-light { display: none; }
:root[data-theme="dark"] .brand .brand-dark { display: block; }

/* App shell: the landing header, extended with the app navigation and the one primary action. */
.shell-header {
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: var(--space-6) var(--gutter) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-7);
}
.shell-nav { display: flex; align-items: center; gap: var(--space-6); flex: 1; min-width: 0; }
.shell-nav a {
  position: relative;
  padding: var(--space-2) 0;
  color: var(--color-muted);
  font-size: var(--text-small);
  text-decoration: none;
}
.shell-nav a:hover { color: var(--color-text); }
.shell-nav a[aria-current="page"] { color: var(--color-text); font-weight: 600; }
.shell-nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--color-accent);
}
.shell-actions { display: flex; align-items: center; gap: var(--space-5); }
.shell-account { color: var(--color-muted); font-size: var(--text-small); text-decoration: none; white-space: nowrap; }
.shell-account:hover { color: var(--color-text); }
.shell-menu-button { display: none; }
.shell-menu { display: none; }
.shell-focused { justify-content: center; }

/* Page */
.page { max-width: calc(var(--measure) + 2 * var(--gutter)); margin: 0 auto; padding: var(--space-5) var(--gutter) var(--space-8); }
.page--narrow { max-width: calc(30rem + 2 * var(--gutter)); }
.page--reading { max-width: calc(42rem + 2 * var(--gutter)); }
.breadcrumb { display: flex; gap: var(--space-2); font-size: var(--text-small); color: var(--color-muted); margin-bottom: var(--space-4); }
.breadcrumb a { color: var(--color-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--color-text); text-decoration: underline; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-5); margin-bottom: var(--space-6); }
.page-header > div { min-width: 0; }
.page-title { font-size: var(--text-title); line-height: 1.25; font-weight: 400; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.page-lede { margin-top: var(--space-2); color: var(--color-muted); max-width: 40rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); flex-shrink: 0; }

/* Page meta: the facts about the page as a quiet ledger line, divided by thin vertical rules. */
.page-meta { display: flex; flex-wrap: wrap; gap: var(--space-3) 0; margin-top: var(--space-4); font-size: var(--text-small); color: var(--color-muted); }
.page-meta > * { display: inline-flex; align-items: center; gap: var(--space-2); padding-right: var(--space-5); margin-right: var(--space-5); border-right: 1px solid var(--color-line); }
.page-meta > *:last-child { border-right: 0; margin-right: 0; padding-right: 0; }
.page-meta strong { color: var(--color-text); font-weight: 600; }

/* Section: a rule above, a heading, and content. Never a box. */
.section { border-top: 1px solid var(--color-line); padding-top: var(--space-6); margin-top: var(--space-7); }
.section:first-child { margin-top: 0; }
.section-header { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); }
.section-heading { font-size: var(--text-heading); line-height: 1.4; font-weight: 500; letter-spacing: -0.01em; }
.section-lede { color: var(--color-muted); max-width: 40rem; margin-top: var(--space-2); }
.section-header .section-lede { margin-top: 0; }

/* Rows: the Index steps of the landing, used for every list. A rule above each row, one below the last. */
.rows { list-style: none; border-bottom: 1px solid var(--color-line); }
.rows > li { border-top: 1px solid var(--color-line); }
.row {
  display: grid;
  align-items: center;
  gap: var(--space-5);
  padding: var(--row-padding) var(--space-3);
  margin: 0 calc(-1 * var(--space-3));
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
a.row:hover, button.row:hover, .row.is-selected { background: var(--color-tint); }
a.row:hover .row-title { text-decoration: underline; text-underline-offset: 3px; }
.row-main { display: grid; gap: 2px; }
.row-main > span { display: block; }
.row > * { min-width: 0; }
.row-title { font-size: var(--text-row); font-weight: 500; line-height: 1.5; overflow-wrap: anywhere; }
.row-sub { color: var(--color-muted); font-size: var(--text-small); overflow-wrap: anywhere; }
.row-number { font-size: var(--text-row); text-align: right; }
.row-number small { display: block; color: var(--color-muted); font-size: var(--text-label); }
.row-chevron { color: var(--color-muted); }
.row-index { font-size: var(--text-small); color: var(--color-muted); }

/* QR row: thumbnail, name with destination and public URL, status, 14-day openings, chevron. */
.qr-row { grid-template-columns: 56px minmax(0, 1fr) 7.5rem 8.5rem 1rem; }
.qr-row .qr-image { width: 56px; height: 56px; padding: 4px; }
.qr-row.is-archived .row-title, .qr-row.is-archived .qr-image { opacity: 0.6; }
.spark { display: flex; align-items: flex-end; gap: 1px; height: 18px; margin-top: 2px; justify-content: flex-end; }
.spark span { width: 3px; min-height: 1px; background: var(--color-accent); opacity: 0.85; }

/* Status: a dot and a word. The word is always present; the colour only repeats it. */
.status { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-small); white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.status--active::before { background: var(--color-ok); }
.status--paused::before { border: 1.5px solid var(--color-warn); }
.status--archived { color: var(--color-archived); }
.status--archived::before { width: 8px; height: 1.5px; border-radius: 0; background: var(--color-archived); }
.status--live::before { background: var(--color-ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-ok) 20%, transparent); }

/* Buttons: one primary per view; secondary is outlined; quiet is text; danger names the loss. */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-3);
  min-height: var(--control-height);
  padding: 0 var(--space-5);
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-text);
  font-size: var(--text-small);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.button:hover { border-color: var(--color-text); text-decoration: none; }
.button--primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-ink); }
.button--primary:hover { border-color: var(--color-accent); filter: brightness(0.92); }
.button--quiet { border-color: transparent; padding: 0 var(--space-2); color: var(--color-text); font-weight: 500; text-decoration: underline; text-decoration-color: var(--color-line-strong); text-underline-offset: 4px; }
.button--quiet:hover { border-color: transparent; text-decoration-color: currentColor; }
.button--danger { color: var(--color-bad); border-color: var(--color-bad); }
.button--danger:hover { border-color: var(--color-bad); background: color-mix(in srgb, var(--color-bad) 8%, transparent); }
.button--small { min-height: 2.25rem; padding: 0 var(--space-4); }
.button:disabled, .button[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; filter: none; }
.button .arrow { font-weight: 400; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-5); }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Forms: label above, field, hint below; an error replaces nothing and adds a line in the bad colour. */
.form { display: grid; gap: var(--space-5); max-width: 36rem; }
.field { display: grid; gap: var(--space-2); }
.field-label { font-size: var(--text-label); font-weight: 600; letter-spacing: 0.02em; }
.field-label .optional { color: var(--color-muted); font-weight: 400; }
.input {
  width: 100%;
  min-height: var(--control-height);
  padding: 0 var(--space-3);
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius);
  background: var(--color-page);
  color: var(--color-text);
  font-size: var(--text-body);
}
.input:hover { border-color: var(--color-text); }
.input:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 1px; border-color: var(--color-focus); }
.input[aria-invalid="true"] { border-color: var(--color-bad); }
.input--mono { font-family: var(--font-mono); font-size: var(--text-small); }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix span { display: flex; align-items: center; padding: 0 var(--space-3); border: 1px solid var(--color-line-strong); border-right: 0; border-radius: var(--radius) 0 0 var(--radius); color: var(--color-muted); font-size: var(--text-small); background: var(--color-tint); }
.input-prefix .input { border-radius: 0 var(--radius) var(--radius) 0; }
.field-hint { font-size: var(--text-small); color: var(--color-muted); }
.field-error { display: flex; gap: var(--space-2); font-size: var(--text-small); color: var(--color-bad); font-weight: 500; }
.field-error::before { content: "!"; display: inline-grid; place-items: center; width: 16px; height: 16px; flex: none; margin-top: 2px; border: 1.5px solid currentColor; border-radius: 50%; font-size: 10px; font-weight: 700; }

/* Notices: a 2 px rule in the state colour at the left, the message in Ink. No tinted box. */
.notice { border-left: 2px solid var(--color-line-strong); padding: var(--space-1) 0 var(--space-1) var(--space-4); max-width: 44rem; }
.notice + .notice { margin-top: var(--space-4); }
.notice-title { font-weight: 600; }
.notice p.notice-title { color: var(--color-text); }
.notice p + p, .notice-title + p { margin-top: var(--space-1); }
.notice p { color: var(--color-muted); }
.notice .notice-title + p, .notice > p:only-child { color: var(--color-text); }
.notice--ok { border-left-color: var(--color-ok); }
.notice--warn { border-left-color: var(--color-warn); }
.notice--bad { border-left-color: var(--color-bad); }
.notice--accent { border-left-color: var(--color-accent); }
.notice .button-row { margin-top: var(--space-4); }

/* Facts: a definition list as label and value rows with thin rules. */
.facts { display: grid; grid-template-columns: 11rem minmax(0, 1fr); border-bottom: 1px solid var(--color-line); }
.facts dt, .facts dd { border-top: 1px solid var(--color-line); padding: var(--space-4) 0; }
.facts dt { color: var(--color-muted); font-size: var(--text-small); padding-right: var(--space-5); }
.facts dd { min-width: 0; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); }
.facts dd .field-hint { flex-basis: 100%; }

/* The QR image: always on a White tile that includes its quiet zone, in both themes, so it scans. */
.qr-image { background: var(--color-qr-tile); padding: 16px; flex: none; }
.qr-image img, .qr-image svg { width: 100%; height: 100%; }
.qr-figure { display: grid; gap: var(--space-3); justify-items: start; }
.qr-figure .qr-image { width: 208px; height: 208px; }
.qr-figure figcaption { font-size: var(--text-small); color: var(--color-muted); }

/* Copy field: the landing's AI instruction field, a single bordered line that copies on click. */
.copy-field { display: flex; align-items: stretch; min-width: 0; border: 1px solid var(--color-line-strong); border-radius: var(--radius); cursor: pointer; background: var(--color-page); }
.copy-field:hover { border-color: var(--color-text); }
.copy-field code { flex: 1; min-width: 0; padding: var(--space-3) var(--space-4); font: 500 var(--text-body)/1.5 var(--font-mono); white-space: nowrap; overflow-x: auto; scrollbar-width: thin; }
.copy-field button { flex: none; display: inline-flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-4); border: 0; border-left: 1px solid var(--color-line); background: transparent; color: var(--color-link); font-size: var(--text-small); font-weight: 600; }
.copy-field button svg { width: 14px; height: 14px; }
.copy-status { min-height: 1.25rem; margin-top: var(--space-2); font-size: var(--text-small); color: var(--color-muted); }

/* Tabs: text with a 2 px accent underline for the current tab, on a rule. */
.tabs { display: flex; gap: var(--space-5); border-bottom: 1px solid var(--color-line); overflow-x: auto; scrollbar-width: none; }
.tabs button, .tabs a { flex: none; padding: var(--space-3) 0; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--color-muted); font-size: var(--text-small); font-weight: 500; text-decoration: none; white-space: nowrap; }
.tabs button:hover, .tabs a:hover { color: var(--color-text); }
.tabs [aria-selected="true"], .tabs [aria-current="true"] { color: var(--color-text); border-bottom-color: var(--color-accent); font-weight: 600; }
.tabs .count { color: var(--color-muted); font-weight: 400; margin-left: var(--space-1); }

/* Segmented choice for the chart grouping: three text options separated by thin rules. */
.segmented { display: inline-flex; border: 1px solid var(--color-line-strong); border-radius: var(--radius); }
.segmented button { min-height: 2.25rem; padding: 0 var(--space-4); border: 0; border-left: 1px solid var(--color-line); background: transparent; color: var(--color-muted); font-size: var(--text-small); font-weight: 500; }
.segmented button:first-child { border-left: 0; }
.segmented button[aria-pressed="true"] { color: var(--color-accent-ink); background: var(--color-accent); font-weight: 600; }
.segmented button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Metrics: the one large number of a view, with a label above and a caption below. */
.metrics { display: flex; flex-wrap: wrap; gap: var(--space-5) var(--space-7); }
.metric-label { font-size: var(--text-label); font-weight: 600; letter-spacing: 0.02em; color: var(--color-muted); }
.metric-value { display: block; font-size: var(--text-metric); line-height: 1.1; font-weight: 400; letter-spacing: -0.03em; margin-top: var(--space-1); }
.metric-caption { font-size: var(--text-small); color: var(--color-muted); }

/* Chart: the MCP card bars, larger. A bar keeps a floor so a measured zero is not a gap. */
.chart { margin-top: var(--space-5); }
.chart-plot { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 11rem; border-bottom: 1px solid var(--color-line-strong); }
.chart-plot::before, .chart-plot::after { content: ""; position: absolute; left: 0; right: 0; border-top: 1px dashed var(--color-line); pointer-events: none; }
.chart-plot::before { top: 0; }
.chart-plot::after { top: 50%; }
.chart-bar { position: relative; flex: 1 1 0; min-height: 2px; background: var(--color-chart); border-radius: 1px 1px 0 0; }
.chart-bar.is-blocked-only { background: var(--color-chart-muted); }
.chart-bar:hover, .chart-bar:focus-visible { filter: brightness(0.85); outline-offset: 1px; }
.chart-scale { display: flex; justify-content: space-between; font-size: var(--text-label); color: var(--color-muted); margin-bottom: var(--space-2); }
.chart-axis { display: flex; justify-content: space-between; gap: var(--space-4); margin-top: var(--space-2); font-size: var(--text-label); color: var(--color-muted); }
.chart-tooltip { min-height: 1.5rem; margin-top: var(--space-3); font-size: var(--text-small); color: var(--color-muted); }
.chart-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4); }

/* Tables: for admin only. Thin rules, no zebra, numbers right-aligned in tabular figures. */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-small); }
.table th { text-align: left; font-size: var(--text-label); font-weight: 600; letter-spacing: 0.02em; color: var(--color-muted); padding: var(--space-3) var(--space-4) var(--space-3) 0; border-bottom: 1px solid var(--color-line-strong); white-space: nowrap; }
.table td { padding: var(--space-4) var(--space-4) var(--space-4) 0; border-bottom: 1px solid var(--color-line); vertical-align: middle; }
.table th:last-child, .table td:last-child { padding-right: 0; text-align: right; }
.table .num { text-align: right; }
.table tr.is-selected > td { background: var(--color-tint); }
.table tr.detail-row > td { background: var(--color-tint); padding: var(--space-5) var(--space-5) var(--space-6); text-align: left; }
.table td:first-child { padding-left: var(--space-3); }
.table th:first-child { padding-left: var(--space-3); }
.tag { display: inline-block; margin-left: var(--space-2); padding: 0 var(--space-2); border: 1px solid var(--color-line-strong); border-radius: var(--radius); font-size: var(--text-label); color: var(--color-muted); vertical-align: 1px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-top: var(--space-4); font-size: var(--text-small); color: var(--color-muted); }

/* Dialog: the one surface allowed, because it interrupts. A rule, no shadow, no rounding beyond controls. */
dialog.dialog { width: min(30rem, calc(100% - 2rem)); padding: var(--space-6); border: 1px solid var(--color-line-strong); border-radius: var(--radius); background: var(--color-page); color: var(--color-text); }
dialog.dialog::backdrop { background: var(--color-backdrop); }
.dialog h2 { font-size: var(--text-heading); font-weight: 500; line-height: 1.4; margin-bottom: var(--space-3); }
.dialog p { color: var(--color-muted); }
.dialog p + p { margin-top: var(--space-3); }

/* Loading: skeleton rows in the tint, with the sentence for assistive technology. */
.skeleton { display: block; height: 0.75rem; border-radius: 2px; background: var(--color-tint); }
.skeleton--thumb { width: 56px; height: 56px; }
.skeleton--wide { width: 60%; }
.skeleton--narrow { width: 35%; margin-top: var(--space-2); }
@media (prefers-reduced-motion: no-preference) {
  .skeleton { animation: pulse 1.4s ease-in-out infinite; }
}
@keyframes pulse { 50% { opacity: 0.45; } }

/* Empty state: a heading, a sentence and one action, then the three landing steps as rows. */
.empty { padding: var(--space-6) 0 var(--space-5); max-width: 36rem; }
.empty h2 { font-size: var(--text-heading); font-weight: 500; }
.empty p { color: var(--color-muted); margin-top: var(--space-2); }
.steps { list-style: none; border-bottom: 1px solid var(--color-line); }
.steps li { display: grid; grid-template-columns: 2.25rem 13rem minmax(0, 1fr); gap: var(--space-5); align-items: baseline; padding: var(--row-padding) 0; border-top: 1px solid var(--color-line); }
.steps .step-number { font-size: var(--text-small); color: var(--color-muted); }
.steps h3 { font-size: var(--text-row); font-weight: 400; letter-spacing: -0.01em; }
.steps p { color: var(--color-muted); overflow-wrap: anywhere; }

/* Disclosure row, for archived QRs and for long help. */
details.disclosure > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) 0; color: var(--color-muted); font-size: var(--text-small); font-weight: 500; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: "+"; width: 1rem; text-align: center; font-size: var(--text-body); }
details.disclosure[open] > summary::before { content: "\2212"; }
details.disclosure > summary:hover { color: var(--color-text); }

/* Two-column detail layout: the QR image and its facts beside it; stacks on a phone. */
.split { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: var(--space-7); align-items: start; }

/* Footer inside the app: a single quiet line on the rule, never a status panel. */
.shell-footer { max-width: calc(var(--measure) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter) var(--space-6); }
.shell-footer > div { display: flex; flex-wrap: wrap; gap: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--color-line); font-size: var(--text-small); color: var(--color-muted); }
.shell-footer a { color: var(--color-muted); text-decoration: none; }
.shell-footer-theme { margin-left: auto; }
.shell-footer a:hover { color: var(--color-text); text-decoration: underline; }

/* Scope rows on consent: glyph, title and the sentence the owner approves. */
.scope-row { display: grid; grid-template-columns: 1.25rem minmax(0, 1fr); gap: var(--space-4); padding: var(--space-4) 0; border-top: 1px solid var(--color-line); }
.scope-row:last-child { border-bottom: 1px solid var(--color-line); }
.scope-row svg { width: 20px; height: 20px; color: var(--color-accent); margin-top: 2px; }
.scope-row strong { display: block; font-weight: 600; }
.scope-row span { display: block; color: var(--color-muted); font-size: var(--text-small); }

/* Phone: 20 px gutters, the navigation collapses into a Menu disclosure that opens as rows. */
@media (max-width: 760px) {
  :root { --gutter: 1.25rem; --text-title: 1.75rem; --row-padding: 1rem; }
  .shell-header { padding-top: var(--space-5); padding-bottom: var(--space-4); gap: var(--space-4); flex-wrap: wrap; }
  .brand img { width: 122px; }
  .shell-nav, .shell-actions { display: none; }
  .shell-menu-button {
    display: inline-flex; align-items: center; gap: var(--space-2); margin-left: auto;
    min-height: 2.5rem; padding: 0 var(--space-3); border: 1px solid var(--color-line-strong); border-radius: var(--radius);
    background: transparent; font-size: var(--text-small); font-weight: 600;
  }
  .shell-menu { width: 100%; }
  .shell-menu:not([hidden]) { display: block; }
  .shell-menu a { display: flex; justify-content: space-between; padding: var(--space-4) 0; border-top: 1px solid var(--color-line); color: var(--color-text); text-decoration: none; font-size: var(--text-body); }
  .shell-menu-theme { justify-content: space-between; padding: var(--space-4) 0; border-top: 1px solid var(--color-line); border-bottom: 1px solid var(--color-line); }
  .shell-menu a[aria-current="page"] { font-weight: 600; box-shadow: inset 2px 0 0 var(--color-accent); padding-left: var(--space-3); }
  .shell-menu a.menu-primary { color: var(--color-link); font-weight: 600; }
  .page { padding-top: var(--space-4); }
  .page-header { flex-direction: column; align-items: stretch; gap: var(--space-4); margin-bottom: var(--space-5); }
  .page-actions .button { flex: 1; }
  .page-meta { display: grid; gap: var(--space-2); }
  .page-meta > * { border-right: 0; padding-right: 0; margin-right: 0; }
  .section { margin-top: var(--space-6); padding-top: var(--space-5); }
  .qr-row { grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-areas: "img main num" "img status num"; row-gap: var(--space-1); column-gap: var(--space-4); align-items: start; }
  .qr-row .qr-image { width: 48px; height: 48px; padding: 3px; grid-area: img; }
  .qr-row .row-main { grid-area: main; }
  .qr-row .status { grid-area: status; }
  .qr-row .row-number { grid-area: num; }
  .qr-row .row-chevron, .qr-row .row-public { display: none; }
  .facts { grid-template-columns: 1fr; }
  .facts dt { border-top: 1px solid var(--color-line); padding-bottom: 0; }
  .facts dd { border-top: 0; padding-top: var(--space-1); }
  .split { grid-template-columns: 1fr; gap: var(--space-5); }
  .qr-figure .qr-image { width: 176px; height: 176px; }
  .steps li { grid-template-columns: 1.75rem minmax(0, 1fr); gap: var(--space-1) var(--space-3); }
  .steps .step-number { grid-row: 1 / 3; }
  .copy-field code { font-size: var(--text-small); padding: var(--space-3); }
  .copy-field button span { display: none; }
  .button-row .button { flex: 1 1 auto; }
  .metrics { gap: var(--space-5); }
  .metric-value { font-size: 2rem; }
  .chart-plot { height: 8rem; }
  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
  .table--stack tr { border-bottom: 1px solid var(--color-line); padding: var(--space-3) 0; }
  .table--stack tr:first-child { border-top: 1px solid var(--color-line-strong); }
  .table--stack td { border: 0; padding: var(--space-1) var(--space-3); text-align: left; display: flex; justify-content: space-between; gap: var(--space-4); }
  .table--stack td[data-label]::before { content: attr(data-label); color: var(--color-muted); font-size: var(--text-label); font-weight: 600; flex: none; }
  .table--stack td.num { text-align: right; }
  .table--stack td:first-child { font-weight: 600; display: block; }
  .table--stack td:first-child::before { display: none; }
  .table--stack td:last-child { justify-content: flex-start; padding-top: var(--space-2); }
  .table--stack tr.detail-row { padding: 0; }
  .table--stack tr.detail-row > td { display: block; padding: var(--space-4) var(--space-3) var(--space-5); }
  .table th:first-child, .table td:first-child { padding-left: var(--space-3); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; scroll-behavior: auto !important; }
}
