/* ==========================================================================
   DeVenture - application styles
   Rebuilt from the UI mockups: same measurements, same ramp, same lanes.
   ========================================================================== */

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

/* Flex and grid children ignore the hidden attribute without this. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 13px/1.45 var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }

.boot {
  display: grid;
  place-items: center;
  min-height: 100vh;
  font: 500 13px var(--text);
  color: var(--muted);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* --------------------------------- type ---------------------------------- */

.eyebrow {
  font: 600 9.5px/1 var(--display);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow-lg { font-size: 10px; letter-spacing: .22em; }
.h1 { font: 700 25px/1.2 var(--display); letter-spacing: -.015em; margin: 0; }
.h2 { font: 700 24px/1.15 var(--display); letter-spacing: -.015em; margin: 0; }
.h3 { font: 700 17px/1.15 var(--display); letter-spacing: -.01em; margin: 0; }
.h4 { font: 600 13.5px/1.2 var(--display); margin: 0; }
.lede { font: 400 13px/1.55 var(--text); color: var(--body); max-width: 68ch; text-wrap: pretty; }
.small { font: 400 11.5px/1.4 var(--text); color: var(--muted); }
/*
 * Small, but still read: a template link, a footnote under a figure, the
 * "optional" tag. It takes --muted (5.5:1), not --faint - 10.5px at 2.1:1 is
 * decoration pretending to be information. Use .inert for what truly is.
 */
.tiny { font: 400 10.5px/1.3 var(--text); color: var(--muted); }
.inert { color: var(--faint); }
.mono { font-family: var(--mono); font-size: .92em; }
.num { font: 700 27px/1.1 var(--display); letter-spacing: -.02em; }
.num-lg { font: 700 32px/1.05 var(--display); letter-spacing: -.025em; }
.num-xl { font: 700 44px/1 var(--display); letter-spacing: -.03em; }
.num-sm { font: 700 18px/1.1 var(--display); }
.neg { color: var(--kill); }
.pos { color: var(--ok); }
.dim { color: var(--muted); }
.faint { color: var(--faint); }
.body-copy { color: var(--body); }
.strike { color: var(--muted); text-decoration: line-through; }

/* -------------------------------- topbar --------------------------------- */

.app-shell { min-height: 100%; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 24px;
  height: var(--topbar-h); padding: 0 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 9px; flex: none; }
.brand-mark {
  font: 700 19px/1 var(--display); letter-spacing: -.02em; color: var(--ink);
  background: none; border: 0; padding: 0; cursor: pointer;
}
.brand-mark span { color: var(--accent); }
.brand-kicker {
  font: 600 9px/1 var(--display); letter-spacing: .24em; text-transform: uppercase;
  color: var(--muted); border-left: 1px solid var(--line); padding-left: 9px;
}
/*
 * Nav items as pills rather than an underline. The underline marked the
 * active entry with two pixels at the very bottom edge of a 56px bar - far
 * from the word it belongs to. A filled pill puts the mark on the word.
 */
.topnav { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a {
  display: flex; align-items: center; padding: 8px 13px; border-radius: var(--r-chip);
  font: 500 13.5px/1 var(--display); color: var(--body); white-space: nowrap;
  transition: background .12s ease, color .12s ease;
}
.topnav a:hover { color: var(--ink); background: #F1F4F6; }
.topnav a.on { font-weight: 600; color: #fff; background: var(--ink); }
.topnav a.on:hover { color: #fff; background: var(--ink); }
.topbar-end { display: flex; align-items: center; gap: 10px; flex: none; }

.langswitch { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r-chip); overflow: hidden; }
.langswitch button {
  padding: 5px 8px; font: 500 10.5px/1 var(--text); color: var(--muted);
  background: none; border: 0; cursor: pointer;
}
.langswitch button.on { background: var(--ink); color: #fff; font-weight: 600; }

.rolechip {
  display: flex; align-items: center; gap: 7px; padding: 5px 9px;
  border: 1px solid var(--line); border-radius: var(--r-chip); background: var(--doc-lane);
}
.rolechip .label { font: 600 8.5px/1 var(--text); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.rolechip .value { font: 600 12px/1 var(--text); }

.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: var(--ink); color: #fff;
  display: grid; place-items: center;
  font: 600 10.5px/1 var(--text);
  border: 0; cursor: pointer;
}

/* --------------------------------- page ---------------------------------- */

.page {
  flex: 1;
  width: 100%; max-width: var(--page-max); margin: 0 auto;
  padding: 22px var(--page-pad) 40px;
}
.page-wide { max-width: none; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 18px; flex-wrap: wrap;
}
.page-head .h1, .page-head .h2 { margin-top: 6px; }
.crumbs { font: 400 11.5px/1 var(--text); color: var(--muted); margin-bottom: 7px; }
.crumbs .sep { color: var(--faint); margin: 0 4px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* -------------------------------- buttons -------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: var(--r-input); padding: 9px 13px;
  font: 500 12.5px/1 var(--text); cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.btn:hover { border-color: var(--glyph); }
/* Not pure --ink: the primary button sits on cards that are themselves --ink
   in the dark panels, and #12212B keeps the two apart. */
.btn-primary { background: var(--ink-card); border-color: var(--ink-card); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--ink-card-hover); border-color: var(--ink-card-hover); }
.btn-danger { background: var(--kill); border-color: var(--kill); color: #fff; font-weight: 600; }
.btn-danger:hover { background: #93291d; border-color: #93291d; }
.btn-ghost { background: none; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--ink); border-color: var(--line); }
.btn-sm { padding: 6px 9px; font-size: 11.5px; border-radius: 6px; }
/* On the dark gate card: white ground, so the one action on the card is the
   brightest thing on it. */
.btn-on-dark { background: #fff; border-color: #fff; color: var(--ink); font-weight: 600; }
.btn-on-dark:hover { background: #fff; border-color: #fff; color: var(--link-hover); }
.btn[disabled], .btn[aria-disabled='true'] {
  background: rgba(22, 28, 36, .08); border-color: transparent; color: var(--muted);
  cursor: not-allowed; font-weight: 600;
}
.btn-primary[disabled] { background: rgba(22, 28, 36, .08); color: var(--muted); }
.btn-block { width: 100%; padding: 12px; }

.linkbtn {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: 500 12px/1 var(--text); color: var(--accent);
}
.linkbtn:hover { color: var(--ink); }

/* --------------------------------- cards --------------------------------- */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 15px 17px;
}
.card-flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.card-dark { background: var(--ink); color: #fff; border: 0; border-radius: var(--r-card); padding: 17px 18px; }
.card-dark .eyebrow { color: rgba(255, 255, 255, .55); }
.card-dark .small { color: var(--on-dark); }
.card-dark a { color: var(--mint); }
.card-dark hr, .card-dark .rule { border: 0; border-top: 1px solid var(--on-dark-line); margin: 14px 0 12px; }
.card-kill { background: var(--kill-bg); border: 1px solid var(--kill-line); }
.card-kill .eyebrow { color: var(--kill); }
.card-kill p, .card-kill .body { color: var(--kill-ink); }
.card-dashed { background: var(--surface); border: 1px dashed var(--line-dash); border-radius: var(--r-card); padding: 16px 18px; }
.card-lane-doc { background: var(--doc-lane); border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px 16px; }
.card-lane-tool { background: var(--tool-lane); border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px 16px; }

.tiles { display: grid; gap: 12px; margin-bottom: 12px; }
.tiles-5 { grid-template-columns: repeat(5, 1fr); }
.tiles-4 { grid-template-columns: repeat(4, 1fr); }
.tiles-3 { grid-template-columns: repeat(3, 1fr); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px 15px; }
.tile .num { margin-top: 9px; }
.tile .foot { font: 400 11.5px/1.35 var(--text); color: var(--muted); margin-top: 6px; }
.tile-alert { border-left: 3px solid var(--kill); }
.tile-alert .eyebrow { color: var(--kill); }
.tile-ok { border-left: 3px solid var(--ok); }

/* -------------------------------- badges --------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--r-pill); padding: 4px 9px;
  font: 600 10.5px/1 var(--display); white-space: nowrap;
  background: var(--s0); color: #fff;
}
.badge-lg { padding: 5px 11px; font-size: 11px; }
.badge-role { font-family: var(--text); font-size: 10.5px; padding: 5px 9px; }
.badge-admin { background: var(--ink); color: #fff; }
.badge-founder { background: var(--ok-bg); color: var(--ok-ink); }
.badge-mentor { background: var(--badge-blue-bg); color: var(--badge-blue-ink); }
.badge-investor { background: var(--badge-amber-bg); color: var(--badge-amber-ink); }
.badge-guest { background: var(--badge-grey-bg); color: var(--badge-grey-ink); }
/* Whether a Map entry is required or not - small, next to the wording, so a
   list of documents can be read as a checklist rather than a set of demands. */
.pill {
  display: inline-block; margin-left: 7px; padding: 2px 6px; border-radius: var(--r-pill);
  font: 600 9px/1.35 var(--display); letter-spacing: .1em; text-transform: uppercase;
  vertical-align: 1px; white-space: nowrap;
}
.pill-req { background: var(--badge-blue-bg, var(--doc-lane)); color: var(--badge-blue-ink, var(--muted)); }
.pill-soft { background: var(--badge-grey-bg, var(--paper)); color: var(--badge-grey-ink, var(--muted)); }
.pill-off { background: var(--kill-bg); color: var(--kill); }

/* The other entries in this stage about the same obligation. */
.related-note {
  border-top: 1px solid var(--line); margin-top: 4px; padding-top: 12px;
  display: flex; flex-direction: column; gap: 7px;
}
.related-note .k {
  font: 600 9px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.related-item {
  display: flex; align-items: center; gap: 9px; text-align: left; width: 100%;
  border: 1px solid var(--line); border-radius: var(--r-chip); background: var(--surface);
  padding: 8px 10px; cursor: pointer;
}
.related-item:hover { border-color: var(--glyph); }
.related-item .kind {
  font: 600 8.5px/1 var(--display); letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); flex: none;
}
.related-item .text { font: 500 12.5px/1.3 var(--text); flex: 1; min-width: 0; }
.related-item .pill { margin-left: 0; }
/* A retired entry stays readable but steps back: the pill says why, and where
   :has() is unavailable the entry simply looks normal - nothing is lost. */
.doc-row:has(.pill-off), .row:has(> span > .pill-off), .tool:has(.pill-off) { opacity: .62; }

.badge-warnline {
  background: var(--kill-bg); border: 1px solid var(--kill-line); color: var(--kill);
  font: 600 11.5px/1 var(--text); padding: 6px 10px;
}
.chip-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 10px/1 var(--text); border-radius: 4px; padding: 4px 7px;
}
.chip-cost { background: var(--kill-bg); color: var(--kill); }
.chip-revenue { background: var(--ok-bg); color: var(--ok-ink); }
.rbac-flag {
  font: 600 9.5px/1 var(--display); letter-spacing: .16em; text-transform: uppercase;
  color: var(--kill); background: var(--kill-bg); border: 1px solid var(--kill-line);
  padding: 5px 8px; border-radius: 5px;
}
.rbac-flag-neutral { color: var(--muted); background: var(--surface); border-color: var(--line); }

/* ------------------------------- filter row ------------------------------ */

.filters { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; flex-wrap: wrap; }
.filter {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 6px 12px; font: 500 11.5px/1 var(--text); color: var(--muted); cursor: pointer;
}
.filter:hover { border-color: var(--muted); color: var(--ink); }
.filter.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.spacer { flex: 1; }

.segmented { display: flex; border: 1px solid var(--line); border-radius: var(--r-chip); overflow: hidden; background: var(--surface); }
.segmented button {
  padding: 7px 11px; font: 500 11.5px/1 var(--text); color: var(--muted);
  background: none; border: 0; border-left: 1px solid var(--line); cursor: pointer;
}
.segmented button:first-child { border-left: 0; }
.segmented button.on { background: var(--ink); color: #fff; font-weight: 600; }

.search, .field {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-input);
  padding: 8px 11px; font: 400 12px/1.2 var(--text); color: var(--ink); width: 100%;
}
.search::placeholder, .field::placeholder { color: var(--faint); }
.field:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(28, 158, 147, .12); }
.field-sm { padding: 6px 9px; font-size: 11.5px; }
textarea.field { min-height: 74px; resize: vertical; line-height: 1.5; }
.search-wrap { width: 210px; }

.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row > label { font: 500 11.5px/1 var(--text); color: var(--muted); }
.form-grid { display: grid; gap: 12px; }
.form-error {
  background: var(--kill-bg); border: 1px solid var(--kill-line); color: var(--kill-ink);
  border-radius: var(--r-input); padding: 9px 11px; font: 500 12px/1.4 var(--text);
}

/* --------------------------- checkbox + progress ------------------------- */

.tick {
  flex: none; width: 15px; height: 15px; border-radius: 4px;
  display: grid; place-items: center;
  background: var(--ok); color: #fff; font: 700 10px/1 var(--text);
  border: 0; padding: 0;
}
.tick-sm { width: 14px; height: 14px; font-size: 9.5px; }
.tick-off { background: transparent; border: 1.5px solid var(--box); color: transparent; }
.tick-missing { background: transparent; border: 1.5px solid var(--kill); color: transparent; }
button.tick { cursor: pointer; }
button.tick[disabled] { cursor: default; opacity: .85; }
button.tick-off:hover:not([disabled]) { border-color: var(--ok); }

.ramp { display: flex; gap: 3px; margin: 14px 0 8px; }
.ramp i { flex: 1; height: 5px; border-radius: 2px; background: var(--line); }

.meter { height: 6px; background: var(--paper); border-radius: 3px; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }

/* The cap table's one bar: every holder's share of the same hundred per cent,
   with what is not allocated yet left visibly empty rather than filled in. */
.capbar { display: flex; height: 9px; background: var(--paper); border-radius: 4px; overflow: hidden; gap: 1px; }
.capbar > i { display: block; height: 100%; background: var(--cap, var(--accent)); min-width: 2px; }
.cap-row { display: grid; grid-template-columns: 9px 1fr auto; align-items: baseline; column-gap: 8px; }
.cap-row .dot { width: 9px; height: 9px; border-radius: 3px; background: var(--cap, var(--accent)); transform: translateY(1px); }
.cap-row.free .dot { background: transparent; border: 1px dashed var(--line-strong, var(--line)); }
.cap-row .who { font: 500 12px/1.35 var(--text); }
.cap-row .pct { font: 600 12px/1.35 var(--display); font-variant-numeric: tabular-nums; }
.cap-row .sub { grid-column: 2 / -1; font: 400 10.5px/1.3 var(--text); color: var(--muted); }
button.cap-row { width: 100%; background: none; border: 0; padding: 3px 4px; margin: 0 -4px; border-radius: 6px; cursor: pointer; text-align: left; }
button.cap-row:hover { background: var(--doc-lane); }

.split-bar { display: flex; height: 9px; border-radius: 3px; overflow: hidden; }
.split-bar > i { display: block; height: 100%; }

/* -------------------------------- tables --------------------------------- */

.table { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
/* The column gap is not decoration: a right-aligned column followed by a
   left-aligned one (Δ 30d then the date) would otherwise touch. */
.table-head, .table-row { display: grid; align-items: center; column-gap: 14px; row-gap: 0; padding: 11px 16px; }
.table-head { background: var(--doc-lane); border-bottom: 1px solid var(--line); }
.table-head span {
  font: 600 9.5px/1 var(--display); letter-spacing: .18em; text-transform: uppercase; color: var(--muted);
}
.table-row { border-bottom: 1px solid var(--line-soft); font: 400 12.5px/1.35 var(--text); }
a.table-row:hover, button.table-row:hover { background: #FAFBFC; }
.table-row:last-child { border-bottom: 0; }
.table-row.total { background: var(--doc-lane); border-top: 1px solid var(--line); border-bottom: 0; }
.table-row.total .bold-cell { font-weight: 700; }
/* A booking that has been asked for but not confirmed. */
.table-row.row-pending { background: var(--warn-bg); }
/* The category heading inside the spending plan. */
.table-row.plan-group { background: var(--doc-lane); font-size: 11.5px; }

/* Granted / planned / spent, side by side above the plan. */
.budget-figures {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px;
  padding-top: 4px;
}
.budget-figures .k {
  font: 600 9px/1 var(--display); letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted);
}
.budget-figures .v { font: 700 19px/1.1 var(--display); letter-spacing: -.01em; margin: 7px 0 4px; }
.budget-figures .v.warn { color: var(--warn-ink); }
@media (max-width: 900px) { .budget-figures { grid-template-columns: repeat(2, 1fr); } }
.table-row.input-row { background: var(--doc-lane); border-bottom: 1px solid var(--line); }
.table-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-top: 1px solid var(--line-soft);
}
.right { text-align: right; justify-self: end; }
.table-toolbar {
  display: flex; align-items: center; gap: 9px; padding: 13px 16px;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.pager { display: flex; gap: 6px; align-items: center; }
.pager button {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 6px; padding: 6px 10px; font: 500 11.5px/1 var(--text); cursor: pointer;
}
.pager button.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.pager button[disabled] { opacity: .4; cursor: default; }

.avatar-cell { display: flex; align-items: center; gap: 9px; }
.avatar-sm {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; font: 600 10px/1 var(--text);
}

/* ------------------------------ project card ----------------------------- */

.grid-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pcard {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--stage, var(--s0));
  border-radius: var(--r-card); padding: 15px 16px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column;
  text-align: left; width: 100%; cursor: pointer;
  transition: border-color .12s ease;
}
.pcard:hover { border-color: var(--glyph); }
.pcard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pcard-sub { font: 400 11.5px/1.3 var(--text); color: var(--muted); margin-top: 4px; }
.pcard-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line);
}
.pcard-stats .k { font: 600 9px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.pcard-stats .v { font: 600 14px/1 var(--text); margin-top: 5px; }
.pcard-note {
  display: flex; align-items: center; gap: 7px; margin-top: 12px;
  background: var(--doc-lane); border-radius: var(--r-chip); padding: 8px 10px;
  font: 500 11.5px/1.3 var(--text);
}
.pcard-note.alert { background: var(--kill-bg); color: var(--kill-ink); }
/* Admin row under a card: a project can be removed, not only archived. */
.pcard-slot { display: flex; flex-direction: column; }
.pcard-slot > .pcard { flex: 1; }
.pcard-admin { display: flex; justify-content: flex-end; gap: 10px; padding: 6px 4px 0; }
.pcard-admin button {
  border: 0; background: none; cursor: pointer; color: var(--muted);
  font: 500 11px/1 var(--text); padding: 2px 0;
}
.pcard-admin button:hover { color: var(--kill); text-decoration: underline; }
.pcard-admin button[data-edit-project]:hover { color: var(--ink); }
/* The link to the prototype or the running app. */
.app-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: var(--r-chip);
  padding: 3px 8px; background: var(--surface);
  font: 500 10.5px/1.5 var(--text); color: var(--muted);
}
.app-chip:hover { color: var(--ink); border-color: var(--muted); }
.app-chip .mark { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; }
.dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--muted); }
.dot-lg { width: 10px; height: 10px; }

/* -------------------------------- stepper -------------------------------- */

.stepper { display: flex; align-items: flex-start; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 9px; }
.step-rail { display: flex; align-items: center; width: 100%; }
.step-rail .line { flex: 1; height: 2px; background: var(--line); }
.step-rail .line.filled { background: var(--stage, var(--line)); }
.step-rail .line.blank { background: transparent; }
.step-node {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font: 700 12px/1 var(--display); color: #fff; background: var(--stage, var(--s0));
  border: 0; padding: 0; cursor: pointer;
}
.step-node.upcoming { background: var(--surface); border: 2px solid var(--line); color: var(--faint); }
.step-node.current {
  width: 38px; height: 38px; font-size: 15px; margin: -6px 0;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--stage) 18%, transparent);
}
.step-label { text-align: center; }
.step-label .name { font: 600 12px/1.2 var(--display); }
.step-label .sub { font: 400 11px/1.3 var(--text); color: var(--muted); margin-top: 3px; }
.step-label .when { font: 400 10.5px/1 var(--text); color: var(--faint); margin-top: 4px; }
.step.is-current .step-label .name { font-weight: 700; font-size: 12.5px; color: var(--stage); }
.step.is-current .step-label .sub { font-weight: 500; color: var(--ink); }
.step.is-upcoming .step-label .name,
.step.is-upcoming .step-label .sub { color: var(--faint); }
/*
 * The stepper carries two facts that were competing for one signal: which
 * stage the venture *is in* (the big filled node) and which stage you are
 * *looking at* (was a hairline underline, easy to miss entirely). The one you
 * are reading now gets a panel of its own and a bar in the stage colour, so
 * the two never have to be told apart by weight of type.
 */
