/* ---------- Tokens ---------- */

/* tokens:begin: generated from design/tokens.json by scripts/tokens; don't edit */
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter Tight";
  src: url("/fonts/inter-tight-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter Tight";
  src: url("/fonts/inter-tight-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter Tight";
  src: url("/fonts/inter-tight-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/IBMPlexMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/IBMPlexMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/IBMPlexMono-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
:root {
  --ground: #f5f6f3;
  --surface: #ffffff;
  --sunken: #ecefeb;
  --ink: #17211f;
  --ink-2: #3d4944;
  --muted: #56625d;
  --border: #dde2de;
  --border-strong: #7f8a84;
  --accent: #4b45a8;
  --accent-soft: #eeedf9;
  --focus: var(--accent);
  --pencil: #5c6762;
  --pencil-soft: #f3f4f2;
  --ok: #0b6e63;
  --ok-soft: #e3f1ee;
  --warn: #8d570e;
  --warn-soft: #f9f1e4;
  --danger: #a83a2c;
  --danger-soft: #f8ece9;
  --brand: #c9f36b;
  --on-brand: #0e0e0e;
  --brand-ink: #516b1c;
  --on-ink: var(--ground);
  --scrim: rgba(13, 20, 18, 0.35);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --touch-min: 44px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --rule: 1px;
  --rule-pencil: 1.5px;
  --rule-double: 3px;
  --focus-width: 2px;
  --shadow-pop: 0 8px 24px rgba(23, 33, 31, 0.12);
  --shadow-dialog: 0 18px 40px -24px rgba(23, 33, 31, 0.35);
  --sidebar: 216px;
  --main-max: 1080px;
  --w-fig: 14;
  --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Inter Tight", "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: var(--font-sans);
  --display: var(--font-display);
  --mono: var(--font-mono);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #101614;
    --surface: #161f1c;
    --sunken: #1b2522;
    --ink: #ecf1ed;
    --ink-2: #cbd4ce;
    --muted: #aab6af;
    --border: #31403b;
    --border-strong: #6e7e77;
    --accent: #aba6f2;
    --accent-soft: #262a47;
    --pencil: #a3afa8;
    --pencil-soft: #1b2522;
    --ok: #5fc4b4;
    --ok-soft: #12302b;
    --warn: #e5b669;
    --warn-soft: #2b2214;
    --danger: #f29a8a;
    --danger-soft: #2c1916;
    --brand-ink: #c9f36b;
    --scrim: rgba(0, 0, 0, 0.6);
    --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-dialog: 0 18px 40px -24px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}
@media (prefers-contrast: more) and (prefers-color-scheme: light) {
  :root {
    --ground: #ffffff;
    --ink: #000000;
    --ink-2: #000000;
    --muted: #3d4944;
    --border-strong: #3d4944;
    --accent: #2a2566;
    --pencil: #3d4944;
    --ok: #07524a;
    --warn: #5f3b08;
    --danger: #74281f;
    --brand-ink: #3f5316;
  }
}
/* tokens:end */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--display); text-wrap: balance; letter-spacing: -0.015em; }
h1 { font-size: 22px; font-weight: 600; margin: 4px 0 16px; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
h1.flush { margin: 0 0 4px; }

a:focus-visible, button:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: var(--focus-width); }
.crumb a, .card a, table a { color: var(--accent); text-decoration: none; }
.crumb a:hover, .card a:hover, table a:hover { text-decoration: underline; }

.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 12.5px; }
.hint { color: var(--muted); font-size: 12px; }
.late { color: var(--warn); }
.code { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }
.eyebrow { font: 500 11px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.pre { white-space: pre-line; margin: 0 0 4px; }
.spacer { flex: 1; }
.voided { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--pencil); }

/* ---------- Navigation the books and the platform share ---------- */

/* Where you are: a breadcrumb above the page's title, and tabs between views of one thing. */
.crumb { margin: 0 0 8px; font-size: 13px; }
.crumb [aria-hidden] { color: var(--muted); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 8px 0; }
.tab {
  background: transparent; color: var(--ink-2); border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 5px 10px; font-weight: 400; font-size: 12.5px;
}
.tab.on { background: var(--surface); border-color: var(--border); color: var(--ink); font-weight: 500; }
.tab .n { font-family: var(--mono); color: var(--muted); font-size: 11px; margin-left: 4px; }

