/* Keep 1031 platform -- one stylesheet for the console and the portal.
 *
 * BRAND: navy and gold, ring mark. Operator ruling 2026-08-13.
 *
 * EVERY COLOUR BELOW COMES FROM assets/brand/keep1031-tokens.css, which is
 * byte-identical to keep1031-ops/assets/brand/keep1031-tokens.css. The pack is
 * the palette; this file maps it onto local names and does the layout.
 *
 * The suite enforces both halves: no hex may appear here that is not in the
 * pack, and the pack must match the ops repo's copy. That is the whole
 * mechanism by which campaign mail and the product cannot drift apart -- which
 * they already had, silently, before the ruling. A colour is not the kind of
 * thing that fails a test on its own.
 *
 * SO: to change a colour, change it in BOTH copies of the pack and then here.
 * Adding a new one here without adding it to the pack fails the suite, which
 * is the intended amount of friction: an invented colour is how a second
 * palette starts.
 *
 * Colours are defined once on :root and only re-bound under the dark blocks,
 * so a token can never be defined solely inside a media query.
 */

:root {
  --navy-900: #081426;
  --navy-800: #0d1f38;
  --navy-700: #14304f;
  --navy-600: #1d4470;
  --gold-500: #d4af37;
  --gold-400: #d9b64a;
  --on-navy: #cfdcec;
  --on-navy-muted: #9db0c8;
  --navy-line: #35506f;

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --fg: #101826;
  --muted: #5a6675;
  --line: #d8dee6;

  --accent: var(--navy-800);
  --accent-fg: #ffffff;

  --ok: #14683f;
  --ok-bg: #e6f4ec;
  --warn: #8a5a00;
  --warn-bg: #fdf1da;
  --critical: #8f1d1d;
  --critical-bg: #fbe6e6;
  --passed: #4a2570;
  --passed-bg: #efe7f7;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(8, 20, 38, .08), 0 4px 14px rgba(8, 20, 38, .06);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* THE TYPE SCALE, copied from assets/brand/keep1031-tokens.css (--k-text-*)
     exactly as the colours are. Ruled 2026-09-11 (UI round 3 addendum v3):
     headers move more than body, and nothing is under --text-min outside a
     pill. tools/type-scale-test.mjs checks these values against the pack and
     fails on any literal font-size in this file. */
  --text-title: 28px;
  --text-section: 20px;
  --text-row: 16px;
  --text-body: 15px;
  --text-meta: 14px;
  --text-label: 13px;
  --text-min: 12px;
  --lh-body: 1.5;
  --lh-head: 1.25;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1220;
    --surface: #101c2e;
    --surface-2: #16253a;
    --fg: #e8edf4;
    --muted: #97a5b8;
    --line: #24354e;
    --accent: var(--gold-500);
    --accent-fg: #0a1220;
    --ok: #7fd0a0;      --ok-bg: #12301f;
    --warn: #e5b862;    --warn-bg: #33270d;
    --critical: #f09b9b; --critical-bg: #3a1616;
    --passed: #c9a6f0;  --passed-bg: #271a3a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

/* THE SAME PALETTE, REACHED BY CHOICE RATHER THAN BY THE OPERATING SYSTEM.
 *
 * Ruling 5.3, 2026-09-04. Until now dark existed ONLY inside the media query
 * above, which means a person whose machine is set to light had no way to get
 * it: the rules to apply it did not exist. A toggle would have flipped an
 * attribute that nothing was listening for, appeared to work, and changed
 * nothing -- the same silent nothing as a colour token that resolves to
 * empty, and the reason `--navy` and `--ink` had to be hunted down earlier
 * this run.
 *
 * THESE DECLARATIONS ARE GENERATED FROM THE BLOCK ABOVE and must stay
 * identical to it. Two palettes that drift are two products: somebody fixes a
 * contrast bug in one, and the half of the users on the other never see the
 * fix. tools/theme-test.mjs compares them token by token and fails on the
 * first difference, which is the only reason duplicating them is acceptable.
 *
 * WHY DUPLICATED AT ALL. CSS has no way to share one declaration block
 * between a media query and a plain selector -- @custom-media is not
 * implemented anywhere we ship to. The alternatives are worse: a build step
 * for one stylesheet, or hanging every token off a second layer of
 * indirection that makes the palette unreadable in the file where somebody
 * has to edit it.
 *
 * NOTHING SETS THIS ATTRIBUTE YET. Ruling 5.1 decides how the default is
 * applied and 5.2 decides where the preference lives; both are held. Until
 * one of them lands this block is unreachable and the rendered product is
 * unchanged -- which is why it was safe to build tonight.
 */
:root[data-theme="dark"] {
    --bg: #0a1220;
    --surface: #101c2e;
    --surface-2: #16253a;
    --fg: #e8edf4;
    --muted: #97a5b8;
    --line: #24354e;
    --accent: var(--gold-500);
    --accent-fg: #0a1220;
    --ok: #7fd0a0;      --ok-bg: #12301f;
    --warn: #e5b862;    --warn-bg: #33270d;
    --critical: #f09b9b; --critical-bg: #3a1616;
    --passed: #c9a6f0;  --passed-bg: #271a3a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }

/* The `hidden` attribute has to win.
 *
 * Both front ends hide their chrome with `hidden` until they know who is
 * signed in. The browser implements that with `[hidden] { display: none }` in
 * its own stylesheet -- which any author rule beats, and `header.top` below
 * sets `display: flex`. The result was a signed-out console showing its
 * header and a "Sign out" button. Found in a browser, because it is invisible
 * to anything checking HTTP responses.
 *
 * !important because the whole point is that it outranks whatever a component
 * rule says about display. This is the one place in the file it is warranted.
 */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: var(--text-body);
  line-height: var(--lh-body);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--navy-600); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) a { color: var(--gold-400); } }
:root[data-theme="dark"] a { color: var(--gold-400); }

/* -- the shell ------------------------------------------------------------
 *
 * Persistent left navigation, ruled. The whole product is two clicks deep:
 * the nav is click one and it never goes away, so no screen is ever reached
 * by remembering where you came from.
 *
 * The sidebar is fixed on desktop and, under 900px, slides in from the left
 * behind a menu button (CAIRN-0121, 11/9, Christian on his phone; this
 * reversed the 2026-09-08 "no hamburger" ruling and answered Q-109).
 */

/* THE SHELL IS A GRID SO THE HEADER CAN SPAN BOTH COLUMNS. Ruling 6.1
   option A, 2026-09-08. It was a flex row of sidebar + content, which has no
   way to put anything above both of them.

   --topbar-h is a variable rather than a number in three places because the
   sticky sidebar has to start exactly where the header ends; a header that
   grew by two pixels and a sidebar that did not would leave a seam, and the
   seam is the kind of thing nobody files a bug about. */
:root { --topbar-h: 52px; }

.shell {
  display: grid;
  grid-template-columns: 208px 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  min-height: 100vh;
}

.topbar {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 18px;
  padding: 0 16px;
  background: var(--navy-900);
  color: var(--on-navy);
  border-bottom: 1px solid var(--navy-line);
  position: sticky; top: 0; z-index: 30;
}
.topbar .brand { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.topbar .brandname { font-weight: 600; font-size: var(--text-body); color: #fff;
                     letter-spacing: .01em; white-space: nowrap; }

/* THE SEARCH SITS IN THE HEADER AND THE DROPDOWN HANGS OFF IT.
   position:relative here is what the absolutely-positioned panel measures
   against; without it the panel would be placed against the viewport and
   would not follow the input on a narrow window. */
.searchwrap { position: relative; flex: 1 1 auto; max-width: 620px; }
.searchwrap input {
  width: 100%; padding: 7px 11px; font-size: var(--text-meta);
  border-radius: var(--radius);
  border: 1px solid var(--navy-line);
  background: var(--navy-800); color: var(--on-navy);
}
.searchwrap input::placeholder { color: var(--on-navy-muted); }
.searchwrap input:focus {
  outline: 2px solid var(--gold-500); outline-offset: -1px;
  background: var(--navy-700);
}

.searchdrop {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  max-height: 70vh; overflow-y: auto;
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 12px; z-index: 40;
}

.sidebar {
  flex: 0 0 208px;
  background: var(--navy-800);
  color: var(--on-navy);
  display: flex;
  flex-direction: column;
  padding: 14px 0 0;
  position: sticky;
  /* BELOW THE HEADER, NOT UNDER IT. The header is sticky at z-index 30 and
     the sidebar scrolls within what is left, so both offsets are derived from
     --topbar-h rather than written twice. */
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}
/* The brand lives in .topbar now (ruling 6.1). These rules went with it. */
.navgroup {
  font-size: var(--text-label); letter-spacing: .01em;
  color: var(--on-navy-muted); padding: 14px 16px 5px; font-weight: 600;
}
/* A GROUP HEADING THAT OPENS AND CLOSES (P1). It is a real <button>, so it
   takes focus and announces its state; these rules only stop it looking like
   one. The marker is drawn from aria-expanded rather than a class, so the
   thing a screen reader is told and the thing an eye sees cannot disagree. */
.navfold {
  display: flex; align-items: center; gap: 6px;
  width: 100%; background: none; border: 0; text-align: left;
  cursor: pointer; font-family: inherit;
}
.navfold::before {
  content: "▾"; font-size: 9px; opacity: .7; width: 9px;
  transition: transform .12s ease;
}
.navfold[aria-expanded="false"]::before { transform: rotate(-90deg); }
.navfold:hover { color: var(--on-navy); }
.navsub[hidden] { display: none !important; }

/* 13px, ruled. The rail is read by scanning, and it competes with the page
   for the eye every second somebody is on a screen. */
.navitem {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 16px; color: var(--on-navy); text-decoration: none;
  font-size: var(--text-label); border-left: 3px solid transparent;
}
.navsub .navitem { padding-left: 25px; }

/* The firm's name, pinned to the bottom of the rail. */
.sidecompany {
  font-size: var(--text-label); color: var(--on-navy);
  font-weight: 600; margin-bottom: 2px;
}
.navitem:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.navitem.active {
  background: rgba(201, 162, 39, .12);
  border-left-color: var(--gold-500);
  color: #fff; font-weight: 600;
}
/* Grayed, not hidden: an operator who can see that Accounting is coming and
   is not here yet knows more than one who sees six items and wonders. */
.navitem.disabled { color: var(--on-navy-muted); opacity: .45; cursor: default; }
.navitem.disabled:hover { background: none; color: var(--on-navy-muted); }
.navicon { width: 16px; text-align: center; opacity: .85; font-size: var(--text-min); }

.sidefoot {
  margin-top: auto; padding: 14px 16px; font-size: var(--text-label);
  color: var(--on-navy-muted); border-top: 1px solid var(--navy-line);
}
.sidefoot button {
  background: transparent; border: 1px solid var(--navy-line);
  color: var(--on-navy); font-size: var(--text-label); padding: 5px 10px; margin-top: 8px;
}
.sidefoot button:hover { border-color: var(--gold-500); color: var(--gold-400); }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* CAIRN-0121 (Christian, 11/9, on his phone): the sideways strip is gone. At 900px and under the
   rail is the same rail as on desktop, slid in from the left behind a menu button (MENU, top left,
   like AppFolio's). Same groups, same order, same names; each group opens in place. This SUPERSEDES
   the 2026-09-08 "no hamburger" ruling and W8-G-2's strip (Q-109 answered by order CAIRN-0121).
   Desktop (over 900px) is untouched: the menu button, scrim and drawer head are display:none there. */
.menubtn, .searchbtn {
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  min-width: 44px; min-height: 44px; padding: 2px 6px; background: transparent; border: 0;
  color: var(--on-navy); font-family: inherit; font-size: 10px; letter-spacing: .04em; cursor: pointer;
}
.menubtn .menuglyph, .searchbtn .menuglyph { font-size: 20px; line-height: 1; }
.menubtn:hover, .searchbtn:hover { color: #fff; }
.drawerhead { display: none; }
.menuscrim { display: none; }

@media (max-width: 900px) {
  /* ONE COLUMN. The header is static (a sticky bar plus a rail ate a third of the phone). */
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .topbar { position: static; flex-wrap: wrap; gap: 6px; padding: 4px 8px; height: auto; }
  .menubtn, .searchbtn { display: flex; }
  .searchbtn { margin-left: auto; }
  .brand { flex: 1 1 auto; min-width: 0; }
  /* SEARCH IS AN ICON on a phone. The full-width bar opens under the header when it is tapped. */
  .searchwrap { display: none; max-width: none; flex-basis: 100%; padding-bottom: 6px; }
  .searchwrap.open { display: block; }

  /* THE RAIL BECOMES A DRAWER. Closed, it is off-screen AND visibility:hidden, so a closed menu's
     links are not reachable by Tab or a screen reader; the delay on visibility keeps the slide-out
     visible. Open, it is the desktop rail, full height. */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    width: min(86vw, 320px); height: 100%; max-height: 100dvh; padding: 0;
    transform: translateX(-102%); visibility: hidden;
    transition: transform .18s ease, visibility 0s linear .18s;
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    box-shadow: 4px 0 18px rgba(0, 0, 0, .35);
  }
  .sidebar.open { transform: none; visibility: visible; transition: transform .18s ease, visibility 0s; }
  .drawerhead {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 8px 10px 16px; border-bottom: 1px solid var(--navy-line);
    font-weight: 650; color: #fff; position: sticky; top: 0; background: var(--navy-800);
  }
  .drawerhead button {
    min-width: 44px; min-height: 44px; background: transparent; border: 0;
    color: var(--on-navy); font-size: 20px; cursor: pointer; margin: 0;
  }
  .menuscrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .45); }
  .menuscrim[hidden] { display: none; }
  body.menu-open { overflow: hidden; }
  /* Tap targets of at least 44px; the group heads are the drop-downs. */
  .navgroup { padding: 14px 16px 10px; }
  .navitem { min-height: 44px; }
  .sidefoot { margin-top: auto; }
}