.step.is-selected .step-label {
  background: var(--doc-lane); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 11px 6px; box-shadow: inset 0 -3px 0 var(--stage);
}
.step.is-selected .step-label .name { font-weight: 700; color: var(--ink); }
.step.is-selected.is-upcoming .step-label .name,
.step.is-selected.is-upcoming .step-label .sub { color: var(--ink); }
.step.is-selected .step-node { box-shadow: 0 0 0 3px color-mix(in srgb, var(--stage) 30%, transparent); }
.step.is-selected.is-current .step-node {
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--stage) 18%, transparent);
}
/* Said in words when the two differ, because that is the moment somebody
   wonders why the checkboxes have stopped responding. */
/* --ink, not --stage: the ramp is a fill, never small text on a light ground
   (#8AA82E reaches 2.5:1 there). The bar under the panel carries the colour. */
.step-viewing {
  display: block; margin-top: 5px;
  font: 600 8.5px/1 var(--display); letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink);
}

/* ------------------------------ stage panel ------------------------------ */

.stage-layout { display: flex; gap: 14px; align-items: flex-start; }
.stage-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.stage-rail { flex: none; width: 396px; display: flex; flex-direction: column; gap: 12px; }

.lane-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 10px; }
.lane-title { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.tasklist { display: flex; flex-direction: column; gap: 7px; }
.taskrow { display: flex; gap: 8px; align-items: flex-start; }
.taskrow .tick { margin-top: 2px; }

.taskrow .text { font: 400 12.5px/1.35 var(--text); }
.taskrow .meta { font: 400 10.5px/1.35 var(--text); color: var(--faint); }
.taskrow .item-tools { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.taskrow .item-tools .linkbtn { font-size: 10.5px; }

/* Handed in, not yet released: visible everywhere a document is listed. */
.chip-pending {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--warn-bg); color: var(--warn-ink);
  border-radius: var(--r-chip); padding: 2px 7px;
  font: 600 10px/1.5 var(--text); white-space: nowrap;
}
.review-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  flex: 0 0 100%; width: 100%;
  margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line);
}
.review-row .who { font: 400 10.5px/1.3 var(--text); color: var(--muted); flex: 1; min-width: 120px; }
.filedrop {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px dashed var(--line); border-radius: var(--r-chip);
  padding: 10px 12px; background: var(--doc-lane);
}
.filedrop .picked { font: 500 11.5px/1.3 var(--text); }

.doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.doc-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-chip); padding: 8px 10px;
}
.doc-row .name { font: 400 12px/1.3 var(--text); flex: 1; min-width: 0; }
.doc-row .src { font: 400 10.5px/1 var(--text); color: var(--faint); }
.doc-row.missing { background: var(--kill-bg); border-color: var(--kill-line); }
.doc-row.missing .name { font-weight: 500; color: var(--kill-ink); }
.doc-row.missing .src { font: 600 10px/1 var(--text); color: var(--kill); }

.toolset { display: flex; gap: 7px; flex-wrap: wrap; }
.tool {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 7px 11px;
  font: 400 12px/1 var(--text); cursor: default;
}
.tool .tick { width: 12px; height: 12px; border-radius: 3px; font-size: 8.5px; }

/* -------------------------------- gate card ------------------------------ */

.gate-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 13px; }
/* Wraps, so the names of what is open sit on their own line under the
   criterion rather than squeezing the label. */
.gate-item { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.gate-item .label { font: 400 12.5px/1.3 var(--text); flex: 1; min-width: 0; }
.gate-item .gate-open {
  flex-basis: 100%; padding-left: 26px; margin-top: 2px;
  font: 400 11px/1.4 var(--text); color: var(--kill-soft);
}
.gate-item .evidence { font: 500 11px/1 var(--text); color: var(--on-dark-dim); }
.gate-item.blocked {
  background: rgba(178, 51, 37, .22); border-radius: var(--r-chip); padding: 8px 9px;
}
.gate-item.blocked .label { color: var(--kill-pale); font-weight: 500; }
.gate-item.blocked .tick { border-color: var(--kill-soft); }
.stop-row {
  border-top: 1px solid var(--on-dark-line); margin-top: 14px; padding-top: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.btn-stop-ghost {
  font: 600 11.5px/1 var(--text); color: var(--kill-soft);
  border: 1px solid rgba(226, 139, 127, .45); border-radius: var(--r-chip);
  padding: 7px 10px; background: none; cursor: pointer;
}
.btn-stop-ghost:hover { background: rgba(178, 51, 37, .2); }

.timeline { display: flex; flex-direction: column; gap: 9px; }
.timeline-row { display: flex; gap: 9px; }
.timeline-row .bullet { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; flex: none; background: var(--stage, var(--s0)); }
.timeline-row .title { font: 500 12px/1.3 var(--text); }
.timeline-row .meta { font: 400 11px/1.3 var(--text); color: var(--muted); }

/* --------------------------------- modal --------------------------------- */

.modal-scrim {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(22, 28, 36, .42);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 56px 16px 24px; overflow-y: auto;
  backdrop-filter: blur(1.5px);
}
.modal {
  width: 780px; max-width: 100%;
  background: var(--surface); border-radius: var(--r-panel);
  box-shadow: var(--shadow-modal); overflow: hidden;
}
.modal-sm { width: 460px; }
.modal-md { width: 600px; }
.modal-head {
  padding: 20px 24px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.modal-body { padding: 18px 24px 22px; }
.modal-split { display: flex; align-items: stretch; }
.modal-split > .main { flex: 1; padding: 18px 24px 22px; border-right: 1px solid var(--line); min-width: 0; }
.modal-split > .side { flex: none; width: 288px; padding: 18px 20px 22px; background: var(--doc-lane); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px 20px; }
.iconbtn {
  background: none; border: 0; cursor: pointer; color: var(--muted);
  font: 400 18px/1 var(--text); padding: 2px 6px; border-radius: 6px;
}
.iconbtn:hover { color: var(--ink); background: var(--paper); }

.criteria { display: flex; flex-direction: column; gap: 8px; }
.criterion {
  display: flex; align-items: flex-start; gap: 9px;
  border: 1px solid var(--line); border-radius: var(--r-input); padding: 10px 11px;
}
.criterion .label { font: 500 12.5px/1.3 var(--text); flex: 1; }
.criterion .evidence { font: 400 11px/1.3 var(--text); color: var(--muted); }
.criterion.blocked { background: var(--kill-bg); border-color: var(--kill-line); }
.criterion.blocked .label { color: var(--kill-ink); font-weight: 600; }
.criterion.blocked .evidence { color: var(--kill-ink); }
.criterion button.tick { cursor: pointer; }

.happens { display: flex; flex-direction: column; gap: 7px; font: 400 11.5px/1.45 var(--text); }
.happens .row { display: flex; gap: 7px; }
.happens .row .mark { color: var(--ok); font-weight: 700; }

/* --------------------------------- login --------------------------------- */

.login {
  min-height: 100vh; display: flex; align-items: stretch;
  background: var(--paper);
}
.login-brandside {
  flex: 1; background: var(--ink); color: #fff;
  padding: 44px 44px 38px; display: flex; flex-direction: column; justify-content: space-between;
  min-width: 0;
}
.login-brandside .claim {
  font: 700 32px/1.15 var(--display); letter-spacing: -.02em; margin-top: 38px; max-width: 400px;
}
.login-brandside .sub { font: 400 13px/1.6 var(--text); color: rgba(255, 255, 255, .62); margin-top: 14px; max-width: 390px; }
.login-ramp { display: flex; gap: 5px; align-items: flex-end; margin-top: 40px; }
.login-ramp .col { flex: 1; }
.login-ramp .bar { border-radius: 3px; }
.login-ramp .cap { font: 600 9px/1 var(--display); letter-spacing: .14em; color: rgba(255, 255, 255, .45); margin-top: 7px; }
.login-formside {
  flex: none; width: 620px; max-width: 100%;
  background: var(--surface); padding: 44px 56px;
  display: flex; flex-direction: column; justify-content: center;
}
.login-roles { display: flex; flex-direction: column; gap: 6px; }
.login-role {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: var(--r-chip); padding: 8px 10px;
}
.login-role .name { font: 600 12px/1 var(--text); width: 104px; flex: none; }
.login-role .desc { font: 400 11.5px/1.3 var(--text); color: var(--muted); }
.login-role .dot { width: 7px; height: 7px; }
.login-hint {
  border-top: 1px solid var(--line); margin-top: 30px; padding-top: 18px;
}
.login-demo {
  margin-top: 16px; background: var(--doc-lane); border: 1px solid var(--line);
  border-radius: var(--r-chip); padding: 10px 12px; font: 400 11.5px/1.5 var(--text); color: var(--muted);
}
.login-demo button { margin-right: 6px; margin-top: 6px; }

/* --------------------------------- charts -------------------------------- */

.barchart { display: flex; gap: 6px; align-items: flex-end; }
.barchart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; min-width: 0; }
.barchart .bar { border-radius: 3px 3px 0 0; background: var(--stage, var(--s0)); }
.barchart .cap { font: 500 10.5px/1.2 var(--text); color: var(--muted); }
.barchart .val { font: 600 11px/1 var(--text); color: var(--muted); text-align: center; }

.linechart { display: flex; gap: 10px; }
.linechart .yaxis {
  flex: none; width: 52px; display: flex; flex-direction: column; justify-content: space-between;
  padding: 2px 0 26px; font: 400 10.5px/1 var(--text); color: var(--faint); text-align: right;
}
.linechart .plot { flex: 1; min-width: 0; }
.linechart svg { width: 100%; display: block; }
.xaxis { display: flex; justify-content: space-between; margin-top: 8px; font: 400 10.5px/1 var(--text); color: var(--muted); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.legend span { display: flex; align-items: center; gap: 7px; font: 400 11.5px/1.3 var(--text); color: var(--muted); }
.legend .swatch-line { width: 16px; height: 2px; background: var(--ok); }
.legend .swatch-dash { width: 16px; height: 0; border-top: 2px dashed var(--ink); opacity: .55; }
.legend .swatch-dot { width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--ok); }

.rollup { display: flex; flex-direction: column; gap: 9px; }
.rollup .row { display: flex; justify-content: space-between; font: 400 12px/1.3 var(--text); margin-bottom: 4px; }

/* ------------------------------- info page ------------------------------- */

.info-layout { display: flex; align-items: stretch; min-height: calc(100vh - var(--topbar-h)); }
.info-side {
  flex: none; width: 250px; background: var(--surface);
  border-right: 1px solid var(--line); padding: 20px 18px;
}
.info-main { flex: 1; padding: 22px var(--page-pad) 40px; min-width: 0; }
.stage-nav { display: flex; flex-direction: column; gap: 3px; }
.stage-nav a {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px;
  border-radius: var(--r-chip); font: 400 12.5px/1 var(--text); color: var(--muted);
  border: 1px solid transparent;
}
.stage-nav a:hover { background: var(--doc-lane); color: var(--ink); }
.stage-nav a.on { background: var(--doc-lane); border-color: var(--line); color: var(--ink); font-weight: 600; }
.stage-nav .dot { width: 8px; height: 8px; }
.side-block { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 15px; }
.role-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.bullets { display: flex; flex-direction: column; gap: 6px; font: 400 12px/1.4 var(--text); }
.bullets .row { display: flex; gap: 7px; }
.bullets .row .mark { color: var(--accent); }

/* ------------------------------- doc screen ------------------------------ */

.docstage { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--stage, var(--line)); border-radius: var(--r-card); overflow: hidden; }
.docstage-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap;
}
.docstage-body { display: grid; grid-template-columns: 1fr 1fr; }
.docstage-body .cell {
  display: flex; align-items: center; gap: 9px; padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft); min-width: 0;
}
.docstage-body .cell:nth-child(odd) { border-right: 1px solid var(--line-soft); }
.docstage-body .cell .name { font: 400 12.5px/1.3 var(--text); flex: 1; min-width: 0; }
.docstage-body .cell.missing { background: var(--kill-bg); }
.docstage-body .cell.missing .name { font-weight: 500; color: var(--kill-ink); }
.docstage.upcoming { border-left-color: var(--line); }
.docstage.upcoming .docstage-head { border-bottom: 0; }
.docstage.upcoming .h4 { color: var(--faint); }

