/* Design tokens: the register direction, oxblood seal palette (D-PRP-2-visual-direction).
   Oxblood is the only colour you can press; amber means a flag or "above what buyers paid".
   Light is the default. Dark is its own set of steps, applied by prefers-color-scheme unless
   <html data-theme> says otherwise (web/design/theme.js sets it). The two dark blocks must stay
   identical: check-contrast.mjs fails when they differ. Both are screen-only, so print is always
   the light set (D-PRP-50-theme-switch). */

/* Fonts: Martel and Martel Sans (OFL), vendored in fonts/ (D-PRP-44-vendored-fonts). One static
   weight per face, in two files: the first rule takes every character, the Devanagari rule
   after it takes its own range, so a page with no Marathi never downloads those files. */
@font-face { font-family: "Martel"; font-weight: 400; font-display: swap; src: url("fonts/martel/Martel-Regular-latin.woff2"); }
@font-face { font-family: "Martel"; font-weight: 400; font-display: swap; src: url("fonts/martel/Martel-Regular-devanagari.woff2"); unicode-range: U+0900-097F, U+200C-200D, U+25CC; }
@font-face { font-family: "Martel"; font-weight: 700; font-display: swap; src: url("fonts/martel/Martel-Bold-latin.woff2"); }
@font-face { font-family: "Martel"; font-weight: 700; font-display: swap; src: url("fonts/martel/Martel-Bold-devanagari.woff2"); unicode-range: U+0900-097F, U+200C-200D, U+25CC; }
@font-face { font-family: "Martel"; font-weight: 800; font-display: swap; src: url("fonts/martel/Martel-ExtraBold-latin.woff2"); }
@font-face { font-family: "Martel"; font-weight: 800; font-display: swap; src: url("fonts/martel/Martel-ExtraBold-devanagari.woff2"); unicode-range: U+0900-097F, U+200C-200D, U+25CC; }
@font-face { font-family: "Martel Sans"; font-weight: 400; font-display: swap; src: url("fonts/martelsans/MartelSans-Regular-latin.woff2"); }
@font-face { font-family: "Martel Sans"; font-weight: 400; font-display: swap; src: url("fonts/martelsans/MartelSans-Regular-devanagari.woff2"); unicode-range: U+0900-097F, U+200C-200D, U+25CC; }
@font-face { font-family: "Martel Sans"; font-weight: 600; font-display: swap; src: url("fonts/martelsans/MartelSans-SemiBold-latin.woff2"); }
@font-face { font-family: "Martel Sans"; font-weight: 600; font-display: swap; src: url("fonts/martelsans/MartelSans-SemiBold-devanagari.woff2"); unicode-range: U+0900-097F, U+200C-200D, U+25CC; }
@font-face { font-family: "Martel Sans"; font-weight: 700; font-display: swap; src: url("fonts/martelsans/MartelSans-Bold-latin.woff2"); }
@font-face { font-family: "Martel Sans"; font-weight: 700; font-display: swap; src: url("fonts/martelsans/MartelSans-Bold-devanagari.woff2"); unicode-range: U+0900-097F, U+200C-200D, U+25CC; }

/* What the text is drawn in until a face arrives: a system font scaled to the same width and
   line box, so the swap moves nothing. How the numbers are measured: fonts/README.md. */
@font-face { font-family: "Martel Fallback"; font-weight: 400; src: local("Georgia"); size-adjust: 112.74%; ascent-override: 99.79%; descent-override: 49.85%; line-gap-override: 0%; }
@font-face { font-family: "Martel Fallback"; font-weight: 700; src: local("Georgia Bold"); size-adjust: 98.39%; ascent-override: 114.34%; descent-override: 57.12%; line-gap-override: 0%; }
@font-face { font-family: "Martel Fallback"; font-weight: 800; src: local("Georgia Bold"); size-adjust: 99.17%; ascent-override: 113.44%; descent-override: 56.67%; line-gap-override: 0%; }
@font-face { font-family: "Martel Sans Fallback"; font-weight: 400; src: local("Arial"), local("Roboto"), local("Helvetica Neue"); size-adjust: 107.91%; ascent-override: 106.57%; descent-override: 62.46%; line-gap-override: 0%; }
@font-face { font-family: "Martel Sans Fallback"; font-weight: 600; src: local("Arial Bold"), local("Roboto Bold"), local("Helvetica Neue Bold"); size-adjust: 102.69%; ascent-override: 111.98%; descent-override: 65.63%; line-gap-override: 0%; }
@font-face { font-family: "Martel Sans Fallback"; font-weight: 700; src: local("Arial Bold"), local("Roboto Bold"), local("Helvetica Neue Bold"); size-adjust: 105.60%; ascent-override: 108.91%; descent-override: 63.83%; line-gap-override: 0%; }

:root {
  color-scheme: light;

  /* Colour */
  --page: #F4F4F2;
  --sheet: #FFFFFF;
  --ink: #231F1D;
  --ink-2: #615A56;
  --rule: #DAD6D2;
  --rule-strong: #A39C96;
  --edge: #8A827C; /* control boundaries: 3:1 on page and sheet (WCAG 1.4.11) */
  --ox: #6E2A2A;
  --ox-press: #5A2121;
  --ox-wash: #F4ECEA;
  --on-ox: #FFFFFF;
  --amber: #8A5A00;
  --amber-wash: #F8EEDB;
  --focus: #6E2A2A;
  --scrim: rgb(35 31 29 / 0.45);

  /* Chart palette: validated with the dataviz palette validator (PRP-3 PR body). */
  --chart-cat-1: #236292;
  --chart-cat-2: #81385E;
  --chart-cat-3: #3B8960;
  --chart-seq-1: #DAA09B;
  --chart-seq-2: #C77F79;
  --chart-seq-3: #B25E59;
  --chart-seq-4: #954440;
  --chart-seq-5: #742E2B;
  --chart-flag: #8A5A00; /* the amber flag itself */

  /* Type: Martel for display and prices, Martel Sans for text. Each is followed by its
     metric-matched fallback above; the Noto Devanagari faces are the fallback named in
     docs/design/direction.md. */
  --serif: "Martel", "Martel Fallback", "Noto Serif Devanagari", Georgia, serif;
  --sans: "Martel Sans", "Martel Sans Fallback", "Noto Sans Devanagari", system-ui, sans-serif;
  --text-xs: 0.8125rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.1875rem;
  --text-xl: 1.5rem;
  --text-2xl: 1.6875rem;
  --text-3xl: 2.125rem;
  --leading-tight: 1.25;
  --leading-body: 1.6;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* Radius: controls, sheets and cards, the top of a bottom sheet. */
  --radius-1: 3px;
  --radius-2: 6px;
  --radius-3: 14px;

  /* Elevation: overlays only (tooltip, toast, modal, bottom sheet), never on cards. */
  --elevation-1: 0 1px 2px rgb(35 31 29 / 0.12);
  --elevation-2: 0 10px 28px rgb(35 31 29 / 0.18);

  /* Motion (PRP-4): 150-250 ms, ease-out; one signature motion at most 400 ms. */
  --motion-press: 80ms;
  --motion-fast: 150ms;
  --motion-base: 200ms;
  --motion-slow: 250ms;
  --motion-signature: 400ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Smallest side of anything you can press. */
  --target: 44px;
}

