/* Centurion Tax Solutions — brand UI
 * Palette and type from the 2021 Brand Guidelines: Midnight ink on white
 * and Silver surfaces, Ocean for links and interactive accents, Gold
 * reserved for the selected state. Print-inspired, intentionally dense.
 * No decorative motion — accountants want clarity. */

:root {
  /* Brand palette, verbatim from the guide. Everything below is expressed
   * in terms of these, so a brand revision is an eight-line edit. */
  --midnight:   #0B2038;   /* primary   */
  --ocean:      #306E9E;   /* primary   */
  --gold:       #CAA977;   /* primary   */
  --white:      #FFFFFF;   /* primary   */
  --gray:       #848484;   /* secondary */
  --silver:     #E5E6E7;   /* secondary */
  --deep-sea:   #1F496D;   /* secondary */
  --gulf-coast: #4D95B5;   /* secondary */

  /* Three-level surface system, light → dark by elevation:
   *   canvas   the page behind everything
   *   rail     navigation; overridden to Midnight in the .rail scope below
   *   bright   cards and data areas; the crisp working surface
   *   deep     selected / secondary control state
   * Kept as separate tokens because the rail and cards were previously the
   * same colour, which flattened the hierarchy. */
  --paper:        var(--silver);   /* application canvas */
  --paper-rail:   var(--midnight); /* sidebar */
  --paper-bright: var(--white);    /* cards, data areas */
  --paper-deep:   #D6D8DB;         /* selected / secondary control */
  --ink:          var(--midnight);
  /* Midnight at the guide's 75% and 50% tints, flattened onto white so they
   * stay opaque over any surface. */
  --ink-soft:     #48586A;
  /* The guide's Gray is 3.74:1 on white — fine for the large type it was
   * drawn for, short of AA at the 11-12px meta sizes this token carries.
   * Darkened to 5.3:1; --gray itself stays exact for fills and borders. */
  --ink-mute:     #6B6B6B;
  --rule:         #C6C9CD;         /* visible without becoming heavy */
  --rule-soft:    var(--silver);   /* lighter tier, kept so hairlines stay ranked */
  /* Status colours are semantic, not brand — a FAIL has to read as a FAIL.
   * Desaturated to sit alongside Midnight without shouting over it. */
  --pass:         #1E6E4B;
  --warn:         #8A6A1F;
  --fail:         #A02B22;
  --unver:        #6B6B6B;
  --accent:       var(--ocean);
  --accent-deep:  var(--deep-sea);

  /* Gotham is licensed and has no web release; Montserrat is the standard
   * substitute — same geometric skeleton, Bold for headers and Regular for
   * body, matching the guide's hierarchy. Plex Mono stays for figures:
   * Montserrat has no tabular numerals and a ledger needs columns to line
   * up. */
  --display: 'Montserrat', 'Gotham', 'Helvetica Neue', Arial, sans-serif;
  --sans:    'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image:
    radial-gradient(circle at 18% 0%,  rgba(48, 110, 158, 0.06), transparent 38%),
    radial-gradient(circle at 82% 110%, rgba(11, 32, 56, 0.05), transparent 42%);
  background-attachment: fixed;
}


.paper {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 2.75rem 4rem;
}

/* ───────────────────────────────────────── masthead */

.masthead {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--ink);
}
.masthead-meta {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.masthead-meta--right { text-align: right; }
.masthead-meta strong {
  font-weight: 500;
  color: var(--ink);
  letter-spacing: 0.18em;
}

.title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.6rem, 5.4vw, 4.5rem);
  letter-spacing: -0.025em;
  line-height: 0.95;
  margin: 0;
  text-align: center;
}
.title-mark {
  color: var(--accent);
  font-style: italic;
  font-weight: 400;
  margin: 0 0.05em;
}
.title-sub {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-mute);
  text-align: center;
  margin: 0.45rem 0 0;
}

.rule-double {
  margin: 4px 0 2.5rem;
  height: 4px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

/* ───────────────────────────────────────── kickers + section heads */

.kicker {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-block;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--accent);
  margin-bottom: 1rem;
}

.section-heading {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.55rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.012em;
}
.section-lede {
  color: var(--ink-soft);
  margin: 0 0 1.5rem;
  font-size: 0.94rem;
  max-width: 42ch;
}

/* ───────────────────────────────────────── intake (two forms side-by-side) */

.intake {
  display: grid;
  grid-template-columns: 1fr 1px 1fr;
  gap: 2.4rem;
  margin-bottom: 3rem;
}
.intake-divider {
  background: var(--rule);
  width: 1px;
}

.form { display: flex; flex-direction: column; gap: 0.95rem; }
.field { display: block; }
.field-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  display: block;
  margin-bottom: 0.4rem;
}
.field input[type=file],
.field input[type=text] {
  font-family: var(--mono);
  font-size: 0.88rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--paper-bright);
  border: 1px solid var(--rule);
  border-radius: 0;
  color: var(--ink);
  transition: border-color 0.15s, background 0.15s;
}
.field input[type=text]::placeholder { color: var(--ink-mute); }
.field input[type=text]:focus,
.field input[type=file]:focus {
  outline: none;
  border-color: var(--ink);
  background: #fff;
}
.field input[type=file]::file-selector-button {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--paper-bright);
  border: 0;
  padding: 0.4rem 0.7rem;
  margin-right: 0.7rem;
  cursor: pointer;
}
.field input[type=file]::file-selector-button:hover { background: var(--accent); }

.button {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.75rem 1.4rem 0.7rem;
  background: var(--ink);
  color: var(--paper-bright);
  border: 1px solid var(--ink);
  cursor: pointer;
  margin-top: 0.4rem;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.button:hover { background: var(--accent); border-color: var(--accent); }
.button:active { transform: translateY(1px); }
.button .arrow { display: inline-block; margin-left: 0.45rem; }

.hint {
  margin: 1.4rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--rule);
  font-size: 0.82rem;
  color: var(--ink-mute);
  line-height: 1.55;
}
.hint code {
  font-family: var(--mono);
  background: var(--paper-deep);
  padding: 0.05rem 0.35rem;
  font-size: 0.88em;
  letter-spacing: 0;
}

/* ───────────────────────────────────────── ledger (review table) */

