/* Comp Happens — the one stylesheet. Every page links it; nothing is styled
   inline. Conventions (also recorded in CLAUDE.md):
   - The visual system is HR Happens's: ink on cream, paper sheets, teal for
     the header, links and the one primary action per step, orange as a mark
     only (never text), wine for refusals and destructive acts. The platform
     pages (customer accounts, account invitations, grants) draw the header
     in teal-deep with the word "Platform" beside the wordmark.
   - Type: Cormorant Garamond for page titles, dialog titles and statements,
     Inter Tight for everything else, both self-hosted from /static/fonts.
     Tabular figures on every number.
   - Spacing scale: --s-1 … --s-7 (4, 8, 12, 16, 24, 32, 48 px).
   - Type scale: --t-note, --t-table, --t-body, --t-head, --t-statement,
     --t-title, --t-median (13, 14, 15, 16, 22, 36, 40 px as rem).
   - Page frame: <header class="site"> with the wordmark, the account links
     and the person's menu; the acting-as bar; <main> with the breadcrumb,
     the stepper (and the role sub-steps), then one <h1> in a .page-head with
     its status chip and its one primary action; the .layout of a .main sheet
     column and an aside.rail; <footer class="site">.
   - Sheets: .card is a paper sheet (1px rule, no shadow); .card.flush holds
     a table edge to edge; details.card opens a sheet one step away;
     details.more is the "More actions" menu.
   - Dialogs: a <dialog class="card"> is opened by app.js from a button with
     data-open; without scripts it renders open, in the page, as a sheet.
     app.js also asks a data-confirm form's question in a dialog.
   - Forms: .field wraps a <label> above its control; .field-help and
     .field-error sit beneath. Buttons: .button (the primary action),
     .button.secondary, .button.quiet, .button.danger.
   - Tables: .table with <thead>; numeric cells use .num (right-aligned);
     table.table.stack rows stack into labelled lines on a phone.
   - Chips: .badge, with .ok (done, published), .attention, .muted-badge /
     .system, .refused and .tier4 (an estimated figure, dashed). The word in
     the chip carries the meaning; colour never carries it alone.
   - Notices: .notice (neutral), .notice.success, .notice.warning (and
     .notice.warning.pre-charge for the billing warning), .refusal (a refusal
     with its three parts: what is not permitted, what was attempted, what
     would resolve it), .card.disclosure (a figure that stands, with what is
     weaker stated).
   - Choices: fieldset.choice holds radio options (.option with .option-title
     and .option-detail); .field.checkbox is a single agreement.
   - Palette: every colour is a :root variable and is applied only through
     var(). Text reaches 4.5:1 on every background it sits on; control
     borders, notice edges and the focus ring reach 3:1 on every surface.
     web/contrast_test.go reads this file and holds each pair to that, and
     refuses a colour it has not been told about, so a new colour is added
     to its tables in the same change. */

@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/fonts/inter-tight-400.woff2") format("woff2"); }
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 500; font-display: swap; src: url("/static/fonts/inter-tight-500.woff2") format("woff2"); }
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/fonts/inter-tight-600.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 500; font-display: swap; src: url("/static/fonts/cormorant-garamond-500.woff2") format("woff2"); }

:root {
  --ink: #0F2626; --ink-soft: #4B5C5A;
  --cream: #F7F2E9; --paper: #FFFFFF; --rule: #E2D9CA;
  --teal: #2E6F6A; --teal-deep: #0F4C4C; --teal-tint: #E3EFEC;
  --orange: #E8783F; --orange-tint: #FCE9DE;
  --wine: #842234; --wine-tint: #F7E6E8;
  --focus: #0F4C4C; --focus-inverse: #FFFFFF;

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px;
  --t-note: 0.8125rem; --t-table: 0.875rem; --t-body: 0.9375rem; --t-head: 1rem;
  --t-statement: 1.375rem; --t-title: 2.25rem; --t-median: 2.5rem;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r-sheet: 10px; --r-input: 8px;
  --measure: 68ch;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--cream);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

a { color: var(--teal); text-underline-offset: 2px; }
a:hover { color: var(--teal-deep); text-decoration-thickness: 2px; }