@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #1A1615;
    --sheet: #221D1B;
    --ink: #EDE7E3;
    --ink-2: #A99F99;
    --rule: #3A322F;
    --rule-strong: #5E5450;
    --edge: #7E736E;
    --ox: #D88A80;
    --ox-press: #E6A49B;
    --ox-wash: #3A2522;
    --on-ox: #1A1615;
    --amber: #E0A94A;
    --amber-wash: #3A2C12;
    --focus: #D88A80;
    --scrim: rgb(0 0 0 / 0.6);
    --chart-cat-1: #4886B8;
    --chart-cat-2: #B16389;
    --chart-cat-3: #2B7A52;
    --chart-seq-1: #83423E;
    --chart-seq-2: #A45953;
    --chart-seq-3: #C2736D;
    --chart-seq-4: #DB918B;
    --chart-seq-5: #EEB3AD;
    --chart-flag: #B68028; /* amber, darkened into the dark chart band */
    --elevation-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --elevation-2: 0 10px 28px rgb(0 0 0 / 0.55);
  }
}

@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;
    --page: #1A1615;
    --sheet: #221D1B;
    --ink: #EDE7E3;
    --ink-2: #A99F99;
    --rule: #3A322F;
    --rule-strong: #5E5450;
    --edge: #7E736E;
    --ox: #D88A80;
    --ox-press: #E6A49B;
    --ox-wash: #3A2522;
    --on-ox: #1A1615;
    --amber: #E0A94A;
    --amber-wash: #3A2C12;
    --focus: #D88A80;
    --scrim: rgb(0 0 0 / 0.6);
    --chart-cat-1: #4886B8;
    --chart-cat-2: #B16389;
    --chart-cat-3: #2B7A52;
    --chart-seq-1: #83423E;
    --chart-seq-2: #A45953;
    --chart-seq-3: #C2736D;
    --chart-seq-4: #DB918B;
    --chart-seq-5: #EEB3AD;
    --chart-flag: #B68028; /* amber, darkened into the dark chart band */
    --elevation-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --elevation-2: 0 10px 28px rgb(0 0 0 / 0.55);
  }
}

@media (pointer: coarse) {
  :root {
    --target: 48px;
  }
}

/* Reduced motion shows final states: every duration collapses to zero. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-press: 0ms;
    --motion-fast: 0ms;
    --motion-base: 0ms;
    --motion-slow: 0ms;
    --motion-signature: 0ms;
  }
}

/* Component kit (D-PRP-3-css-first-kit). Needs tokens.css first. Plain classes, so the
   Python-generated pilot pages and the Next.js wrappers in web/components/ui/ share them.
   State hooks: :hover, :active, :focus-visible, :disabled / [aria-disabled="true"],
   [aria-busy="true"]. The .is-hover, .is-pressed and .is-focus-visible classes render
   those states statically (the gallery and screenshots); never use them in a product.
   State changes are instant, so feedback lands within 100 ms; entrances are in motion.css. */

/* Base */
:where(body) {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  font-variant-numeric: tabular-nums;
}

/* A ligature glyph (Martel Sans has fi and fl) carries no text in a PDF Chromium prints, so a
   search for "floor" would miss. Devanagari conjuncts are not common ligatures and stay
   (D-PRP-44-vendored-fonts). */
@media print {
  :where(body) {
    font-variant-ligatures: no-common-ligatures;
  }
}

[hidden] {
  display: none !important;
}

:where(.btn, .chip, .seg-option, .input, .select, .link-btn, .tooltip-trigger, .theme-toggle) {
  font: inherit;
  box-sizing: border-box;
  margin: 0;
}

:where(.btn, .chip, .seg-option, .input, .select, .link-btn, .tooltip-trigger, .table-scroll, .theme-toggle):focus-visible,
.is-focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Button: primary (oxblood) by default, .btn-secondary for the second action. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--target);
  min-width: var(--target);
  padding: 0 18px;
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--on-ox);
  background: var(--ox);
  border: 1px solid var(--ox);
  border-radius: var(--radius-1);
  cursor: pointer;
}

.btn-secondary {
  color: var(--ox);
  background: var(--sheet);
}

.btn:not(:disabled, [aria-disabled="true"], [aria-busy="true"]):hover,
.btn.is-hover {
  background: var(--ox-press);
  border-color: var(--ox-press);
}

.btn-secondary:not(:disabled, [aria-disabled="true"], [aria-busy="true"]):hover,
.btn-secondary.is-hover {
  background: var(--ox-wash);
  border-color: var(--ox);
}

.btn:not(:disabled, [aria-disabled="true"], [aria-busy="true"]):active,
.btn.is-pressed {
  background: var(--ox-press);
  border-color: var(--ox-press);
  transform: translateY(1px);
}

.btn-secondary:not(:disabled, [aria-disabled="true"], [aria-busy="true"]):active,
.btn-secondary.is-pressed {
  background: var(--ox-wash);
  border-color: var(--ox-press);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  color: var(--ink-2);
  background: var(--page);
  border-color: var(--rule);
  cursor: not-allowed;
}

/* Loading keeps the action's place and names the step; the ring only says "working".
   No dimming: at 0.85 opacity the dark theme's label fell under 4.5:1. */
.btn[aria-busy="true"] {
  cursor: progress;
}

.btn[aria-busy="true"]::after,
.link-btn[aria-busy="true"]::after,
.context-bar[aria-busy="true"] .link-btn::after {
  content: "";
  width: 0.9em;
  height: 0.9em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
}

/* Chip and segmented control: toggles with aria-pressed. */
.chip,
.seg-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--target);
  min-width: var(--target);
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--edge);
  border-radius: var(--radius-1);
  cursor: pointer;
}

:is(.chip, .seg-option)[aria-pressed="true"] {
  color: var(--sheet);
  background: var(--ink);
  border-color: var(--ink);
}

:is(.chip, .seg-option).is-hover {
  background: var(--ox-wash);
  border-color: var(--ink);
}


:is(.chip, .seg-option):not(:disabled, [aria-disabled="true"], [aria-busy="true"]):active,
:is(.chip, .seg-option).is-pressed {
  background: var(--ox-wash);
  border-color: var(--ink);
  transform: translateY(1px);
}

:is(.chip, .seg-option)[aria-pressed="true"]:not(:disabled, [aria-disabled="true"], [aria-busy="true"]):active,
:is(.chip, .seg-option)[aria-pressed="true"]:is(.is-hover, .is-pressed) {
  background: var(--ink-2);
  border-color: var(--ink-2);
}

/* Toggles drop :hover on touch screens, where it sticks after a tap and makes a chip just
   pressed look unlike the others in its state. */
@media (hover: hover) {
  :is(.chip, .seg-option):not(:disabled, [aria-disabled="true"], [aria-busy="true"]):hover {
    background: var(--ox-wash);
    border-color: var(--ink);
  }

  :is(.chip, .seg-option)[aria-pressed="true"]:not(:disabled, [aria-disabled="true"], [aria-busy="true"]):hover {
    background: var(--ink-2);
    border-color: var(--ink-2);
  }
}

:is(.chip, .seg-option):disabled,
:is(.chip, .seg-option)[aria-disabled="true"] {
  color: var(--ink-2);
  background: var(--page);
  border-color: var(--rule);
  cursor: not-allowed;
}