.ledger { margin-top: 2.6rem; scroll-margin-top: 1.5rem; }
.ledger-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--ink);
}
.ledger-head .kicker { margin: 0; padding-bottom: 0; border: 0; }
.ledger-head .page-heading { flex: 1; margin: 0; }
.ledger-count {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.ledger-table thead th {
  text-align: left;
  padding: 0.55rem 0.85rem 0.55rem 0;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
.ledger-table thead th.col-num { text-align: right; }
.ledger-table tbody td {
  padding: 0.85rem 0.85rem 0.85rem 0;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
}
.ledger-table tbody tr { transition: background 0.1s; }
.ledger-table tbody tr:hover td { background: rgba(48, 110, 158, 0.06); }
.ledger-table tbody tr:last-child td { border-bottom: 1px solid var(--ink); }

.col-when {
  font-family: var(--mono);
  font-size: 0.78rem;
  white-space: nowrap;
  color: var(--ink-soft);
  width: 11rem;
}
.col-client { min-width: 11rem; }
.client-name {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
}
.client-meta {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-mute);
  margin-top: 0.15rem;
}
.col-files { min-width: 16rem; }
.col-status { width: 8rem; }
.col-num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-size: 0.92rem;
  width: 4.2rem;
  font-weight: 500;
}
.col-actions { white-space: nowrap; text-align: right; }

/* Row actions: one always-visible primary, one hover-revealed overflow.
 * The trigger fades rather than being removed from the flow — a row whose
 * action column changes width on hover makes the whole table twitch. */
.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1px;
}
.row-act {
  width: 27px; height: 27px;
  display: grid; place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.row-act svg { width: 15px; height: 15px; display: block; }
.row-act:hover { background: var(--paper-deep); color: var(--accent); }
.row-act:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Open menu = the app's active state, the same Ocean fill the segmented
   control uses for its checked option. */
.row-menu.is-open .row-act { background: var(--accent); color: #fff; }

/* Failed rows put the error text and the overflow trigger on one line; the
   text takes the slack so the trigger stays hard right, in the same column
   position as every other row's. */
.row-actions--failed { gap: 0.5rem; }
.row-actions--failed .error-note { text-align: right; white-space: normal; }
/* Always visible here: on a failed row the menu is the only way to act, and
   hiding the sole affordance behind hover would make the row look inert. */
.row-actions--failed .row-menu { opacity: 1; }

/* Destructive menu items read in the FAIL colour and only commit to a filled
   background on hover, so the menu doesn't open with a red bar in it. */
.menu-pop .menu-danger { color: var(--fail); }
.menu-pop .menu-danger:hover { background: var(--fail); color: #fff; }
.menu-rule {
  height: 0;
  margin: 4px 6px;
  border: 0;
  border-top: 1px solid var(--rule-soft);
}

/* ── ledger filter + bulk clear ───────────────────────────────
 * Segmented, matching the settings page's control: the two views are
 * mutually exclusive, and one is always active. */
.ledger-filter {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: 7px;
}
.ledger-filter-opt {
  padding: 0.22rem 0.7rem;
  border-radius: 5px;
  font: 500 0.76rem/1.3 var(--sans);
  color: var(--ink-mute);
  text-decoration: none;
  white-space: nowrap;
}
.ledger-filter-opt:hover { color: var(--ink); }
.ledger-filter-opt.is-on {
  background: var(--accent);
  color: #fff;
}

.ledger-clear { margin: 0; flex: none; }
/* Not solid: a destructive control sitting permanently next to the heading
   shouldn't out-shout "Run review". It commits to the FAIL colour only under
   the pointer. */
.btn-quiet--danger { color: var(--fail); border-color: var(--rule); }
.btn-quiet--danger:hover {
  background: var(--fail);
  border-color: var(--fail);
  color: #fff;
}

/* The primary action is spelled out. An arrow alone isn't readable in a table
 * cell — nothing says "this chevron navigates" — whereas the word plus the
 * arrow needs no learning. The overflow trigger stays an icon because "…" is
 * the one glyph that already means "more". Colours come from .btn-solid
 * above; this is geometry only. */
.row-open {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-left: 0.25rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 7px;
  /* Transparent rather than a fixed surface colour: the button then sits on
     whatever is behind it — the page at rest, the row's tint on hover — so it
     never reads as a pale chip pasted onto the row. */
  background: transparent;
  font: 500 0.78rem/1.2 var(--sans);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.1s;
}
.row-open svg { width: 13px; height: 13px; display: block; }
/* Fifty solid buttons down a table is a wall, so it rests neutral and only
 * takes on "Run review" — Midnight fill, white label — under the pointer.
 * Pressing goes to Ocean, the same accent .btn-solid moves to on hover, so
 * the two buttons share one colour vocabulary in a different order. */
.row-open:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper-bright);
}
.row-open:active {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(1px);
}
.row-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Hidden by opacity, not visibility: the button stays in the tab order, and
 * revealing on :focus-within keeps it reachable without a pointer. It can
 * only be clicked while the row is hovered anyway, since it lives inside the
 * row it appears on. .is-open is set by the shared menu script so an open
 * menu survives the pointer leaving the row. */
.row-menu { opacity: 0; transition: opacity 0.12s; }
.ledger-table tbody tr:hover .row-menu,
.row-menu:focus-within,
.row-menu.is-open { opacity: 1; }

/* Right-aligned in the last column, so the pop would otherwise hang off the
 * card's edge. */
.row-actions .menu-pop { top: calc(100% + 3px); }
.row-actions .menu-pop.menu-pop--up { top: auto; bottom: calc(100% + 3px); }

.file-name {
  display: block;
  font-family: var(--mono);
  font-size: 0.82rem;
  word-break: break-all;
}
.file-name--pdf { color: var(--ink-mute); margin-top: 0.2rem; }

.num--pass  { color: var(--pass); }
.num--warn  { color: var(--warn); }
.num--fail  { color: var(--fail); }
.num--unver { color: var(--ink-mute); }
.num--zero  { color: var(--rule); }

/* status pills — small caps + dot */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 2px var(--paper);
  display: inline-block;
}
.pill--done    { color: var(--pass); }
.pill--running { color: var(--warn); animation: pulse 1.6s ease-in-out infinite; }
.pill--blocked { color: var(--fail); }
.pill--error   { color: var(--fail); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.link {
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 1px;
  white-space: nowrap;
}
.link:hover { color: var(--accent); border-color: var(--accent); }

.link-quiet {
  margin-left: 0.85rem;
  background: none;
  border: 0;
  border-bottom: 1px dotted var(--ink-mute);
  padding: 0 0 1px;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  cursor: pointer;
}
.link-quiet:hover { color: var(--accent); border-color: var(--accent); }


.error-note {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--fail);
  font-style: italic;
  display: inline-block;
  max-width: 14rem;
  white-space: normal;
  line-height: 1.4;
}

.ledger-empty {
  padding: 3.5rem 0 4rem;
  text-align: center;
  color: var(--ink-mute);
  border-bottom: 1px solid var(--ink);
}
.ledger-empty-mark {
  display: block;
  font-family: var(--display);
  font-size: 3.5rem;
  color: var(--rule);
  margin-bottom: 0.4rem;
  line-height: 1;
  font-style: italic;
}
.ledger-empty-text {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.05rem;
}

