/*
 * Lightpass interface styles.
 *
 * Set in the Comatter brand: chalk ground, ink as punctuation, pine for
 * everything that carries weight, four tints as status grounds only. Headings
 * sit at 500 — weight is not how this page shouts. See the Comatter Brand
 * Guidelines v1.2, sections 03, 04 and 07.
 *
 * One family, self-hosted. No external request, so nothing to block and no
 * third party is told who signed in.
 */

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

:root {
  color-scheme: light;

  --chalk: #eff1ec;
  --bone: #e4e8e1;
  --ink: #141c1a;
  --ink-deep: #0c1211;

  --text: #1e2724;   /* 13.5:1 on chalk */
  --muted: #4b5551;  /* 6.8:1 */
  --faint: #5a6460;  /* 5.4:1 — never lighter, it must also clear AA on straw */

  --pine: #0e5b4e;   /* 7.0:1 — the dot, links, buttons, focus */
  --mint: #6fcbb4;   /* the same accent, opened up, on ink only */
  --ink-muted: #b3bcb8;
  --ink-faint: #8e9793;

  --straw: #f1e4be;
  --mist: #d3e2dc;
  --clay: #efdad3;
  --apricot: #f6d9c2;

  /* Two grounds, and the two the guidelines actually name. The page recedes to
     chalk-deep; every card is chalk, so a card is lighter than what it sits on.
     The invented --paper ground is gone: it was 5.1% from chalk, which is to
     say invisible, and that flatness was the whole complaint. Measured on
     bone — text 12.35:1, muted 6.23:1, faint 4.94:1, pine 6.45:1. */
  --ground: var(--bone);
  --surface: var(--chalk);
  --sunken: var(--bone);

  /* State marks. Not a sixth and seventh brand colour: these are only ever the
     4px dot inside a chip, never a ground, a rule or a run of type. */
  --mark-wait: #8a6d1f;
  --mark-stop: #8a3a2e;

  --rule: rgb(20 28 26 / 13%);
  --rule-soft: rgb(20 28 26 / 7%);
  --rule-strong: rgb(20 28 26 / 26%);
  --rule-ink: rgb(239 241 236 / 14%);

  /* Elevation. The guidelines' "no shadows" sits in the mark's misuse list and
     is about the wordmark; the interface is uncovered. So: ink-tinted, never
     black, never a gradient, and never more than two levels in view at once —
     which is what the old 0 10px 40px stack got wrong. Level means role. 1 is
     a surface you act on; 2 is the thing in hand. */
  --lift-1: 0 1px 2px rgb(20 28 26 / 5%), 0 2px 6px rgb(20 28 26 / 5%);
  --lift-2: 0 2px 4px rgb(20 28 26 / 6%), 0 8px 20px rgb(20 28 26 / 8%);

  /* Radius. The only radius the guidelines set is the drop's own construction,
     so this is a chosen scale rather than a recovered one — written down here
     so it stays a decision. The mark is three quadrants of a circle with the
     fourth squared to a point: generous, with one hard corner. */
  --r-control: 6px;
  --r-card: 10px;
  --r-lead: 14px;

  /* Space. The palette section asks for air in as many words. */
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  font-family: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Arial,
    sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  background: var(--ground);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--pine); text-underline-offset: 0.18em; }

::selection { background: color-mix(in srgb, var(--pine) 24%, transparent); }

/* Keyboard users keep the ring; pointer users never see it. */
:focus-visible { outline: 2px solid var(--pine); outline-offset: 3px; border-radius: var(--r-control); }
:focus:not(:focus-visible) { outline: none; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 10;
  padding: 0.6rem 0.9rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--pine);
  border-radius: var(--r-control);
  box-shadow: var(--lift-2);
  font-weight: 500;
  text-decoration: none;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 1rem; }

/* ── Type ─────────────────────────────────────────────────────────────
   Tracking tightens as size grows. A grotesque set large without negative
   tracking looks typed rather than set. */

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.026em;
  text-wrap: balance;
}
h1 { margin-bottom: 0.5rem; font-size: clamp(1.75rem, 3.2vw, 2.25rem); letter-spacing: -0.032em; line-height: 1.06; }
h2 { font-size: clamp(1.3rem, 2.2vw, 1.6rem); letter-spacing: -0.028em; }
h3 { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.014em; }
h4 { font-size: 0.95rem; font-weight: 600; }
p { margin: 0 0 0.9rem; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

.lede { max-width: 56ch; color: var(--muted); font-size: 1.1rem; }

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--faint);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