/* ------------------------------ misc blocks ------------------------------ */

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; align-items: flex-start; }
.row-center { align-items: center; }
.row-tight { gap: 8px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mt-0 { margin-top: 0; }
.mt-6 { margin-top: 6px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 14px 0 12px; }

.notice {
  display: flex; align-items: center; gap: 10px;
  background: var(--kill-bg); border: 1px solid var(--kill-line);
  border-radius: 9px; padding: 11px 14px; margin-bottom: 16px;
  font: 400 12px/1.4 var(--text); color: var(--kill-ink); flex-wrap: wrap;
}
.notice strong { font-weight: 600; }
.notice .square { width: 9px; height: 9px; border-radius: 2px; background: var(--kill); flex: none; }
.notice-info { background: var(--doc-lane); border-color: var(--line); color: var(--muted); }
.notice-info .square { background: var(--accent); }

.locked-note {
  display: flex; align-items: center; gap: 9px;
  font: 600 12.5px/1 var(--text); color: var(--muted);
}
.locked-note + .body { font: 400 11.5px/1.5 var(--text); color: var(--muted); margin-top: 8px; padding-left: 24px; }

.empty {
  display: grid; place-items: center; gap: 10px; text-align: center;
  padding: 56px 20px; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--line-dash); border-radius: var(--r-card);
}
.empty .h3 { color: var(--ink); }