h1, h2, h3, h4 { margin: 0 0 var(--s-3); }
h1 { font: 500 var(--t-title)/1.1 var(--serif); letter-spacing: -0.01em; }
h2 { font: 500 1.5rem/1.2 var(--serif); margin-top: var(--s-6); }
h3 { font: 600 var(--t-head)/1.3 var(--sans); margin-top: var(--s-5); }
h4 { font: 600 var(--t-table)/1.3 var(--sans); margin-top: var(--s-4); }
h1, h2 { font-variant-numeric: lining-nums; }
p, ul, ol, dl { margin: 0 0 var(--s-4); max-width: var(--measure); }
small, .small { font-size: var(--t-note); }
.muted { color: var(--ink-soft); }
code { font-family: var(--mono); font-size: 0.9em; background: var(--cream); padding: 0 var(--s-1); border-radius: 4px; }
q { quotes: "\201C" "\201D"; font-style: italic; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Page frame: the teal header with the wordmark, the five account links,
   the person's menu (a <details>, so it needs no script) and, on a phone,
   one menu in place of both; the acting-as bar under it; then the
   breadcrumb and the stepper above the page's own content. The platform
   pages draw the same header in teal-deep with "Platform" beside the
   wordmark and the platform links in place of the account's. */
header.site { background: var(--teal); color: var(--paper); position: relative; }
header.site.platform { background: var(--teal-deep); }
header.site :focus-visible { outline-color: var(--focus-inverse); }
header.site .inner, main, footer.site .inner {
  width: min(100% - 2 * var(--s-5), 77.5rem);
  margin: 0 auto;
}
main.narrow { width: min(100% - 2 * var(--s-5), 27.5rem); padding-top: var(--s-7); }
main.narrow form.stack { max-width: none; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-sheet); padding: var(--s-5); margin-bottom: var(--s-4); }
main.narrow .card form.stack { background: none; border: 0; border-radius: 0; padding: 0; margin: 0; }
main.narrow .card form.stack + form.stack { margin-top: var(--s-4); }
main.narrow .card { max-width: none; }
header.site .inner { display: flex; align-items: stretch; gap: var(--s-2) var(--s-5); min-height: 56px; }
.brand { align-self: center; font: 500 1.375rem/1 var(--serif); color: var(--paper); text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--paper); }
.console-tag { align-self: center; font-size: var(--t-note); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; margin-left: calc(-1 * var(--s-3)); }
nav.primary { flex: 1; display: flex; }
nav.primary ul { display: flex; flex-wrap: wrap; gap: var(--s-4); list-style: none; margin: 0; padding: 0; max-width: none; }
nav.primary li { display: flex; }
nav.primary a { display: flex; align-items: center; color: var(--paper); text-decoration: none; padding: var(--s-2) 0; font-size: var(--t-table); font-weight: 500; border-bottom: 3px solid transparent; }
nav.primary a:hover { color: var(--paper); border-bottom-color: var(--rule); }
nav.primary a[aria-current="page"] { font-weight: 600; border-bottom-color: var(--orange); }
.who, .app-menu { position: relative; margin-left: auto; align-self: center; }
.who > summary, .app-menu > summary { list-style: none; cursor: pointer; color: var(--paper); font-weight: 500; font-size: var(--t-table); padding: var(--s-2) var(--s-3); border-radius: var(--r-input); white-space: nowrap; }
.who > summary::-webkit-details-marker, .app-menu > summary::-webkit-details-marker { display: none; }
.who > summary::after { content: ""; display: inline-block; margin-left: var(--s-2); border: 4px solid transparent; border-top-color: currentColor; transform: translateY(2px); }
.who > summary:hover, .app-menu > summary:hover { background: var(--teal-deep); }
header.site.platform .who > summary:hover, header.site.platform .app-menu > summary:hover { background: var(--teal); }
.who ul { position: absolute; right: 0; top: calc(100% + 6px); z-index: 3; min-width: 15rem; list-style: none; margin: 0; padding: var(--s-2); background: var(--paper); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--r-sheet); }
.who ul a, .who ul .button.quiet { display: block; width: 100%; text-align: left; padding: var(--s-2) var(--s-3); color: var(--ink); text-decoration: none; border-radius: 6px; font-weight: 400; font-size: var(--t-body); min-height: 0; }
.who ul a:hover, .who ul .button.quiet:hover { background: var(--cream); color: var(--ink); }
.who ul a[aria-current="page"] { font-weight: 600; }
.who ul form { margin: 0; border-top: 1px solid var(--rule); padding-top: var(--s-2); margin-top: var(--s-2); }
.who .role-note { padding: var(--s-1) var(--s-3) var(--s-2); font-size: var(--t-note); color: var(--ink-soft); border-bottom: 1px solid var(--rule); margin-bottom: var(--s-2); }
.app-menu { display: none; position: static; }
.app-menu ul { position: absolute; left: 0; right: 0; top: 100%; z-index: 3; list-style: none; margin: 0; padding: var(--s-2) var(--s-4) var(--s-4); background: var(--teal-deep); }
.app-menu ul a, .app-menu ul .button.quiet { display: block; color: var(--paper); text-decoration: none; padding: var(--s-3) 0; border-bottom: 1px solid var(--teal); font-weight: 500; }
.app-menu ul a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--orange); padding-left: var(--s-3); }
.app-menu ul form { margin: 0; }
.app-menu ul .button.quiet { border-radius: 0; min-height: 0; padding: var(--s-3) 0; }
.app-menu ul .button.quiet:hover { background: var(--teal-deep); color: var(--paper); }

.acting-as { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); align-items: center; justify-content: space-between; padding: var(--s-2) max(var(--s-5), calc((100% - 77.5rem) / 2)); background: var(--orange-tint); border-bottom: 3px solid var(--orange); font-size: var(--t-table); }
.acting-as p { margin: 0; }
.acting-as a { color: var(--teal-deep); font-weight: 600; }

.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s-2); padding: 0; margin: 0 0 var(--s-3); max-width: none; font-size: var(--t-note); color: var(--ink-soft); }
.crumbs li + li::before { content: "\203A"; margin-right: var(--s-2); }
.crumbs a { color: var(--ink-soft); }

/* The stepper: the steps in a row over one rule, the current one underlined
   in teal and each saying in words whether it is done, current or next. The
   role's sub-steps are pills beneath it. */