:is(.chip, .seg-option)[aria-busy="true"],
.seg[aria-busy="true"] > .seg-option {
  opacity: 0.75;
  border-style: dashed;
  cursor: progress;
}

.seg {
  display: inline-flex;
  gap: 0;
}

.seg-option {
  border-radius: 0;
}

.seg-option + .seg-option {
  margin-left: -1px;
}

.seg-option:first-child {
  border-radius: var(--radius-1) 0 0 var(--radius-1);
}

.seg-option:last-child {
  border-radius: 0 var(--radius-1) var(--radius-1) 0;
}

.seg-option:focus-visible,
.seg-option.is-focus-visible {
  position: relative;
  z-index: 1;
}

/* Theme toggle: one icon button that flips between light and dark (D-PRP-52-icon-theme-toggle).
   It names the action and shows the moon while light shows, the sun while dark shows; theme.js
   sets data-shows on a toggle it has wired and marks it .is-live. Until then, and without
   JavaScript, the toggle keeps its place unseen. Print is always light, so it has no toggle. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-height: var(--target);
  min-width: var(--target);
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: var(--radius-1);
  cursor: pointer;
}

.theme-toggle:not(.is-live) {
  visibility: hidden;
}

.theme-toggle .icon {
  width: 20px;
  height: 20px;
}

.theme-toggle[data-shows="dark"] > .icon:first-child,
.theme-toggle:not([data-shows="dark"]) > .icon:last-child {
  display: none;
}

.theme-toggle:is(.is-hover, .is-pressed, :active) {
  background: var(--ox-wash);
}

.theme-toggle:is(.is-pressed, :active) {
  transform: translateY(1px);
}

/* No :hover on touch screens, where it sticks after a tap. */
@media (hover: hover) {
  .theme-toggle:hover {
    background: var(--ox-wash);
  }
}

@media print {
  .theme-toggle {
    display: none !important;
  }
}

/* Fields: input and select share one look. */
.field {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.field-label {
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}

.input,
.select {
  width: 100%;
  min-width: 0; /* a date input's own minimum would push it out of a narrow grid or flex track */
  min-height: var(--target);
  /* Martel Sans puts the cap-height box 0.11em above the middle of its line box; 0.22em of
     top padding moves it back to the field's centre, for typed text and the sample alike. */
  padding: 0.22em var(--space-3) 0;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--edge);
  border-radius: var(--radius-1);
}

/* The sample in an empty field: secondary ink and regular weight, so it never reads as a typed value. */
.input::placeholder {
  font-weight: 400;
  color: var(--ink-2);
  opacity: 1;
}

:is(.input, .select):not(:disabled, [aria-disabled="true"], [aria-busy="true"]):hover,
:is(.input, .select).is-hover {
  border-color: var(--ink-2);
}

:is(.input, .select):not(:disabled, [aria-disabled="true"], [aria-busy="true"]):active,
:is(.input, .select).is-pressed {
  background: var(--page);
  border-color: var(--ink);
}

:is(.input, .select):disabled {
  color: var(--ink-2);
  background: var(--page);
  border-color: var(--rule);
  cursor: not-allowed;
}

:is(.input, .select)[aria-busy="true"] {
  color: var(--ink-2);
  border-style: dashed;
  cursor: progress;
}

/* Checkbox: the native box and its label are one target; the box takes the accent. */
.check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  min-height: var(--target);
  padding: var(--space-2) 0;
  line-height: 1.4;
  cursor: pointer;
}

.check-box {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0.1em 0 0;
  accent-color: var(--ox);
  cursor: inherit;
}

.check-box:focus-visible,
.check-box.is-focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.check:not(:has(:disabled), [aria-busy="true"]):hover,
.check.is-hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.check:not(:has(:disabled), [aria-busy="true"]):active .check-box,
.check.is-pressed .check-box {
  transform: scale(0.9);
}

.check:has(:disabled) {
  color: var(--ink-2);
  cursor: not-allowed;
}

.check[aria-busy="true"] {
  color: var(--ink-2);
  cursor: progress;
}

/* Errors are ink with an icon and a message next to the field (D-PRP-3-css-first-kit). */
:is(.input, .select)[aria-invalid="true"] {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.select-box {
  position: relative;
  display: block;
}

.select {
  appearance: none;
  padding-right: 40px;
  cursor: pointer;
}

.select-box::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.helper-text {
  margin: 0;
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--ink-2);
}

.field-error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.45;
  color: var(--ink);
}

.field-error .icon {
  margin-top: 1px;
}

/* Link button: reset-to-default and the context bar's change action. */
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--target);
  min-width: var(--target);
  padding: 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ox);
  background: transparent;
  border: 0;
  border-radius: var(--radius-1);
  text-decoration-line: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-btn:not(:disabled, [aria-disabled="true"], [aria-busy="true"]):hover,
.link-btn.is-hover {
  background: var(--ox-wash);
}

.link-btn:not(:disabled, [aria-disabled="true"], [aria-busy="true"]):active,
.link-btn.is-pressed {
  background: var(--ox-wash);
  color: var(--ox-press);
  transform: translateY(1px);
}

.link-btn:disabled,
.link-btn[aria-disabled="true"] {
  color: var(--ink-2);
  text-decoration-line: none;
  cursor: not-allowed;
}

.link-btn[aria-busy="true"] {
  text-decoration-line: none;
  cursor: progress;
}

/* Sticky context bar: project, flat, quote; the change action edits them. */
.context-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-5);
  padding: var(--space-2) var(--space-4);
  background: var(--sheet);
  border-bottom: 1px solid var(--rule);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.context-bar-items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-5);
  margin: 0;
}

.context-bar-items > div {
  display: flex;
  gap: 6px;
  align-items: baseline;
}

.context-bar-items dt {
  color: var(--ink-2);
}

.context-bar-items dd {
  margin: 0;
  font-weight: 700;
  color: var(--ink);
}

.context-bar .link-btn {
  margin-left: auto;
}

.context-bar[aria-busy="true"] {
  cursor: progress;
}

.context-bar[aria-busy="true"] dd {
  color: var(--ink-2);
}

/* Filter chips: the reset appears only while the view differs from the default. */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* Tiles: big number, small label. */
.tiles,
.skeleton-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
}

.tile,
.skeleton-tiles > .skeleton-line {
  padding: var(--space-3) var(--space-4) 14px;
  border-left: 1px solid var(--rule);
  font-variant-numeric: tabular-nums;
}

.tile:first-child,
.skeleton-tiles > .skeleton-line:first-child {
  border-left: 0;
}

.tile-label {
  font-size: var(--text-xs);
  color: var(--ink-2);
}

.tile-value {
  margin-top: var(--space-1);
  font-family: var(--serif);
  font-size: var(--text-xl);
  font-weight: 800;
  line-height: var(--leading-tight);
  color: var(--ink);
}

.tile-note {
  margin-top: 2px;
  font-size: 0.78125rem;
  color: var(--ink-2);
}

.tile-flag .tile-value {
  color: var(--amber);
}

/* Table: ruled, numbers right-aligned. Phones use deed cards instead.
   A .table-scroll that can scroll takes tabindex="0", role="region" and a label, so keys scroll it. */