/* The top bar: the mark, then where you are (a company's menu, or plain words), then the person's
   initials and their account. Both menus are <details>, so they open without scripts. */
.topbar { position: relative; z-index: 1; display: flex; align-items: center; gap: var(--space-3); min-height: 52px; padding: 0 var(--space-4); background: var(--surface); border-bottom: var(--rule) solid var(--border); font-size: 13px; }
/* The bar's lockup (Design's lockup spec): 28px tall, 24px on a phone, and below 360px the mark
   alone. The link is the bar's height and at least 44px wide. */
.topbar-brand { display: flex; align-items: center; min-height: var(--touch-min); min-width: var(--touch-min); text-decoration: none; }
.topbar-lockup, .topbar-lockup img { display: block; height: 28px; width: auto; }
.topbar-mark { display: none; height: 28px; width: 28px; }
@media (max-width: 640px) {
  .topbar-lockup, .topbar-lockup img { height: 24px; }
}
@media (max-width: 359px) {
  .topbar-lockup { display: none; }
  .topbar-mark { display: block; }
}
.context { min-width: 0; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context-menu { position: relative; min-width: 0; }
.context-menu > summary { display: flex; align-items: center; min-height: var(--touch-min); list-style: none; cursor: pointer; color: var(--ink); font-weight: 500; }
.context-menu > summary::-webkit-details-marker { display: none; }
.context-menu > summary .context { color: inherit; }
.context-panel { position: absolute; left: 0; top: 100%; min-width: 220px; max-width: calc(100vw - 32px); padding: var(--space-2); display: grid; background: var(--surface); border: var(--rule) solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); }
.context-panel a { display: flex; align-items: center; min-height: var(--touch-min); padding: 0 var(--space-2); border-radius: var(--radius-sm); color: var(--ink-2); text-decoration: none; }
.context-panel a:hover { background: var(--sunken); color: var(--ink); }
.context-panel hr { width: 100%; margin: var(--space-1) 0; border: 0; border-top: var(--rule) solid var(--border); }
.account-menu > summary { list-style: none; cursor: pointer; }
.account-menu > summary::-webkit-details-marker { display: none; }
.initials { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--sunken); color: var(--ink); font: 500 11.5px/1 var(--mono); }
.account-panel { position: absolute; left: 16px; right: 16px; top: 100%; margin-top: 4px; padding: 12px 14px; display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); }
.account-panel .who { margin: 0 0 4px; font-size: 13px; color: var(--ink); }
.account-panel form { margin: 0; }
a.account-action { display: flex; align-items: center; min-height: 44px; font-size: 13px; color: var(--ink-2); text-decoration: none; }
a.account-action:hover { color: var(--ink); text-decoration: underline; }
button.link.account-action { font-weight: 400; display: flex; align-items: center; min-height: 44px; padding: 0; font-size: 13px; color: var(--ink-2); text-align: left; }
/* In the top bar, the account is always behind the initials, at the bar's right. */
.topbar .account-menu { display: block; position: relative; margin-left: auto; }
.topbar .account-menu > summary { display: grid; place-items: center; width: var(--touch-min); height: var(--touch-min); }
.topbar .account-panel { left: auto; right: 0; width: min(280px, calc(100vw - 32px)); }
/* ---------- Surfaces ----------
   One surface, the card, at two densities: standard for lists, forms and panels, and sheet for
   anything that reads as a document. An inset is a box inside a card. */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 16px 0;
}
.card.sheet { padding: 22px 24px; }
.card.flush { padding: 0; overflow-x: auto; }
.ink { border-color: var(--border-strong); }

/* Pencil: anything proposed and not yet in the books. */
.pencil {
  border: var(--rule-pencil) dashed var(--pencil);
  background: var(--pencil-soft);
  border-radius: var(--radius);
}

.inset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 12px 0;
}
/* Where the parent spaces its children with a gap, the surfaces inside bring no margin. */
:is(.split, .side, .doc, .detail, .proposal-why, .form-grid) > :is(.card, .inset) { margin: 0; }

/* ErrorCard: name the rule, say what happened, offer the ways forward. */
.inset.danger {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--ink);
}
.inset.danger strong { color: var(--danger); }
/* Something needs a person, but nothing failed: a connection to renew, a line that changed. */
.inset.warn {
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn) 40%, transparent);
  color: var(--ink);
}

.confirm { border-color: var(--border-strong); display: grid; gap: 8px; }
.confirm p { margin: 0; font-size: 13.5px; }