/* ───────────────────────────────────────── colophon */

.colophon {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--ink);
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.colophon code {
  font-family: var(--mono);
  background: var(--paper-deep);
  padding: 0.05rem 0.35rem;
  letter-spacing: 0.04em;
  text-transform: none;
}
.colophon-mark {
  font-family: var(--display);
  font-style: italic;
  letter-spacing: 0.02em;
  text-transform: none;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ───────────────────────────────────────── narrow pages (blocked / error / ambiguous) */

.paper-narrow {
  max-width: 640px;
  /* Left-aligned, not centred: the index runs the full content width, so a
     centred narrow column put every other page's heading at a different x. */
  margin: 1.5rem auto 0 0;
}
.page-heading {
  font-family: var(--display);
  font-weight: 700;
  font-size: 2.1rem;
  letter-spacing: -0.018em;
  line-height: 1.1;
  margin: 0 0 0.85rem;
}
.page-lede {
  color: var(--ink-soft);
  font-size: 0.98rem;
  margin: 0 0 1.6rem;
  max-width: 56ch;
  line-height: 1.6;
}
.page-detail {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--fail);
  background: var(--paper-deep);
  border-left: 3px solid var(--fail);
  padding: 0.85rem 1rem;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 1.6rem;
}

/* failure page */
.paper-narrow--wide { max-width: 760px; }
.fail-section { margin: 0 0 1.8rem; }
.fail-head {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 0.6rem;
  font-weight: 500;
}
.fail-step { margin: 0 0 0.7rem; display: flex; flex-wrap: wrap; gap: 0.35rem 0.8rem; align-items: baseline; }
.fail-step-name { font-weight: 600; font-size: 1.02rem; }
.fail-step-detail { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-soft); }
.fail-note { color: var(--ink-soft); font-size: 0.9rem; margin: 0 0 0.8rem; max-width: 60ch; }
.steps--static .step-mark { animation: none; }
.file-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.file-table td {
  padding: 0.55rem 0.85rem 0.55rem 0;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: baseline;
}
.file-table tr:first-child td { border-top: 1px solid var(--ink); }
.file-table tr:last-child td { border-bottom: 1px solid var(--ink); }
.file-kind { white-space: nowrap; }
.file-name-cell code { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-soft); }
.file-size { font-family: var(--mono); font-size: 0.76rem; color: var(--ink-mute); white-space: nowrap; text-align: right; }
.file-act { text-align: right; white-space: nowrap; }
.fail-trace { margin: 0 0 1.4rem; }
.fail-trace summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.page-detail--trace { color: var(--ink-soft); border-left-color: var(--rule); margin-top: 0.6rem; font-size: 0.74rem; max-height: 28rem; overflow: auto; }

.check-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.8rem;
  font-size: 0.88rem;
}
.check-table td {
  padding: 0.7rem 0.85rem 0.7rem 0;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
}
.check-table tr:first-child td { border-top: 1px solid var(--ink); }
.check-table tr:last-child td { border-bottom: 1px solid var(--ink); }
.check-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  width: 7rem;
}
.check-state {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  width: 7rem;
}
.check-row--ok    .check-state { color: var(--pass); }
.check-row--warn  .check-state { color: var(--warn); }
.check-row--block .check-state { color: var(--fail); font-weight: 500; }
.check-vals {
  font-family: var(--mono);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.check-side {
  display: inline-block;
  width: 4.5rem;
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.actions {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  margin-top: 1.5rem;
}
.inline-form { display: inline; margin: 0; padding: 0; }

/* ───────────────────────────────────────── progress page */

.run-meta {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-right: 0.45rem;
  margin-left: 0.85rem;
}
.run-meta:first-of-type { margin-left: 0; }
.page-lede code {
  font-family: var(--mono);
  background: var(--paper-deep);
  padding: 0.05rem 0.35rem;
  font-size: 0.85em;
}

.steps {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
  border-top: 1px solid var(--ink);
}
.step {
  display: grid;
  grid-template-columns: 1.4rem 16rem 1fr auto;
  align-items: baseline;
  gap: 0.85rem;
  padding: 0.85rem 0.4rem 0.85rem 0;
  border-bottom: 1px solid var(--rule-soft);
  transition: background 0.15s, opacity 0.2s;
}
.step:last-child { border-bottom: 1px solid var(--ink); }

.step-mark {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  border: 1.5px solid var(--rule);
  background: var(--paper-bright);
  position: relative;
  flex-shrink: 0;
}
.step-label {
  font-family: var(--sans);
  font-size: 0.94rem;
  color: var(--ink-soft);
  font-weight: 500;
}
.step-detail {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-mute);
  letter-spacing: 0.01em;
}
.step-time {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
  text-align: right;
  white-space: nowrap;
}

/* status states */
.step[data-status="queued"]   { opacity: 0.55; }
.step[data-status="queued"]   .step-mark { border-color: var(--rule); }
.step[data-status="queued"]   .step-label { color: var(--ink-mute); font-weight: 400; }

.step[data-status="start"]    { background: rgba(48, 110, 158, 0.06); }
.step[data-status="start"]    .step-label { color: var(--ink); font-weight: 600; }
.step[data-status="start"]    .step-mark {
  border-color: var(--accent);
  background: var(--paper-bright);
  animation: stepRun 1.05s ease-in-out infinite;
}
.step[data-status="start"]    .step-mark::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--accent);
  animation: stepDot 1.05s ease-in-out infinite;
}