.table-scroll {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

.table th {
  padding: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: left;
  vertical-align: bottom;
  color: var(--ink-2);
  border-bottom: 1px solid var(--rule-strong);
}

.table td {
  padding: 10px var(--space-2);
  border-bottom: 1px solid var(--rule);
}

.table .num {
  text-align: right;
  white-space: nowrap;
}

/* Tooltip: explains jargon where it appears; opens on hover and keyboard focus. */
.tooltip-anchor {
  position: relative;
  display: inline-flex;
}

.tooltip-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--target);
  padding: 0 2px;
  color: inherit;
  background: none;
  border: 0;
  border-radius: var(--radius-1);
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  cursor: help;
}

.tooltip {
  position: absolute;
  bottom: calc(100% + 2px);
  left: 0;
  z-index: 20;
  width: max-content;
  max-width: 32ch;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--sheet);
  background: var(--ink);
  border-radius: var(--radius-1);
  box-shadow: var(--elevation-1);
  opacity: 0;
  visibility: hidden;
}

.tooltip-anchor:is(:hover, :focus-within):not([data-dismissed]) .tooltip,
.tooltip.is-open {
  opacity: 1;
  visibility: visible;
}

/* Toast: one calm line naming the result. */
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  max-width: 440px;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.45;
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-2);
  box-shadow: var(--elevation-2);
  pointer-events: auto;
}

/* Motion.toast stacks toasts at the bottom of the screen in two live regions: polite for
   a result, assertive for an error, which stays until dismissed and can offer a retry. */
.toasts {
  position: fixed;
  inset: auto var(--space-4) var(--space-4);
  z-index: 30;
  display: grid;
  justify-items: center;
  pointer-events: none;
}

.toast-region {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
}

.toast-region:not(:empty) {
  margin-top: var(--space-2);
}

.toast-body {
  display: grid;
  min-width: 0;
}

.toast-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-2);
  margin: 0 calc(-1 * var(--space-2)) calc(-1 * var(--space-2));
}

/* Modal and bottom sheet: <dialog> opened with showModal(). */
.modal,
.bottom-sheet {
  position: fixed;
  box-sizing: border-box;
  overflow: auto;
  color: var(--ink);
  background: var(--sheet);
  box-shadow: var(--elevation-2);
}

.modal {
  inset: 0;
  width: min(480px, calc(100% - 32px));
  max-width: none;
  height: fit-content;
  max-height: calc(100% - 32px);
  margin: auto;
  padding: var(--space-5);
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
}

.bottom-sheet {
  inset: auto 0 0;
  width: 100%;
  max-width: none;
  max-height: 85%;
  margin: 0;
  padding: var(--space-2) var(--space-4) var(--space-5);
  border: 0;
  border-top: 1px solid var(--rule);
  border-radius: var(--radius-3) var(--radius-3) 0 0;
}

.bottom-sheet::before {
  content: "";
  display: block;
  width: 36px;
  height: 4px;
  margin: 0 auto var(--space-3);
  border-radius: 2px;
  background: var(--rule-strong);
}

.modal::backdrop,
.bottom-sheet::backdrop,
.scrim {
  background: var(--scrim);
}

.scrim {
  position: fixed;
  inset: 0;
}

.dialog-title {
  margin: 0;
  font-family: var(--serif);
  font-size: var(--text-lg);
  font-weight: 800;
  line-height: 1.3;
}

.dialog-body {
  margin: var(--space-2) 0 0;
  color: var(--ink-2);
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

.bottom-sheet .dialog-actions .btn {
  flex: 1;
}

/* Skeleton: shown only when loading passes 300 ms (PRP-4 times it). */
.skeleton {
  display: grid;
  gap: var(--space-2);
}

.skeleton-line {
  display: block;
  height: 0.9em;
  border-radius: var(--radius-1);
  background: var(--rule);
}

.skeleton-line:last-child {
  width: 60%;
}

/* Skeleton variants stand in for the report's parts at their size, so the swap moves
   nothing. Each is .skeleton plus .skeleton-line children: 5 for the headline, 4 for the
   tiles, 2 for a chart, a header and one per row for the table. */
.skeleton-headline,
.skeleton-tiles,
.skeleton-chart,
.skeleton-table {
  gap: 0;
}

:is(.skeleton-headline, .skeleton-tiles, .skeleton-chart, .skeleton-table) > .skeleton-line {
  box-sizing: border-box;
  width: auto;
  background-clip: content-box;
}

/* Headline: the quote check. Verdict lines, the basis, then the strip's track. A phone
   wraps the verdict to three lines and the basis to two. */
.skeleton-headline > .skeleton-line {
  width: min(100%, 30rem);
  height: calc(1.3 * var(--text-2xl));
  padding-block: 7px;
}

.skeleton-headline > .skeleton-line:nth-child(3) {
  width: min(60%, 18rem);
}

.skeleton-headline > .skeleton-line:nth-child(4) {
  height: calc(2 * var(--leading-body) * var(--text-sm));
  margin-top: var(--space-1);
  padding-block: 5px calc(var(--leading-body) * var(--text-sm) + 5px);
}

.skeleton-headline > .skeleton-line:nth-child(5) {
  width: auto;
  height: 116px;
  margin-top: var(--space-4);
  padding: 37px 8px 53px;
}

@media (min-width: 600px) {
  .skeleton-headline > .skeleton-line:nth-child(2) {
    width: min(60%, 18rem);
  }

  .skeleton-headline > .skeleton-line:nth-child(3) {
    display: none;
  }

  .skeleton-headline > .skeleton-line:nth-child(4) {
    height: calc(var(--leading-body) * var(--text-sm));
    padding-block: 5px;
  }
}

/* Tiles: grid, ruling and padding come from .tiles and .tile; each line is one tile with a
   label bar and a value bar. */
.skeleton-tiles > .skeleton-line {
  height: calc(var(--leading-body) * var(--text-xs) + var(--leading-tight) * var(--text-xl) + 1.25rem + 32px);
  background: none;
  border-radius: 0;
}

.skeleton-tiles > .skeleton-line::before,
.skeleton-tiles > .skeleton-line::after {
  content: "";
  display: block;
  border-radius: var(--radius-1);
  background: var(--rule);
}

.skeleton-tiles > .skeleton-line::before {
  width: 60%;
  height: 0.75rem;
  margin-top: 4px;
}

.skeleton-tiles > .skeleton-line::after {
  width: 80%;
  height: 1.25rem;
  margin-top: 14px;
}

/* Chart: its title, then the plot at --chart-ratio (the width / height of its viewBox). */
.skeleton-chart > .skeleton-line:first-child {
  width: 50%;
  height: calc(var(--leading-body) * var(--text-base));
  margin-bottom: var(--space-2);
  padding-block: 6px;
}

.skeleton-chart > .skeleton-line:last-child {
  height: auto;
  aspect-ratio: var(--chart-ratio, 16 / 9);
  background: none;
  border: 1px solid var(--rule);
}

/* Table: the header, then one line per row, ruled like .table. */
.skeleton-table > .skeleton-line {
  height: calc(var(--leading-body) * 0.9375rem + 21px);
  padding: 14px var(--space-2);
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
}

.skeleton-table > .skeleton-line:first-child {
  height: calc(var(--leading-body) * var(--text-xs) + 17px);
  padding: 12px 60% 12px var(--space-2);
  border-bottom-color: var(--rule-strong);
}

/* Slot: a part and its stand-ins share one cell; stand-ins show by Motion.wait stage and
   loop only while shown (D-PRP-4-skeleton-holds-the-slot). */
.slot {
  display: grid;
}

.slot > * {
  grid-area: 1 / 1;
  align-self: start;
  min-width: 0;
}

.slot > :is(.skeleton, .progress, .progress-text) {
  visibility: hidden;
}

:is([data-wait="skeleton"], [data-wait="step"]) .slot > :is(.skeleton, .progress),
[data-wait="step"] .slot > .progress-text {
  visibility: visible;
}

.slot > .skeleton .skeleton-line,
.slot > .progress > .progress-bar::after {
  animation-play-state: paused;
}

:is([data-wait="skeleton"], [data-wait="step"]) .slot > .skeleton .skeleton-line,
:is([data-wait="skeleton"], [data-wait="step"]) .slot > .progress > .progress-bar::after {
  animation-play-state: running;
}

/* Empty and error states: say what happened and offer the way forward. */
.empty-state,
.error-state {
  display: grid;
  justify-items: start;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
}

.error-state {
  border-left: 3px solid var(--ink);
}

.state-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1.4;
}