.notice { background: var(--accent-soft); border-radius: var(--radius-sm); padding: 8px 12px; margin: 0 0 12px; font-size: 13.5px; }

/* ---------- Pills, tags and chips ----------
   A pill is a short status and never wraps. A tag says what search understood, can be a whole
   sentence, and wraps as a box. A chip is a suggestion to click. */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-2);
  margin: 2px 4px 2px 0;
  white-space: nowrap;
}
.pill-info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.pill-ink { background: var(--sunken); color: var(--ink); border-color: transparent; }
.pill-pencil { background: transparent; color: var(--pencil); border: 1px dashed var(--pencil); }
.pill-muted { color: var(--muted); text-decoration: line-through; }

.tag {
  display: inline-block;
  max-width: 100%;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-2);
  white-space: normal;
}
.tag-info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.code { font: 11.5px/1.5 var(--mono); padding: 2px 6px; background: var(--sunken); border-color: transparent; color: var(--ink-2); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--border);
  font-weight: 400;
  font-size: 13px;
  border-radius: var(--radius-pill);
  padding: 5px 12px;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 640px) {
  .card:not(.flush), .card.sheet { padding: 14px; }
}

/* The reconcile page's difference bar: its six figures in a row, held at the bottom while the
   items scroll, wrapping to pairs on a phone. */
.recon-bar {
  position: sticky; bottom: 0; z-index: 1;
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px;
  margin: 16px 0; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px;
}
.recon-bar > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.recon-bar .num { font-variant-numeric: tabular-nums; }
.recon-bar .difference.ok .num { color: var(--ok); }
.recon-bar .difference.danger .num { color: var(--danger); }
@media (max-width: 640px) {
  .recon-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
ul.items { display: grid; gap: 6px; margin: 8px 0; padding: 0; list-style: none; }
.warn-text { color: var(--warn); }
.cleared { color: var(--ok); font-weight: 600; }
.flag-actions { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 4px; }
/* Settings' tabs: one row that scrolls sideways inside itself on a phone, never the page. */
/* A section's tab bar (Bank, Settings): one row of links that scrolls inside itself, never the
   page, with the current page's tab underlined; a hairline between groups. */
.tabs.section-tabs { flex-wrap: nowrap; overflow-x: auto; margin-bottom: 12px; align-items: center; }
.section-tabs .tab {
  white-space: nowrap; text-decoration: none; flex: none;
  max-width: 16ch; overflow: hidden; text-overflow: ellipsis;
}
.section-tabs .tab[aria-current="page"] { border-bottom: 2px solid var(--accent); }
.section-tabs .tab-divider { flex: none; align-self: stretch; width: 1px; margin: 4px 6px; background: var(--border); }
@media (max-width: 640px) {
  .row.between.choice { flex-direction: column; align-items: stretch; gap: 8px; text-align: left; }
  .choice .segmented { display: flex; flex-direction: column; width: 100%; }
  .choice .segmented .tab { min-height: 44px; width: 100%; }
}

/* Today: one row per thing that needs a person, its action on the right. */
.today-rows { margin: 0; }
.today-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); }
.today-row:first-child { border-top: 0; }
.today-row .grow { flex: 1; min-width: 0; }
@media (max-width: 640px) {
  .today-row { flex-direction: column; align-items: stretch; }
  .today-row .button { width: 100%; min-height: 44px; }
}
/* On a phone, each bar is one row that scrolls inside itself, and every tab is a 44px target. */
@media (max-width: 640px) {
  .tabs.view-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .section-tabs .tab, .view-tabs .tab { min-height: 44px; display: inline-flex; align-items: center; flex: none; }
}
/* ---------- Forms and buttons ---------- */