/* margin-inline:auto matters in both contexts and was dropped once in the
   shell refactor: inside .content it centres the column on a wide monitor,
   and outside the shell -- the signed-out screens render in a bare <main> --
   its absence left the sign-in card pinned to the left of the window. */
main { padding: 22px 26px; max-width: 1320px; margin-inline: auto; width: 100%; }

/* B10 (10/14 go-live grade): the footer is <main>'s SIBLING inside .content,
   not its child, so it never picked up main's own column rules above --
   invisible on a narrow page, obvious on Accounting and Calendar, the two
   screens wide enough that the gutter mismatch between the footer's
   full-width edge and the page column's padded one actually shows. */
footer.legal {
  padding: 10px 26px; max-width: 1320px; margin-inline: auto; width: 100%;
  box-sizing: border-box;
}

/* -- typographic rhythm ---------------------------------------------------
 * REVERSED 2026-09-11 (UI round 3 addendum v3). Section headings used to be
 * 11px grey small caps so the data would be the loudest thing on screen --
 * and the operator measured the result: the wayfinding text was the
 * smallest thing on every page. A section header is now 20px, dark and
 * mixed case; the page title 28. The deadline chip still wins a glance
 * because it is the only element with a coloured ground and an edge.
 */
h1.page { font-size: var(--text-title); line-height: var(--lh-head);
          margin: 0 0 6px; font-weight: 650; letter-spacing: -.01em; }