.skeleton {
  background: linear-gradient(90deg, var(--line-soft) 25%, #f4f7f9 37%, var(--line-soft) 63%);
  background-size: 400% 100%; animation: sheen 1.4s ease infinite; border-radius: var(--r-card);
}
@keyframes sheen { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  * { transition: none !important; }
}

.toast-root {
  position: fixed; right: 18px; bottom: 18px; z-index: 80;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.toast {
  background: var(--ink); color: #fff; border-radius: var(--r-input);
  padding: 11px 14px; font: 500 12.5px/1.4 var(--text); max-width: 380px;
  box-shadow: 0 18px 40px -18px rgba(20, 30, 45, .7);
}
.toast.error { background: var(--kill); }
.toast.ok { background: var(--ok-ink); }

.tabs { display: flex; gap: 22px; margin-top: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  position: relative; padding-bottom: 11px; white-space: nowrap;
  font: 400 12.5px/1 var(--text); color: var(--muted);
}
.tabs a:hover { color: var(--ink); }
.tabs a.on { font-weight: 600; color: var(--ink); }
.tabs a.on::after {
  content: ''; position: absolute; left: -3px; right: -3px; bottom: 0; height: 2px; background: var(--accent);
}
.subhead {
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 18px var(--page-pad) 0;
}
.subhead-inner { max-width: var(--page-max); margin: 0 auto; }
/* ------------------------- the project strip ----------------------------- */

.projhead-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.projhead-id { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; min-width: 0; }

/*
 * People on the left, figures on the right, divided by a rule. The two are
 * different kinds of fact - who is on this, and how it stands - and reading
 * them as one run of label-value pairs is what made the line wrap between a
 * word and its number.
 */
/*
 * People, then a rule, then the figures - one continuous line. Spread apart
 * (space-between) the two halves drifted to opposite edges of a 1440px bar
 * with a lake between them, and stopped reading as one statement about one
 * venture.
 */
.projhead-facts {
  display: flex; align-items: center; justify-content: flex-start;
  gap: 20px; flex-wrap: wrap; margin-top: 12px;
}
.peopleline { display: flex; gap: 18px; flex-wrap: wrap; min-width: 0; }
.peopleline .fact { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.peopleline .k { font: 400 12px/1.5 var(--text); color: var(--muted); }
.peopleline b { font: 500 12px/1.5 var(--text); color: var(--ink); }

.figurestrip {
  display: flex; gap: 24px; flex: none;
  border-left: 1px solid var(--line); padding-left: 20px;
}
.figurestrip .figure { display: flex; flex-direction: column; gap: 3px; }
.figurestrip .k {
  font: 600 9px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.figurestrip .v { font: 700 17px/1.1 var(--display); letter-spacing: -.01em; }
.figurestrip .v.neg { color: var(--kill); }

@media (max-width: 1080px) {
  /* Stacked, the rule would sit above the figures instead of beside them. */
  .figurestrip { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 12px; width: 100%; }
}
@media (max-width: 560px) {
  /* Four figures across 390px squeezes "Capital released" into two words per
     line; two by two keeps every label whole. */
  .figurestrip { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
}

.factline { display: flex; gap: 18px; margin-top: 11px; font: 400 12px/1.5 var(--text); color: var(--muted); flex-wrap: wrap; }
.factline b { color: var(--ink); font-weight: 500; }
.factline .fact { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }

/* ------------------------------- the funnel ------------------------------ */

/* Six stage columns; a venture sits in the one it is in, so the shape of the
   pipeline - and every gap in it - is the layout itself. */
.funnel { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; align-items: start; }
.funnel-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.funnel-head {
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px; overflow: hidden;
}
.funnel-head > i { display: block; height: 4px; }
.funnel-head-body { display: grid; grid-template-columns: 1fr auto; padding: 9px 12px; column-gap: 8px; }
.funnel-head .name { font: 700 13.5px/1.2 var(--display); }
.funnel-head .count { font: 700 13.5px/1.2 var(--display); }
.funnel-head .count.dim { color: var(--muted); }
.funnel-head .meta { grid-column: 1 / -1; font: 400 10.5px/1.3 var(--text); color: var(--muted); margin-top: 2px; }
.funnel-card {
  display: flex; flex-direction: column; gap: 9px;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--stage, var(--s0)); border-radius: 9px;
  padding: 12px 13px; color: inherit;
}
.funnel-card:hover { border-color: var(--glyph); border-left-color: var(--stage, var(--s0)); color: inherit; }
.funnel-card .name { font: 700 15px/1.2 var(--display); color: var(--link); }
/* Its own class rather than .row: the narrow layout stacks every .row, and
   "how long" and "how many tasks" belong on one line at any width. */
.funnel-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.funnel-card .meta { font: 400 11px/1.35 var(--text); color: var(--muted); }
.funnel-card .tasks { font: 700 12px/1 var(--display); }
.funnel-card .note { border-radius: 6px; padding: 8px 9px; font: 500 11px/1.35 var(--text); }
.funnel-card.tone-plain .note { background: var(--doc-lane); color: var(--body); }
.funnel-card.tone-warn .note { background: var(--warn-bg); color: var(--warn-ink); }
.funnel-card.tone-alert .note { background: var(--kill-bg); color: var(--kill); }
.funnel-empty {
  border: 1px dashed var(--line-dash); border-radius: 9px; padding: 16px 12px;
  text-align: center; font: 400 11.5px/1.4 var(--text); color: var(--muted);
}

.viewswitch { display: flex; border: 1px solid var(--line); border-radius: var(--r-chip); overflow: hidden; }
.viewswitch button {
  border: 0; background: var(--surface); cursor: pointer;
  padding: 6px 12px; font: 500 12px/1 var(--display); color: var(--body);
}
.viewswitch button.on { background: var(--ink); color: #fff; font-weight: 600; }

@media (max-width: 1180px) {
  .funnel { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .funnel { grid-template-columns: 1fr; }
}

.matrix { display: grid; grid-template-columns: 1fr repeat(5, 42px); }
.matrix .head {
  font: 600 9px/1 var(--display); letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); text-align: center; padding-bottom: 8px;
}
.matrix .rowlabel { font: 400 11.5px/1.3 var(--text); padding: 7px 0; border-top: 1px solid var(--line-soft); }
.matrix .cell { font: 500 10.5px/1 var(--text); text-align: center; padding: 7px 0; border-top: 1px solid var(--line-soft); color: var(--muted); }
.matrix .cell.edit { font-weight: 600; color: var(--ok-ink); }
.matrix .cell.none { color: var(--faint); }
.matrix .rowlabel.sensitive { font-weight: 600; color: var(--kill); }

.mobile-nav { display: none; }

/* ------------------------------- responsive ------------------------------ */

@media (max-width: 1280px) {
  .tiles-5 { grid-template-columns: repeat(3, 1fr); }
  .stage-rail { width: 340px; }
}

@media (max-width: 1080px) {
  .grid-cards { grid-template-columns: repeat(2, 1fr); }
  .tiles-4 { grid-template-columns: repeat(2, 1fr); }
  /*
   * Turning the row into a column leaves align-items:flex-start governing the
   * *cross* axis, which is now the width - both children shrank to their
   * content and left a gutter. Stretch is what "stacked" is supposed to mean.
   */
  .stage-layout { flex-direction: column; align-items: stretch; }
  .stage-main, .stage-rail { width: 100%; }
  .modal-split { flex-direction: column; }
  .modal-split > .main { border-right: 0; border-bottom: 1px solid var(--line); }
  .modal-split > .side { width: 100%; }
  .login-brandside { display: none; }
  .login-formside { width: 100%; padding: 32px 28px; }
}

@media (max-width: 860px) {
  .info-layout { flex-direction: column; }
  .info-side { width: 100%; border-right: 0; border-bottom: 1px solid var(--line); }
  .stage-nav { flex-direction: row; overflow-x: auto; }
  .role-cols { grid-template-columns: 1fr; }
  .doc-grid { grid-template-columns: 1fr; }
  .docstage-body { grid-template-columns: 1fr; }
  .docstage-body .cell:nth-child(odd) { border-right: 0; }
  .stepper { overflow-x: auto; padding-bottom: 6px; }
  .step { min-width: 118px; }
}

@media (max-width: 720px) {
  .tiles-5, .tiles-4, .tiles-3 { grid-template-columns: 1fr 1fr; }
  .grid-cards { grid-template-columns: 1fr; }
  .h1, .h2 { font-size: 20px; }
  .num, .num-lg { font-size: 24px; }
  .num-xl { font-size: 34px; }
  .page { padding-bottom: 84px; }

  /* The topbar collapses to brand + controls; navigation moves to the bottom,
     matching the phone layout drawn on screen 15. */
  .topnav { display: none; }
  .brand-kicker { display: none; }
  .mobile-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-around;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 9px 8px calc(9px + env(safe-area-inset-bottom));
  }
  .mobile-nav a {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    font: 500 10px/1 var(--text); color: var(--muted); min-width: 44px; min-height: 44px;
    justify-content: center;
  }
  .mobile-nav a .mark { width: 16px; height: 16px; border-radius: 4px; background: var(--line); }
  .mobile-nav a.on { color: var(--ink); font-weight: 600; }
  .mobile-nav a.on .mark { background: var(--ink); }

  .table-head { display: none; }
  .table-row {
    grid-template-columns: 1fr auto !important;
    column-gap: 10px; row-gap: 4px; padding: 12px 14px;
  }
  .table-row > .right { justify-self: end; }
  .table-row > .col-hide { display: none; }
  /* With the header row hidden, a cell that is only a figure says nothing.
     Cells that name themselves print the name in front of the value. */
  .table-row > [data-label]::before {
    content: attr(data-label) ' ';
    font: 600 9px/1 var(--display); letter-spacing: .14em; text-transform: uppercase;
    color: var(--muted); margin-right: 7px;
  }
  /* :not(.col-hide) - without it this rule's display would win over the
     hiding rule above, and every column would come back. */
  .table-row > [data-label]:not(.col-hide) {
    display: flex; align-items: baseline; justify-content: space-between;
  }

  /*
   * Same reason as .stage-layout above: a stacked row still had flex-start on
   * what is now the width.
   *
   * The children stretch - except the ones that are shaped, not sized: a
   * status dot, a stage badge, a chip. Stretching those turned an 8px dot
   * into a full-width green bar and the stage pill into a banner.
   */
  .row { flex-direction: column; align-items: stretch; }
  .row > * { width: 100%; }
  .row > .dot, .row > .badge, .row > .chip-tag, .row > .app-chip,
  .row > .pill, .row > .spacer, .row > .tick, .row > .rolechip {
    width: auto; align-self: flex-start;
  }
  .stage-rail, .search-wrap { width: 100%; }
  .modal-scrim { padding: 12px 10px 24px; }
  .factline { gap: 10px 14px; }
  .page-head { align-items: flex-start; }
  .actions { width: 100%; }
  .actions .btn { flex: 1; }
  .btn { min-height: 40px; }
}

@media print {
  .topbar, .mobile-nav, .actions, .filters, .toast-root { display: none !important; }
  body { background: #fff; }
  .card, .tile, .table { box-shadow: none; break-inside: avoid; }
  * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* --------------------------- viewport switches --------------------------- */

.only-mobile { display: none; }

@media (max-width: 720px) {
  .only-mobile { display: block; }
  .only-desktop { display: none; }
}