code, pre { font-family: var(--mono); font-size: 0.86em; }
code { overflow-wrap: anywhere; }
pre {
  margin: 0;
  padding: 0.7rem 0.8rem;
  overflow-x: auto;
  background: var(--bone);
  border: 1px solid var(--rule-soft);
  border-radius: 2px;
  line-height: 1.5;
}

/* Generated message bodies keep their author's line breaks. */
.pre-line { white-space: pre-line; }
.signature-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.signature-toolbar label { display: inline-flex; align-items: center; gap: .35rem; margin: 0; }
.signature-toolbar select { width: auto; min-width: 5rem; }
.signature-logo-fields { display: flex; flex-wrap: wrap; align-items: end; gap: 1rem; }
.signature-logo-fields p { margin: 0; }
#signature-editor { background: white; color: #222; border: 1px solid #8b9992; border-radius: .35rem; min-height: 12rem; padding: 1rem; overflow-wrap: anywhere; font-family: Arial, sans-serif; font-size: 14px; }
#signature-editor:focus { outline: 2px solid #0c6154; outline-offset: 2px; }
#signature-editor img[data-signature-logo="true"] { display: inline-block; max-width: 320px; max-height: 160px; vertical-align: middle; }
.signature-preview { background: white; border: 1px solid #8b9992; width: 100%; min-height: 22rem; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Frame ────────────────────────────────────────────────────────────── */

.site-header {
  min-height: 60px;
  padding: 0 max(1.25rem, 2.5vw);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--chalk);
  background: var(--ink);
}

/* The wordmark. 500, tracked in, with the full stop as the mark. On ink the
   stop is mint, never pine — pine on ink measures 2.17:1. */
.brand {
  color: var(--chalk);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.042em;
  text-decoration: none;
}
.brand .stop { color: var(--mint); }

/* A button that reads as a link, so it keeps none of the button chrome below —
   including the dark hover ground, which is invisible in the header and a black
   block anywhere else. */
.link-button {
  padding: 0.4rem 0.5rem;
  color: var(--ink-muted);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  box-shadow: none;
  font: inherit;
  cursor: pointer;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.link-button:hover {
  color: var(--chalk);
  background: transparent;
  border-bottom-color: var(--mint);
  box-shadow: none;
  transform: none;
}

/* The same control on a light panel: the header's muted ink is 1.7:1 there. */
.panel .link-button { color: var(--pine); text-decoration: underline; text-underline-offset: 0.18em; }
.panel .link-button:hover { color: var(--ink); border-bottom-color: transparent; }

.shell { width: min(1100px, 92vw); margin: var(--s6) auto var(--s7); }

.workspace-nav {
  display: flex;
  gap: 0.15rem;
  flex-wrap: wrap;
  margin: -1rem 0 2rem;
  border-bottom: 1px solid var(--rule);
}
.workspace-nav a {
  padding: 0.55rem 0.8rem;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.workspace-nav a:hover { color: var(--text); border-bottom-color: var(--rule-strong); }
.workspace-nav a[aria-current="page"] { color: var(--pine); border-bottom-color: var(--pine); }

.site-footer {
  padding: 1.75rem max(1.25rem, 5vw) 2.5rem;
  border-top: 1px solid var(--rule);
}
.endorsement { margin: 0; font-size: 0.95rem; font-weight: 500; letter-spacing: -0.02em; }
.endorsement .stop { color: var(--pine); }
.colophon { margin: 0.35rem 0 0; color: var(--faint); font-size: 0.8rem; }

/* ── Surfaces ─────────────────────────────────────────────────────────
   A card is chalk on a chalk-deep page, lifted one level. Nested rows recede
   to the page ground and rise to card level when you point at them, so a list
   is flush until it is under the cursor. */

.panel {
  padding: clamp(1.25rem, 2.6vw, 2rem);
  margin-bottom: var(--s4);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  box-shadow: var(--lift-1);
}
.narrow { width: min(460px, 100%); margin: 8vh auto; }

/* A heading that opens a panel needs air under it before the list or fact grid
   it introduces. The managed heading rows (.section-heading, .stage-head, the
   dark .lead) set their own spacing and are left alone. */
.panel > h2, .panel > h3 { margin-bottom: 0.6rem; }

/* The page head. One pattern, used on every screen. The actions align to the
   top of the block, level with the eyebrow, rather than to the baseline of a
   subtitle that may run one line or three. */
.hero-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem 1.75rem;
  flex-wrap: wrap;
  margin: 0 0 1.75rem;
}
.hero-row > div:first-child { flex: 1 1 22rem; min-width: 0; }
.hero-row > div:first-child > p:last-child { max-width: 68ch; }

.crumbs {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
  margin-bottom: var(--s3);
  color: var(--faint);
  font-size: 0.86rem;
}
.crumbs > * + *::before {
  content: "/";
  margin-right: var(--s2);
  color: var(--rule-strong);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}
.section-heading h2, .section-heading p { margin-bottom: 0; }

/* Columns size to their own content: a short panel next to a tall one keeps its
   height rather than stretching to match and carrying a block of dead space. */
.two-column { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: var(--s4); margin-bottom: var(--s4); }
.two-column > .panel { margin-bottom: 0; }
.stack { display: grid; gap: var(--s4); }
.cards { display: grid; gap: var(--s2); }

.card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  color: inherit;
  background: var(--sunken);
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
  text-decoration: none;
  transition:
    border-color 0.2s var(--ease),
    background-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    transform 0.2s var(--ease);
}
/* A row that goes somewhere says so, and the mark travels when you point. */
a.card { padding-right: 2.4rem; }
a.card::after {
  content: "\203A";
  position: absolute;
  top: 50%;
  right: 1rem;
  color: var(--faint);
  font-size: 1.2rem;
  line-height: 1;
  transform: translateY(-50%);
  transition: transform 0.2s var(--ease), color 0.2s var(--ease);
}
a.card:hover {
  background: var(--surface);
  border-color: var(--rule-strong);
  box-shadow: var(--lift-1);
  transform: translateY(-1px);
}
a.card:hover::after { color: var(--pine); transform: translateY(-50%) translateX(3px); }
a.card:active { transform: translateY(0); box-shadow: none; }