.pagesub { color: var(--muted); font-size: var(--text-meta); margin: 0 0 18px; }
.mailbody { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; margin: 12px 0; }
/* CAIRN-0148 B: the Email inbox. Three columns on a desktop, one stack at phone width. */
.mailgrid { display: grid; grid-template-columns: 170px minmax(260px, 1fr) minmax(300px, 1.4fr); gap: 12px; align-items: start; }
.mailfolders { display: flex; flex-direction: column; gap: 6px; }
.mailfolder { display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; }
.mailcount { font-size: 12px; color: var(--muted); }
.mailcount.hasunread { color: var(--fg); font-weight: 700; }
.maillist { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.mailrow { text-align: left; display: flex; gap: 8px; align-items: flex-start; overflow-wrap: anywhere; width: 100%; }
.mailrow.open { outline: 2px solid var(--accent, currentColor); }
.maildot { width: 12px; flex: none; color: var(--accent, currentColor); line-height: 1.4; }
.mailmain { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.mailtop { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.mailwho { font-weight: 500; }
.mailrow.unread .mailwho { font-weight: 800; }
.mailwhen { margin-left: auto; white-space: nowrap; }
.mailsubject { font-weight: 700; }
.mailrow:not(.unread) .mailsubject { font-weight: 500; }
.mailpreview { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.mailchip { align-self: flex-start; text-decoration: none; margin-top: 2px; font-size: 12px; }
.mailscopes { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.mailsync { margin: 0 0 8px; }
.mailmatch { background: var(--card-alt, rgba(127,127,127,.08)); border-radius: 8px; padding: 8px 12px; margin: 10px 0; }
.mailmatch p { margin: 4px 0; }
.mailback { display: none; margin-bottom: 8px; }
.pickresults { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.mailpick { text-align: left; }
@media (max-width: 700px) {
  /* The list first; opening a message swaps the message in, with a Back button. */
  .mailgrid { grid-template-columns: 1fr; }
  .mailfolders { flex-direction: row; flex-wrap: wrap; }
  .mailgrid[data-view="list"] .mailpane { display: none; }
  .mailgrid[data-view="message"] .mailleft, .mailgrid[data-view="message"] .mailmid { display: none; }
  .mailback { display: inline-block; }
}
h2 { font-size: var(--text-section); line-height: var(--lh-head); color: var(--fg);
     margin: 28px 0 10px; font-weight: 600; letter-spacing: -.005em; }
h2:first-child { margin-top: 0; }

/* Pipeline-by-stage cards. Counts read at a glance; the value underneath is
   the number a QI actually wants off this screen — "how much is committed and
   when does it land" rather than "how many prospects". */
.statrow { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.stat { flex: 1 1 130px; background: var(--surface); border: 1px solid var(--line);
        border-radius: var(--radius); padding: 11px 13px; box-shadow: var(--shadow); }
a.stat { color: inherit; text-decoration: none; }
.statlabel { font-size: var(--text-meta); color: var(--muted); font-weight: 600; }
.statvalue { font-size: var(--text-title); font-weight: 700; line-height: 1.15;
             font-variant-numeric: tabular-nums; }
.statvalue.critical { color: var(--critical); }
.statsub { font-size: var(--text-meta); color: var(--muted); font-variant-numeric: tabular-nums; }

table.kv td { padding: 5px 8px 5px 0; border-bottom: 1px solid var(--line); }
table.kv td.kvkey { width: 180px; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
           margin-bottom: 14px; }
.toolbar .spacer { flex: 1; }
.toolbar input[type="search"] { max-width: 280px; }
/* CAIRN-C-33/G-3, DO-1: "Documents shows four dropdowns, one per row." Same
   root cause the .filterbar fix (P4, 2026-09-12, above) already names --
   `input, select, textarea { width: 100% }` is the right default for a form
   and the wrong one for a horizontal bar, where a full-width select claims
   the whole row and pushes the next control onto its own line regardless of
   viewport. .filterbar was scoped out of that rule; .toolbar, used by the
   Documents screen's own search-plus-four-selects row, was not. Scoped the
   same way .filterbar is, for the same reason: every dialog and form in this
   console still depends on the 100% default. */
.toolbar select { width: auto; }

/* A–Z jump bar (C-10). Letters with nothing under them are left out by
   azBar() itself, so this is only ever a styling concern, not a filter. */
.azbar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; }
.azbar .az { padding: 3px 8px; min-width: 26px; font-weight: 600;
             font-size: var(--text-meta); }
.azbar .az.active { background: var(--fg); color: var(--surface);
                     border-color: var(--fg); }

/* -- cards, tables ------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card + .card { margin-top: 14px; }
.card .pad { padding: 16px; }

/* CAIRN-0027 item 4: a loading placeholder, shown the instant a screen
   clears itself and before its fetch resolves, so a slow load never sits on
   a blank page. Pure CSS animation -- no network, no delay of its own. */
.loadingcard .loadingrow {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--line) 25%, var(--surface2, var(--line)) 50%, var(--line) 75%);
  background-size: 200% 100%;
  animation: loadingrow-pulse 1.2s ease-in-out infinite;
  margin-bottom: 10px;
}
.loadingcard .loadingrow:last-child { margin-bottom: 0; width: 60%; }
@keyframes loadingrow-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.contractpreview { padding: 1.5em; max-width: 40em; }
.contractpreview p { margin: .3em 0; }

.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: var(--text-body); }

/* B12 (CAIRN-0096, 11/3 production deep grade): the Leads and Tenant leads
   tables' Contact column cut off around 1321px window width. A contact
   email has no space, hyphen or other point the browser will break a line
   at, so one long address forces the whole table wider than its container
   -- past what the min-width:100% scroll rule below can forgive at a
   desktop width that only has a little room to spare. Letting it wrap
   instead of growing the table removes the forcing, rather than papering
   over one window width; max-width keeps a long address from reclaiming
   the room this was meant to free. */
.contactcell { max-width: 220px; overflow-wrap: anywhere; }

/* CAIRN-0027 item 3 (staging deep grade, 2026-10-21): at a wide-but-not-huge
   desktop width (about 1038px, 1280px) every list table CLIPPED --
   Exchanges, Leads, Referrers, Clients, Staff, Queue, Sales, Documents, by
   script and by screenshot -- even though .scroll (just above) already gives
   each one a horizontal-scroll container. The cause: `table { width: 100% }`
   just above pins the table to its container's width unconditionally, so a
   table with more columns than that width can hold does not scroll, it
   SQUEEZES -- every column shrinks to fit, which is what wrapped exchange
   numbers onto three lines and cut off the Staff/Queue action buttons. Above
   900px (where a table is still a real <table>, not the stacked-card layout
   the next block builds for a phone), the table is let go back to its
   natural content width with a 100% floor, so a table that fits stays full
   width and one that does not gets a real horizontal scrollbar inside its
   own card -- the whole page never gains one, and nothing right of the
   viewport is simply gone. Scoped to `.scroll table` only, the same way the
   900px stacked-card rule below is -- a fixed key-value table (table.kv) is
   untouched either way. */
@media (min-width: 901px) {
  .scroll table { width: auto; min-width: 100%; }
}

/* ---------------------------------------------------------------------------
   A LIST TABLE BECOMES A STACK OF CARDS BELOW 900px (W8-G-2, 10/8 grade).
   Scoped to `.scroll table` specifically -- the wrapper every list screen
   (Leads, Sales, Exchanges, Clients, Staff and the rest) already uses for
   its own horizontal scrollbar, per the grade's own complaint ("Leads
   1,119px wide in a 317px box"). A fixed key-value table (table.kv, an
   exchange record's own facts) is NOT wrapped in .scroll and is untouched.

   Each <td> is labelled by app.js's labelTableCells() (see there) from its
   column's own <th> text -- G-4 already put a real <thead> on every one of
   these tables, so the label text already exists; this just moves it onto
   the cell so CSS can show it beside the value once the header row is
   hidden. The first cell is the row's own subject (the name/record every
   one of these tables leads with) and becomes the card's title rather than
   a third "Name: " line repeating what the card already is a list of. ---- */
@media (max-width: 900px) {
  .scroll { overflow-x: visible; }
  .scroll table, .scroll thead, .scroll tbody, .scroll tr { display: block; width: 100%; }
  .scroll thead { display: none; }
  .scroll tr {
    border: 1px solid var(--line); border-radius: var(--radius);
    margin-bottom: 10px; padding: 10px 12px; background: var(--surface);
  }
  .scroll td {
    display: flex; justify-content: space-between; align-items: baseline;
    gap: 10px; padding: 3px 0; border-bottom: 0; text-align: right;
  }
  .scroll td:first-child {
    display: block; text-align: left; padding-bottom: 6px;
    border-bottom: 1px solid var(--line); margin-bottom: 6px;
  }
  .scroll td:first-child::before { content: none; }
  /* B12 (10/14 go-live grade): a label and its value with nothing between
     them read as one run-on word -- "ClientAlmond Grove Capital" -- not a
     label beside a value. `gap` on the flex row (above) only spaces flex
     CHILDREN; this pseudo-element sits inside the <td>'s own box, so it
     never got that gap. The literal ": " is the separator a label needs. */
  .scroll td[data-label]::before {
    content: attr(data-label) ": "; font-weight: 600; color: var(--muted);
    text-align: left; flex: 0 0 auto;
  }
  /* A row with no label (e.g. a colspan "Nothing matches" row) reads
     left-aligned like ordinary text, not shoved to the right edge. */
  .scroll td:not([data-label]):not(:first-child) { justify-content: flex-start; }
}
th {
  text-align: left; font-weight: 600; font-size: var(--text-meta);
  color: var(--fg); padding: 9px 12px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
  background: var(--surface-2);
}
/* Denser than Phase 1. A deadline board is read by scanning a column, and
   scanning gets worse as the eye has to travel further between rows. 8px is
   about the floor before rows stop reading as separate. */
td { padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.tight { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: var(--text-meta); }
/* CAIRN-0027 item 3: an exchange number is one token (DEMO-2026-0100) and
   must never break mid-string across lines -- the squeeze fix above should
   already stop it needing to, but this is the backstop that makes it true
   regardless of column width. Scoped to a table cell's own link so it does
   not touch .mono used elsewhere (a code sample, an id in a form). */
td a.mono, th a.mono { white-space: nowrap; }

/* -- the countdown chip: the whole point of the board --------------------
 *
 * This is the one element on the console allowed to shout. Everything else
 * is deliberately quiet so that a red chip is visible from across a desk.
 *
 * The number and the caption are on one line rather than stacked: at a glance
 * "5d to day 45" reads as a fact, whereas a big number over small text reads
 * as a statistic and makes the eye stop to work out which deadline it is.
 * The left border is a second channel for the same information, so the board
 * still sorts visually for a colour-blind reader.
 */

.days {
  display: inline-flex; align-items: baseline; gap: 5px;
  padding: 3px 9px 3px 7px; border-radius: 5px; font-weight: 700;
  font-variant-numeric: tabular-nums; font-size: var(--text-meta); white-space: nowrap;
  border-left: 3px solid currentColor;
}
.days.ok       { background: var(--ok-bg);       color: var(--ok); }
.days.warn     { background: var(--warn-bg);     color: var(--warn); }
.days.critical { background: var(--critical-bg); color: var(--critical); }
.days.passed   { background: var(--passed-bg);   color: var(--passed); }
.days.none     { background: var(--surface-2);   color: var(--muted); }
.days small { font-weight: 500; font-size: var(--text-min); opacity: .75;
              letter-spacing: .02em; }
/* Critical gets weight as well as colour — the only element in the product
   that is allowed both. */
.days.critical { box-shadow: inset 0 0 0 1px var(--critical); }

.chip {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: var(--text-min); font-weight: 600; border: 1px solid transparent;
  margin: 1px 4px 1px 0; white-space: nowrap;
}
.chip.neutral  { background: var(--surface-2); color: var(--muted); }
.chip.warn     { background: var(--warn-bg); color: var(--warn); }
.chip.critical { background: var(--critical-bg); color: var(--critical);
                 border-color: var(--critical); }
.chip.ok       { background: var(--ok-bg); color: var(--ok); }
.chipgap       { margin-left: 6px; }

/* -- forms and buttons -------------------------------------------------- */

button, .btn {
  font: inherit; font-weight: 600; font-size: var(--text-meta);
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  /* A native <button> is inline-block by default, so its vertical padding
     reserves its own line height. An <a class="btn"> is inline by default,
     so the same padding bleeds into whatever sits above/below it instead of
     pushing it away -- found 2026-09-24 on the Referrers table, where a
     phone-number <a class="btn small"> stacked over a mailto link via <br>
     inside a nowrap cell rendered with its top border cutting through the
     phone digits. Declared explicitly so every .btn anchor gets the same box
     a real button already has. */
  display: inline-block;
}
button.primary {
  background: var(--accent); color: var(--accent-fg); border-color: var(--accent);
}
button.danger { border-color: var(--critical); color: var(--critical); }
button:disabled { opacity: .5; cursor: not-allowed; }

label { display: block; font-size: var(--text-meta); font-weight: 600; color: var(--muted);
        margin: 12px 0 4px; }
input, select, textarea {
  font: inherit; width: 100%; padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--gold-500); outline-offset: 1px; border-color: var(--gold-500);
}
/* CAIRN-0134 item 19g: the rule above gives every input width:100%, which
   stretched a checkbox across its row and left it floating far from its label
   (Settings > Contracts signer roles, the Request a signature member list).
   A checkbox or radio keeps its own size and sits beside its label. */
input[type="checkbox"], input[type="radio"] {
  width: auto; flex: none; padding: 0; margin: 0 8px 0 0; vertical-align: middle;
}
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
         gap: 0 16px; }
/* CAIRN-C-22: the contract templates card's new merge-field rows need their
   two columns top-aligned rather than stretched. A class, not the
   `style="align-items:start"` several older .grid2 call sites already carry
   -- tools/inline-style-test.mjs ratchets the inline-style count, so a new
   call site gets a class instead of one more inline style to pay down later. */
.grid2.top { align-items: start; }

/* CAIRN-C-22: the contract templates card's signer-role checkboxes --
   replaces a JSON-list textarea, so this never had a class to reuse. */
.checklist { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.checkrow { display: flex; align-items: center; gap: 8px; font-size: var(--text-body); }

/* MFA_OPTIONAL TEST-MODE BANNER (CAIRN-0027). app.js (both faces) PREPENDS
   this to document.body -- not to the header or to #bare/#app, both of which
   get cleared wholesale on every screen change -- so it is the first thing
   in the document on every page, including the sign-in screen, which has no
   header to attach to yet. Ordinary block flow, not fixed: the sticky
   header below it (z-index 30, top: 0) already knows how to stick at the top
   of WHATEVER precedes it, and a fixed overlay here would otherwise cover
   itself the moment the page scrolls past this banner's own height. */
.mfa-test-banner {
  display: block; width: 100%; box-sizing: border-box;
  background: var(--warn); color: var(--warn-bg);
  text-align: center; font-weight: 600; letter-spacing: .02em;
  font-size: var(--text-small); padding: 6px 10px;
}
/* CAIRN-0085's own "switch to a passkey" nudge reuses this banner's look
   for a dismissible one, so its two links need to read on the banner's own
   colour rather than the page's default link blue. */
.mfa-test-banner a { color: inherit; text-decoration: underline; }

/* Two bare spacing utilities (CAIRN-0085), so a primary action or a small
   paragraph that needs a gap above it does not reach for an inline style --
   tools/inline-style-test.mjs counts those against a frozen baseline. */
.btn-wide { width: 100%; margin-top: 18px; }
.spaced-top { margin-top: 10px; }

.notice { padding: 12px 14px; border-radius: 8px; font-size: var(--text-body); margin: 12px 0; }
.notice.critical { background: var(--critical-bg); color: var(--critical);
                   border: 1px solid var(--critical); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.info { background: var(--surface-2); color: var(--muted); }
/* THE PENDING-SIGNATURE NOTICE'S OWN LIST (item 3/C1, 2026-09-29): one
   button per document waiting on this person's signature, inside the
   notice that says so. */
.notice .chain { margin-top: 8px; }

.muted { color: var(--muted); }
/* A link or control that follows text on the same line. The console's CSP is
   style-src 'self', so an inline style="margin-left" is dropped and the words
   run into each other ("companyopen the client"). The gap lives here. */
.inlinegap { margin-left: 10px; }
/* A row-pick checkbox: the form rule gives every input width:100% and padding. */
.pick { width: 1%; }
.pick input { width: auto; padding: 0; }
/* A dialog's closing row: the error it produced, then Cancel and the action.
   It was style="margin-top:18px;display:flex..." on the open-exchange form,
   which the CSP dropped, so the buttons stacked and the error sat far above
   them (staging audit 2026-09-15, A1). */
.formactions { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 10px;
               justify-content: flex-end; align-items: center; }
.formactions .notice { flex-basis: 100%; margin: 0; }
/* An empty value, said the same way everywhere on a screen: muted, the meta
   size, never mistaken for a value. */
.notonfile { color: var(--muted); font-size: var(--text-meta); }
.small { font-size: var(--text-meta); }
.right { text-align: right; }

/* ITEM 7 -- currency fields. The $ is drawn by the WRAPPER, never typed into
   the field, so the value a person copies out is a plain number and the value
   posted to the API is a plain number. A currency symbol inside the input is
   how "$1,250,000" ends up in a numeric column. */
.moneyfield { position: relative; }
.moneyfield::before {
  content: "$"; position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%); color: var(--muted); pointer-events: none;
}
.moneyfield input { padding-left: 22px; text-align: right; }

/* -- the relinquished list, and the rate-card picker (round 3, item 7) ---
   The first repeatable-row form in this console. Each property is a card so
   that "two properties" reads as two things at a glance rather than as one
   long column of inputs -- density from grids, legibility from type. */

/* The one action that starts work sits with the page title, not under the
   table (C1, 2026-09-11). Right-aligned on a desk, full width on a phone --
   a primary action a thumb cannot reach is one nobody presses. */
/* ==========================================================================
 * DO THIS NEXT -- Today's one list (P2, 2026-09-12).
 *
 * A NUMBERED LIST, because the order is the answer. The old screen was four
 * stat cards over four tables; the audit measured it at 24,241px on a phone
 * with zero buttons in the main column. Each row here is the subject, one
 * sentence, and one real verb -- and the verb is a button, because an
 * arrow-suffixed link is a sentence pretending to be a control.
 * ========================================================================== */
.donext { list-style: decimal; margin: 0; padding: 0 0 0 30px; }
.donextrow {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin: 0 0 8px; padding: 11px 14px;
  display: flex; align-items: center; gap: 14px;
}
.donextrow::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
/* S-TOD-7 (220803-C): the row opens the file, not only the underlined
   number -- the cursor says so before the click does. */
.donextclickable { cursor: pointer; }
.donextclickable:hover { border-color: var(--accent); }
.donextwhat { flex: 1; min-width: 0; }
.donextsubject { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.donextkind { font-size: var(--text-min); }
.donextline { font-size: var(--text-meta); color: var(--muted); margin-top: 2px; }
.donextact { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

/* On a phone the verb goes under the sentence rather than off the edge. */
@media (max-width: 560px) {
  .donext { padding-left: 22px; }
  .donextrow { flex-direction: column; align-items: stretch; gap: 9px; }
  .donextact { justify-content: space-between; }
  .donextact button, .donextact .btn { flex: 1; }
}

/* A footnote set apart from the table above it. Replaces an inline
   `style="margin-top:24px"` that this console's CSP had been dropping since
   the day it was written -- see tools/inline-style-test.mjs. */
.spaced { margin-top: 24px; }

/* Same reasoning, smaller gap -- the portal's "Sign out everywhere" link
   under summaryScreen(). */
.spaced-sm { margin-top: 12px; }

.toolbar-right { display: flex; justify-content: flex-end; }
@media (max-width: 560px) {
  .toolbar-right { justify-content: stretch; }
  .toolbar-right button { width: 100%; }
}

.proprow { margin: 10px 0; }
.prophead-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 8px;
}
.prophead { margin: 0; font-size: var(--text-section); }

/* A button that reads as a link: used for "Remove", which must be available
   without competing with the one primary action on the dialog. */
.linklike {
  background: none; border: 0; padding: 0; color: var(--accent);
  cursor: pointer; font: inherit; text-decoration: underline;
}
.linklike[hidden] { display: none !important; }

/* One rate-card line: what it is, what it costs, how many. The amount is
   quiet and the label leads, because the label is what somebody is choosing. */
.feepick {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; border-bottom: 1px solid var(--line);
}
.feepick label { flex: 1; margin: 0; display: flex; align-items: center; gap: 8px; }
.feepick .qtyfield { width: 68px; text-align: right; }
/* CAIRN-0143 F: the checkbox sits beside its own line name, never stretched to the row width. */
.feepick input[type="checkbox"] { width: auto; flex: none; margin: 0; }
/* CAIRN-0134 item 55: the amount and its reason for an unpriced line, on the line's own row, below it. */
.feepick { flex-wrap: wrap; }
.feepick .feeinline { flex-basis: 100%; display: flex; gap: 8px; padding-left: 26px; }
.feepick .feeinline[hidden] { display: none; }
.feepick .feeinline-amount { width: 120px; text-align: right; }
.feepick .feeinline-why { flex: 1; min-width: 0; }

@media (max-width: 560px) {
  .feepick { flex-wrap: wrap; }
  .feepick label { flex-basis: 100%; }
}


/* -- the portal header (P1, 2026-10-08 grade) ----------------------------
 *
 * `header.top` had no rule of its own anywhere in this file -- only the
 * comment above `[hidden]` that describes one. The header rendered with
 * none of its own styling: a transparent background, the brand initial's
 * white text invisible against the page's own grey, every button the same
 * outline weight as the body's. This is the rule that comment always
 * assumed existed.
 */
header.top {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px;
  background: var(--navy-800); color: var(--on-navy);
  border-bottom: 2px solid var(--gold-500);
}
header.top .brandname { font-weight: 600; font-size: var(--text-row);
                         color: #fff; white-space: nowrap; }
header.top h1 {
  margin: 0; font-size: var(--text-section); font-weight: 600; color: #fff;
  padding-left: 10px; border-left: 1px solid var(--navy-line);
}
header.top .spacer { flex: 1; }
header.top .signout {
  /* CAIRN-0035 queue item B14: the smaller font-size/padding here used to
     leave the button under 34px tall -- below the 44px touch target a
     client on a phone needs to hit it reliably. min-height plus an
     inline-flex center keeps the target full-size without changing the
     visible label's own font/padding. */
  font-size: var(--text-label); padding: 6px 12px;
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--on-navy); border-color: var(--navy-line);
}
header.top .signout:hover { border-color: var(--gold-500); color: var(--gold-400); }

/* -- sign-in ------------------------------------------------------------ */

.signin { max-width: 400px; margin: 8vh auto; }
.signin .card .pad { padding: 26px; }
.signin .mark { display: block; margin: 0 auto 18px; }
/* The quiet other-door line under both sign-in forms (2026-09-12). */
.signin-alt { margin: 14px 0 0; }
/* The enrolment QR, now the second of two ways to add the key (P6,
   2026-10-08 grade). Replaces a dropped `style="display:flex;..."`. */
.qrholder { display: flex; justify-content: center; margin: 4px 0 14px; }
/* The enrolment setup key and its Copy button, side by side (CAIRN-0027,
   2026-10-21): the key leads on both the staff and client screens now. */
.keyrow { display: flex; align-items: center; gap: 10px; }
.setupkey { font-size: 1.15em; }

/* Unstyled list for a card's stacked facts (C-11) -- no bullet, no indent. */
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: 4px 0; }

/* "N of M steps complete", as a bar instead of a sentence of fractions
   (strike list, 2026-10-08 grade). Sits directly above the chain it
   summarises. */
.steps-progress { margin: 14px 0 6px; }
.steps-bar { height: 6px; border-radius: 999px; background: var(--surface-2);
             margin-bottom: 6px; overflow: hidden; }
.steps-fill { height: 100%; border-radius: 999px; background: var(--navy-800); }

/* -- milestone chain ---------------------------------------------------- */

.chain { list-style: none; margin: 0; padding: 0; }
.chain li { display: flex; gap: 12px; align-items: flex-start;
            padding: 9px 0; border-bottom: 1px solid var(--line); }
.chain li:last-child { border-bottom: 0; }
.chain .dot { flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%;
              border: 2px solid var(--line); margin-top: 2px; }
.chain li.complete .dot { background: var(--ok); border-color: var(--ok); }
.chain li.in_progress .dot { border-color: var(--gold-500); border-width: 4px; }
.chain li.na .dot { background: var(--surface-2); }
.chain .label { flex: 1; }
.chain li.complete .label { color: var(--muted); }

/* The portal's entity switcher: buttons rather than a <select>, because on a
   phone a select is a modal wheel and this is the control a person uses most.
   Renders only when there is more than one taxpayer to switch between. */
.switcher { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.switcher button { display: inline-flex; align-items: center; gap: 6px;
                   font-size: var(--text-meta); }

dialog {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0;
  background: var(--surface); color: var(--fg); max-width: 640px; width: 92vw;
  box-shadow: 0 12px 48px rgba(8, 20, 38, .35);
}
dialog::backdrop { background: rgba(8, 20, 38, .55); }
dialog .pad { padding: 20px; }
dialog h3 { margin: 0 0 6px; font-size: var(--text-section); line-height: var(--lh-head); }

/* -- the client's own ledger, on the portal -------------------------------
 *
 * Three columns and no table: a date, what it was, and the amount. The amount
 * column is tabular so a stack of figures lines up on the decimal, which is
 * the only reason a balance is readable at a glance.
 *
 * An outgoing amount is muted rather than red. Red is reserved for the
 * countdown chip -- the one element allowed to shout -- and a fee leaving a
 * trust account on schedule is not an alarm.
 */
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li { display: grid; grid-template-columns: 92px 1fr auto; gap: 10px;
             align-items: baseline; padding: 6px 0;
             border-bottom: 1px solid var(--line); }
.ledger li:last-child { border-bottom: 0; }
.ledger .amt { font-variant-numeric: tabular-nums; font-weight: 600;
               white-space: nowrap; }
.ledger .amt.out { color: var(--muted); }

/* -- the deadline timeline, on the client portal (P2, 2026-10-08 grade) ---
 *
 * REPLACES two identical grey boxes ("12 days", "147 days") that carried no
 * anchor -- the operator's own words were "I don't know". One bar, anchored
 * at the exchange's own day zero (close of escrow), with day 45 and day 180
 * as points on it and "today" as a third point that moves between them.
 *
 * THE 45-DAY IDENTIFICATION IS THE ONE DATE THAT CAN END AN EXCHANGE, so a
 * passed or imminent identification still leads the card in words (the
 * `.notice` above the bar, built in deadlineBlock()) -- the bar's own colour
 * (`.ok`/`.warn`/`.critical`) is the same three-step ramp, reusing the
 * server's urgency() thresholds (<=10 days amber, <=3 red) rather than a
 * second copy of them here.
 *
 * Every colour here is a token. The one hand-picked hex in the first draft was
 * caught by the gate, which is the check doing exactly its job.
 */
.deadlinewrap { margin: 10px 0 14px; }
.timeline-daycount { font-size: var(--text-title); font-weight: 700;
                     font-variant-numeric: tabular-nums; margin-bottom: 10px; }
.timeline-daycount.warn { color: var(--warn); }
.timeline-daycount.critical { color: var(--critical); }
.timeline-bar { position: relative; height: 10px; border-radius: 999px;
                background: var(--surface-2); margin: 6px 2px 22px; }
.timeline-fill { position: absolute; top: 0; left: 0; height: 100%;
                 border-radius: 999px; background: var(--navy-800); }
.timeline-fill.warn { background: var(--warn); }
.timeline-fill.critical { background: var(--critical); }
.timeline-point { position: absolute; top: 50%; width: 14px; height: 14px;
                  border-radius: 50%; background: var(--surface);
                  border: 3px solid var(--navy-800); transform: translate(-50%, -50%); }
.timeline-point.start { left: 0; }
.timeline-point.end { left: 100%; }
.timeline-point.mid.warn { border-color: var(--warn); }
.timeline-point.mid.critical { border-color: var(--critical); }
/* The "today" point sits ABOVE the bar, not on its edge, so it never hides
   behind the start/end/mid dots when today coincides with one of them. */
.timeline-point.today { top: -9px; width: 10px; height: 10px;
                        background: var(--navy-800); border: 2px solid var(--surface); }
.timeline-point.today.warn { background: var(--warn); }
.timeline-point.today.critical { background: var(--critical); }
.timeline-point.today.onmid { top: 15px; }
.timeline-labels { display: flex; justify-content: space-between; gap: 10px; }
.timeline-label { max-width: 34%; }
.timeline-label.mid { text-align: center; }
.timeline-label.end { text-align: right; }

@media (max-width: 560px) {
  .timeline-labels { flex-direction: column; gap: 6px; }
  .timeline-label, .timeline-label.mid, .timeline-label.end { max-width: 100%;
                                                                text-align: left; }
}

/* ===========================================================================
 * LAYOUT UTILITIES FOR TODAY AND THE EXCHANGE VIEW.
 *
 * THESE ARE CLASSES BECAUSE INLINE STYLES DO NOT WORK HERE, and that is not a
 * preference -- it is the Content-Security-Policy in public/_headers, which
 * sets `style-src 'self'` with no 'unsafe-inline' anywhere. A `style="..."`
 * attribute is therefore DROPPED BY THE BROWSER. Silently: nothing errors, the
 * element simply renders unstyled, so a flex row becomes a stack and a 26px
 * figure becomes body text.
 *
 * Found 2026-08-26 by building the Today screen and looking at it. The four
 * phase cards were meant to sit in a row and were stacked full-width; the
 * funds figures likewise. The header of public/_headers says it out loud --
 * "Both front ends load their JavaScript and CSS as separate files precisely
 * so this policy can be strict" -- and the app had been quietly ignoring it.
 * =========================================================================== */

/* A row of equal cards that wraps: the Today counters, the phase chain. */
.cardrow      { display: flex; gap: 12px; flex-wrap: wrap; }
.cardrow > *  { flex: 1; }
.cardrow.wide > * { min-width: 190px; }
.cardrow.narrow > * { min-width: 150px; }

/* A row of labelled figures inside one card: balance, total in, total out. */
.figrow  { display: flex; gap: 32px; flex-wrap: wrap; align-items: flex-end; }
/* R-32 (10/6 grade): "the three 'Issue' buttons are staggered, not in a
   column" -- .figrow's own gap-only layout lets each row's button sit at
   a different x, following its label's length. Scoped to the one row
   this card builds (the exchange record's Issued Reports section),
   rather than widening .figrow itself and risking every other figrow on
   the money cards, where the gap-not-justify layout is deliberate. */
.figlabel { min-width: 230px; }
.bignum  { font-size: var(--text-title); font-weight: 700; font-variant-numeric: tabular-nums; }
.midnum  { font-size: var(--text-row); font-variant-numeric: tabular-nums; }
.bignum.critical { color: var(--critical); }
.bignum.warn     { color: var(--warn); }

/* The persistent exchange header: pills first, then facts, wrapping. */

/* The phase card's title line, and a chain that sits under it. */
.phasehead { display: flex; justify-content: space-between;
             align-items: baseline; gap: 8px; }
.phasefact { margin-top: 6px; }
.phasechain { margin-top: 10px; }

/* NEXT ACTION IS THE BIGGEST THING ON THE RECORD (P3, 2026-09-12). One line
   at title scale, with its label small above it -- the ranked answer to "what
   do I do about this file", set so it wins against the four notices that
   surround it. */
.nextaction { margin-top: 14px; }

/* B16 (CAIRN-0096, 11/3 production deep grade): the exchange record's tab
   strip sits roughly three screens below the fold -- this card (state /
   waiting / balance, the fee line, the evidence notices, the next-action
   block) is most of why. Tightened here, scoped to `.herocard` only, so
   nothing else that uses `.pad`, `.figrow` or `.notice` on this or any
   other screen changes size. Content, wording and which notices appear
   are untouched -- that is B07/B08's own work, on its own branch. */
.herocard .pad { padding: 12px 16px; }
.herocard .figrow { gap: 24px; }
.herocard .spaced { margin-top: 10px; }
.herocard .notice { margin: 8px 0; }
.herocard .nextaction { margin-top: 10px; }

.nextaction .nextlabel {
  font-size: var(--text-meta);
  font-weight: 600;
  opacity: 0.75;
  margin-bottom: 4px;
}
.nextaction .nexttext {
  font-size: var(--text-title);
  font-weight: 700;
  line-height: 1.25;
}
.blurb      { margin-top: -6px; }

/* THE INSTALL HINT (2026-09-14, queue item h): a phone's first visit, on
   either face. Fixed to the foot so it never moves the page under a thumb,
   and clear of the home-indicator inset an installed iPhone app reserves. */
.installhint {
  position: fixed; left: 12px; right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  background: var(--navy-800); color: var(--on-navy);
  border: 1px solid var(--navy-line); border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
}
.installhint p { margin: 0 0 10px; font-size: var(--text-meta); }
.installhintactions { display: flex; gap: 8px; justify-content: flex-end; }

/* DOCTRINE BEHIND A "?" (audit 2026-09-14, item 8; round 3 item 4). The
   reason a section works the way it does is one press away, not in the way. */
/* THE PROVENANCE HOVER'S WRAPPER (2026-09-16). It carries the `title` that
   answers "counted from what?" in place, and nothing else -- so it must not
   introduce a box of its own. `display: contents` leaves the pill laid out
   exactly as it was when unwrapped, which matters because .twoclocks puts two
   of these side by side. A wrapper with no rule at all would default to
   inline and change the pill's spacing; style-src 'self' means the fix cannot
   be an inline style. */
.basiswrap { display: contents; }

.helpq { margin: -4px 0 10px; }
/* THE MARK AND WHAT IT OPENS (acceptance walk 2026-09-16, C2). This rule was
   a 20px disc with the "?" centred in it, which is right for ONE of these
   beside a heading that names it and wrong for three stacked in the record
   rail -- there they were three identical unlabelled circles. The disc is now
   .helpqmark and the summary is the row that carries it plus the label, so
   the label sits BESIDE the mark instead of being clipped inside it. */
.helpq > summary {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; list-style: none;
}
.helpqmark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%; flex: 0 0 auto;
  border: 1px solid var(--muted); color: var(--muted);
  font-size: 12px; line-height: 1;
}
.helpqlabel { color: var(--muted); font-size: var(--text-meta); }
.helpq > summary::-webkit-details-marker { display: none; }
.helpq[open] > p { margin: 6px 0 0; max-width: 64ch; }

/* AN ALERT, SAID FOR A PERSON (audit 2026-09-14, item 2): headline, one line,
   and the engineering text behind its toggle. */
.alertdetails { margin-top: 8px; }
.alertdetails > summary { display: inline-block; cursor: pointer; }
.alertdetails[open] > p { margin: 8px 0 0; white-space: pre-wrap; word-break: break-word; }
.alertactions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

/* CAIRN-C-13 (NX-1): the new-exchange box as collapsible steps instead of one
   undifferentiated scroll. Each step is a bordered block so the form reads
   as sections, not a continuous page. */
.formstep {
  border: 1px solid var(--border, #ddd); border-radius: 6px;
  margin: 10px 0; padding: 0 12px;
}
.formstep > summary {
  cursor: pointer; list-style: none; padding: 10px 0;
}
.formstep > summary > h2 { display: inline; margin: 0; font-size: 1em; }
.formstep > summary::-webkit-details-marker { display: none; }
.formstepbody { padding: 2px 0 12px; }

/* THE TEMPLATE EDITOR (Marketing piece 3): a plain editor, and a preview that
   keeps the email's own line breaks. P2-MK-6: still a plain-text <textarea>
   underneath (no WYSIWYG, no change to the stored {field}/[[gate:...]]
   format) -- just sized and set so it reads like a text editor instead of a
   code box. */
.tplbody { width: 100%; min-height: 360px; font-family: inherit;
           font-size: 1rem; line-height: 1.6; padding: 10px 12px; }
.tplflags { margin: 8px 0; }
/* P2-MK-7: pre-wrap (not raw <pre> monospace) so a long line wraps like
   prose, with a sane max-width so it reads like an email instead of a
   terminal; leading "- "/"* " lines get real bullets via previewBodyEl(). */
.previewtext { white-space: pre-wrap; word-break: break-word; font-family: inherit;
               margin: 8px 0 0; max-width: 640px; }
.previewlist { margin: 4px 0; padding-left: 1.4em; }
/* A reversed ledger entry is still evidence, and is shown quieter rather than
   hidden -- 008: "a gap in a ledger is indistinguishable from a theft". */
.reversed   { opacity: .55; }

/* THE PORTAL FUNDS BLOCK. Classes rather than style= attributes, because
   `style-src 'self'` carries no unsafe-inline and the CSP drops inline styles
   silently -- the three that used to live in fundsBlock() had never applied on
   a deployed build. See docs/a-check-that-cannot-fail.md on things that fail
   without saying so. */
.fundsrow  { margin: 12px 0 8px; }
.zerostate { margin-top: 4px; }
.movehead  { margin-bottom: 4px; }

/* The DEMO mark travels with the figure. A banner at the top of the page is
   not what somebody is looking at when they read a number in 22px bold. */
.demochip  { margin-left: 6px; vertical-align: middle; }
.demonote  { margin-top: 4px; max-width: 34em; }

/* THE SHARED STATE PILL (public/pill.js). The pill says what, the line beside
   it says why, and the facts are the evidence somebody needs to act. Classes
   rather than style= because the CSP drops inline styles silently. */
.wirehead  { display: flex; gap: 16px; flex-wrap: wrap; align-items: baseline; }
.pillrow   { display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline;
             margin: 8px 0 4px; }
.pillwhy   { font-size: var(--text-meta); color: var(--muted); }
.pillfact  { white-space: nowrap; }

/* THE SCOPE LINE (public/scope.js). Above the first row of every list and
   every report -- what was filtered, as of when, run by whom. */
.scopeline { font-size: var(--text-min); color: var(--muted); margin: 0 0 8px;
             padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.scopeempty { font-size: var(--text-meta); margin: 8px 0; }

/* ---------------------------------------------------------------------------
 * RELATIONSHIPS -- a draft beside the reason it exists.
 *
 * Real classes rather than style attributes: public/_headers sets
 * `style-src 'self'` with no unsafe-inline, so a style="..." attribute is
 * dropped by the browser silently and the element renders unstyled. See
 * tools/inline-style-test.mjs -- this is the rule that check exists for.
 * ------------------------------------------------------------------------ */

/* The reason leads, and is meant to be read before the draft. It is what
   makes the draft worth sending; a card that led with the message would be a
   mail merge with a justification bolted on. */
.nudgereason {
  font-size: var(--text-body);
  line-height: 1.5;
  margin: 10px 0 14px;
}

.nudgehead { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.nudgelabel {
  display: block;
  margin: 10px 0 4px;
  font-size: var(--text-meta);
  font-weight: 600;
  color: var(--muted);
}

.nudgefield { width: 100%; }
.nudgebody { width: 100%; min-height: 190px; font-family: inherit; }

/* "Not now" is the SAME SIZE as Send, deliberately. Declining an invitation
   is a complete answer; a small grey link in a corner would make it feel like
   an admission, and the suggestions would get ignored rather than declined --
   which loses the dismissal signal entirely. */
.nudgeacts { display: flex; gap: 8px; margin-top: 12px; }

.nudgefoot { margin-top: 10px; }

.nudgedecided { display: flex; gap: 8px; align-items: baseline; }

/* ---------------------------------------------------------------------------
   EXHIBIT A, PREVIEWED AS THE DOCUMENT WILL CARRY IT.

   The one place in this console where the WHITESPACE IS THE CONTENT: a fee
   schedule is columns, and a preview that re-flows them is a preview of a
   different page from the one the client signs. So `white-space: pre` and a
   monospace stack, and it scrolls rather than wrapping -- the same rule every
   wide table here follows, for the same reason: a wrapped figure column stops
   being a column.

   A CLASS RATHER THAN A style ATTRIBUTE because `style-src 'self'` drops
   those silently and the element renders unstyled. See
   tools/inline-style-test.mjs.
   --------------------------------------------------------------------------- */
.exhibit {
  background: var(--surface-2);
  padding: 10px;
  overflow-x: auto;
  white-space: pre;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--text-meta);
  line-height: var(--lh-body);
  margin: 8px 0;
}

/* A section that is its own subject, separated from the one above it. Used by
   the portal's identification form, which was carrying this as an inline style
   and therefore rendering flush against the documents list. */
.section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* A refusal said in words beside the control it disabled. public/pill.js's
   rule: a control that refuses without saying why reads as a system fault. */
.refusal { color: var(--critical); }

/* THE PORTAL'S IDENTIFICATION FORM, PER-PROPERTY (P5, 2026-10-08 grade).
   `.idrow` replaces a dropped `style="margin:10px 0;background:..."`
   attribute. `.cszrow` puts city, state and ZIP on one line instead of
   three fields the same 917px width as the street address -- a two-letter
   state and a five-digit ZIP do not need it. */
.idrow { margin: 10px 0; background: var(--surface-2); }
.cszrow { display: flex; gap: 12px; flex-wrap: wrap; }
.cszrow > div { flex: 1 1 auto; }
.cszrow .csz-city { flex-basis: 180px; }
.cszrow .csz-state { flex: 0 0 80px; }
.cszrow .csz-zip { flex: 0 0 120px; }
@media (max-width: 480px) {
  .cszrow .csz-city { flex-basis: 100%; }
}

/* ---------------------------------------------------------------------------
   THE CALENDAR (EMP gap 9).

   A seven-column grid whatever the window, so a week and a month are the same
   component with a different number of rows -- and Today's strip is the same
   component again with one row. Three layouts would be three places for a
   Saturday to land in the wrong column.

   COLOUR IS BY EVENT KIND, and the exchange's STATE tints the left edge. The
   two say different things: the kind is what the date IS, the state is how the
   file is doing. Urgency is deliberately absent -- the day pills already speak
   that language, and a calendar shouting it too would be one fact in two
   vocabularies.
   --------------------------------------------------------------------------- */
.calgrid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.calhead {
  background: var(--surface-2);
  padding: 6px 8px;
  font-size: var(--text-label);
  font-weight: 600;
  color: var(--muted);
}
.calcell {
  background: var(--surface);
  min-height: 92px;
  padding: 4px 5px;
  overflow: hidden;
}
/* A day outside the requested window still occupies a square -- a month that
   starts on a Thursday has three empty ones -- but must not read as a day with
   nothing happening in it. */
.calout { background: var(--surface-2); opacity: .55; }
.caltoday { outline: 2px solid var(--accent); outline-offset: -2px; }
.caldate { font-size: var(--text-label); color: var(--muted); margin-bottom: 3px; }

.calev {
  display: block;
  font-size: var(--text-min);
  line-height: var(--lh-head);
  margin-bottom: 3px;
  padding: 2px 4px;
  border-left: 3px solid var(--muted);
  border-radius: 2px;
  background: var(--surface-2);
  text-decoration: none;
  color: inherit;
}
.calev:hover { background: var(--line); }
.calev strong { display: block; font-size: var(--text-min); }
.calev span { color: var(--muted); }

.cal-d45      { border-left-color: var(--critical); }
.cal-d180     { border-left-color: var(--warn); }
.cal-closing  { border-left-color: var(--ok); }
.cal-notice   { border-left-color: var(--muted); }
.cal-callback { border-left-color: var(--accent); }
.cal-dayoff   { border-left-color: var(--warn); background: var(--surface-2); font-style: italic; }

/* P2-CA-3: the client's name, visible in the cell, not only on hover. A
   second line between the exchange number and the kind label, rather than
   folded into either, so neither reads as a client's full legal name
   truncated mid-word. */
.calev-client { display: block; font-weight: 600; }

/* P2-CA-4: a heading above the scope-line sentence, naming the month (or
   week) the grid below is actually showing. */
.calendar-title { margin: 4px 0 10px; }

/* P2-CA-5: the legend's own gap, independent of whatever spacing .chip
   carries elsewhere -- zeroing the chip's margin here means this is the
   ONLY place the gap comes from, so it cannot silently vanish if .chip's
   own margin ever changes for an unrelated reason. */
.callegend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.callegend .chip { margin: 0; }

/* ---------------------------------------------------------------------------
   P2-CA-1. THE WEEK VIEW, a day-column layout distinct from the month grid's
   tiny boxes, not calendarGrid(d, from, to) called again with a shorter
   range. Each column carries an explicit "All day" section -- see
   calendarWeekGrid's own comment in app.js for why there is no hourly axis
   underneath it. */
.calweekgrid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.calweekcol {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  min-height: 180px;
}
.calweekcol.caltoday { outline: 2px solid var(--accent); outline-offset: -2px; }
.calweekhead { margin-bottom: 8px; }
.calweekday {
  font-size: var(--text-label); font-weight: 600; color: var(--fg);
}
.calweekdate { font-size: var(--text-min); color: var(--muted); }
.calweekallday { border-top: 1px dashed var(--line); padding-top: 6px; }
.calweekalldaylabel {
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 5px;
}
.calweekempty { opacity: .6; }
.calday { padding: 8px 0; }
.calday .calev { margin: 6px 0; }
.calagendaday { padding: 8px 0; border-top: 1px dashed var(--line); }
.calagendaday:first-child { border-top: 0; }
.calagendaday.caltoday { outline: 2px solid var(--accent); outline-offset: -2px; padding: 8px; }
.calagendahead { margin: 0 0 6px; font-size: var(--text-min); }
.calagendaday .calev { margin: 6px 0; }

/* A settled exchange's dates are history, not work. They stay on the calendar
   because "what happened in July" is a real question, and they recede. */
.calstate-complete, .calstate-cancelled, .calstate-failed { opacity: .5; }

/* ---------------------------------------------------------------------------
   (a) THE RECORD SUMMARY STRIP. 8/28 doctrine, ruled a requirement 8/29.

   Six slots, equal width, never reordered. The fixed geometry IS the feature:
   after a week the third slot IS the state, and the eye goes there without
   reading. A strip that reflows by relevance has to be read every time.

   It wraps rather than scrolls on a narrow screen -- six facts stacked are
   still six facts in order, where a horizontal scroll hides the last two and
   they are the ones about money and what to do next.
   --------------------------------------------------------------------------- */
.sumstrip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}
@media (max-width: 900px) {
  .sumstrip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .sumstrip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* CAIRN-0014 item 1: with the right rail beside it the strip is far narrower
   than the window, and "KEEP-2026-0103" (nowrap, below) ran into the
   Relinquished slot at 1280px. Three columns whenever the rail is present
   and the window is under 1500px; nowrap stays, so the number never splits. */
@media (max-width: 1500px) {
  body.hasrail .sumstrip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  body.hasrail .sumstrip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.sumslot { min-width: 0; }
/* CAIRN-0134 item 12: every fact in the strip sits in its own box. The top rule
   colour tells the group: who (client, coordinator), what (exchange,
   relinquished), when (closing, day 45/180). */
.sumstrip .sumslot {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top-width: 3px;
  border-radius: 8px;
  padding: 10px 12px;
}
.sumstrip .sumgroup-who  { border-top-color: var(--navy-600); }
.sumstrip .sumgroup-what { border-top-color: var(--muted); }
.sumstrip .sumgroup-when { border-top-color: var(--warn); }
.sumlabel {
  font-size: var(--text-meta);
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}
.sumbody { font-size: var(--text-body); }
/* B19 (10/15 production grade): "KEEP-2026- / 0103" wrapped at the hyphen
   once the strip dropped to 2 columns (520px) -- a browser treats "-" as a
   break opportunity by default, independent of column width. The exchange
   number is the one .sumbody value short enough to never need to wrap. */
.sumbody .mono { white-space: nowrap; }
/* THE STRIP'S DAY PILL WRAPS. It carries a weekday date beside the count
   (ruling A3), and at six slots across 1280px that did not fit on one line --
   it ran into the Day 180 slot and covered the state chip. The count stays
   first and the date drops beneath it: fixed here, not by shrinking the
   scale back (addendum v3). */
.sumbody .days { white-space: normal; flex-wrap: wrap; row-gap: 0; }
.sumbody .num { font-variant-numeric: tabular-nums; font-weight: 600; }
/* TWO CLOCKS IN ONE SLOT (P3, 2026-09-12). The six facts now identify the
   file -- client, number, property, closing, coordinator -- which leaves the
   two countdowns sharing the fifth slot rather than owning two of six. They
   stack, because side by side at 1/6 of the width each day pill lost its
   weekday to a wrap, and the weekday is the part somebody acts on (A3). */
.twoclocks { display: flex; flex-direction: column; gap: 4px; }

/* ---------------------------------------------------------------------------
   THE OMNIBOX (ruled 8/19; doctrine (h) for the grouping).

   A dialog drawn over the page rather than a screen of its own: an omnibox is
   a way to REACH something, and navigating away to search is the friction it
   exists to remove. It sits high rather than centred, because the list grows
   downward and a centred panel jumps as you type.
   --------------------------------------------------------------------------- */
/* .omniwrap, .omnipanel, .omnihead and .omnires were the Ctrl-K DIALOG and
   were retired on 2026-09-08 with it, under ruling 6.3 -- after the dropdown
   passed, in that order, as ruled. The rules that survived are the ones the
   dropdown still uses: .omnigrouphead and .omniitem style a result, and a
   result looks the same whether it is in a dialog or a panel. */
.omnigrouphead {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 12px 0 4px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--line);
}
.omnigrouphead a { margin-left: auto; }

/* A result is a link and reads as one row: what it is, then what distinguishes
   it, then its state. Three columns in a fixed order for the same reason the
   summary strip has six -- the eye learns the position. */
.omniitem {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 6px;
  border-radius: 3px;
  text-decoration: none;
  color: inherit;
}
.omniitem:hover { background: var(--surface-2); }
.omniitem strong { flex: 0 0 auto; }
.omniitem .muted { flex: 1 1 auto; min-width: 0; overflow: hidden;
                   text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------------------
   (5) THE CONTEXTUAL RIGHT RAIL. Doctrine (b), 8/28.

   Beside the record on a wide screen, beneath it on a narrow one. It is
   CONTEXT, never the record, so it never takes width from the thing somebody
   opened -- and on a phone it goes last rather than pushing the record down.

   MONEY HAS ITS OWN BLOCK WITH ITS OWN EDGE. ui-teardown-filed.md: reaching a
   money action should be "a deliberate move to a different part of the
   screen", not a different position in one list.
   --------------------------------------------------------------------------- */
.rail {
  display: block;
  margin-top: 18px;
}
@media (min-width: 1180px) {
  body.hasrail #app {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-auto-flow: dense;
    column-gap: 22px;
    align-items: start;
  }
  body.hasrail #app > .rail {
    grid-column: 2;
    grid-row: 1 / span 999;
    margin-top: 0;
    position: sticky;
    top: 16px;
  }
  body.hasrail #app > *:not(.rail) { grid-column: 1; }
}

.railgroup {
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: var(--surface);
}
.railhead {
  font-size: var(--text-label);
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 6px;
}
.railact {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  margin: 2px 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--surface-2);
  color: inherit;
  text-decoration: none;
  font-size: var(--text-meta);
  cursor: pointer;
}
.railact:hover { background: var(--line); }

/* Money: a visible edge, so the block reads as a different part of the screen
   rather than the next few rows of the same list. */
.railmoney { border-left: 3px solid var(--critical); }

/* The assistant's suggestions: proposals rather than doors, so they carry their
   own edge. Since CAIRN-0134 19h they sit on the step they belong to (inside
   .flowstep), not in a rail box. */
.assistrow { margin: 6px 0 10px; padding-left: 8px; border-left: 3px solid var(--accent); }

/* A refused action is a LABEL AND A REASON, never a dead button. Greyed-out
   tells somebody the door exists and nothing about why it is shut. */
.railrefused { margin: 6px 0 8px; }
.railactlabel { font-size: var(--text-meta); margin-bottom: 2px; }

/* The assistant's slot: visibly a placeholder, never a thing that looks like
   it is loading. */
.railslot { border-style: dashed; }

/* ---------------------------------------------------------------------------
   (c) EXPAND-IN-PLACE, (d) FILTER BARS, (g) THE REPORT LIBRARY.
   8/28 doctrine, ruled a requirement 8/29.
   --------------------------------------------------------------------------- */

/* The chevron is a button inside a clickable row, so it must look pressable
   and must not look like part of the row's own click target. */
.chevron {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 3px;
  padding: 0 6px;
  font-size: var(--text-min);
  line-height: 1.6;
  cursor: pointer;
}
.expandrow > td { background: var(--surface-2); padding: 0; }
.expandbody { padding: 10px 14px; }
.expandacts { margin-bottom: 8px; }
.logline { margin: 2px 0; }
/* A money action inside an expanded row NAVIGATES and says so. Acting on money
   from inside a list, mid-scroll, is what the separated-verbs ruling forbids. */
.railmoneylink { border-left: 3px solid var(--critical); display: inline-block;
                 width: auto; }

/* THE COUNTS ARE FILTERS, so they are buttons and the active one is obvious.
   A metric that looks like text is one nobody presses. */
/* ONE ROW (P4, 2026-09-12). The counts and the dropdowns were two children of
   .filterbar, each its own flex row, so the bar always stood two lines tall --
   press-to-filter chips on the first, owner/reset/saved-views on the second,
   with nothing but the markup to say why they were apart. They are the same
   control surface and they now share one wrapping row: .filterbar is the flex
   container and its two groups dissolve into it. No change to filterBar()'s
   structure, and none to the saved-view storage key. */
.filterbar { margin: 10px 0 14px; display: flex; flex-wrap: wrap; gap: 8px;
             align-items: center; }
.countrow { display: contents; }
.countchip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: var(--text-meta);
  cursor: pointer;
  color: inherit;
}
.countchip strong { font-size: var(--text-row); font-variant-numeric: tabular-nums; }
.countchip:hover { background: var(--surface-2); }
.countactive { border-color: var(--accent); background: var(--surface-2); }

.filterrow { display: contents; }

/* AND THE CONTROLS MUST BE THEIR OWN WIDTH (P4, 2026-09-12).
   `input, select, textarea { width: 100% }` is the right rule for a form --
   a stacked column of labelled fields -- and the wrong one for a filter bar,
   where a select at full width claims an entire line and pushes the next
   control onto another. That, not the breakpoints, is why the bar rendered
   one control per line at 800px and at 1280px alike: a percentage width does
   not care how wide the window is.

   Scoped to the bar rather than loosened globally: every dialog and form in
   this console depends on that rule. */
.filterbar select,
.filterbar input { width: auto; }

/* THE CONSOLE SAYS WHEN IT IS FETCHING (P4, 2026-09-12). Every screen awaits
   its payload and only THEN calls clear(app), so during the fetch the previous
   screen sat there looking answered -- on a slow link, a coordinator read a
   stale list and believed it.

   IT COSTS NOTHING ON A FAST ONE. The bar starts transparent and the animation
   is delayed, so a route that resolves in 80ms never paints it: the flicker of
   a spinner that appears and vanishes is its own kind of noise. Pure CSS, on a
   class the router sets and clears in a finally -- a timer would have to be
   cancelled on every early return, and route() has several. */
.busy::after {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 50;
  background: var(--accent);
  transform-origin: 0 50%;
  opacity: 0;
  animation: navbusy 1.4s ease-out 0.2s infinite;
}
@keyframes navbusy {
  0%   { opacity: 0; transform: scaleX(0); }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { opacity: 0; transform: scaleX(1); }
}
@media (prefers-reduced-motion: reduce) {
  .busy::after { animation: none; opacity: 1; transform: scaleX(1); }
}

/* THE REPORT LIBRARY, ruled 2026-09-11 (UI round 3 addendum v3): a row is
   its name at row size, one plain line beneath it, and a star. Two columns
   on a desk, one on a phone. The whole name-and-line is the button, so the
   target is the size of the thing somebody is reading. */
.reportgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
              gap: 10px; }
@media (max-width: 900px) { .reportgrid { grid-template-columns: 1fr; } }
.reportrow { background: var(--surface); border: 1px solid var(--line);
             border-radius: var(--radius); box-shadow: var(--shadow);
             padding: 10px 10px 10px 14px; }
.reportline { display: flex; align-items: baseline; gap: 8px; }
.reportname { font-size: var(--text-row); font-weight: 600; color: var(--fg);
              text-decoration: none; flex: 1 1 auto; min-width: 0; }
.reportname:hover { text-decoration: underline; }
.reportacts { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; }
/* ONE SHORT GREY LINE, ALWAYS VISIBLE. Ruled 2026-09-13: the name is the link
   and the description stays; it was the CHEVRON that had to go, not the
   sentence it hid. Meta size and muted, so the name stays the thing the eye
   lands on and the line answers "what is this" without a gesture.

   .reportmore and .reportfor -- the chevron-revealed blurb and its "for: ..."
   audience line -- are gone with their markup. The chevron rule stays in the
   sheet: it is shared with the Exchanges row expander. */
.reportdesc { margin: 4px 0 0; font-size: var(--text-meta); color: var(--muted);
              line-height: 1.5; }

/* The release toggle on the record's Documents tab: the box and its words are
   one target, because a checkbox alone is a 13px hit area beside a filename. */
.releasetoggle { display: inline-flex; align-items: center; gap: 6px;
                 font-size: var(--text-meta); cursor: pointer; margin: 0; }
.releasetoggle input { width: auto; margin: 0; }
/* A COLOUR AND THE HEX THAT IS ACTUALLY SAVED, side by side (P7). The swatch
   is how somebody chooses; the hex is what they paste from a brand book, and
   it is the value the server validates. */
.colourrow { display: flex; align-items: center; gap: 8px; }
.colourrow input[type="color"] { width: 46px; height: 34px; padding: 2px;
                                 flex: 0 0 auto; cursor: pointer; }
.hexfield { width: 9em; flex: 0 0 auto; font-family: var(--mono, monospace);
            text-transform: lowercase; }

.reportfamily { display: flex; align-items: center; gap: 8px; }
.foldbtn { border: 0; background: none; padding: 0 2px; cursor: pointer;
           font-size: var(--text-meta); color: var(--muted); }
.reportsearch { margin-bottom: 14px; }
.reportfind { max-width: 260px; }
.starbtn {
  border: none;
  background: none;
  font-size: var(--text-section);
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}
.starred { color: var(--warn); }

/* One centred line, for the "or sign in with your password" divider under the
   passkey button. A class rather than a style attribute because
   tools/inline-style-test.mjs records that the browser DROPS style attributes
   in this console -- an inline rule here would simply never render, which is
   why the ratchet exists and why it caught this one. */
.centred { text-align: center; }

/* The Accounting tab strip. A tab is an anchor, so it is a link somebody can
   send -- the state is in the URL, not in a variable that resets on reload.

   THE TOKENS ARE THIS FILE'S OWN. The first version reached for --navy, --gold
   and --ink, which do not exist here: the palette is --navy-800, --gold-500
   and --fg. A colour that resolves to nothing renders as the browser default
   and looks deliberate, which is exactly the failure this file's header warns
   about when it says a token must never be defined only inside a media
   query. */
/* AT DESKTOP WIDTHS THE TABS WRAP rather than scroll: this was a flex row
   that could not wrap, so a strip wider than the screen pushed the whole
   PAGE wider -- the client record measured 512px at a 390px viewport with
   five tabs and 602px with six, and every screen under it then scrolled
   sideways. Measured 2026-09-23 while adding the Contacts tab -- the
   overflow predated that tab, which is why nothing had been blamed for it.
   UNDER 700px IT SCROLLS INSTEAD (C1, ruled 2026-09-24, Cowork audit entry
   220803-C): "the bar scrolls sideways with a fade, and the active tab
   scrolls into view." A fade on the trailing edge is what makes a scrolling
   strip different from the "hides the last tab behind a gesture" failure
   the 9/23 fix was written to avoid -- it says more is there, and the
   active tab is guaranteed on screen (tabStrip(), app.js) rather than
   trusted to already be visible. */
.tabstrip { position: relative; display: flex; flex-wrap: wrap; gap: 4px;
            margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.tabstrip .tab { display: flex; align-items: center; gap: 6px;
                 height: 46px; padding: 0 14px; box-sizing: border-box;
                 font-size: 15px; font-weight: 500; text-decoration: none;
                 color: var(--muted); border-bottom: 3px solid transparent;
                 margin-bottom: -1px; white-space: nowrap; }
.tabstrip .tab:hover { color: var(--fg); }
.tabstrip .tab.on { color: var(--navy-800); border-bottom-color: var(--navy-800);
                    font-weight: 600; }
/* Counts as pill badges ("Documents (3)") -- C1's own example. */
.tabstrip .tabcount { padding: 1px 7px; border-radius: 9px; background: var(--line);
                       color: var(--muted); font-size: 12px; font-weight: 600; }
.tabstrip .tab.on .tabcount { background: var(--navy-800); color: #fff; }
@media (max-width: 700px) {
  .tabstrip { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tabstrip::after { content: ""; position: absolute; top: 0; right: 0;
                      bottom: 3px; width: 28px; pointer-events: none;
                      background: linear-gradient(to right, transparent, var(--bg)); }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tabstrip .tab.on { color: var(--gold-400);
    border-bottom-color: var(--gold-400); }
  :root:not([data-theme="light"]) .tabstrip .tab.on .tabcount { background: var(--gold-400);
    color: var(--navy-800); }
}
:root[data-theme="dark"] .tabstrip .tab.on { color: var(--gold-400);
  border-bottom-color: var(--gold-400); }
:root[data-theme="dark"] .tabstrip .tab.on .tabcount { background: var(--gold-400);
  color: var(--navy-800); }

/* A panel: a write form in front of the page rather than open inside it.
   Wider than promptDialog because these carry several fields, and capped so a
   long form scrolls within the panel instead of the page behind it. */
.panel { width: min(560px, 92vw); max-height: 86vh; overflow: auto;
         border: 1px solid var(--line); border-radius: 6px;
         background: var(--surface); color: var(--fg); padding: 0; }
.panel::backdrop { background: rgba(8, 20, 38, .45); }
.panelhead { display: flex; align-items: center; justify-content: space-between;
             gap: 12px; margin-bottom: 8px; }
.panelhead h3 { margin: 0; }

/* ==========================================================================
 * DATE FIELDS. Item A, ruled 2026-09-10: every date is picked from a
 * calendar; nobody types a date as the primary path.
 *
 * NATIVE <input type="date">, BECAUSE THE CSP LEAVES NO ALTERNATIVE --
 * script-src 'self' with no CDN host means a third-party picker cannot load.
 * What the constraint buys: the OS calendar on a phone, keyboard entry on a
 * desktop, and no third-party script in a console that approves wires.
 *
 * THE ICON IS ALWAYS VISIBLE. WebKit hides the calendar indicator until the
 * field is hovered or focused, so a date field is indistinguishable from a
 * text field until somebody happens to point at it -- which is precisely the
 * "nobody knows they can pick" failure this ruling is about. opacity:1 and a
 * pointer cursor put it back.
 * ========================================================================== */
input[type="date"] {
  font-family: var(--sans);
  font-size: var(--text-body);
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
  /* iOS shrinks a date input to its content and left-aligns the caret; both
     make it look disabled next to a text field. */
  min-height: 38px;
  width: 100%;
}
input[type="date"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 1;
  cursor: pointer;
  padding-left: 6px;
}
/* A date the database will not edit in place -- coe_date, schema/010 -- is
   rendered as text with the version action beside it, never as a picker
   inviting an edit that will be refused. See dateReadOnly() in the console. */
.datelocked {
  display: inline-flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.datelocked .val { font-weight: 600; }

/* A REPORT INSIDE THE CONSOLE (2026-09-11, round 3 item 1): a frame of this
   origin, as wide as the column, grown to the report's height once it loads.
   A class because the CSP drops style attributes; the height is set through
   the CSSOM, which the policy allows. */
.reportframe { display: block; width: 100%; min-height: 70vh;
               border: 1px solid var(--line); border-radius: var(--radius);
               background: var(--surface); }

/* THE TENANT'S MARK (ruling 11, 2026-09-11). A logo is an <img> capped so a
   tall one cannot push the header about; a firm with no logo gets its own
   name at section-header size, which is the ruled fallback. Never the
   product's ring, and never a broken image: the <img> alt is the firm. */
.brandlogo { max-height: 30px; max-width: 132px; display: block; }
.brandinitial { font-size: var(--text-section); font-weight: 650;
                line-height: 1.1; color: #fff; white-space: nowrap;
                max-width: 190px; overflow: hidden; text-overflow: ellipsis; }

/* SETTINGS > STAFF, THE LEADS SECTION (PLATFORM-20260925-200300-C item 1).
   These five classes exist because the spacing they carry was written as
   inline `style:` attributes first, and tools/inline-style-test.mjs refused
   the gate for it -- correctly: the production CSP DROPS inline styles, so
   that version would have rendered unspaced on staging while looking right in
   the local screenshot I walked it with. A ratchet catching exactly the thing
   it is named for. */
.leadcard { margin-top: 24px; }
.leadrow { padding: 12px 0; border-top: 1px solid var(--line); }
.leadrow p { margin: 0 0 6px; }
.leadrow .toolbar { margin: 6px 0 0; }
.leadwho { margin: 0 0 2px; font-weight: 600; }
.leadfoot { margin-top: 12px; }
/* The first heading inside a .pad sits flush with the card's own top padding.
   Written inline as `style="margin-top:0"` in ~20 places before this; this is
   the class for new ones, since an inline style never reaches the browser
   under the production CSP. */
.cardtop { margin-top: 0; }
/* C-43: a sub-heading inside a dialog, set tight against the fields that
   follow it (same shape as the Add-a-client dialog's "Referred by"/"First
   member" h3s used an inline style for -- a class here instead of repeating
   that pattern, since every new `style:` attribute fails inline-style-test,
   which counts rather than renders them). */
.subhead-tight { margin-bottom: 2px; }

/* CAIRN-0057 #4 (R37): the client's texts, two-sided. */
.commthread { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.commmsg { max-width: 78%; padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.commmsg.out { align-self: flex-end; background: var(--ok-bg); }
.commmsg.in { align-self: flex-start; }
.commbody { white-space: pre-wrap; overflow-wrap: anywhere; }

/* CAIRN-0057 #3 (R43): the Documents library. */
.dropzone { border: 2px dashed var(--line); border-radius: 8px; padding: 14px;
  margin: 8px 0; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dropzone.dragging { border-color: var(--accent); background: var(--surface); }
.docfolders { flex-wrap: wrap; }
.docbulk { background: var(--surface); padding: 6px 8px; border-radius: 6px; }
.sortbtn { background: none; border: 0; padding: 0; font: inherit; font-weight: 600;
  color: inherit; cursor: pointer; }
.docshared.on { color: var(--ok); font-weight: 600; }

/* CAIRN-0114: the Lead sources drop box. */
.dropbox { display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center;
  min-height: 120px; padding: 24px 16px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--fg); }
.dropbox:hover, .dropbox:focus-visible, .dropbox.over { border-color: var(--accent); outline: none; }
.dropbox.over { background: var(--surface); border-style: solid; border-width: 3px; }
.planline { color: var(--warn); }
.numfield-tier { width: 4.2rem; }
.numfield-cap { width: 4.8rem; }

/* ==========================================================================
 * THE CLIENT PORTAL, WARM (CAIRN-0135, Christian 11/16: "rudimentary... it
 * should feel fun, easy to read, easy to use, warm and fuzzy"). Navy and gold
 * on white, per the 9/3 palette ruling. Header: firm mark + name, the firm's
 * phone, and one menu button (avatar + hamburger). Page: greeting, a countdown
 * ring for the deadline that matters next, three tiles (next step, money,
 * coordinator), the steps as a line of checks, then documents and messages.
 * ========================================================================== */
.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; }
header.top .topphone { color: var(--on-navy); text-decoration: none;
  font-size: var(--text-label); white-space: nowrap; }
header.top .topphone:hover { color: var(--gold-400); }
header.top .menubtn { display: inline-grid; grid-auto-flow: column; align-items: center; gap: 10px;
  flex: 0 0 auto; white-space: nowrap;
  min-height: 44px; padding: 4px 8px 4px 4px; border-radius: 999px;
  background: transparent; border: 1px solid var(--navy-line); color: #fff; cursor: pointer; }
header.top .menubtn:hover, header.top .menubtn[aria-expanded="true"] { border-color: var(--gold-500); }
.avatar { display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; background: var(--gold-500);
  color: var(--navy-900); font-weight: 650; font-size: var(--text-label); letter-spacing: .02em; }
.burger { display: inline-flex; flex-direction: column; gap: 4px; padding-right: 4px; }
.burger span { display: block; width: 18px; height: 2px; border-radius: 2px; background: #fff; }

.portalmenu { position: absolute; right: 16px; top: 76px; z-index: 40; width: 260px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(8, 20, 38, .18); padding: 8px 0; }
.portalmenu .menuhead { display: flex; align-items: center; gap: 10px;
  padding: 8px 16px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.portalmenu .menuname { font-weight: 600; color: var(--fg); }
.portalmenu .menugroup { padding: 10px 16px 4px; font-size: var(--text-min);
  color: var(--muted); letter-spacing: .04em; }
.portalmenu .menuitem { display: block; padding: 10px 16px; color: var(--fg);
  text-decoration: none; font-size: var(--text-body); min-height: 44px; box-sizing: border-box; }
.portalmenu .menuitem:hover, .portalmenu .menuitem:focus-visible {
  background: var(--warn-bg); color: var(--navy-800); outline: none; }
.portalmenu .menuitem.quiet { color: var(--muted); font-size: var(--text-meta); }
.portalmenu .menusep { border-top: 1px solid var(--line); margin: 6px 0; }

.greet { margin: 6px 0 18px; }
.greet-hello { font-size: var(--text-title); font-weight: 650; color: var(--navy-800);
  margin: 0; line-height: var(--lh-head); }
.greet-sub { margin: 4px 0 0; color: var(--muted); font-size: var(--text-row); }
.nudge { background: var(--warn-bg); border: 1px solid var(--gold-400); border-radius: 10px;
  padding: 10px 14px; font-size: var(--text-meta); color: var(--navy-800); }
.nudge a { color: var(--navy-800); font-weight: 600; }
.backline { margin: 4px 0 14px; }

.xcard { border-radius: 16px; }
.xcard > .pad { padding: 22px; }
.xhead { margin-bottom: 16px; scroll-margin-top: 16px; }
.xhead .xaddr { margin: 0; font-size: var(--text-section); color: var(--navy-800); }
.xhead .xnum { margin: 2px 0 0; }

.hero { display: flex; align-items: center; gap: 20px; padding: 18px;
  border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; }
.hero-title { margin: 0 0 4px; font-size: var(--text-row); font-weight: 650; color: var(--navy-800); }
.hero-text p { margin-top: 0; margin-bottom: 4px; }
.ring { --pct: 0; flex: 0 0 auto; width: 104px; height: 104px; border-radius: 50%;
  background: conic-gradient(var(--gold-500) calc(var(--pct) * 1%), var(--surface-2) 0);
  display: flex; align-items: center; justify-content: center; }
.ring.warn { background: conic-gradient(var(--warn) calc(var(--pct) * 1%), var(--surface-2) 0); }
.ring.critical { background: conic-gradient(var(--critical) calc(var(--pct) * 1%), var(--surface-2) 0); }
.ring-inner { width: 82px; height: 82px; border-radius: 50%; background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-big { font-size: 28px; font-weight: 700; line-height: 1; color: var(--navy-800);
  font-variant-numeric: tabular-nums; }
.ring-small { font-size: var(--text-min); color: var(--muted); margin-top: 3px; }

.tilegrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 14px 0 6px; }
.tile { border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; min-width: 0; }
.tile-next { border-left: 4px solid var(--gold-500); }
.tile-label { font-size: var(--text-label); color: var(--muted); margin-bottom: 6px; }
.tile .nextline { margin: 0 0 10px; font-size: var(--text-body); color: var(--fg); }
.tile .section h2 { display: none; }
.tile .notice { margin: 0; }
.tile-money .statrow { flex-direction: column; gap: 8px; margin: 0; }
.tile-money .stat { flex: 0 0 auto; padding: 0; border: 0; background: transparent;
  box-shadow: none; min-width: 0; }
.tile-money .movehead { margin-top: 10px; }
.tile-money .ledger li { grid-template-columns: auto 1fr; }
.tile-money .ledger .amt { grid-column: 1 / -1; text-align: left; }
.coordname { margin: 0 0 10px; font-weight: 600; color: var(--fg); }
.coordlinks { display: flex; flex-wrap: wrap; gap: 8px; }
.pillbtn { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--navy-800);
  text-decoration: none; font-size: var(--text-label); font-weight: 600; }
.pillbtn:hover { border-color: var(--gold-500); background: var(--warn-bg); }

.stephead { margin: 22px 0 12px; font-size: var(--text-row); color: var(--navy-800); }
.chain.stepper .dot { width: 22px; height: 22px; }
.chain.stepper li.complete .dot { background: var(--gold-500); border-color: var(--gold-500);
  box-shadow: inset 0 0 0 4px var(--gold-500); position: relative; }
.chain.stepper li.complete .dot::after { content: ""; position: absolute; left: 7px; top: 3px;
  width: 5px; height: 10px; border: solid var(--navy-900); border-width: 0 2px 2px 0;
  transform: rotate(45deg); }
.chain.stepper li.complete .label { color: var(--fg); }
.chain.stepper li.in_progress .dot { border-color: var(--navy-800); }
@media (min-width: 760px) {
  .chain.stepper { display: flex; align-items: flex-start; }
  .chain.stepper li { flex: 1 1 0; flex-direction: column; align-items: center; text-align: center;
    border-bottom: 0; padding: 0 4px; position: relative; font-size: var(--text-label); }
  .chain.stepper li::before { content: ""; position: absolute; top: 11px; left: -50%; width: 100%;
    height: 2px; background: var(--line); z-index: 0; }
  .chain.stepper li:first-child::before { display: none; }
  .chain.stepper li.complete::before { background: var(--gold-500); }
  .chain.stepper .dot { position: relative; z-index: 1; background: var(--surface); }
}

.xcard h2[id], .card[id], .section[id] { scroll-margin-top: 16px; }
.emptyline { color: var(--muted); font-size: var(--text-meta); background: var(--surface-2);
  border-radius: 10px; padding: 12px 14px; }
.emptystate .empty-title { font-size: var(--text-row); font-weight: 600; margin: 0 0 4px; }
.secure-line { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line); }

@media (max-width: 760px) {
  .tilegrid { grid-template-columns: minmax(0, 1fr); }
  header.top .topphone { display: none; }
  header.top .brandinitial { font-size: var(--text-row); }
  .hero { gap: 14px; padding: 14px; }
  .ring { width: 86px; height: 86px; }
  .ring-inner { width: 68px; height: 68px; }
  .ring-big { font-size: 24px; }
  .greet-hello { font-size: 24px; }
  .portalmenu { right: 8px; left: 8px; width: auto; }
}

/* CAIRN-0134 item 8: the exchange's step list as a spine. Current step open
   and highlighted, finished steps one line with a check, future steps grey. */
.flowlist { display: grid; gap: 6px; }
.flowstep { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.flowstep .flowhead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flowstep .flownum { min-width: 1.6em; font-weight: 700; color: var(--muted); }
.flowstep .flowwhen { margin-left: auto; }
.flowstep.done { background: var(--ok-bg); }
.flowstep.done .flownum { color: var(--ok); }
.flowstep.current { border-color: var(--accent); border-width: 2px; background: var(--surface); }
.flowstep.upcoming { opacity: 0.6; background: var(--surface-2); }
.flowstep .linkish { background: none; border: 0; padding: 0; color: var(--muted);
  text-decoration: underline; cursor: pointer; font-size: var(--text-meta); }

/* CAIRN-0147: the one sign-in card heading (was an inline style, which the browser drops). */
.signin-title { text-align: center; margin: 0 0 18px; }

/* Fix and Drop on a lead held for its listing location (Batch review, Leads, agent page). The three fields
   wrap on a phone and sit in a row on a desktop; nothing forces the page wider than the screen. */
.addressfix { margin: 8px 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.addressfix-fields { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.addressfix-fields input { flex: 1 1 140px; min-width: 0; width: auto; }
.addressfix-fields input[name="fix_zip"] { flex: 0 1 90px; }

/* Leads list (Christian 11/19): a text-style button for "Edit" under a Market, and a sortable Market header. */
button.linkbtn { background: none; border: 0; padding: 0; min-height: 0; font: inherit; font-size: 0.85em;
  color: inherit; text-decoration: underline; cursor: pointer; box-shadow: none; }
th.sortable { cursor: pointer; user-select: none; }
/* Q-0143-CONVERT: one row of the exchange "Still needed" list */
.needed-row { padding: 8px 0; border-top: 1px solid var(--line); }