.state-body {
  margin: 0;
  max-width: 60ch;
  color: var(--ink-2);
}

.state-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

/* Icons: one outline set at one stroke width (docs/design/direction.md). */
.icon {
  display: inline-flex;
  flex: none;
  width: 1.25em;
  height: 1.25em;
}

.icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Quote check: the signature strip. Deeds as dots, median rule, dashed run to the quote. */
.quote-check {
  font-variant-numeric: tabular-nums;
}

.quote-check-headline {
  max-width: 32ch;
  margin: 0 0 var(--space-1);
  font-family: var(--serif);
  font-size: var(--text-2xl);
  font-weight: 800;
  line-height: 1.3;
}

.quote-check-basis {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.quote-check-strip {
  display: block;
  width: 100%;
  height: auto;
  margin-top: var(--space-4);
  overflow: visible;
}

.qc-track {
  fill: var(--page);
  stroke: var(--rule);
}

.qc-band {
  fill: var(--ox-wash);
  stroke: var(--ox);
  stroke-width: 1.5;
}

.qc-deed {
  fill: var(--ox);
}

.qc-deed-flagged {
  fill: var(--chart-flag);
}

.qc-median {
  stroke: var(--ink);
  stroke-width: 2.25;
}

.qc-run {
  stroke: var(--amber);
  stroke-width: 1.5;
  stroke-dasharray: 5 4;
}

.qc-pin {
  stroke: var(--amber);
  stroke-width: 2.25;
}

.qc-pin-head {
  fill: var(--amber);
}

.qc-label {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  fill: var(--ink);
}

.qc-label-quote {
  fill: var(--amber);
}

.qc-tick {
  stroke: var(--rule-strong);
}

.qc-tick-label {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 500;
  fill: var(--ink-2);
}

/* The withheld band of the free preview: dashed, with no figures on it. */
.qc-band-locked {
  stroke-dasharray: 4 3;
}

/* The free preview's quote: a caption in ink, no pin stroke (D-PRP-51-preview-pin). */
.qc-pin.qc-pin-unplaced {
  stroke: none;
}

/* Chart: a figure titled by its caption, an HTML legend, then an SVG plot drawn at the plot's
   own width (1 viewBox unit = 1 px), so its text keeps its size at every width. */
.chart-fig {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
  margin: 0;
}

.chart-caption {
  display: grid;
  gap: var(--space-1);
}

.chart-title {
  font-weight: 700;
}

.chart-note {
  max-width: 68ch;
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  font-size: var(--text-xs);
  color: var(--ink-2);
}

.chart-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-key svg {
  flex: none;
  width: 22px;
  height: 14px;
}

.chart-plot {
  position: relative;
  min-width: 0;
}

/* Its height is the SVG's height attribute, so the page does not move when the width is measured. */
.chart-svg {
  display: block;
  width: 100%;
  overflow: visible;
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
}

.chart-grid {
  stroke: var(--rule);
  stroke-width: 1;
}

.chart-axis {
  stroke: var(--rule-strong);
  stroke-width: 1;
}

.chart-tick {
  font-size: 11px;
  fill: var(--ink-2);
}

.chart-label {
  font-size: 13px;
  fill: var(--ink);
}

.chart-value {
  font-size: 13px;
  font-weight: 700;
  fill: var(--ink);
}

.chart-dot {
  stroke: var(--sheet);
  stroke-width: 2;
}

/* A series' colour, in the kit's fixed categorical order; past three, one neutral "other". */
.chart-tone-1 {
  fill: var(--chart-cat-1);
}

.chart-tone-2 {
  fill: var(--chart-cat-2);
}

.chart-tone-3 {
  fill: var(--chart-cat-3);
}

.chart-tone-other {
  fill: var(--ink-2);
}

/* A flagged deed: a ring as well as its dot, so the flag is never colour alone. */
.chart-ring,
.chart-ring-key {
  fill: none;
  stroke: var(--chart-flag);
  stroke-width: 2;
}

/* The point's target: larger than the dot, and where keyboard focus shows. */
.chart-hit {
  fill: transparent;
  cursor: pointer;
}

.chart-hit:focus {
  outline: none;
}

.chart-hit:focus-visible,
.chart-hit:hover {
  stroke: var(--focus);
  stroke-width: 2;
}

.chart-line {
  fill: none;
  stroke: var(--chart-cat-1);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-quote {
  stroke: var(--amber);
  stroke-width: 2;
  stroke-dasharray: 6 4;
}

.chart-bar {
  fill: var(--chart-cat-1);
}

.chart-zero {
  stroke: var(--ink-2);
  stroke-width: 1;
}

/* The point's tooltip, beside it; data-side="left" when the point is in the right half. */
.chart-tip {
  position: absolute;
  z-index: 5;
  display: grid;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  line-height: 1.45;
  white-space: nowrap;
  color: var(--sheet);
  background: var(--ink);
  border-radius: var(--radius-1);
  box-shadow: var(--elevation-1);
  pointer-events: none;
  transform: translate(14px, -50%);
}

.chart-tip[data-side="left"] {
  transform: translate(calc(-100% - 14px), -50%);
}

/* Text for assistive technology only: a chart's table of figures. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Deed card: a phone row; nothing truncated. */
.deed-card {
  position: relative;
  padding: var(--space-3) 14px var(--space-3) 26px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius-2);
  font-variant-numeric: tabular-nums;
}

.deed-card::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 12px;
  border-left: 1px solid var(--ox);
  opacity: 0.45;
}

.deed-card-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px var(--space-3);
}

.deed-card-flat,
.deed-card-price {
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 800;
}

.deed-card-meta {
  font-size: var(--text-xs);
  color: var(--ink-2);
}

/* Label: a short status beside a figure ("High confidence"); .label-flag is the amber flag. */
.label {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1.5;
  color: var(--ink);
  white-space: nowrap;
  border: 1px solid var(--edge);
  border-radius: var(--radius-1);
}

.label-flag {
  color: var(--amber);
  background: var(--amber-wash);
  border-color: var(--amber);
}

/* Listbox: a combobox's options under its input. The active option (keyboard or pointer)
   takes the wash; the input keeps focus. */
.listbox {
  margin: var(--space-1) 0 0;
  padding: 0;
  list-style: none;
  background: var(--sheet);
  border: 1px solid var(--edge);
  border-radius: var(--radius-1);
}