.stepper { list-style: none; display: flex; padding: 0; margin: 0 0 var(--s-4); max-width: none; border-bottom: 1px solid var(--rule); }
.stepper li { flex: 1; min-width: 0; overflow-wrap: anywhere; padding: var(--s-2) var(--s-2) var(--s-2) 0; margin-bottom: -1px; border-bottom: 3px solid transparent; font-size: var(--t-table); font-weight: 500; color: var(--ink-soft); }
.stepper li small { display: block; font-size: var(--t-note); font-weight: 400; }
.stepper li.done { color: var(--ink); }
.stepper li[aria-current="step"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--teal); }
.substeps { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s-2); padding: 0; margin: 0 0 var(--s-4); max-width: none; font-size: var(--t-note); }
.substeps li { padding: 2px var(--s-3); border-radius: 999px; border: 1px solid var(--rule); background: var(--paper); color: var(--ink); }
.substeps li a { color: inherit; text-decoration: none; }
.substeps li.done { background: var(--teal-tint); border-color: var(--teal-tint); }
.substeps li[aria-current="step"] { border-color: var(--teal); font-weight: 600; }

main { flex: 1; padding: var(--s-4) 0 var(--s-6); }
footer.site { border-top: 1px solid var(--rule); color: var(--ink-soft); font-size: var(--t-note); }
footer.site .inner { padding: var(--s-4) 0; }

/* A page's title row: the title, its status chip and, at the right, its one
   primary action; the lede under them. */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin-bottom: var(--s-4); }
.page-head > div { min-width: 0; display: contents; }
.page-head .page-title { margin: 0; }
.page-head .lede { flex: 0 0 100%; max-width: none; margin: 0; }
.page-head .actions, .page-head > .button, .page-head > form { margin-left: auto; margin-top: 0; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.page-title { margin-bottom: var(--s-2); }
.lede { color: var(--ink-soft); margin-bottom: var(--s-4); }

/* Sheets. A .card is a paper sheet on the cream ground: a 1px rule, no
   shadow. Its headings are sans, so a page's serif h1/h2 stand above it. */
.card { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-sheet); padding: var(--s-5); margin-bottom: var(--s-4); max-width: 48rem; }
.card h2, .card h3 { font: 600 var(--t-head)/1.3 var(--sans); margin: 0 0 var(--s-2); }
.card h4 { margin-top: var(--s-4); }
.card > :last-child { margin-bottom: 0; }
.card .sub { color: var(--ink-soft); font-size: var(--t-table); margin: 0 0 var(--s-4); }
.card .inline-actions { margin-bottom: var(--s-4); }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .table-wrap { margin: 0; }
.card.flush table.table caption { padding: var(--s-3) var(--s-4) 0; }
.statement, .summary-statement { font: 500 var(--t-statement)/1.3 var(--serif); font-variant-numeric: lining-nums; max-width: 60ch; margin: 0 0 var(--s-4); }
.summary-statement { max-width: 60ch; }

dl.facts { display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); gap: var(--s-2) var(--s-4); max-width: none; font-size: var(--t-table); }
dl.facts dt { color: var(--ink-soft); }
dl.facts dd { margin: 0; font-weight: 500; }
dl.facts dd strong { font-weight: 600; }
dl.facts pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: var(--s-4); max-width: none; margin-bottom: var(--s-4); }
.stat { display: grid; gap: 2px; }
.stat b { font-size: 1.75rem; font-weight: 600; line-height: 1.1; }
.stat small { color: var(--ink-soft); }
.meter { height: 8px; border-radius: 999px; background: var(--cream); border: 1px solid var(--rule); overflow: hidden; margin-bottom: var(--s-2); }
.meter i { display: block; height: 100%; background: var(--teal); }
progress.meter { display: block; width: 100%; appearance: none; -webkit-appearance: none; }
progress.meter::-webkit-progress-bar { background: var(--cream); }
progress.meter::-webkit-progress-value { background: var(--teal); }
progress.meter::-moz-progress-bar { background: var(--teal); }

/* Forms */
form.stack { max-width: 30rem; }
form.stack.wide { max-width: 48rem; }
.field { margin-bottom: var(--s-4); }
.field label { display: block; font-weight: 600; font-size: var(--t-table); margin-bottom: 6px; }
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="number"], .field input[type="date"], .field input[type="search"],
.field select, .field textarea {
  width: 100%; min-height: 44px; font: inherit; color: var(--ink); background: var(--paper);
  padding: var(--s-2) var(--s-3); border: 1px solid var(--ink-soft); border-radius: var(--r-input);
}
.field textarea { min-height: 150px; line-height: 1.55; resize: vertical; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { border-color: var(--teal); }
.field input[readonly], .field textarea[readonly], .field input[type="file"][disabled] { background: var(--cream); }
.field input[type="file"] { display: block; font: inherit; margin-top: var(--s-1); }
.link-box { font-family: var(--mono); font-size: var(--t-table); }
.field-help { display: block; color: var(--ink-soft); font-size: var(--t-note); margin-top: var(--s-1); max-width: var(--measure); }
.field-error { display: block; color: var(--wine); font-size: var(--t-note); margin-top: var(--s-1); font-weight: 600; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border: 2px solid var(--wine); }
.field-row { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-4); }
.field-row .field { flex: 1 1 12rem; margin-bottom: var(--s-2); }
.field-row.has-error { box-shadow: inset 3px 0 0 var(--wine); padding-left: var(--s-3); }
.actions { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: center; margin-top: var(--s-4); }
.divider-or { display: flex; align-items: center; gap: var(--s-3); color: var(--ink-soft); font-size: var(--t-note); margin: var(--s-4) 0; max-width: none; }
.divider-or::before, .divider-or::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }

/* Buttons. .button is the one primary action of a step, in teal; the others
   are outlined, quiet or, for a destructive act, wine. */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: 0 var(--s-4); border-radius: var(--r-sheet);
  font: 600 var(--t-table)/1.2 var(--sans); text-align: center; text-decoration: none; cursor: pointer;
  border: 1px solid var(--teal); background: var(--teal); color: var(--paper);
}
.button:hover { background: var(--teal-deep); border-color: var(--teal-deep); color: var(--paper); }
.button.secondary { background: var(--paper); color: var(--teal-deep); }
.button.secondary:hover { background: var(--teal-tint); border-color: var(--teal); color: var(--teal-deep); }
.button.quiet { background: transparent; border-color: transparent; color: var(--teal); padding: 0 var(--s-2); text-decoration: underline; text-underline-offset: 2px; }
.button.quiet:hover { background: var(--teal-tint); color: var(--teal-deep); }
.button.danger { background: var(--wine); border-color: var(--wine); color: var(--paper); }
.button.danger:hover { background: var(--wine); border-color: var(--ink); color: var(--paper); }
.button.danger.secondary { background: var(--paper); color: var(--wine); }
.button.danger.secondary:hover { background: var(--wine-tint); color: var(--wine); }
.button.small { min-height: 36px; padding: 0 var(--s-3); font-size: var(--t-note); }
.button.block { width: 100%; }
.button[disabled], .button[aria-disabled="true"] { background: var(--cream); border-color: var(--rule); color: var(--ink-soft); cursor: not-allowed; }

/* Several small actions side by side, as in a table row. */
.inline-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.inline-actions form { margin: 0; }

/* "More actions": a menu one step away, drawn as a secondary button whose
   list opens beneath it. */
details.more { position: relative; display: inline-block; }
details.more > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: 44px; padding: 0 var(--s-4); border-radius: var(--r-sheet); border: 1px solid var(--teal); background: var(--paper); color: var(--teal-deep); font-weight: 600; font-size: var(--t-table); white-space: nowrap; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: ""; border: 4px solid transparent; border-top-color: currentColor; transform: translateY(2px); }
details.more > summary:hover { background: var(--teal-tint); }
details.more > .menu { position: absolute; right: 0; z-index: 2; margin-top: var(--s-1); background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-sheet); padding: var(--s-2); display: grid; min-width: 15rem; }
.menu a, .menu button, .menu .button { display: block; width: 100%; text-align: left; padding: var(--s-2) var(--s-3); border: 0; border-radius: 6px; background: none; font: inherit; color: var(--ink); text-decoration: none; min-height: 0; cursor: pointer; }
.menu a:hover, .menu button:hover, .menu .button:hover { background: var(--cream); color: var(--ink); }
.menu form { margin: 0; }
.menu .danger { color: var(--wine); }
.menu .danger:hover { background: var(--wine-tint); color: var(--wine); }

/* Dialogs. A <dialog class="card"> opened by app.js sits over a dimmed page;
   without scripts it is open in the page, drawn as a sheet, and the button
   that would open it stays hidden. A data-confirm form's question is asked
   the same way. */
dialog.card { border: 0; padding: var(--s-5); max-width: 30rem; width: calc(100% - 2 * var(--s-4)); margin: auto; }
dialog.card:not(:modal) { position: static; width: auto; max-width: 48rem; border: 1px solid var(--rule); margin: 0 0 var(--s-4); }
dialog.card::backdrop { background: var(--ink); opacity: 0.55; }
dialog.card h2 { font: 500 1.625rem/1.15 var(--serif); margin: 0 0 var(--s-2); }
dialog.card .actions { margin-top: var(--s-4); }

/* Tooltips. A .tip right after its button shows above it after 1 second of
   hover or keyboard focus; a title attribute's delay is the browser's. It
   opens upward so a modal dialog does not scroll to show it. */
.tipped { position: relative; }
.tip { position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 3; width: max-content; max-width: min(22rem, calc(100vw - 2 * var(--s-4))); padding: var(--s-2) var(--s-3); background: var(--ink); color: var(--paper); font-size: var(--t-note); line-height: 1.4; border-radius: 6px; pointer-events: none; visibility: hidden; opacity: 0; transition: opacity 0.15s, visibility 0s 0.15s; }
:hover + .tip, :focus-visible + .tip { visibility: visible; opacity: 1; transition-delay: 1s; }
/* In the rail the button spans the card, so its tip keeps to the card's right edge. */
.rail .card > .tipped > .tip { left: auto; right: 0; }
/* The dialog's submit carries the tip only for a page without script, where
   the dialog stands open in the page: there it is plain text under the button.
   Opened as a modal, the button that opened it has already shown it. */