.workspace-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.workspace-card {
  display: grid;
  gap: 0.3rem;
  align-content: start;
  min-height: 130px;
  padding: 1.25rem 1.3rem;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  box-shadow: var(--lift-1), inset 2px 0 0 var(--rule-strong);
  text-decoration: none;
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.workspace-card:hover {
  box-shadow: var(--lift-2), inset 2px 0 0 var(--pine);
  transform: translateY(-1px);
}
.workspace-card:active { transform: translateY(0); box-shadow: var(--lift-1), inset 2px 0 0 var(--pine); }
.workspace-card strong { font-size: 1.2rem; font-weight: 500; letter-spacing: -0.02em; }
.workspace-card .eyebrow { margin-bottom: 0.1rem; }
.workspace-card > span:last-child { color: var(--faint); font-size: 0.88rem; }

/* ── Metrics ──────────────────────────────────────────────────────────
   Tabular figures, so a row stops reflowing as counts change. The pine rule
   marks the figures a customer is actually watching. */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0 1px;
  margin: 0 0 var(--s4);
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  box-shadow: var(--lift-1);
  overflow: hidden;
}
.metric {
  display: grid;
  gap: 0.1rem;
  align-content: start;
  padding: 0.95rem 1.1rem;
  background: var(--surface);
}
.metric strong {
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.metric span { color: var(--faint); font-size: 0.82rem; line-height: 1.35; }
.metric-grid-six { grid-template-columns: repeat(6, 1fr); }
/* Marks the figures a customer is actually watching. The rest recede without
   being hidden. */
.metric-lead { box-shadow: inset 2px 0 0 var(--pine); }

.metrics { grid-template-columns: repeat(4, 1fr); }
.metrics div { padding: 0.85rem 0.95rem; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-control); box-shadow: var(--lift-1); }
.metrics dt { color: var(--faint); font-size: 0.82rem; font-weight: 500; }
.metrics dd { font-size: 1.35rem; font-weight: 500; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }

/* ── Status ───────────────────────────────────────────────────────────
   State reads in form first — a dot and a hairline chip — then in ground.
   Grounds are brand tints; the dot is the only place a state mark appears.
   Every value below is one a model can actually emit into a class. */

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0.6rem 0.15rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
.status::before {
  content: "";
  flex: none;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: var(--faint);
}

/* Settled */
.status.succeeded,
.status.completed,
.status.parsed,
.status.created,
.status.active { background: var(--mist); }
.status.succeeded::before,
.status.completed::before,
.status.parsed::before,
.status.created::before,
.status.active::before { background: var(--pine); }