.step[data-status="done"]     .step-mark {
  border-color: var(--pass);
  background: var(--pass);
}
.step[data-status="done"]     .step-mark::after {
  content: "";
  position: absolute;
  left: 0.18rem;
  top: 0.04rem;
  width: 0.18rem;
  height: 0.36rem;
  border: solid var(--paper-bright);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.step[data-status="done"]     .step-label { color: var(--ink); }

.step[data-status="warn"]     .step-mark {
  border-color: var(--warn);
  background: var(--warn);
}
.step[data-status="warn"]     .step-mark::after {
  content: "";
  position: absolute;
  left: 0.32rem;
  top: 0.12rem;
  width: 1.5px;
  height: 0.36rem;
  background: var(--paper-bright);
  border-radius: 1px;
  box-shadow: 0 0.5rem 0 0 var(--paper-bright);
}
.step[data-status="warn"]     .step-label { color: var(--ink); }
.step[data-status="warn"]     .step-detail { color: var(--warn); }

.step[data-status="skipped"]  { opacity: 0.7; }
.step[data-status="skipped"]  .step-mark { border-color: var(--rule); background: transparent; }
.step[data-status="skipped"]  .step-mark::after {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.36rem;
  right: 0.15rem;
  height: 1.5px;
  background: var(--ink-mute);
}
.step[data-status="skipped"]  .step-label { color: var(--ink-mute); font-style: italic; }

.step[data-status="blocked"]  .step-mark {
  border-color: var(--fail);
  background: var(--paper-bright);
}
.step[data-status="blocked"]  .step-mark::after {
  content: "";
  position: absolute;
  inset: 0.18rem;
  border-radius: 50%;
  background: var(--fail);
}
.step[data-status="blocked"]  .step-label { color: var(--fail); font-weight: 600; }
.step[data-status="blocked"]  .step-detail { color: var(--fail); }

.step[data-status="error"]    .step-mark {
  border-color: var(--fail);
  background: var(--fail);
}
.step[data-status="error"]    .step-mark::after {
  content: "×";
  position: absolute;
  inset: 0;
  color: var(--paper-bright);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.step[data-status="error"]    .step-label { color: var(--fail); font-weight: 600; }
.step[data-status="error"]    .step-detail { color: var(--fail); }

@keyframes stepRun {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.18); }
}
@keyframes stepDot {
  0%, 100% { opacity: 0.65; }
  50%      { opacity: 1; }
}

.run-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}
.run-status {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.block-list {
  list-style: none;
  margin: 0 0 1.6rem;
  padding: 0.6rem 1rem;
  background: var(--paper-deep);
  border-left: 3px solid var(--fail);
}
.block-list li {
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.2rem 0;
}
.block-list code { background: transparent; padding: 0; }

/* ───────────────────────────────────────── settings page */

.masthead-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 1px;
  transition: color 0.15s, border-color 0.15s;
}
.masthead-link:hover { color: var(--accent); }

.settings-page { max-width: 760px; }

.settings-form { gap: 2rem; }

.settings-group {
  border: 1px solid var(--rule);
  background: var(--paper-bright);
  padding: 1.4rem 1.5rem 1.2rem;
}
.settings-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--rule);
}
.settings-group-head .kicker {
  margin: 0;
  padding-bottom: 0;
  border: 0;
}

.field-hint {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}
.field-hint code {
  background: var(--paper-deep);
  padding: 0.05rem 0.3rem;
  letter-spacing: 0;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-mute);
  margin: 0.2rem 0 0.6rem;
  cursor: pointer;
}
.checkbox input { margin: 0; }

.status-pill-text {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.status-pill-text--ok      { color: var(--pass); }
.status-pill-text--missing { color: var(--warn); }

.banner {
  font-family: var(--mono);
  font-size: 0.84rem;
  padding: 0.7rem 1rem;
  margin: 0 0 1.6rem;
  border-left: 3px solid currentColor;
}
.banner--ok  { background: rgba(30, 110, 75, 0.09); color: var(--pass); }
.banner--err { background: rgba(160, 43, 34, 0.08); color: var(--fail); }

.button--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
}
.button--ghost:hover {
  background: var(--ink);
  color: var(--paper-bright);
}

/* ───────────────────────────────────────── responsive */

@media (max-width: 720px) {
  .step { grid-template-columns: 1.4rem 1fr; row-gap: 0.2rem; }
  .step-detail, .step-time { grid-column: 2 / 3; }
}
@media (max-width: 880px) {
  .paper { padding: 1.5rem 1.2rem 3rem; }
  .masthead { grid-template-columns: 1fr; text-align: left; gap: 0.6rem; }
  .masthead-meta--right { text-align: left; }
  .title { text-align: left; font-size: 2.6rem; }
  .title-sub { text-align: left; }
  .intake { grid-template-columns: 1fr; gap: 2rem; }
  .intake-divider { display: none; }
  .ledger-head { flex-wrap: wrap; }
  .ledger-table thead { display: none; }
  .ledger-table tbody td {
    display: block;
    padding: 0.3rem 0;
    border: 0;
  }
  .ledger-table tbody tr {
    display: block;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--rule);
  }
  .col-num { display: inline-block !important; width: auto; margin-right: 0.85rem; text-align: left; }
  .col-num::before {
    content: attr(data-label) " ";
    font-family: var(--mono);
    font-size: 0.6rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-mute);
    margin-right: 0.3rem;
  }
}

/* ═══════════════════════════════════════════ shell + collapsible rail
 * The rail is opt-in: only pages that define the `sidebar` block get one,
 * so settings/run/login keep the single-column layout they were built for.
 * Width lives in a custom property because both the rail and the content
 * offset read from it — one number to change. */

:root { --rail-w: 268px; --rail-w-min: 62px; }
.rail-collapsed { --rail-w: var(--rail-w-min); }

.shell { position: relative; z-index: 1; }

/* The rail is the one dark surface in the app, so it redefines the ink and
 * surface tokens for its own subtree rather than restyling each child: every
 * .rail-* rule below already reads --ink-soft / --paper-deep / --accent and
 * inverts for free. Gold lands here as the selected state, which is the only
 * place the guide's third primary earns a load-bearing role. */
.rail {
  --ink:          var(--white);
  --ink-soft:     #B7C2CE;   /* Silver, cooled toward Midnight */
  --ink-mute:     #8595A6;
  --paper-bright: rgba(255, 255, 255, 0.10);
  --paper-deep:   rgba(255, 255, 255, 0.08);
  --rule:         rgba(255, 255, 255, 0.18);
  --rule-soft:    rgba(255, 255, 255, 0.12);
  --accent:       var(--gold);

  /* Load-bearing: redefining the tokens is not enough on its own. Anything
     in the rail without an explicit colour — .rail-user-name was the one
     that showed — inherits Midnight straight from body and disappears
     against the rail. This gives the whole subtree a light default. */
  color: var(--ink-soft);

  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 1.15rem 0.85rem 1.1rem;
  background: var(--paper-rail);
  border-right: 1px solid var(--deep-sea);
  transition: width 0.18s ease;
  z-index: 20;
  overflow: hidden;
}
/* Only the sibling of a rail shifts; pages without one are unaffected. */
.rail ~ .paper {
  margin-left: var(--rail-w);
  max-width: none;
  transition: margin-left 0.18s ease;
}

/* Brand row. Fixed height so the logo swap can never move the nav below it,
 * and padding matched to .rail-item so the mark shares a left edge with the
 * nav icons.
 *
 * flex: none on the logo is load-bearing — as a flex child it was shrinking
 * to 14.6px inside the 62px collapsed rail and slicing the mark in half.
 *
 * The two files are drawn at the SAME height, not the same width: the emblem
 * in the wordmark measures 139.4x159 and the standalone icon 334x381, both
 * 0.877, so equal heights render an identical mark. */