dialog:modal .tip { display: none; }
dialog:not(:modal) .tip { position: static; display: block; width: auto; max-width: none; margin-top: var(--s-2); padding: 0; background: none; color: var(--ink-soft); visibility: visible; opacity: 1; }

/* Notices and refusals */
.notice { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-sheet); padding: var(--s-3) var(--s-4); margin-bottom: var(--s-4); max-width: var(--measure); font-size: var(--t-table); box-shadow: inset 4px 0 0 var(--teal); }
.notice.success { background: var(--teal-tint); border-color: var(--teal-tint); }
.notice.warning { background: var(--paper); border-color: var(--rule); box-shadow: inset 4px 0 0 var(--orange); }
.notice p:last-child { margin-bottom: 0; }

.refusal { background: var(--wine-tint); border: 1px solid var(--wine-tint); box-shadow: inset 4px 0 0 var(--wine); border-radius: var(--r-sheet); padding: var(--s-3) var(--s-4); margin-bottom: var(--s-4); max-width: var(--measure); font-size: var(--t-table); }
.refusal h2 { font: 600 var(--t-body)/1.3 var(--sans); margin: 0 0 var(--s-2); color: var(--wine); }
.refusal dl { display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); gap: var(--s-1) var(--s-3); margin: 0; max-width: none; }
.refusal dt { font-weight: 600; }
.refusal dd { margin: 0; }

/* Tables */
.table-wrap { overflow-x: auto; margin-bottom: var(--s-4); }
table.table { border-collapse: collapse; width: 100%; font-size: var(--t-table); background: var(--paper); }
table.table th, table.table td { text-align: left; vertical-align: top; padding: var(--s-3); border-bottom: 1px solid var(--rule); }
table.table thead th { font-size: var(--t-note); font-weight: 600; color: var(--ink-soft); padding-top: var(--s-2); padding-bottom: var(--s-2); white-space: nowrap; }
table.table .num { text-align: right; }
table.table caption { text-align: left; caption-side: top; color: var(--ink-soft); font-size: var(--t-note); padding-bottom: var(--s-2); }
table.table time { white-space: nowrap; }
table.table pre { margin: 0; font-size: var(--t-note); white-space: pre-wrap; word-break: break-word; max-width: 28rem; }
table.table tr.archived td { color: var(--ink-soft); }
table.table td .note { display: block; font-size: var(--t-note); color: var(--ink-soft); }
.card.flush table.table tbody tr:last-child td { border-bottom: 0; }
details.values summary { cursor: pointer; color: var(--teal); font-weight: 600; }

/* Chips. A .badge is a small pill whose word carries the meaning; only the
   attention chip carries a dot, and the estimated chip is dashed. */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; border-radius: 999px; padding: 0 var(--s-2); font-size: 0.75rem; font-weight: 600; line-height: 1; white-space: nowrap; background: var(--paper); border: 1px solid var(--rule); color: var(--ink); vertical-align: middle; }
.badge.ok { background: var(--teal-tint); border-color: var(--teal-tint); color: var(--teal-deep); }
.badge.attention { background: var(--orange-tint); border-color: var(--orange-tint); }
.badge.attention::before { content: ""; width: 8px; height: 8px; border-radius: 50%; box-shadow: inset 0 0 0 4px var(--orange); flex: none; }
.badge.system, .badge.muted-badge { background: var(--cream); color: var(--ink-soft); }
.badge.refused { background: var(--wine-tint); border-color: var(--wine-tint); color: var(--wine); }
.badge.tier4 { background: var(--paper); border: 1px dashed var(--ink); font-style: italic; }

.empty { background: var(--paper); border: 1px dashed var(--ink-soft); border-radius: var(--r-sheet); padding: var(--s-5); color: var(--ink-soft); max-width: var(--measure); }
.empty h2 { font: 600 var(--t-head)/1.3 var(--sans); color: var(--ink); margin: 0 0 var(--s-1); }
.empty p:last-child { margin-bottom: 0; }

ul.plain { list-style: none; padding: 0; }
ul.plain li { padding: var(--s-2) 0; border-bottom: 1px solid var(--rule); display: flex; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
ul.plain li form { margin: 0; }
ul.plain.rejected li, ul.plain.flags li { align-items: flex-start; }
ul.plain.sources li { font-size: var(--t-table); }
ul.checklist { list-style: none; padding: 0; max-width: none; font-size: var(--t-table); }
ul.checklist li { display: flex; gap: var(--s-2); align-items: center; padding: var(--s-1) 0; }
ul.checklist .badge { margin-left: auto; }

/* A group of radio options, each a bordered card that turns teal when
   chosen; the chosen state is also the checked control. */
fieldset.choice { border: 0; padding: 0; margin: 0 0 var(--s-4); min-width: 0; max-width: 48rem; }
fieldset.choice legend { font-weight: 600; font-size: var(--t-table); padding: 0; margin-bottom: var(--s-2); }
fieldset.choice.has-error { box-shadow: inset 3px 0 0 var(--wine); padding-left: var(--s-3); }
.option { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px var(--s-3); align-items: start; padding: var(--s-3); margin-bottom: var(--s-2); border: 1px solid var(--ink-soft); border-radius: var(--r-sheet); background: var(--paper); cursor: pointer; }
.option:has(input:checked) { border: 2px solid var(--teal); background: var(--teal-tint); padding: calc(var(--s-3) - 1px); }
.option input[type="radio"], .option input[type="checkbox"] { grid-row: span 2; margin: 3px 0 0; width: 18px; height: 18px; accent-color: var(--teal); }
.option-title { font-weight: 500; }
.option .option-aside { grid-column: 3; grid-row: span 2; align-self: center; font-weight: 600; }
.option:has(.option-aside) { grid-template-columns: auto minmax(0, 1fr) auto; }
.option-detail { grid-column: 2; color: var(--ink-soft); font-size: var(--t-note); }
.field.checkbox label { display: flex; gap: var(--s-3); align-items: start; font-weight: 400; font-size: var(--t-body); max-width: var(--measure); }
.field.checkbox input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--teal); }
.field.checkbox.has-error label { color: var(--wine); }