/* Waiting on someone */
.status.recovery_required,
.status.review_required { background: var(--straw); }
.status.recovery_required::before,
.status.review_required::before { background: var(--mark-wait); }

/* Blocked */
.status.failed,
.status.rejected { background: var(--clay); }
.status.failed::before,
.status.rejected::before { background: var(--mark-stop); }

/* draft, closed, running, quarantined and duplicate keep the neutral chip:
   in flight or inert, and neither is worth a ground. */

/* ── Notices ──────────────────────────────────────────────────────────── */

.notice {
  padding: 0.75rem 0.9rem;
  background: var(--mist);
  border-left: 2px solid var(--pine);
  border-radius: 0 var(--r-control) var(--r-control) 0;
}
.notice.warning { background: var(--straw); border-left-color: var(--mark-wait); }
.notice.error { background: var(--clay); border-left-color: var(--mark-stop); }
.notice h2 { margin-bottom: 0.5rem; }

.authenticator-qr {
  width: min(100%, 18rem);
  padding: 0.75rem;
  background: white;
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
}
.setup-secret {
  display: inline-block;
  max-width: 100%;
  padding: 0.45rem 0.6rem;
  overflow-wrap: anywhere;
  background: var(--sunken);
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
  user-select: all;
}

.empty-state {
  display: grid;
  gap: 0.4rem;
  justify-items: start;
  padding: 1.25rem;
  background: var(--sunken);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--r-card);
}
.empty-state h3 { margin-bottom: 0.1rem; }
.empty-state p { margin-bottom: 0.2rem; color: var(--muted); }

/* ── Forms ────────────────────────────────────────────────────────────
   One field shape. Help and errors sit in normal flow beneath their field,
   so nothing depends on a negative margin surviving a wrap. */

.field { display: grid; gap: 0.3rem; margin-bottom: 0.2rem; }
.field > .field-name { font-weight: 500; }

label { display: grid; gap: 0.3rem; font-weight: 500; }

input, textarea, select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-control);
  box-shadow: inset 0 1px 2px rgb(20 28 26 / 4%);
  font: inherit;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--pine);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pine) 18%, transparent);
}
textarea { line-height: 1.55; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--pine); }
input[type="file"] { padding: 0.45rem 0.5rem; }

.help { margin: 0; color: var(--faint); font-size: 0.86rem; line-height: 1.45; }
.errorlist { margin: 0; padding-left: 1.1rem; color: var(--mark-stop); font-size: 0.88rem; }

fieldset { min-width: 0; margin: 0; padding: 1rem; background: var(--sunken); border: 1px solid var(--rule); border-radius: var(--r-card); }
legend { padding: 0 0.35rem; font-weight: 500; }

.form-grid { grid-template-columns: 1fr 1fr; }
.form-grid label:has(textarea), .form-grid .errorlist, .form-grid div { grid-column: 1 / -1; }

.checkbox-list ul { display: grid; gap: 0.5rem; margin: 0.75rem 0 0; padding: 0; list-style: none; }
.checkbox-list label { display: flex; align-items: flex-start; gap: 0.6rem; font-weight: 400; }
.checkbox-list input { margin-top: 0.32rem; }

.search-form { min-width: min(360px, 100%); }
.inline-form { display: flex; align-items: flex-end; gap: 0.5rem; flex-wrap: wrap; min-width: 260px; }
.inline-form label { flex: 0 0 auto; }

.confirmation { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--rule); }

.price-breakdown {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3);
  margin: 1.25rem 0;
}
.price-stage {
  padding: 1.15rem;
  background: var(--sunken);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
}
.price-stage .eyebrow { margin-bottom: 0.7rem; }
.price-stage-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
}
.price-stage-heading h3 { font-size: 1.05rem; }
.price-stage-heading strong {
  color: var(--pine);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  white-space: nowrap;
}
.price-unit { margin: 0.25rem 0 0.8rem; color: var(--muted); font-size: 0.86rem; }
.price-stage ul { display: grid; gap: 0.4rem; margin: 0 0 0.85rem; padding-left: 1.1rem; }
.price-stage li { padding-left: 0.1rem; }
.price-stage .help { padding-top: 0.75rem; border-top: 1px solid var(--rule-soft); }

/* ── Controls ─────────────────────────────────────────────────────────── */