input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  width: 100%;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: var(--focus-width) solid var(--focus); outline-offset: -1px; border-color: transparent; }
input.invalid { border-color: var(--danger); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
label.check { display: flex; flex-direction: row; gap: 8px; align-items: center; color: inherit; font-size: 15px; }
label.check input { width: auto; }
.inline-err { display: block; color: var(--danger); font-size: 12px; margin-top: 4px; }

/* Primary is ink: one per screen, for the action that commits. */
button, a.button, label.button {
  background: var(--ink);
  color: var(--ground);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
a.button, label.button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
a.button:hover { text-decoration: none; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.secondary, a.button.secondary, label.button.secondary { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
button.quiet, a.button.quiet { background: transparent; color: var(--ink-2); }
button.danger { background: transparent; color: var(--danger); border-color: var(--border-strong); }
button.link { background: none; color: var(--accent); padding: 4px 6px; font-weight: 500; }
button.link:disabled { color: var(--muted); }
button.link.danger { color: var(--danger); }
button.quiet.danger-text { color: var(--danger); }
.wide-button { width: 100%; margin-bottom: 8px; }

.form-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
/* On a phone an inline form's button (Connect, Save key) is a full-width, 44px touch target. */
@media (max-width: 760px) {
  .inline-form > button { width: 100%; min-height: 44px; }
}
.status { color: var(--muted); font-size: 13.5px; }
.status.ok { color: var(--ok); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.form-grid .wide, .form-grid h2 { grid-column: 1 / -1; }
.form-grid label.check { flex-wrap: wrap; font-size: 13.5px; align-self: center; }
.form-grid label.check .hint { flex-basis: 100%; }

/* ---------- Fields: as wide as the values they hold ----------
   Widths are in ch of the mono face. A field rests at its type's typical width, grows with what's
   typed, and never clips. --max matches the field's maxlength: the domain's longest value plus a
   little room for a pasted `$` or an extra decimal, which the field then refuses in words.
   --len is set from the value. */

:root { --field-chrome: 22px; /* 10px padding and a 1px border, each side */ }
input.field-money { --rest: 12; --max: 26; }
input.field-qty { --rest: 10; --max: 21; }
input.field-rate { --rest: 9; --max: 13; padding-right: calc(10px + 1ch); }
input.field-days { --rest: 5; --max: 5; }
.field-days-row { display: inline-flex; align-items: baseline; gap: 6px; margin-top: 6px; }
input.field-num {
  font: 13px/1.4 var(--mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  width: calc(clamp(var(--rest), var(--len, 0), var(--max)) * 1ch + var(--field-chrome));
}
input.field-num::placeholder { text-align: right; }
/* A field keeps its width in a flex row; the row wraps instead of squeezing it. */
input.field-num, input.field-date, .field-affix { flex: none; }
.field-affix { position: relative; display: inline-block; width: max-content; }
.field-affix .affix { position: absolute; right: 10px; top: 9px; font: 13px/1.4 var(--mono); color: var(--muted); pointer-events: none; }
input.field-date { font: 13px/1.4 var(--mono); width: calc(10ch + 32px + var(--field-chrome)); }
input.field-text { min-width: 16em; }

/* Line tables: numbers take their fields' widths first; description and account share the rest
   3 : 2. A table wider than its box scrolls inside its .table-scroll, never the page. */
table.lines td { vertical-align: top; }
table.lines td.num, table.apply td.num { width: 1%; white-space: nowrap; }
table.lines td.desc { width: 60%; }
table.lines td.acct { width: 40%; }
/* Line tables share a narrow sheet, so their text fields rest smaller than in ordinary forms. */
table.lines .field-text { min-width: 9em; }
table.lines td.acct select { min-width: 7em; }
table.lines .ctl { width: 36px; text-align: center; }
table.lines .ctl input { width: auto; }
/* A read-only figure lines up with the fields above it, and is never narrower than one. */
table.lines td.fig, table.apply td.fig { min-width: calc(12ch + var(--field-chrome)); }
table.lines td.fig { padding-right: 17px; }
.entry-form table.lines td { border-bottom: 0; padding: 4px 6px 4px 0; }

@media (max-width: 640px) {
  /* In an editable line table each line is a card: text fields full width under their label,
     numbers on their own line with the label on the left and the field at its type's width on
     the right. */
  table.lines.editable thead { display: none; }
  table.lines.editable, table.lines.editable tbody, table.lines.editable tfoot { display: block; }
  table.lines.editable tr { display: grid; gap: 6px; border-bottom: 1px solid var(--border); padding: 8px 0; }
  table.lines.editable tfoot tr { border-bottom: 0; }
  table.lines.editable td { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; padding: 0; width: auto; min-width: 0; }
  table.lines.editable td:empty { display: none; }
  table.lines.editable td[data-label]::before { content: attr(data-label); font: 12px/1.4 var(--sans); color: var(--muted); }
  table.lines.editable td.desc, table.lines.editable td.acct { display: grid; grid-template-columns: minmax(0, 1fr); }
  table.lines.editable td.desc .field-text, table.lines.editable td.acct select { min-width: 0; }
  table.lines.editable td.ctl { justify-content: flex-start; }
  table.lines td.num .inline-err, table.cards td.num .inline-err { flex-basis: 100%; text-align: right; }
  /* After the forms rules above, which would otherwise override it in a card. */
  table.cards td.num { width: 100%; min-width: 0; }
}

/* The starter chart's card: its list of accounts, and on a phone full-width, 44px buttons that
   stack with the primary on top. */
.starter-list h4 { margin: 12px 0 4px; }
.starter-accounts li { display: flex; justify-content: space-between; gap: 12px; }
@media (max-width: 760px) {
  .card .wide-button, .confirm .stack-phone button { width: 100%; min-height: 44px; }
  .confirm .stack-phone { flex-direction: column; align-items: stretch; }
  .starter-accounts li { flex-direction: column; gap: 0; }
}
/* A hand-entered statement's checks: each passing or failing in words, never colour alone. */
ul.checks { margin: 12px 0; padding: 0; list-style: none; display: grid; gap: 6px; }
ul.checks li.ok > span { color: var(--ok); }
ul.checks li.danger { color: var(--danger); }
/* A setting shown as a fact: the value in ink, who and when in ink-2, and a quiet Change. */
.zone-fact { margin: 0 0 4px; }
.ink-2 { color: var(--ink-2); }
@media (max-width: 640px) {
  .zone-fact .change { display: block; width: 100%; min-height: 44px; text-align: left; }
}
/* Sign out after inactivity: the field, why it won't save, and Save over Cancel on a phone. */
.idle-form { display: grid; gap: 6px; max-width: 420px; margin: 8px 0; }
.idle-form input { max-width: 10ch; }
.idle-form .field-error { margin: 0; color: var(--danger); }
.idle-actions { display: flex; gap: 12px; align-items: center; }
.idle-actions button { min-height: 44px; }
@media (max-width: 640px) {
  .idle-form, .idle-form input { max-width: none; width: 100%; font-size: 16px; }
  .idle-actions { flex-direction: column; align-items: stretch; }
  #sign-out-after-inactivity .change { display: block; width: 100%; min-height: 44px; text-align: left; }
}
/* How long free text is, once it nears its limit; past it, in warning colour. Never truncated. */
.counter { display: block; flex-basis: 100%; margin-top: 2px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--warn); font-weight: 500; }

/* Read by screen readers, not shown. */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* A page's one sentence: 4px under its heading, 8px above any tabs, never truncated. */
.lede { max-width: 68ch; }
main > .title-row + .lede, main > h1 + .lede { margin-top: -12px; }
.lede + .tabs { margin-top: -8px; }
/* A sub-label on its own line, such as the plain words under a column heading. */
.block { display: block; }
/* The platform's own pieces, on top of the books app's base, surfaces, forms and notices (served
   together as /assets/platform.css). Design: the platform pages delta (ONE-ADR-17, 18, 19). The
   platform has no sidebar: the shared top bar (base.css), and one short card per page. */

body { margin: 0; background: var(--ground); color: var(--ink); font: 14px/1.5 var(--sans); }
main.platform { padding: 28px var(--space-4) 40px; display: grid; justify-items: center; }
.platform .card { width: min(520px, 100%); margin: 0; padding: 22px; display: grid; gap: var(--space-4); }
.platform h1 { font-size: 20px; margin: 0; letter-spacing: -0.015em; }
.platform p { margin: 0; }
/* The breadcrumb lines up with the card under it; the tabs under a title are full touch targets. */
.platform > .crumb { width: min(520px, 100%); }
.platform > .crumb:has(+ .card.wide) { width: min(960px, 100%); }
.platform .tabs { margin: var(--space-2) 0 0; }
.platform .tabs .tab { display: inline-flex; align-items: center; min-height: var(--touch-min); color: var(--ink-2); text-decoration: none; }
.platform .tabs .tab.on { color: var(--ink); }
/* Sign-in: the lockup and tagline above the card. */
.lockup { display: grid; justify-items: center; gap: 6px; margin-bottom: 20px; text-align: center; }
.lockup img { display: block; height: 40px; width: auto; }
.platform .wide-button, .platform .row > .button, .platform .row > button { min-height: var(--touch-min); }
.row { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.companies { display: grid; gap: var(--space-2); }
.company { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--space-3); align-items: center; padding: var(--space-3) 14px; border: var(--rule) solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; }
a.company:hover { border-color: var(--accent); text-decoration: none; }
.company .name { font-weight: 600; }
.company .host { font: 12px/1.4 var(--mono); color: var(--muted); }
.company .role { grid-row: 1 / span 2; grid-column: 2; }
.address { display: flex; align-items: stretch; border: var(--rule) solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.address input { border: 0; border-radius: 0; flex: 1; min-width: 0; font: 13px/1.4 var(--mono); }
.address span { padding: var(--space-2) 10px; font: 13px/1.4 var(--mono); color: var(--muted); background: var(--sunken); border-left: var(--rule) solid var(--border); white-space: nowrap; }
input.code { font: 13px/1.4 var(--mono); word-break: break-all; }
label.check.accept { align-items: flex-start; background: var(--sunken); border-radius: var(--radius); padding: 10px var(--space-3); font-size: 13px; color: var(--ink); }
label.check.accept input { margin-top: 3px; }
.document { white-space: pre-wrap; font-size: 13.5px; }
@media (max-width: 640px) {
  main.platform { padding: var(--space-4); }
  .platform .card { padding: var(--space-4); }
}

/* The dev tool that makes issuance codes: dev mode only, in the warning colour. */
.dev-panel { background: var(--warn-soft); border-color: var(--warn); }
.dev-panel .wide-button, .dev-panel .button { min-height: var(--touch-min); }
.code-once { display: block; font-family: var(--mono); overflow-wrap: anywhere; padding: var(--space-3);
  border: var(--rule) solid var(--warn); border-radius: var(--radius-sm); background: var(--surface);
  user-select: all; }

/* A company's Members page: one card per group, a row per person, confirmations in place. */
.members { display: grid; gap: 10px; }
.member { display: grid; gap: 10px; padding: var(--space-3) 14px; border: var(--rule) solid var(--border); border-radius: var(--radius); background: var(--surface); }
.member .who { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--space-3); align-items: center; }
.member .name { font-weight: 600; }
.member .role { grid-column: 2; grid-row: 1; }
.member .email, .member .access { grid-column: 1; font-size: 13px; color: var(--muted); }
.member form { margin: 0; }
.member label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.member .row > .button, .member .row > button, .member > .button, .member > button { min-height: var(--touch-min); }
.member.past { background: var(--sunken); color: var(--muted); }
.member.past .name { font-weight: 500; }
.member .confirm { display: grid; gap: 10px; padding: var(--space-3); border: var(--rule) solid var(--danger); border-radius: var(--radius); background: var(--danger-soft); }
.member .confirm label { display: grid; gap: var(--space-1); }
@media (max-width: 640px) {
  .member .confirm .row { flex-direction: column; align-items: stretch; }
}

/* Your companies over time: an Owner's Members link, access that ends soon, and access that
   ended, greyed under a quiet Past label. The Owner's notice sits above the list. */
.company-row { display: grid; gap: var(--space-1); }
.company-row .members-link { justify-self: end; font-size: 13px; }
.company-row .fine { margin: 0 var(--space-1); }
.company.past { background: var(--sunken); color: var(--muted); }
.past-label { margin-top: var(--space-1); text-transform: uppercase; letter-spacing: .06em; }
.notice-card { gap: var(--space-2); }
.notice-card form { margin: 0; }

/* A company's members history: a table, and a card per event on a phone. */
.platform .card.wide { width: min(960px, 100%); }
.filters label { display: grid; gap: var(--space-1); font-size: 13px; }
.filters .button, .filters button { align-self: end; min-height: var(--touch-min); }
table.history { width: 100%; border-collapse: collapse; font-size: 13px; }
table.history th, table.history td { text-align: left; padding: var(--space-2) 10px; border-bottom: var(--rule) solid var(--border); vertical-align: top; }
table.history th { font-weight: 600; color: var(--muted); }
@media (max-width: 640px) {
  table.history thead { display: none; }
  table.history tr { display: grid; gap: 2px; padding: 10px 0; border-bottom: var(--rule) solid var(--border); }
  table.history td { border: 0; padding: 0; }
  table.history td[data-label="Person"]::before, table.history td[data-label="By"]::before,
  table.history td[data-label="Details"]::before { content: attr(data-label) ": "; color: var(--muted); }
  .filters { flex-direction: column; align-items: stretch; }
}

/* Your account: passkeys, a row each, renamed in place, removal confirmed in place. */
.stack { display: grid; gap: var(--space-4); width: min(520px, 100%); }
.passkeys { display: grid; gap: var(--space-2); }
.passkey { display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-4); border: var(--rule) solid var(--border); border-radius: var(--radius); background: var(--surface); }
.passkey form { margin: 0; }
.passkey .rename { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-2); }
.passkey .rename label { display: grid; gap: var(--space-1); flex: 1; min-width: 12rem; font-size: 13px; }
.passkey .rename button, .passkey > form > button, .passkey .confirm button, .passkey .confirm .button { min-height: var(--touch-min); }
/* Removing starts from a danger outline; confirming it is the filled step. */
.passkey > form > button.danger { border-color: var(--danger); }
.passkey .confirm { display: grid; gap: var(--space-3); padding: var(--space-3); border: var(--rule) solid var(--danger); border-radius: var(--radius); background: var(--danger-soft); }

/* Home, signed in: Clients or Your companies (the firm view). Each company's status in a table,
   figures in mono, each count a dotted link to its proof; on a phone, one card per company with
   its values in a 2 × 2 grid, sorted by the Sort by form above. */
.firm .proof { font-family: var(--mono); }
.firm-table { width: 100%; border-collapse: collapse; }
.firm-table th, .firm-table td { padding: var(--space-2); border-bottom: var(--rule) solid var(--border); text-align: left; vertical-align: top; }
.firm-table thead th { font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.firm-table .num { text-align: right; font-family: var(--mono); }
.firm-table tbody th { font-weight: 400; }
.firm-table .name { font-weight: 600; color: var(--ink); }
.firm-table .host { font-family: var(--mono); }
.firm-table .sort { display: inline-flex; align-items: center; min-height: var(--touch-min); color: inherit; }
.firm-table [aria-sort="ascending"] .sort::after { content: " ↑"; }
.firm-table [aria-sort="descending"] .sort::after { content: " ↓"; }
.firm-table a.figure, .firm-table .figure { font-family: var(--mono); color: var(--ink); text-decoration: underline dotted; text-underline-offset: 3px; }
.firm-table .figure.ok, .firm-table span.ok { color: var(--ok); }
.firm-table .figure.warn, .firm-table span.warn { color: var(--warn); }
.firm-table .figure.danger, .firm-table span.danger { color: var(--danger); }
/* A company that needs attention: an ochre dot beside the reasons, never the dot alone. */
.firm-table .attention { color: var(--warn); }
.firm-table .attention a { color: var(--warn); }
.firm-table .attention-dot { display: inline-block; width: 8px; height: 8px; margin-right: var(--space-1); border-radius: 50%; background: var(--warn); vertical-align: middle; }
/* All, or only those needing attention: two segmented buttons. */
.firm .segmented { display: inline-flex; border: var(--rule) solid var(--border); border-radius: var(--radius); overflow: hidden; }
.firm .segmented a { display: inline-flex; align-items: center; min-height: var(--touch-min); padding: 0 var(--space-3); color: var(--ink); text-decoration: none; }
.firm .segmented a + a { border-left: var(--rule) solid var(--border); }
.firm .segmented [aria-current="true"] { background: var(--sunken); font-weight: 600; }
.firm .sort-by { display: none; }
@media (max-width: 640px) {
  .firm .sort-by { display: flex; }
  .firm .sort-by select, .firm .sort-by button { min-height: var(--touch-min); }
  .firm-table thead { display: none; }
  .firm-table, .firm-table tbody, .firm-table tr { display: block; }
  .firm-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); padding: var(--space-3); margin-bottom: var(--space-2); border: var(--rule) solid var(--border); border-radius: var(--radius); background: var(--surface); }
  .firm-table th, .firm-table td, .firm-table .num { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--space-2); padding: 0; border: 0; text-align: left; }
  .firm-table tbody th { grid-column: 1 / -1; display: grid; }
  .firm-table td::before { content: attr(data-label); flex-basis: 100%; font: 12px/1.4 var(--sans); color: var(--muted); }
  .firm-table .fine a { display: inline-flex; align-items: center; min-height: var(--touch-min); }
  .firm .segmented { display: flex; }
  .firm .segmented a { flex: 1; justify-content: center; }
  .firm-table td[colspan] { grid-column: 1 / -1; }
  .firm-table .figure, .firm-table .name { display: inline-flex; align-items: center; min-height: var(--touch-min); }
}