.rail-brand {
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 0.6rem;
  flex: none;
}
.rail-logo { display: block; flex: none; height: 26px; line-height: 0; }
/* No `display` on this shared rule: `.rail-logo img` is (0,1,1) and would
 * outrank the (0,1,0) variant selectors below, leaving both marks visible.
 * Each variant owns its own display value instead. */
.rail-logo img { height: 26px; width: auto; max-width: none; }
.rail-logo-full { display: block; }
.rail-logo-mark { display: none; }
.rail-collapsed .rail-logo-full { display: none; }
.rail-collapsed .rail-logo-mark { display: block; }

/* Floating edge control: straddles the rail border, vertically centred on
 * the brand row. Fixed rather than absolute because the rail clips overflow
 * to hide labels mid-collapse — an absolute child would be cut in half. It
 * reads --rail-w, the same variable the rail width comes from, so both
 * animate as one. */
.rail-toggle {
  position: fixed;
  top: 25px;
  left: calc(var(--rail-w) - 13px);
  width: 26px; height: 26px;
  display: grid; place-items: center;
  padding: 0;
  background: var(--paper-bright);
  /* --rule-soft is Silver, which is also the canvas: the right half of the
     circle had no edge at all, while the left half met Midnight at full
     contrast. Read as a bulge off the rail rather than a control centred on
     its border. A Midnight hairline holds the shape against both. */
  border: 1px solid var(--rule);
  border-radius: 50%;
  color: var(--ink-soft);
  cursor: pointer;
  z-index: 21;
  box-shadow: 0 1px 3px rgba(11, 32, 56, 0.18);
  transition: left 0.18s ease, background 0.12s, border-color 0.12s, color 0.12s;
}
.rail-toggle:hover {
  background: #fff;
  border-color: var(--accent);
  color: var(--accent);
}
.rail-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* The chevron is centred on its bounding box, but its visual mass sits in
   the two arms, not the apex — so "<" reads a touch right of centre. Nudged
   back by half a pixel. The collapsed state is left exactly as it was: the
   same glyph rotated, and it already sits right. */
.rail-toggle svg {
  width: 15px; height: 15px;
  transform: translateX(-0.5px);
  transition: transform 0.18s ease;
}
.rail-collapsed .rail-toggle svg { transform: rotate(180deg); }

.rail-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 0.5rem; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 0.7rem; border-top: 1px solid var(--rule-soft); }

.rail-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.6rem;
  /* Fixed: the label is taller than the icon, so hiding it on collapse would
     shrink each row and walk the list upward a few pixels. */
  height: 38px;
  border-radius: 7px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.875rem;
  white-space: nowrap;
  border-left: 2px solid transparent;
  transition: background 0.12s, color 0.12s;
}
.rail-item:hover { background: var(--paper-deep); color: var(--ink); }
.rail-item.is-active {
  background: var(--paper-deep);
  color: var(--ink);
  font-weight: 600;
  border-left-color: var(--accent);
}
.rail .rail-item.is-active .rail-icon { color: var(--gold); }
.rail-item.is-disabled { opacity: 0.5; cursor: default; }
.rail-item.is-disabled:hover { background: transparent; color: var(--ink-soft); }
.rail-icon { flex: none; width: 20px; height: 20px; display: block; }
.rail-icon svg { width: 100%; height: 100%; display: block; }
.rail-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rail-tag {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  border: 1px solid var(--rule-soft);
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
}

.rail-user {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.6rem;
  font-size: 0.85rem;
  /* Fixed: collapsing hides the name and sign-out link, which would
     otherwise change this row's height and shift the whole foot cluster. */
  height: 43px;
}
.rail-avatar {
  flex: none;
  width: 27px; height: 27px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--paper-deep);
  border: 1px solid var(--rule-soft);
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--ink-soft);
}
.rail-user-name { flex: 1; font-weight: 500; }
.rail-signout { font-size: 0.72rem; color: var(--ink-mute); text-decoration: none; }
.rail-signout:hover { color: var(--accent); text-decoration: underline; }

/* Collapsed: icons only, centered. Labels are removed from the flow rather
 * than hidden, so they can't hold the rail open. */
.rail-collapsed .rail-label,
.rail-collapsed .rail-tag { display: none; }
/* Deliberately NOT centred when collapsed: the icons sit at the same x in
 * both states, so collapsing changes width and nothing else. */

.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;
}

/* ═══════════════════════════════════════════ page head */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.6rem;
}


/* ═══════════════════════════════════════════ cards */

.deck { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.15rem; }
.card {
  background: var(--paper-bright);
  border: 1px solid var(--rule-soft);
  border-radius: 11px;
  padding: 1.35rem 1.4rem;
}
.card-title {
  font-family: var(--display);
  font-size: 1.22rem;
  font-weight: 600;
  margin: 0 0 1rem;
}

.tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 1.25rem; }
.tab {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.65rem 0.5rem;
  background: var(--paper-deep);
  border: 1px solid var(--rule-soft);
  font-family: var(--sans); font-size: 0.875rem; color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.tab:first-child { border-radius: 7px 0 0 7px; }
.tab:last-child { border-radius: 0 7px 7px 0; border-left: 0; }
.tab:hover { color: var(--ink); }
.tab.is-active {
  background: var(--paper-bright);
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.tab-icon { width: 17px; height: 17px; }

.panel { display: none; }
.panel.is-active { display: block; }

.drop-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
}
.drop {
  position: relative;
  display: block;
  border: 1px dashed var(--rule);
  border-radius: 9px;
  padding: 0.9rem 1rem 1rem;
  text-align: center;
  cursor: pointer;
  background: var(--paper-bright);
  transition: border-color 0.12s, background 0.12s;
}
.drop:hover, .drop.is-over { border-color: var(--accent); background: #fff; }
.drop.has-file { border-style: solid; }
.drop input[type=file] {
  position: absolute; inset: 0;
  opacity: 0; width: 100%; height: 100%; cursor: pointer;
}
.drop-cap {
  display: block;
  font-family: var(--mono);
  font-size: 0.63rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  text-align: left;
  margin-bottom: 0.75rem;
}
.drop-cap em {
  font-style: normal;
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  padding: 0.05rem 0.3rem;
  margin-left: 0.35rem;
}
.drop-body { display: block; }
.drop-glyph {
  display: grid; place-items: center;
  width: 34px; height: 40px;
  margin: 0 auto 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-family: var(--mono); font-size: 0.85rem; font-weight: 500;
  background: #fff;
}
.drop-glyph--x { color: var(--pass); }
.drop-glyph--p { color: var(--fail); }
.drop-name {
  display: block;
  font-size: 0.88rem;
  word-break: break-word;
  line-height: 1.35;
}
.drop.has-file .drop-name { font-weight: 500; }
.drop-size {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-mute);
  margin-top: 0.15rem;
  min-height: 1em;
}
.drop-swap {
  display: none;
  margin: 0.7rem auto 0;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  background: var(--paper-bright);
  width: fit-content;
}
.drop.has-file .drop-swap { display: block; }

.swap {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--paper-bright);
  color: var(--ink-soft);
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, transform 0.12s;
}
.swap:hover { border-color: var(--accent); color: var(--accent); transform: rotate(180deg); }