button, .button {
  display: inline-block;
  padding: 0.58rem 1rem;
  color: var(--chalk);
  background: var(--pine);
  border: 1px solid var(--pine);
  border-radius: var(--r-control);
  box-shadow: var(--lift-1);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease),
    color 0.3s var(--ease);
}
button:hover, .button:hover {
  background: var(--ink);
  border-color: var(--ink);
  box-shadow: var(--lift-2);
  transform: translateY(-1px);
}
button:active, .button:active { transform: translateY(0); box-shadow: var(--lift-1); }
button:disabled { cursor: not-allowed; opacity: 0.45; }
button:disabled:hover { background: var(--pine); border-color: var(--pine); transform: none; box-shadow: var(--lift-1); }

/* Quiet by default, committed on hover: this is the control that holds,
   excludes or rejects, so it should never be the loudest thing in a row. */
.secondary-button { color: var(--mark-stop); background: transparent; border-color: var(--rule-strong); }
.secondary-button:hover { color: var(--chalk); background: var(--mark-stop); border-color: var(--mark-stop); }

.actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding-top: 1rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--rule-soft);
  color: var(--faint);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

/* ── Tables ───────────────────────────────────────────────────────────
   Numbers right and tabular. A run of hairlines is not a boundary: past four
   or five rows they stopped separating anything and the list read as one
   block. Separate borders let every row take the same ground, edge and radius
   a card has, while the columns stay in line — so a table becomes a stack of
   records without giving up the one thing a table is for. The row is the
   record; the header stays because a column label earns its place once, not
   once per row. */

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0 var(--s2); }
th, td { padding: 0.6rem 0.7rem; text-align: left; vertical-align: top; }
th {
  padding-bottom: 0.15rem;
  color: var(--faint);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}
td { font-size: 0.95rem; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
tbody tr { background: var(--sunken); }
/* The row is bounded on all four sides; only the outer cells carry the ends. */
td:first-child {
  padding-left: 0.95rem;
  border-left: 1px solid var(--rule);
  border-radius: var(--r-control) 0 0 var(--r-control);
}
td:last-child {
  padding-right: 0.95rem;
  border-right: 1px solid var(--rule);
  border-radius: 0 var(--r-control) var(--r-control) 0;
}
/* A row answers when you point at it. It rises to card level rather than
   tinting, which is the same answer .card gives and one fewer colour. */
tbody tr { transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease); }
tbody tr:hover { background: var(--surface); }
tbody tr:hover td { border-color: var(--rule-strong); }
/* The row is now the sunken ground a card sits on, so anything nested in it
   has to rise rather than match. */