.listbox-option {
  display: grid;
  gap: 2px;
  min-height: var(--target);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  border-bottom: 1px solid var(--rule);
}

.listbox-option:last-child {
  border-bottom: 0;
}

.listbox-option[aria-selected="true"],
.listbox-option.is-hover {
  background: var(--ox-wash);
}

@media (hover: hover) {
  .listbox-option:hover {
    background: var(--ox-wash);
  }
}

.listbox-name {
  font-weight: 700;
  color: var(--ox);
}

.listbox-meta {
  font-size: var(--text-sm);
  color: var(--ink-2);
}

/* One-line messages. */
.legal-line {
  max-width: 74ch;
  margin: 0;
  font-size: 0.78125rem;
  line-height: 1.5;
  color: var(--ink-2);
}

.success,
.progress-text {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.45;
}

.success {
  font-weight: 600;
  color: var(--ink);
}

.progress-text {
  color: var(--ink-2);
}

/* Progress: an indeterminate bar ([role="progressbar"], no value) over one line of text:
   .progress-label says what is being prepared, and .progress-text replaces it at the
   step stage. */
.progress {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.progress-bar {
  position: relative;
  display: block;
  height: 4px;
  border-radius: var(--radius-1);
  background: var(--rule);
}

.progress-bar::after {
  content: "";
  position: absolute;
  inset: 0 30%;
  border-radius: inherit;
  background: var(--ink-2);
}

.progress-label {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--ink-2);
}

.progress > .progress-text,
[data-wait="step"] .progress > .progress-label {
  display: none;
}

[data-wait="step"] .progress > .progress-text {
  display: flex;
}

/* Amber text: a flag, or a quote above what buyers paid. Last, so it beats muted text. */
.flag {
  font-weight: 700;
  color: var(--amber);
}

@keyframes kit-spin {
  to {
    transform: rotate(1turn);
  }
}

@keyframes kit-pulse {
  50% {
    opacity: 0.55;
  }
}

/* Reduced motion shows the final state: the ring, the skeleton and the bar stay still.
   The bar waits as the skeleton does, in place (D-PRP-42-waiting-pulses-in-place). */
@media (prefers-reduced-motion: no-preference) {
  .btn[aria-busy="true"]::after,
  .link-btn[aria-busy="true"]::after,
  .context-bar[aria-busy="true"] .link-btn::after {
    animation: kit-spin 0.8s linear infinite;
  }

  .skeleton-line,
  .progress-bar::after {
    animation: kit-pulse 1.4s ease-in-out infinite;
  }
}

/* Motion (PRP-4). Needs tokens.css and components.css; Motion (motion.js) sets the classes.
   Entrances move only transform, opacity and stroke-dashoffset, so nothing shifts
   (D-PRP-4-entrances-never-hide-content). Pressed, hover and focus stay instant
   (D-PRP-3-css-first-kit). */

/* Reveal: a section below the fold waits faded, then comes in once on first view. */
[data-reveal].is-waiting {
  opacity: 0;
  translate: 0 var(--space-2);
}

[data-reveal].is-revealed {
  transition: opacity var(--motion-base) var(--ease-out), translate var(--motion-base) var(--ease-out);
}

/* Draw-in: Motion.drawIn measures each stroke into --draw, then lets it in once. */
.is-undrawn,
.is-drawing {
  stroke-dasharray: var(--draw);
}

.is-undrawn {
  stroke-dashoffset: var(--draw);
}

.is-drawing {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset var(--motion-slow) var(--ease-out);
}

/* Toast: fades out, then Motion removes it. */
.toast.is-leaving {
  opacity: 0;
  transition: opacity var(--motion-fast) var(--ease-out);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(var(--space-2));
  }
}

/* The quote pin drops in and is still by 85%, so it has settled well inside 400 ms. */
@keyframes pin-settle {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }

  60% {
    opacity: 1;
    transform: translateY(1px);
  }

  85%,
  to {
    transform: none;
  }
}

/* Arrival (Motion.fadeIn): content that has just come in, such as search results. */
@keyframes arrive {
  from {
    opacity: 0;
  }
}

/* Flash (Motion.flash): a figure a filter change rewrote. A neutral token: amber means a flag
   and oxblood an action. */
@keyframes flash {
  from {
    background-color: var(--rule);
  }
}

/* Screen only: a printed page (the PDF) shows every motion's end state. */
@media screen and (prefers-reduced-motion: no-preference) {
  .is-arriving {
    animation: arrive var(--motion-fast) var(--ease-out);
  }

  .is-flashing {
    animation: flash var(--motion-slow) var(--ease-out);
  }

  .toast-region > .toast {
    animation: toast-in var(--motion-base) var(--ease-out);
  }

  /* Once, when the strip is first rendered: update a strip in place, never re-create it. */
  .qc-pin,
  .qc-pin-head,
  .qc-label-quote {
    animation: pin-settle var(--motion-signature) var(--ease-out) both;
  }
}

/* A printed page (the PDF) never scrolls, so nothing may wait for a first view. */
@media print {
  [data-reveal].is-waiting {
    opacity: 1;
    translate: none;
  }

  .is-undrawn {
    stroke-dasharray: none;
    stroke-dashoffset: 0;
  }

}

/* Pilot pages (PRP-6): the patterns the report and the landing shell share that the kit does
   not have yet (docs/design/screens/README.md, "Kit gaps"). Needs web/design/tokens.css and
   components.css first. No colour is declared here: every one is a kit token.
   Why this is not in components.css: D-PRP-6-pilot-page-css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { min-width: 320px; overflow-wrap: break-word; }
svg { max-width: 100%; }

/* Text links: oxblood, since a link is something you press. */
a:not([class]) { color: var(--ox); text-underline-offset: 3px; }
a:not([class]):hover { color: var(--ox-press); }
:is(a, summary):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-1); }

/* Header and brand mark. */
.p-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0 var(--space-3); padding: var(--space-1) var(--space-4); background: var(--sheet); border-bottom: 1px solid var(--rule); }
.p-brand { display: inline-flex; align-items: center; gap: 10px; min-height: var(--target); font-family: var(--serif); font-size: var(--text-lg); font-weight: 800; line-height: 1.2; color: var(--ink); text-decoration: none; }
.p-brand svg { flex: none; width: 28px; height: 28px; }
/* The brand on the left, the rest together on the right. */
.p-header > .p-brand { margin-right: auto; }
/* The toggle's target runs into the padding to hold the row on phones (D-PRP-52-icon-theme-toggle). */
.p-header > .theme-toggle { margin-right: calc(-1 * var(--space-3)); }

/* Page frame and type. */
.p-page { max-width: 1240px; margin: 0 auto; padding: var(--space-4) var(--space-4) var(--space-6); }
.p-h1 { margin: 0; font-family: var(--serif); font-size: var(--text-xl); font-weight: 800; line-height: 1.25; }
.p-h2 { margin: 0 0 var(--space-2); font-family: var(--serif); font-size: 1.3125rem; font-weight: 800; line-height: 1.3; }
.p-muted { color: var(--ink-2); }
.p-small { font-size: var(--text-sm); }
.p-nowrap { white-space: nowrap; }
.p-stack { display: grid; gap: var(--space-3); min-width: 0; }
@media (min-width: 900px) {
  .p-header { padding-inline: var(--space-5); }
  .p-page { padding: var(--space-5) var(--space-5) var(--space-7); }
  .p-h1 { font-size: var(--text-2xl); }
  .p-h2 { font-size: var(--text-xl); }
}