.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule-soft);
}
.note {
  display: flex; align-items: center; gap: 0.5rem;
  margin: 0; font-size: 0.83rem; color: var(--ink-soft);
}
.note-mark {
  flex: none;
  width: 15px; height: 15px;
  display: grid; place-items: center;
  border: 1px solid var(--rule);
  border-radius: 50%;
  font-family: var(--mono); font-size: 0.6rem;
}
.btn-solid {
  flex: none;
  display: inline-flex; align-items: center;
  padding: 0.6rem 1.3rem;
  background: var(--ink);
  color: var(--paper-bright);
  border: 1px solid var(--ink);
  border-radius: 7px;
  font-family: var(--mono); font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.btn-solid:hover { background: var(--accent); border-color: var(--accent); }
.btn-solid .arrow { margin-left: 0.5rem; }


/* ═══════════════════════════════════════════ responsive */

@media (max-width: 860px) {
  :root { --rail-w: var(--rail-w-min); }
  .rail .rail-label, .rail .rail-tag { display: none; }
  .rail-logo-full { display: none; }
  .rail-logo-mark { display: block; }
  .drop-row { grid-template-columns: minmax(0, 1fr); }
  .swap { transform: rotate(90deg); margin: 0 auto; }
  .swap:hover { transform: rotate(270deg); }
  .page-head { flex-direction: column; }
}

/* Content column. .paper drops its own max-width when a rail is present
 * (the rail already consumes the left edge), so the measure is restored on
 * each top-level child instead — otherwise the ledger sprawls on wide
 * screens. The table scrolls in place rather than clipping in the band
 * between the rail appearing and the card layout taking over at 880px. */
.rail ~ .paper > * {
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
}
/* Horizontal scroll only when the table really cannot fit. On a wide screen
 * the ledger must NOT clip: the row overflow menu hangs below the last row,
 * and any overflow other than visible cuts it off. */
@media (max-width: 1100px) { .ledger { overflow-x: auto; } }

/* ═══════════════════════════════════════════ framed report view
 * The report keeps its own document and stylesheet; the shell supplies only
 * the rail. Full-viewport frame with no padding — the report already sets
 * its own margins and its export bar is sticky to the frame's top. */
.viewport { height: 100vh; overflow: hidden; }
.rail ~ .viewport {
  margin-left: var(--rail-w);
  transition: margin-left 0.18s ease;
}
.report-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ═══════════════════════════════════════════ report topbar
 * Page chrome for the framed report. Deliberately outside the frame: the
 * report document is downloaded verbatim, so breadcrumbs and export menus
 * must not end up inside it. */
.viewport { display: flex; flex-direction: column; }

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.1rem;
  background: var(--paper-bright);
  border-bottom: 1px solid var(--rule-soft);
}

.crumbs { display: flex; align-items: center; gap: 0.55rem; min-width: 0; }
.crumb-back {
  display: inline-flex; align-items: center; gap: 0.35rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}
.crumb-back:hover { text-decoration: underline; }
.crumb-back svg { width: 14px; height: 14px; }
.crumb-sep { color: var(--rule); font-size: 0.85rem; }
.crumb {
  font-size: 0.85rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crumb--mono { font-family: var(--mono); font-size: 0.78rem; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }
.topbar-stamp {
  font-size: 0.76rem;
  color: var(--ink-mute);
  white-space: nowrap;
  margin-left: 0.35rem;
}

.btn-bar {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  background: var(--paper-bright);
  border: 1px solid var(--rule);
  border-radius: 7px;
  font: 500 0.82rem/1.2 var(--sans);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.btn-bar:hover { border-color: var(--accent); background: #fff; }
.btn-bar svg { width: 14px; height: 14px; }
.btn-bar .caret { width: 12px; height: 12px; color: var(--ink-mute); }
.btn-bar--icon { padding: 0.4rem 0.5rem; }

.menu { position: relative; }
.menu-pop {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  min-width: 190px;
  z-index: 30;
  background: var(--paper-bright);
  border: 1px solid var(--rule-soft);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(11, 32, 56, 0.16);
  padding: 4px;
  display: flex;
  flex-direction: column;
}
.menu-pop--right { left: auto; right: 0; }
/* The [hidden] attribute is a UA rule (display:none) and loses to the class
   rule above, so it must be restated here or the menus render open. */
.menu-pop[hidden] { display: none; }
.menu-pop a,
.menu-pop button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.6rem;
  border: 0;
  border-radius: 5px;
  background: transparent;
  font: 400 0.83rem/1.3 var(--sans);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}
.menu-pop a:hover,
.menu-pop button:hover { background: var(--paper-deep); }
.menu-pop form { margin: 0; }

.report-frame { flex: 1 1 auto; min-height: 0; }

@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; gap: 0.5rem; }
  .topbar-stamp { display: none; }
}

/* ═══════════════════════════════════════════ settings */

.settings-page { max-width: 860px; }

.settings-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.4rem;
}
.settings-head .page-lede { margin-bottom: 0; }
.settings-head .save-state { flex: none; padding-bottom: 0.35rem; }

.save-state {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.8rem; color: var(--ink-mute);
  white-space: nowrap;
}
.save-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--pass);
}
.save-state.is-dirty { color: var(--warn); }
.save-state.is-dirty .save-dot { background: var(--warn); }

.btn-primary {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.55rem 1.05rem;
  background: var(--ink);
  color: var(--paper-bright);
  border: 1px solid var(--ink);
  border-radius: 7px;
  font: 500 0.85rem/1.2 var(--sans);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }

.btn-quiet {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  background: var(--paper-bright);
  border: 1px solid var(--rule);
  border-radius: 7px;
  font: 500 0.84rem/1.2 var(--sans);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.12s, background 0.12s;
}
.btn-quiet:hover { border-color: var(--accent); background: #fff; }
.btn-quiet[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-quiet[disabled]:hover { border-color: var(--rule); background: var(--paper-bright); }
.btn-quiet svg { width: 15px; height: 15px; flex: none; }
.btn-quiet--wide { width: 100%; margin-top: 0.9rem; }

.settings-form { display: flex; flex-direction: column; gap: 1.1rem; }
.set-card { padding: 1.3rem 1.4rem; }
.set-card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.1rem;
}
.set-card-head .card-title { margin: 0; }
.set-sub { margin: 0.2rem 0 0; font-size: 0.85rem; color: var(--ink-soft); }

.chip {
  flex: none;
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.28rem 0.6rem;
  border-radius: 6px;
  font: 500 0.76rem/1.2 var(--sans);
  border: 1px solid transparent;
}
.chip--ok   { color: var(--pass); background: rgba(30, 110, 75, 0.10); border-color: rgba(30, 110, 75, 0.24); }
.chip--warn { color: var(--warn); background: rgba(138, 106, 31, 0.10); border-color: rgba(138, 106, 31, 0.24); }

.set-row { display: flex; align-items: flex-end; gap: 0.6rem; flex-wrap: wrap; }
.set-field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.set-field--grow { flex: 1 1 240px; }
.set-label { font-size: 0.84rem; font-weight: 500; color: var(--ink); }

.set-input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: var(--paper-bright);
  border: 1px solid var(--rule);
  border-radius: 7px;
  font: 400 0.88rem/1.3 var(--sans);
  color: var(--ink);
}
.set-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.set-input[readonly] { color: var(--ink-mute); font-family: var(--mono); font-size: 0.82rem; }
.set-input--custom { margin-top: 0.35rem; }

.set-select { position: relative; }
.set-select select {
  width: 100%;
  appearance: none;
  padding: 0.55rem 2rem 0.55rem 0.7rem;
  background: var(--paper-bright);
  border: 1px solid var(--rule);
  border-radius: 7px;
  font: 400 0.88rem/1.3 var(--sans);
  color: var(--ink);
  cursor: pointer;
}
.set-select::after {
  content: "";
  position: absolute; right: 0.75rem; top: 50%;
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--ink-mute);
  border-bottom: 1.5px solid var(--ink-mute);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.set-hint { margin: 0; font-size: 0.79rem; color: var(--ink-mute); line-height: 1.45; }
.set-hint--lock { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.6rem; }
.set-hint svg { width: 14px; height: 14px; flex: none; }
.set-hint code { font-family: var(--mono); font-size: 0.92em; }

.set-check { display: flex; align-items: center; gap: 0.45rem; margin-top: 0.7rem; font-size: 0.83rem; color: var(--ink-soft); }

.set-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; margin-bottom: 1.1rem; }
.set-grid--3 { grid-template-columns: repeat(3, 1fr); }

/* Segmented radio group — the inputs stay real for keyboard and form posting.
 * align-self stops it stretching to the field width (which handed all the
 * slack to the last option), and equal flex basis + a shared min-width make
 * both segments the same size regardless of label length. */
.seg {
  display: inline-flex;
  align-self: flex-start;
  border: 1px solid var(--rule);
  border-radius: 7px;
  overflow: hidden;
}
.seg-opt { display: flex; flex: 1 1 0; }
.seg-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg-opt span {
  flex: 1;
  min-width: 136px;
  text-align: center;
  padding: 0.5rem 1.1rem;
  font: 500 0.84rem/1.2 var(--sans);
  color: var(--ink-soft);
  background: var(--paper-bright);
  cursor: pointer;
}
.seg-opt + .seg-opt span { border-left: 1px solid var(--rule); }
.seg-opt input:checked + span { background: var(--accent); color: #fff; }
.seg-opt input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: -2px; }

.stepper { display: flex; align-items: stretch; border: 1px solid var(--rule); border-radius: 7px; overflow: hidden; }
.stepper-btn {
  width: 34px;
  background: var(--paper-bright);
  border: 0;
  color: var(--ink-soft);
  font-size: 1rem;
  cursor: pointer;
}
.stepper-btn:hover { background: var(--paper-deep); color: var(--ink); }
.stepper-input {
  flex: 1; min-width: 0;
  text-align: center;
  border: 0;
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  background: var(--paper-bright);
  font: 400 0.9rem var(--sans);
  color: var(--ink);
  padding: 0.5rem 0;
  -moz-appearance: textfield;
}
.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.callout {
  display: flex; align-items: center; gap: 0.55rem;
  margin: 0;
  padding: 0.7rem 0.85rem;
  background: var(--paper-deep);
  border: 1px solid var(--rule-soft);
  border-radius: 7px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.callout svg { width: 16px; height: 16px; flex: none; }

.disclose { border: 1px solid var(--rule-soft); border-radius: 7px; }
.disclose summary {
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  font: 500 0.85rem/1.2 var(--sans);
  list-style: none;
  display: flex; align-items: center; justify-content: space-between;
}
.disclose summary::-webkit-details-marker { display: none; }
.disclose summary::after {
  content: "";
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--ink-mute);
  border-bottom: 1.5px solid var(--ink-mute);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.15s;
}
.disclose[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.disclose-body {
  padding: 0.2rem 0.8rem 0.9rem;
  display: flex; flex-direction: column; gap: 0.8rem;
}

.copy-row { display: flex; gap: 0.4rem; }
.copy-btn {
  flex: none;
  width: 36px;
  background: var(--paper-bright);
  border: 1px solid var(--rule);
  border-radius: 7px;
  color: var(--ink-mute);
  cursor: pointer;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.copy-btn.is-copied { border-color: var(--pass); color: var(--pass); }
.copy-btn svg { width: 15px; height: 15px; }

.settings-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  margin-top: 1.3rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule-soft);
}
.settings-foot-actions { display: flex; align-items: center; gap: 0.6rem; }
.settings-foot form { margin: 0; }

@media (max-width: 820px) {
  .set-grid, .set-grid--3 { grid-template-columns: 1fr; }
  .settings-head { flex-direction: column; align-items: flex-start; }
}

/* ── Integrations page ──────────────────────────────────────────────── */
.chip--err { color: var(--fail); background: rgba(160, 43, 34, 0.08); border-color: rgba(160, 43, 34, 0.24); }

.int-form { display: flex; flex-direction: column; gap: 0.9rem; }
.int-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin-top: 0.4rem; }
.int-actions .btn-primary svg { width: 14px; height: 14px; margin-right: 0.35rem; vertical-align: -2px; }
.btn-primary.is-busy { opacity: 0.7; cursor: progress; }