tbody details { background: var(--surface); }
td small { color: var(--faint); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.cell-wide { min-width: 14rem; }

/* A per-row control set. Folded away by default so the table stays scannable;
   every control inside it remains one click from the row it belongs to. */
.row-action { margin-top: 0.5rem; padding: 0.4rem 0.55rem; }
.row-action > summary { font-size: 0.86rem; }
.row-action .actions { gap: 0.4rem; }
.row-action button { padding: 0.4rem 0.7rem; font-size: 0.88rem; }

/* ── Lists and definitions ────────────────────────────────────────────── */

dl { display: grid; grid-template-columns: minmax(130px, 0.35fr) 1fr; gap: 0.6rem 1rem; margin: 0; }
/* min-width:0 stops a long unbroken value — a hash, or a canonical bundle in a
   <pre> — from forcing its grid track wider than the page. */
dt { color: var(--faint); font-weight: 500; min-width: 0; }
dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
dd > pre { max-width: 100%; }

/* A fact list is the inside of one record, not a list of records, so it takes
   a rule between pairs rather than a boundary around each: ten boxes would say
   these are ten things. The rule is what carries a long label across the
   column gap to the value that answers it. .metrics is a dl too, but it is a
   figure grid and already bounded, so it keeps out of this. */
/* The gap closes and the label carries the space as padding instead, so the
   rule crosses the pair unbroken rather than arriving as two segments. */
dl:not(.metrics) { gap: 0; }
dl:not(.metrics) > dt,
dl:not(.metrics) > dd {
  padding: 0.5rem 0;
  border-top: 1px solid var(--rule-soft);
}
dl:not(.metrics) > dt { padding-right: 1rem; }
dl:not(.metrics) > dt:first-child,
dl:not(.metrics) > dt:first-child + dd { padding-top: 0; border-top: 0; }

/* An audit trail, a bundle history and a page of extracted claims are all
   lists of records, so they take the same boundary a table row does. A bullet
   beside a bounded row says nothing twice; an ordinal does not, because the
   claim list is paginated and the number is the claim's place in the source. */
.timeline { display: grid; gap: var(--s2); margin: 0; }
.timeline li {
  margin: 0;
  padding: 0.55rem 0.75rem;
  background: var(--sunken);
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
}
.timeline li::marker { color: var(--faint); }
ul.timeline { padding-left: 0; list-style: none; }
ol.timeline { padding-left: 2rem; }

/* Evidence is the product's whole argument — it should not look like nothing. */
details {
  padding: 0.55rem 0.75rem;
  background: var(--sunken);
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
}
details + details { margin-top: 0.5rem; }
details[open] { background: var(--sunken); }
/* Section 07 permits motion that responds. Opening is a response, so the
   content arrives rather than appearing. Height is left alone — animating it
   would need script, and the repository does not have any. */
@keyframes disclose {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
details[open] > *:not(summary) { animation: disclose 0.18s var(--ease) both; }
summary {
  cursor: pointer;
  color: var(--pine);
  font-size: 0.92rem;
  font-weight: 500;
  transition: color 0.25s var(--ease);
}
summary:hover { color: var(--ink); }
details[open] > summary { margin-bottom: 0.6rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--rule-soft); }

/* ── Journey ──────────────────────────────────────────────────────────
   A wave is a queue of gates, and the customer's real question on every
   screen is "where am I and who is holding it". The rail answers that once,
   at the top, so nothing below has to. */

.journey { margin: 0 0 var(--s5); }
.readiness-journey { margin-bottom: 0; }
.journey ol {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}
.journey-step {
  position: relative;
  flex: 1 1 9rem;
  min-width: 9rem;
  display: grid;
  gap: 0.15rem;
  align-content: start;
  justify-items: center;
  padding: 0.6rem 0.75rem;
  text-align: center;
}
/* The track runs out of each mark to the next one, so the pine reaches exactly
   as far as the work has. It is a quantity you can see, not eight labels. */
.journey-step::before {
  content: "";
  position: absolute;
  top: calc(1.35rem - 1px);
  left: 50%;
  right: -50%;
  height: 2px;
  border-radius: 999px;
  background: var(--rule);
}
.journey-step:last-child::before { display: none; }
.journey-step.is-done::before { background: var(--pine); }

/* Where you are, raised off the track. The eye lands here before it reads. */
.journey-step.is-current {
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--lift-1);
}
/* The current-step surface sits over the preceding step's outbound rail. Draw
   the short incoming segment again so middle steps read as continuous. */
.journey-step.is-current:not(:first-child)::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: calc(1.35rem - 1px);
  left: -50%;
  right: 50%;
  height: 2px;
  border-radius: 999px;
  background: var(--pine);
}

.journey-mark {
  position: relative;
  z-index: 1;
  width: 1.5rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
  margin-bottom: 0.3rem;
  color: var(--faint);
  background: var(--ground);
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}
.is-done > .journey-mark { color: var(--chalk); background: var(--pine); border-color: var(--pine); }
.is-current > .journey-mark {
  color: var(--pine);
  background: var(--surface);
  border-color: var(--pine);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pine) 22%, transparent);
  font-weight: 500;
}
.needs-attention > .journey-mark {
  color: var(--mark-stop);
  background: var(--clay);
  border-color: var(--mark-stop);
}