/* The pre-charge warning on the account and billing page: prominent, and
   its facts in the same grid as elsewhere. */
.notice.pre-charge { padding: var(--s-4) var(--s-5); max-width: 48rem; }
.notice.pre-charge h2 { font: 600 var(--t-head)/1.3 var(--sans); margin: 0 0 var(--s-3); }
.notice.pre-charge dl.facts { margin-bottom: var(--s-3); }

/* The one primary action on the first-time home, with its explanation, and
   the three numbered steps above it. */
.hero-action { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-4); align-items: center; margin-top: var(--s-4); }
.hero-action p { margin: 0; flex: 1 1 20rem; }
ol.steps-explained { list-style: none; margin: 0 0 var(--s-5); padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); counter-reset: explained; max-width: none; }
ol.steps-explained li { counter-increment: explained; display: grid; gap: var(--s-1); font-size: var(--t-table); color: var(--ink-soft); }
ol.steps-explained li::before { content: counter(explained); font: 500 2rem/1 var(--serif); color: var(--teal); }
ol.steps-explained strong { color: var(--ink); font-size: var(--t-head); }

/* Stripe's payment element sits in a bordered box like our own inputs. */
#payment-element { margin: var(--s-4) 0; }

/* The role editor. */
fieldset.pay { border: 1px solid var(--rule); border-radius: var(--r-sheet); padding: var(--s-4) var(--s-5); margin: 0 0 var(--s-4); background: var(--paper); }
fieldset.pay legend { font-weight: 600; font-size: var(--t-table); padding: 0 var(--s-2); }
fieldset.pay.has-error { border-color: var(--wine); border-width: 2px; }
.nudge { margin: var(--s-2) 0 0; padding: var(--s-2) var(--s-3); background: var(--teal-tint); border-radius: var(--r-input); font-size: var(--t-note); color: var(--ink); }
/* The role library's staleness column: the reason on its own line under
   the badge, and the re-run form beneath it. */
.stale-reason { display: block; font-size: var(--t-note); color: var(--ink-soft); margin: var(--s-1) 0; max-width: 28em; }
/* Something the product read or inferred, awaiting the person's word: the
   frame says so, and the text inside says so too. */
.card.product-reading { background: var(--orange-tint); border-color: var(--orange-tint); box-shadow: inset 4px 0 0 var(--orange); }
.card.extraction { box-shadow: inset 4px 0 0 var(--teal); }

/* Analyses. The gates are a checklist whose marks are also words; the
   waiting page shows a progress bar whose text says the same thing; a
   disclosure for an omitted market is framed like something to read. */
fieldset.choice.picker { max-height: 22rem; overflow-y: auto; padding-right: var(--s-2); }
ul.gates { list-style: none; padding: 0; max-width: var(--measure); }
ul.gates li { padding: var(--s-1) 0; }
ul.gates .gate-mark { display: inline-block; width: 1.4rem; text-align: center; font-weight: 600; }
ul.gates .gate-ok .gate-mark { color: var(--teal-deep); }
ul.gates .gate-open .gate-mark { color: var(--wine); }
.waiting { display: flex; gap: var(--s-4); align-items: flex-start; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-sheet); padding: var(--s-4) var(--s-5); margin-bottom: var(--s-5); max-width: var(--measure); }
.waiting progress.spinner { width: 8rem; height: 8px; margin-top: 0.5rem; flex: none; accent-color: var(--teal); }
.waiting p { margin: 0; }
.card.match h3 { margin-top: 0; }
.card.match h2.occupation { margin: 0; font-size: var(--t-head); }
.card.match h2.occupation + .sub { margin-top: 0; }
ul.plain.market-rows, ul.plain.market-rows > li { max-width: none; }
ul.plain.market-rows > li { display: block; }
ul.plain.market-rows > li:last-child { border-bottom: 0; }
.market-row { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); }
ul.market-rows details.why { border-top: 0; margin-top: var(--s-1); padding-top: 0; }
dl.facts.inline { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); margin: var(--s-3) 0; }
dl.facts.inline dd { margin-right: var(--s-3); font-weight: 600; }
.card.disclosure { box-shadow: inset 4px 0 0 var(--orange); }
details.values { margin-bottom: var(--s-4); max-width: none; }
details.values > summary { padding: var(--s-2) 0; }
details.why { border-top: 1px solid var(--rule); padding-top: var(--s-2); margin-top: var(--s-3); font-size: var(--t-table); max-width: none; }
details.why > summary { cursor: pointer; color: var(--teal); font-weight: 600; }