.int-log {
  margin-top: 1.4rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fbfaf7;
  overflow: hidden;
}
.int-log-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.78rem;
}
.int-log-title { font-weight: 600; color: var(--ink); }
.int-log-meta { font-family: var(--mono); color: var(--ink-mute); }
.int-log-list {
  list-style: none; margin: 0; padding: 0.4rem 0;
  max-height: 440px; overflow: auto;
  font-family: var(--mono); font-size: 0.78rem; line-height: 1.5;
}
.int-log-row {
  display: grid; grid-template-columns: 62px 44px 1fr; gap: 0.6rem;
  padding: 0.22rem 0.85rem;
  border-left: 3px solid transparent;
}
.int-log-ts  { color: var(--ink-mute); }
.int-log-lvl { text-transform: uppercase; font-size: 0.68rem; letter-spacing: 0.04em; padding-top: 0.1em; }
.int-log-msg { min-width: 0; overflow-wrap: anywhere; color: var(--ink); }
.int-log-ms  { color: var(--ink-mute); font-size: 0.72rem; }
.int-log-detail {
  margin: 0.25rem 0 0.3rem; padding: 0.45rem 0.6rem;
  background: rgba(0,0,0,0.035); border-radius: 5px;
  font: inherit; font-size: 0.74rem; color: var(--ink-soft);
  white-space: pre-wrap; overflow-x: auto;
}
.int-log-row--ok    { border-left-color: var(--pass); }
.int-log-row--ok    .int-log-lvl { color: var(--pass); }
.int-log-row--info  .int-log-lvl { color: var(--ink-mute); }
.int-log-row--warn  { border-left-color: var(--warn); }
.int-log-row--warn  .int-log-lvl { color: var(--warn); }
.int-log-row--error { border-left-color: var(--fail); background: rgba(160, 43, 34, 0.04); }
.int-log-row--error .int-log-lvl { color: var(--fail); }

/* Client documents (Integrations → Karbon) */
.docs-search { display: flex; gap: 0.6rem; align-items: flex-end; flex-wrap: wrap; }
.docs-search .set-field { min-width: 160px; }
.docs-matches { margin-top: 1rem; }
.docs-match-list { list-style: none; margin: 0.4rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.docs-match button {
  width: 100%; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 0.1rem;
  padding: 0.5rem 0.7rem; border: 1px solid var(--rule); border-radius: 6px; background: #fff;
  font: inherit; color: var(--ink);
}
.docs-match button:hover, .docs-match.is-active button { border-color: var(--accent); }
.docs-match.is-active button { background: rgba(30, 110, 75, 0.06); }
.docs-match-name { font-weight: 600; font-size: 0.88rem; }
.docs-match-sub { font-size: 0.76rem; color: var(--ink-mute); font-family: var(--mono); }

.docs-results { margin-top: 1.2rem; }
.docs-results-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.5rem; }
.docs-results-title { font-weight: 600; font-size: 0.9rem; }
.docs-table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 8px; }
.docs-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.docs-table th, .docs-table td { padding: 0.5rem 0.7rem; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: top; }
.docs-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-mute); background: #fbfaf7; }
.docs-table tr:last-child td { border-bottom: 0; }
.docs-table .num { text-align: right; font-family: var(--mono); white-space: nowrap; }
.docs-name a { color: var(--ink); text-decoration: none; font-weight: 500; overflow-wrap: anywhere; }
.docs-name a:hover { text-decoration: underline; }
.docs-where { color: var(--ink-soft); }
.docs-date { font-family: var(--mono); white-space: nowrap; }
.docs-dl .btn-quiet { padding: 0.25rem 0.6rem; font-size: 0.76rem; }
.docs-empty { margin-top: 0.6rem; }
.docs-log { margin-top: 1rem; }
.docs-log .int-log-list { max-height: 260px; border: 1px solid var(--rule); border-radius: 6px; background: #fbfaf7; margin-top: 0.4rem; }

/* Day view (Integrations → Karbon) */
.day-only { margin: 0 0 0.45rem; align-self: flex-end; }
.day-results { margin-top: 1.2rem; }
.day-cust { border: 1px solid var(--rule); border-radius: 8px; padding: 0.8rem 1rem; margin-bottom: 0.8rem; }
.day-cust-name { margin: 0 0 0.6rem; font-size: 0.95rem; font-weight: 600; }
.day-cust-type { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-mute); font-weight: 400; margin-left: 0.4rem; }
.day-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 720px) { .day-cols { grid-template-columns: 1fr; } }
.day-list { list-style: none; margin: 0.35rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.day-step, .day-doc { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 0.5rem; font-size: 0.84rem; }
.day-step-title { font-weight: 500; }
.day-step-sub { flex-basis: 100%; font-size: 0.74rem; color: var(--ink-mute); font-family: var(--mono); }
.day-ev { font: 500 0.66rem/1.2 var(--sans); text-transform: uppercase; letter-spacing: 0.04em;
          padding: 0.15rem 0.4rem; border-radius: 4px; border: 1px solid transparent; }
.day-ev--started   { color: var(--pass); background: rgba(30, 110, 75, 0.10); border-color: rgba(30, 110, 75, 0.24); }
.day-ev--completed { color: var(--pass); background: rgba(30, 110, 75, 0.10); border-color: rgba(30, 110, 75, 0.24); }
.day-ev--due       { color: var(--warn); background: rgba(138, 106, 31, 0.10); border-color: rgba(138, 106, 31, 0.24); }
.day-ev--deadline  { color: var(--fail); background: rgba(160, 43, 34, 0.08); border-color: rgba(160, 43, 34, 0.24); }
.day-doc a:first-child { color: var(--ink); font-weight: 500; text-decoration: none; overflow-wrap: anywhere; }
.day-doc a:first-child:hover { text-decoration: underline; }
.day-doc .btn-quiet { padding: 0.2rem 0.55rem; font-size: 0.74rem; margin-left: auto; }

/* ── Integrations: year-over-year candidates ─────────────────────────── */
.yoy-cand { margin-top: 1rem; }
.yoy-table { margin-top: 0.4rem; }
.yoy-table td input[type="radio"] { accent-color: var(--accent); }
.yoy-cand-form .int-actions { margin-top: 0.6rem; align-items: center; }
.yoy-noise td { color: var(--ink-mute); }

/* ── Tax summary intake ─────────────────────────────────────────────── */
.drop--multi { width: 100%; }
.sum-files { list-style: none; margin: 0.6rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.2rem; font-family: var(--mono); font-size: 0.78rem; color: var(--ink-soft); }

/* ── Client share panel (summary shell) ─────────────────────────────── */
.share-panel { border-bottom: 1px solid var(--rule); background: var(--paper-bright); padding: 1rem 1.5rem 1.25rem; }
.share-panel[hidden] { display: none; }
.share-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 2rem; }
.share-form .set-field { margin-top: 0.6rem; }
.btn-bar--on { color: var(--accent); }
@media (max-width: 800px) { .share-cols { grid-template-columns: 1fr; } }