.journey-label {
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--muted);
}
.is-done > .journey-label { color: var(--text); }
.is-current > .journey-label { color: var(--pine); font-weight: 600; }
.is-current > .journey-detail { color: var(--muted); }
.journey-detail {
  font-size: 0.77rem;
  line-height: 1.35;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
a.journey-label { text-decoration: none; }
a.journey-label:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ── Context bar ──────────────────────────────────────────────────────
   The rail is a map you consult; this is the compass you carry. It is the one
   sticky thing on the page — two pinned bands would eat a screen this dense —
   so where you are, which step it is and whose move it is stay visible all the
   way down. The ground halo hides anything scrolling past its rounded corners. */

.context-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0 0 var(--s4);
  padding: 0.5rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-control);
  box-shadow: 0 0 0 6px var(--ground), var(--lift-1);
  font-size: 0.86rem;
}
.context-trail { color: var(--faint); }
.context-step {
  color: var(--pine);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.context-now { font-weight: 500; }
.context-bar .owner { margin-left: auto; }
.context-sep { color: var(--rule-strong); }

/* ── The next step ────────────────────────────────────────────────────
   One dark band per page, carrying one decision. Everything else on the
   screen is a lighter weight than this on purpose. */

.lead {
  display: grid;
  gap: 0.5rem;
  justify-items: start;
  padding: clamp(1.4rem, 3vw, 2rem);
  margin: 0 0 var(--s5);
  color: var(--chalk);
  background: var(--ink);
  border-radius: var(--r-lead);
  box-shadow: var(--lift-2);
}
.lead h2 {
  margin: 0;
  color: var(--chalk);
  font-size: clamp(1.3rem, 3vw, 1.6rem);
}
.lead p { margin: 0; max-width: 60ch; color: var(--ink-muted); }
.lead .lead-detail { color: var(--chalk); font-variant-numeric: tabular-nums; }
.lead a { color: var(--mint); }
[data-analysis-progress] [hidden] { display: none; }
.lead .button {
  margin-top: 0.45rem;
  color: var(--ink-deep);
  background: var(--mint);
  border-color: var(--mint);
  text-decoration: none;
}
.lead .button { box-shadow: none; }
.lead .button:hover { color: var(--ink-deep); background: var(--chalk); border-color: var(--chalk); box-shadow: var(--lift-2); }
.lead ol, .lead ul { margin: 0; color: var(--ink-muted); }
.lead li { margin: 0.3rem 0; }

/* Who is holding this. The single most useful fact on a gated product, and
   until now the one thing the interface never said. */
.owner {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.5rem 0.15rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.lead .owner { color: var(--mint); }

/* ── Funnel ───────────────────────────────────────────────────────────
   The wave counts are a sequence, not eight unrelated figures. Reading them
   against the admitted total shows the drop-off that the grid hid. */

.funnel { display: grid; margin: 0; padding: 0; list-style: none; }
.funnel li {
  display: grid;
  grid-template-columns: minmax(8rem, 13rem) 1fr auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--rule-soft);
}
.funnel li:first-child { border-top: 1px solid var(--rule-soft); }
.funnel li { transition: background-color 0.15s var(--ease); }
.funnel li:hover { background: color-mix(in srgb, var(--pine) 4%, var(--surface)); }
.funnel-label { font-size: 0.88rem; color: var(--muted); }
.funnel-track {
  height: 0.45rem;
  background: var(--sunken);
  border-radius: 999px;
  overflow: hidden;
}
.funnel-track span { display: block; height: 100%; border-radius: 999px; background: var(--pine); }
.funnel-value {
  min-width: 4ch;
  text-align: right;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.funnel .watched .funnel-label { color: var(--text); }
.funnel .watched .funnel-value { color: var(--pine); }

/* ── Stages ───────────────────────────────────────────────────────────
   A finished gate is a record, not work. It keeps every control and every
   piece of evidence, folded, so the live stage is the tallest thing here. */

.stage { margin: 0 0 1rem; }
/* Leave the sticky context and its halo above native fragment destinations.
   The fallback also gives ordinary no-script navigation room below the bar. */
.stage, #stage-example, #example-email {
  scroll-margin-top: calc(var(--wave-context-height, 6rem) + 1.5rem);
}
details.stage {
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  box-shadow: var(--lift-1);
  transition: box-shadow 0.2s var(--ease);
}
details.stage > summary {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  flex-wrap: wrap;
  padding: 0.9rem 1.15rem;
  color: var(--text);
  font-weight: 400;
}
details.stage > summary:hover { color: var(--pine); }
details.stage + details.stage { margin-top: 0; }
details.stage[open] > summary {
  margin-bottom: 0;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--rule);
}
.stage-name { font-weight: 500; }
.stage-note { color: var(--faint); font-size: 0.86rem; font-variant-numeric: tabular-nums; }
.stage-body { display: grid; gap: var(--s4); padding: 1.25rem 1.15rem; }
.stage-body > :first-child { margin-top: 0; }

/* The live stage sits a level above everything around it, which is the whole
   argument: the thing in hand should be the most present thing on the screen.
   The pine edge is inset so it cannot shift the box by a pixel. */
.stage-current { box-shadow: var(--lift-2), inset 2px 0 0 var(--pine); }
section.stage-current { border-left: 0; }

.stage-head { display: grid; gap: 0.3rem; }
.stage-head h2 { margin: 0; }
.stage-head p { margin: 0; color: var(--muted); max-width: 68ch; }

/* ── Setup checklist ──────────────────────────────────────────────────── */