/* The completion sequence. A figure estimated from related data (Tier 4)
   is marked in its row by an inset rule and a badge whose text says so;
   colour never carries it alone. A check judgment is a sheet with its own
   decision controls. */
.table-wrap table.table.figures { min-width: 35rem; }
table.table.figures caption strong { color: var(--ink); }
table.table tr.tier4 td { background: var(--cream); }
table.table tr.tier4 td:first-child { box-shadow: inset 3px 0 0 var(--orange); }
table.table.path td { font-size: var(--t-note); }
table.table.path .num { white-space: nowrap; }
table.table td.median, table.table tr.median td { font-weight: 600; }
.card.judgment { box-shadow: inset 4px 0 0 var(--teal); }
.card.judgment h3 { margin-top: 0; }
.card.market h3 .badge { margin-left: var(--s-2); }
.card.market h4 { font-size: var(--t-head); margin: var(--s-4) 0 var(--s-2); }

/* Reports. The on-screen report is the full report: a contents list, then
   sections in the order the PDF has them. */
.report-section { margin-bottom: var(--s-6); }
.report-page { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-sheet); padding: var(--s-6); max-width: 56rem; margin-bottom: var(--s-5); }
.report-page .card { border: 0; padding: 0; }
.report-page .report-section:last-child { margin-bottom: 0; }
.report-actions { margin: 0 0 var(--s-5); }
fieldset.choice.curation .option-title .badge { margin-left: var(--s-2); }

/* Sheet and rail: the page's main content, and beside it the primary
   action, the facts and the next steps. On a narrow window the rail folds
   under. */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: var(--s-5); align-items: start; }
.layout.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.layout .card, .layout .notice, .layout .refusal, .layout p, .layout fieldset.choice { max-width: none; }
.layout .main > :first-child, .rail > :first-child { margin-top: 0; }
.layout > * { min-width: 0; }
.rail { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); }
.rail .card .card { padding: var(--s-3); margin: 0 0 var(--s-3); }
.rail .button { white-space: normal; padding-top: var(--s-2); padding-bottom: var(--s-2); }
.rail form.stack, .layout form.stack.wide { max-width: none; }
.rail .card { padding: var(--s-4); margin: 0; }
.rail h2 { font: 600 var(--t-head)/1.3 var(--sans); margin: 0 0 var(--s-3); }
.rail h3 { font-size: var(--t-table); }
.rail dl.facts { grid-template-columns: minmax(0, 1fr); gap: 0; }
.rail dl.facts dd { margin-bottom: var(--s-2); }
/* A dialog opened from a rail card is still the page's dialog, centred over it. */
dialog.card:modal, .rail .card dialog.card:modal { margin: auto; padding: var(--s-5); width: calc(100% - 2 * var(--s-4)); max-width: 30rem; }
.rail p, .rail .facts { font-size: var(--t-table); }
.rail .button.block + .button, .rail .button.block + form { margin-top: var(--s-2); }

/* A file field drawn as a drop zone: the file input itself fills the
   dashed area, so a file dropped on it is taken without a script. */
.field.dropzone input[type="file"] { width: 100%; padding: var(--s-6) var(--s-3); border: 2px dashed var(--ink-soft); border-radius: var(--r-sheet); background: var(--paper); cursor: pointer; text-align: center; }

/* Lists: a search above, status filters as pills carrying their counts,
   and a table that stacks into labelled rows on a narrow window. */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: flex-end; margin-bottom: var(--s-4); max-width: 48rem; }
.toolbar .field { margin: 0; flex: 1 1 14rem; }
.toolbar .field.short { flex: 0 1 11rem; }
ul.filters { display: flex; flex-wrap: wrap; gap: var(--s-2); list-style: none; padding: 0; margin: 0 0 var(--s-4); max-width: none; }
ul.filters a { display: inline-block; padding: 3px 12px; border-radius: 999px; border: 1px solid var(--rule); background: var(--paper); color: var(--ink); text-decoration: none; font-size: var(--t-table); }
ul.filters a:hover { background: var(--cream); color: var(--ink); }
ul.filters a[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
ul.filters .count { margin-left: 4px; font-weight: 600; }
.card.table-card { max-width: none; padding: 0; overflow: hidden; }
.card.table-card .table-wrap { margin: 0; }
.card.table-card table.table caption { padding: var(--s-3) var(--s-4) 0; }
.card.table-card table.table tbody tr:last-child td { border-bottom: 0; }
table.table td .sub { display: block; font-size: var(--t-note); color: var(--ink-soft); }
table.table td.title a { font-weight: 600; }
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s-3); margin-top: var(--s-4); font-size: var(--t-table); }

/* A sheet that opens: its summary is the heading, with a word saying what
   opening it does. */
details.card > summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--s-1) var(--s-3); }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { font: 600 var(--t-head)/1.3 var(--sans); margin: 0; }
details.card > summary::after { content: "Show"; order: 2; font-weight: 600; font-size: var(--t-note); color: var(--teal); }
details.card[open] > summary::after { content: "Hide"; }
details.card[open] > summary { margin-bottom: var(--s-4); }
details.card > summary .sub { order: 3; flex-basis: 100%; font-size: var(--t-note); color: var(--ink-soft); margin: 0; }