/* Sheet: the register page. The oxblood double margin line shows from tablet width up. */
.p-sheet { position: relative; margin-top: var(--space-4); padding: var(--space-4); background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-2); }
.p-sheet > :first-child { margin-top: 0; }
@media (min-width: 760px) {
  .p-sheet { padding: var(--space-5) var(--space-5) var(--space-5) 44px; }
  .p-sheet::before { content: ""; position: absolute; top: 0; bottom: 0; left: 26px; width: 4px; border-left: 1px solid var(--ox); border-right: 1px solid var(--ox); opacity: 0.5; }
}

/* "What you can tell the builder": the number in plain words. */
.p-say { padding: var(--space-3) var(--space-4); background: var(--ox-wash); border-radius: var(--radius-1); }
.p-say-label { margin: 0; font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); }
.p-say-line { max-width: 62ch; margin: var(--space-1) 0 0; font-family: var(--serif); font-size: 1.0625rem; line-height: 1.6; }
.p-say .link-btn { margin: var(--space-1) 0 calc(-1 * var(--space-2)) calc(-1 * var(--space-2)); }

.p-footer { margin-top: var(--space-6); padding-top: var(--space-3); font-size: var(--text-xs); line-height: 1.5; color: var(--ink-2); border-top: 1px solid var(--rule); }
.p-footer p { margin: 0; }
/* The about and policy links under it (pilot.site.render.POLICY_LINKS): each one a target. */
.p-policies { display: flex; flex-wrap: wrap; gap: 0 var(--space-4); margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.p-policies a { display: inline-flex; align-items: center; min-height: var(--target); }

/* The strip redrawn after a change keeps its pin still (D-PRP-4-entrances-never-hide-content). */
.quote-check-strip.is-settled :is(.qc-pin, .qc-pin-head, .qc-label-quote) { animation: none; }

/* Public pages (PRP-40): the patterns of the approved screens (docs/design/screens/) that
   neither the kit nor pilot/report/page.css has. The build puts this file after
   web/design/tokens.css, components.css, motion.css and pilot/report/page.css in
   /assets/site.css. No colour is declared here: every one is a kit token
   (D-PRP-6-pilot-page-css). */

/* A link that stands on its own line or cell is a target: 44 px. Links inside a sentence are not. */
:is(.table th, .s-kv dd, .s-crumbs li, .s-more) > a:not([class]) { position: relative; display: inline-flex; align-items: center; min-height: var(--target); }
:is(.table th, .s-kv dd, .s-crumbs li, .s-more) > a:not([class])::after { content: ""; position: absolute; inset: 0 -8px; }
a.btn { text-decoration: none; }

/* Keyboard users jump past the header. */
.s-skip { position: absolute; left: var(--space-2); top: -100px; z-index: 20; padding: var(--space-2) var(--space-3); color: var(--ink); background: var(--sheet); border: 1px solid var(--edge); border-radius: var(--radius-1); }
.s-skip:focus { top: var(--space-2); }

/* Header: the brand, and from tablet width the section links and the request action. */
@media (min-width: 600px) { .s-header { flex-wrap: nowrap; } }
.s-nav { display: none; flex-wrap: wrap; gap: 0 var(--space-1); }
.s-header .btn { display: none; }
.link-btn[aria-current="page"] { color: var(--ink); text-decoration: underline; text-underline-offset: 6px; }
@media (min-width: 900px) {
  .s-nav { display: flex; }
  .s-header .btn { display: inline-flex; }
  .s-menu { display: none; }
}

/* Footer. */
.s-footer { margin-top: var(--space-7); padding: var(--space-5) var(--space-4) var(--space-6); background: var(--sheet); border-top: 1px solid var(--rule); font-size: var(--text-sm); }
.s-footer-in { display: grid; gap: var(--space-4); max-width: 1120px; margin: 0 auto; }
.s-footer-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-4) var(--space-5); }
.s-footer h2 { margin: 0 0 var(--space-1); font-size: var(--text-sm); font-weight: 700; }
.s-footer ul { margin: 0; padding: 0; list-style: none; }
.s-footer li a, .s-footer-id a { display: inline-flex; align-items: center; min-height: var(--target); }
.s-footer-id { margin: 0; color: var(--ink-2); }

/* Page frame and type. One column on phones; .s-cols adds the side column on desktop. */
.s-page { max-width: 1120px; margin: 0 auto; padding: var(--space-4) var(--space-4) var(--space-6); }
.s-cols { display: grid; gap: var(--space-5); margin-top: var(--space-5); }
.s-cols > * { min-width: 0; }
@media (min-width: 900px) {
  .s-page { padding: var(--space-5) var(--space-5) var(--space-7); }
  .s-cols { grid-template-columns: minmax(0, 1fr) 340px; gap: var(--space-7); align-items: start; }
  .s-cols-form { grid-template-columns: 380px minmax(0, 1fr); gap: var(--space-5); }
  .s-aside-sticky { position: sticky; top: var(--space-4); }
}
.s-h1 { margin: 0; font-family: var(--serif); font-size: var(--text-2xl); font-weight: 800; line-height: 1.25; }
.s-h2 { margin: var(--space-6) 0 var(--space-2); font-family: var(--serif); font-size: 1.3125rem; font-weight: 800; line-height: 1.3; }
.s-h3 { margin: 0; font-size: var(--text-base); font-weight: 700; line-height: 1.4; }
.s-cols > div > .s-h2:first-child, .s-prose > .s-h2:first-child { margin-top: 0; }
.s-sub { margin: var(--space-1) 0 0; color: var(--ink-2); }
.s-lede { max-width: 64ch; margin: var(--space-3) 0 0; font-size: 1.0625rem; }
.s-prose p, .s-prose ul, .s-prose ol, .s-answer { max-width: 68ch; margin: var(--space-2) 0; }
.s-more { margin: 0; }
.s-ask { margin: var(--space-1) 0 0; }
.s-after { margin-top: var(--space-5); }
.s-cols .helper-text { margin-top: var(--space-2); }
@media (min-width: 900px) {
  .s-h1 { font-size: var(--text-3xl); }
  .s-h2 { font-size: var(--text-xl); }
  .s-lede { font-size: var(--text-lg); }
}

/* Breadcrumbs. */
.s-crumbs { display: flex; flex-wrap: wrap; align-items: center; margin: 0 0 var(--space-2); padding: 0; list-style: none; font-size: var(--text-sm); color: var(--ink-2); }
.s-crumbs li { display: inline-flex; align-items: center; min-height: var(--target); }
.s-crumbs li + li::before { content: "/"; padding: 0 var(--space-2); color: var(--rule-strong); }

/* Source note: where the numbers come from and their date. */
.s-source { display: flex; align-items: flex-start; gap: var(--space-2); max-width: 74ch; margin: var(--space-4) 0 0; padding: var(--space-2) 0; font-size: var(--text-sm); line-height: 1.5; color: var(--ink-2); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.s-source .icon { margin-top: 2px; }
.s-source b { font-weight: 600; color: var(--ink); }

.s-stack-lg { display: grid; gap: var(--space-5); min-width: 0; }
.s-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin-top: var(--space-3); }
.s-flush { margin-top: 0; }
.s-card { padding: var(--space-4); background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-2); }