.checklist { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.checklist li {
  display: grid;
  grid-template-columns: 1.25rem 1fr auto;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule-soft);
}
.checklist li:first-child { border-top: 1px solid var(--rule-soft); }
.check {
  align-self: center;
  width: 1.25rem;
  height: 1.25rem;
  display: grid;
  place-items: center;
  background: var(--sunken);
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  font-size: 0.68rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.checklist .done .check { color: var(--chalk); background: var(--pine); border-color: var(--pine); }
.checklist strong { font-weight: 500; }
.checklist .checklist-detail { display: block; color: var(--faint); font-size: 0.86rem; }
.checklist .done strong { color: var(--muted); }

/* ── Narrow screens ───────────────────────────────────────────────────── */

@media (max-width: 1000px) {
  .metric-grid, .metric-grid-six { grid-template-columns: repeat(3, 1fr); gap: 1px; }
}

@media (max-width: 760px) {
  .metric-grid, .metric-grid-six { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 700px) {
  /* The rail turns vertical rather than wrapping into ragged rows. */
  .journey ol { display: grid; gap: 0.55rem; }
  .journey-step {
    justify-items: stretch;
    padding: 0.5rem 0.6rem 0.5rem 2.75rem;
    text-align: left;
  }
  .journey-step::before {
    top: 1.75rem;
    bottom: -1.05rem;
    left: calc(1.35rem - 1px);
    right: auto;
    width: 2px;
    height: auto;
  }
  .journey-step.is-current:not(:first-child)::after {
    top: -1.05rem;
    bottom: auto;
    left: calc(1.35rem - 1px);
    right: auto;
    width: 2px;
    height: 2.3rem;
  }
  .journey-mark { position: absolute; top: 0.5rem; left: 0.6rem; margin: 0; }
  .funnel li { grid-template-columns: 1fr auto; }
  .funnel-track { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .shell { width: min(1100px, 94vw); margin-top: 1.75rem; }
  .hero-row, .section-heading { align-items: flex-start; flex-direction: column; }
  /* Column direction turns the 22rem flex-basis into a height, which leaves a
     tall gap between the subtitle and the first section. Let the block take its
     content height instead. */
  .hero-row > div:first-child { flex: 0 0 auto; }
  .two-column, .form-grid, .workspace-cards, .metrics { grid-template-columns: 1fr; }
  .price-breakdown { grid-template-columns: 1fr; }
  dl { grid-template-columns: 1fr; gap: 0.2rem 0; }
  dt { margin-top: 0.6rem; }
  .table-scroll { margin-inline: -0.5rem; padding-inline: 0.5rem; }
  /* Give the columns room to breathe and let the wrapper scroll, rather than
     crushing four columns into the viewport and wrapping every cell. */
  .table-scroll > table { min-width: 32rem; }
  .actions > form, .actions > .button, .actions > button { flex: 1 1 auto; }
}

/* ── Legal documents ──────────────────────────────────────────────────
   A contract is the one screen the customer is entitled to read slowly. It gets
   a reading measure, quiet section rules and its own table treatment: these
   tables are dense reference grids, not the lifted record rows the rest of the
   product uses, so they collapse their borders and keep every column visible. */

.legal-contents { margin: 0 0 var(--s4); }
.legal-contents ol {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.25rem 1.5rem;
  margin: 0;
  padding-left: 1.4rem;
  color: var(--faint);
  font-size: 0.92rem;
}
.legal-contents a { color: var(--muted); }
.legal-contents a:hover { color: var(--pine); }

.legal-document { max-width: 72ch; }
.legal-document > h1:first-child { margin-top: 0; }
.legal-document h2 {
  margin: 2.25rem 0 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule-soft);
  font-size: 1.15rem;
}
.legal-document h2:first-of-type { padding-top: 0; border-top: 0; }
.legal-document h3 { margin: 1.6rem 0 0.5rem; font-size: 1rem; font-weight: 600; }
.legal-document p { margin: 0 0 0.85rem; }
.legal-document code { word-break: break-all; }
.legal-document table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  margin: 1.1rem 0 1.5rem;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 0.92rem;
}
.legal-document th,
.legal-document td {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}
.legal-document th { background: var(--sunken); font-weight: 500; }

@media print {
  .site-header, .site-footer, .workspace-nav, .crumbs, .legal-contents, form { display: none; }
  .panel { border: 0; box-shadow: none; }
  .legal-document { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