/* The markets of a result, one at a time: the segmented links jump to a
   market, and only the market jumped to (or the first) is shown. Every
   market stays in the page, for print, search and a browser without :has. */
.segmented { display: inline-flex; flex-wrap: wrap; max-width: 100%; margin: 0 0 var(--s-4); border: 1px solid var(--ink-soft); border-radius: var(--r-sheet); overflow: hidden; background: var(--paper); }
.segmented a { padding: var(--s-2) var(--s-4); color: var(--ink); text-decoration: none; font-size: var(--t-table); font-weight: 500; border-right: 1px solid var(--rule); }
.segmented a:last-child { border-right: 0; }
.segmented a:hover { background: var(--cream); color: var(--ink); }
.segmented a[aria-current="true"], .segmented a[aria-current="page"] { background: var(--teal); color: var(--paper); font-weight: 600; }
.markets:has(.anchor:target) > .card:not(:has(.anchor:target)) { display: none; }
.markets:not(:has(.anchor:target)) > .card:not(:first-child) { display: none; }
.card.result .card.market, .card.result .card.disclosure { border: 0; box-shadow: none; padding: 0; margin: 0; }
.card.result .card.market h3 { font-size: var(--t-head); }

/* The ladder: the five percentiles as tiles in a row, the median on paper
   with an orange top rule and large; a figure estimated from related data
   says so under it. */
ol.ladder { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-2); padding: 0; margin: 0 0 var(--s-4); max-width: none; }
ol.ladder li { display: grid; gap: 2px; align-content: end; padding: var(--s-3); background: var(--cream); border: 1px solid transparent; border-top: 4px solid transparent; border-radius: var(--r-sheet); }
ol.ladder .pct { font-size: 0.75rem; color: var(--ink-soft); font-weight: 600; }
ol.ladder .amount { font-size: 1.375rem; font-weight: 600; line-height: 1.15; }
ol.ladder li.median { background: var(--paper); border-color: var(--rule); border-top-color: var(--orange); }
ol.ladder li.median .amount { font-size: var(--t-median); line-height: 1.1; }
ol.ladder li[data-estimated] { border-style: dashed; border-color: var(--ink-soft); border-top-style: solid; }
ol.ladder li.median[data-estimated] { border-top-color: var(--orange); }
ol.ladder .mark { font-size: 0.75rem; color: var(--ink-soft); font-style: italic; }

/* A narrow window: one column, facts stacked. */
@media (max-width: 64rem) {
  .layout, .layout.even { grid-template-columns: minmax(0, 1fr); }
  ol.ladder .amount { font-size: 1.125rem; }
  ol.ladder li.median .amount { font-size: 1.875rem; }
}
@media (max-width: 48rem) {
  nav.primary, .who { display: none; }
  .app-menu { display: block; }
  .stepper li small { display: none; }
  .stepper li { font-size: var(--t-note); }
  ol.steps-explained { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 40rem) {
  header.site .inner, main, footer.site .inner { width: min(100% - 2 * var(--s-4), 77.5rem); }
  .acting-as { padding: var(--s-2) var(--s-4); }
  .stepper { border-bottom: 0; }
  .stepper li { flex: none; width: 100%; }
  .stepper li:not([aria-current="step"]) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .page-head .actions, .page-head > .button, .page-head > form { margin-left: 0; }
  table.table.stack thead { display: none; }
  table.table.stack tr { display: block; border-bottom: 1px solid var(--rule); padding: var(--s-2) 0; }
  table.table.stack td { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-1) var(--s-3); border: 0; padding: 3px var(--s-3); text-align: right; }
  table.table.stack td::before { content: attr(data-label); font-weight: 500; color: var(--ink-soft); font-size: var(--t-note); text-align: left; }
  table.table.stack td.title { display: block; text-align: left; font-size: var(--t-head); }
  table.table.stack td.title::before { display: none; }
  table.table.stack td:empty { display: none; }
  ol.ladder { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  ol.ladder li.median { grid-column: 1 / -1; }
  h1 { font-size: 1.75rem; }
  .card { padding: var(--s-4); }
  .card.flush { padding: 0; }
  .report-page { padding: var(--s-5) var(--s-4); }
  .refusal dl, dl.facts { grid-template-columns: minmax(0, 1fr); gap: 0 var(--s-4); }
  .refusal dd, dl.facts dd { margin-bottom: var(--s-2); }
  dialog.card { padding: var(--s-4); }
}

/* Print: the page's content alone, in its own order. */
@media print {
  body { background: var(--paper); font-size: 11pt; }
  header.site, footer.site, .acting-as, .crumbs, .stepper, .substeps, .segmented, .actions, .inline-actions, form, dialog, details.more { display: none; }
  .layout { display: block; }
  .markets > .card { display: block !important; }
  main { width: auto; padding: 0; }
  .report-page { border: 0; padding: 0; max-width: none; }
  .card, .notice { border-color: var(--rule); break-inside: avoid; }
  a { color: var(--ink); text-decoration: none; }
}
ol.ladder a.amount { color: var(--ink); text-decoration: none; }
ol.ladder a.amount:hover { text-decoration: underline; }
.card.note { border-left: 4px solid var(--orange); }
td.value { overflow-wrap: anywhere; font-size: var(--t-note); }