/* The hero figure of a page: one big number and its label. */
.s-hero-num { font-family: var(--serif); font-size: 2.5rem; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.s-hero-label { max-width: 52ch; font-size: var(--text-sm); color: var(--ink-2); }
@media (min-width: 900px) { .s-hero-num { font-size: 3rem; } }

/* The range strip under the hero (pages.range_strip): the report's band as one bar, lowest to
   highest, with its median rule; a fixed height, so drawing it in moves nothing. */
.s-range { margin: var(--space-4) 0 0; }
.s-range svg { display: block; overflow: visible; }
.s-range .qc-band { stroke-width: 6; }
.s-range figcaption { margin-top: var(--space-1); }

/* Segmented control stretched to the field's width on a 360 px phone. */
@media (max-width: 599px) {
  .s-seg-fill { display: flex; }
  .s-seg-fill > .seg-option { flex: 1 1 auto; padding-inline: 6px; font-size: var(--text-xs); white-space: nowrap; }
}

/* Result rows: a ruled list where the whole row is the link. */
.s-results { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule-strong); }
.s-result { display: grid; gap: 2px var(--space-4); min-height: var(--target); padding: var(--space-3) 0; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule); }
.s-result:hover { background: var(--ox-wash); }
.s-result:active { transform: translateY(1px); }
.s-result:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.s-result-name { font-family: var(--serif); font-size: 1.0625rem; font-weight: 800; line-height: 1.4; color: var(--ox); text-decoration: underline; text-underline-offset: 3px; }
.s-result-meta { font-size: var(--text-sm); color: var(--ink-2); }
.s-result-fig { font-size: var(--text-sm); font-weight: 600; }
@media (min-width: 760px) {
  .s-result { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; padding-inline: var(--space-2); }
  .s-result-fig { grid-row: 1 / span 2; grid-column: 2; text-align: right; }
}

/* Key and value rows (project facts). */
.s-kv { display: grid; margin: 0; border-top: 1px solid var(--rule-strong); }
.s-kv > div { display: grid; gap: 0 var(--space-4); padding: var(--space-2) 0; border-bottom: 1px solid var(--rule); }
.s-kv dt { font-size: var(--text-sm); color: var(--ink-2); }
.s-kv dd { margin: 0; font-weight: 600; }
@media (min-width: 600px) { .s-kv > div { grid-template-columns: 220px minmax(0, 1fr); align-items: baseline; } }

/* Rows that are a table on desktop and stacked records on a phone (no sideways scroll,
   nothing cut): each cell prints its column name from data-th. */
@media (max-width: 759px) {
  .s-table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .s-table-stack, .s-table-stack tbody, .s-table-stack tr, .s-table-stack td, .s-table-stack th[scope="row"] { display: block; }
  .s-table-stack tr { padding: var(--space-2) 0; border-bottom: 1px solid var(--rule); }
  .s-table-stack tbody tr:first-child { border-top: 1px solid var(--rule-strong); }
  .s-table-stack td, .s-table-stack th[scope="row"] { display: flex; justify-content: space-between; gap: var(--space-4); padding: 2px 0; border: 0; text-align: right; }
  .s-table-stack td::before { content: attr(data-th); flex: none; max-width: 55%; font-size: var(--text-sm); color: var(--ink-2); text-align: left; }
  .s-table-stack th[scope="row"] { font-family: var(--serif); font-size: 1.0625rem; font-weight: 800; color: var(--ink); text-align: left; }
  .s-table-stack .num { white-space: normal; }
}
.table th[scope="row"] { padding: 10px var(--space-2); font-size: inherit; font-weight: 700; color: var(--ink); border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.table td { vertical-align: baseline; }
.table tfoot :is(td, th[scope="row"]) { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--rule-strong); }
.s-result-table { margin-top: var(--space-3); }

/* Formula and worked example. */
.s-formula { margin: var(--space-3) 0; padding: var(--space-3) var(--space-4); font-family: var(--serif); font-size: 1.0625rem; font-weight: 700; line-height: 1.7; background: var(--sheet); border: 1px solid var(--rule); border-left: 3px solid var(--ink); border-radius: var(--radius-1); }
.s-formula small { display: block; font-family: var(--sans); font-size: var(--text-sm); font-weight: 400; color: var(--ink-2); }

/* Questions: a ruled list of disclosures, open by default so the answers are in the page. */
.s-faq { margin-top: var(--space-6); border-top: 1px solid var(--rule-strong); }
.s-h2 + .s-faq { margin-top: 0; }
.s-faq details { border-bottom: 1px solid var(--rule); }
.s-faq summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: var(--target); padding: var(--space-2) 0; font-weight: 700; line-height: 1.4; cursor: pointer; list-style: none; }
.s-faq summary::-webkit-details-marker { display: none; }
.s-faq summary::after { content: ""; flex: none; width: 8px; height: 8px; margin-right: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-3px) rotate(45deg); }
.s-faq details[open] summary::after { transform: translateY(2px) rotate(225deg); }
.s-faq details > p { max-width: 68ch; margin: 0 0 var(--space-3); }
.s-faq details > .s-more { margin-top: calc(-1 * var(--space-3)); }
.s-faq h2, .s-faq h3 { margin: 0; font: inherit; }

/* Plain link lists (related pages, on this page). */
.s-links { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule-strong); }
.s-links li { border-bottom: 1px solid var(--rule); }
.s-links a { display: flex; align-items: center; min-height: var(--target); padding: var(--space-1) 0; font-weight: 600; }
.s-side-title { margin: 0 0 var(--space-2); font-size: var(--text-sm); font-weight: 700; color: var(--ink-2); }

/* Numbered steps, ruled like register entries. */
.s-steps { margin: var(--space-3) 0 0; padding: 0; list-style: none; counter-reset: step; border-top: 1px solid var(--rule-strong); }
.s-steps > li { position: relative; padding: var(--space-3) 0 var(--space-3) 44px; border-bottom: 1px solid var(--rule); counter-increment: step; }
.s-steps > li::before { content: counter(step); position: absolute; top: var(--space-3); left: 0; width: 30px; font-family: var(--serif); font-size: var(--text-lg); font-weight: 800; line-height: 1.4; text-align: right; }
.s-steps p { max-width: 62ch; margin: 2px 0 0; color: var(--ink-2); }
.s-steps b { display: block; }

/* Phone: the primary action fixed at the bottom, in thumb reach. */
.s-dock { position: fixed; inset: auto 0 0; z-index: 15; display: flex; gap: var(--space-2); padding: 10px var(--space-4) calc(10px + env(safe-area-inset-bottom)); background: var(--sheet); border-top: 1px solid var(--rule); }
.s-dock .btn { flex: 1; min-height: 48px; }
.s-has-dock { padding-bottom: 84px; }
html:has(.s-has-dock) { scroll-padding-bottom: 96px; }
@media (min-width: 900px) {
  .s-dock { display: none; }
  .s-has-dock { padding-bottom: 0; }
  html:has(.s-has-dock) { scroll-padding-bottom: 0; }
}
@media (max-width: 899px) { .s-desktop-only { display: none !important; } }
@media print { .s-dock, .s-header .btn, .s-menu, .s-skip { display: none !important; } }
