/* Section 752 Workpapers
   A single column read from top to bottom. Depth carries meaning: raised slabs
   are steps to work through, recessed wells are where you type, and anything
   you can press has a visible edge that goes down when pressed. */

:root {
  --ink: #14213d;
  --ink-2: #364154;
  --muted: #5d6b82;
  --page: #e6ebf3;
  --surface: #ffffff;
  --well: #f4f6fa;
  --line: #dbe1ec;
  --line-strong: #b9c3d4;
  --edge: #c3ccdb;
  --accent: #1f5fbf;
  --accent-hi: #2f73d8;
  --accent-edge: #0d2a57;
  --accent-wash: #eaf1fc;
  --nr: #257de0;
  --qnf: #f47230;
  --rec: #00b894;
  --good: #0aac23;
  --good-ink: #006c10;
  --good-wash: #e7f6ea;
  --warning: #fbb315;
  --warning-ink: #6b4a00;
  --warning-wash: #fff5d9;
  --critical: #dc3c3d;
  --critical-ink: #9c1c1d;
  --critical-wash: #fdeaea;
  --radius: 16px;
  --slab-shadow: 0 1px 0 #fff inset, 0 7px 0 var(--edge), 0 22px 30px -16px rgba(20, 33, 61, .32), 0 2px 5px rgba(20, 33, 61, .07);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: linear-gradient(180deg, #eef2f8 0, var(--page) 420px) fixed, var(--page);
}
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.25; text-wrap: balance; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: var(--accent); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; background: var(--well); padding: .1em .35em; border-radius: 5px; }
.muted { color: var(--muted); font-weight: 400; }
.fine { font-size: .84rem; color: var(--muted); }
.opt { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--well); border: 1px solid var(--line); border-radius: 99px; padding: .05rem .45rem; vertical-align: middle; white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.strong { font-weight: 700; }
:focus-visible { outline: 3px solid rgba(31, 95, 191, .45); outline-offset: 2px; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1.25rem;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 0 rgba(195, 204, 219, .55), 0 10px 18px -12px rgba(20, 33, 61, .35);
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); font-weight: 700; }
.brand-mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(var(--accent-hi), var(--accent)); color: #fff; font-weight: 800; font-size: .95rem;
  box-shadow: 0 3px 0 var(--accent-edge), 0 1px 0 rgba(255, 255, 255, .35) inset;
}
.brand-mark.big { width: 52px; height: 52px; font-size: 1.6rem; border-radius: 13px; box-shadow: 0 5px 0 var(--accent-edge), 0 1px 0 rgba(255, 255, 255, .35) inset; }
.topbar-mid { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: .75rem; }
.topbar-mid strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.save-state { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.save-state.error { color: var(--critical-ink); font-weight: 600; }
.topbar-nav { display: flex; align-items: center; gap: .5rem; }
.topbar-nav form { margin: 0; }

/* ---------------------------------------------------------------- page and slabs */
.page { max-width: 1120px; margin: 0 auto; padding: 2rem 1.25rem 5rem; }
.page.narrow { max-width: 760px; }
.slab {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--slab-shadow);
  padding: 1.6rem 1.75rem 1.75rem;
  margin-bottom: 2.6rem;
}
/* the spine that joins one step to the next */
.step::before {
  content: ""; position: absolute; left: 48px; top: calc(-2.6rem - 1px); width: 8px; height: calc(2.6rem - 6px);
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, #aab5c8, #d4dbe7 45%, #b3bdcf);
  box-shadow: 0 2px 3px rgba(20, 33, 61, .18);
}
.lead { color: var(--ink-2); margin-top: .25rem; }
.eyebrow { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }

/* ---------------------------------------------------------------- hero */
.hero { padding: 2rem 2rem 1.6rem; background: linear-gradient(180deg, #fff 0, #f8fafd 100%); }
.hero h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); margin: .4rem 0 .7rem; letter-spacing: -.01em; }
.hero-text { max-width: 66ch; color: var(--ink-2); font-size: 1.04rem; }
.flow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.2rem; margin: 1.9rem 0 1.4rem; align-items: end; }
.flow-block {
  position: relative; display: flex; flex-direction: column; gap: .25rem;
  padding: 1rem 1.1rem 1.1rem; border-radius: 13px; background: #fff; border: 1px solid var(--line-strong);
  font-size: .93rem; color: var(--ink-2);
}
.flow-block strong { color: var(--ink); font-size: 1.05rem; }
/* a rising staircase: each block stands on a thicker base than the one before */
.flow-block:nth-child(1) { box-shadow: 0 6px 0 var(--edge), 0 16px 20px -12px rgba(20, 33, 61, .3); }
.flow-block:nth-child(2) { box-shadow: 0 12px 0 var(--edge), 0 22px 22px -12px rgba(20, 33, 61, .3); margin-bottom: 6px; }
.flow-block:nth-child(3) { box-shadow: 0 18px 0 #9fb6d9, 0 28px 24px -12px rgba(20, 33, 61, .34); margin-bottom: 12px; border-color: #8fb0e2; background: var(--accent-wash); }
.flow-block + .flow-block::before {
  content: ""; position: absolute; left: -1.75rem; top: 50%; width: 0; height: 0;
  border: 9px solid transparent; border-left: 13px solid var(--line-strong); transform: translateY(-50%);
}
.flow-n {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; margin-bottom: .2rem;
  background: var(--ink); color: #fff; font-weight: 700; font-size: .82rem; box-shadow: 0 2px 0 #000;
}
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .15rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 600; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: 99px; padding: .15rem .55rem; }
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; flex: none; }
.sw-nr { background: var(--nr); } .sw-qnf { background: var(--qnf); } .sw-rec { background: var(--rec); }
.hero-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; padding-top: 1.1rem; border-top: 1px dashed var(--line-strong); }
.hero-foot > div { margin-right: auto; }
.hero-foot p { font-weight: 600; }
.hero-foot .muted { font-size: .9rem; }

/* ---------------------------------------------------------------- steps */
.step-head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.25rem; }
.step-head h2 { font-size: 1.35rem; letter-spacing: -.005em; }
.coin {
  flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, #5b97ee 0, var(--accent) 58%, #174c9c 100%);
  color: #fff; font-weight: 800; font-size: 1.2rem; text-shadow: 0 1px 0 rgba(0, 0, 0, .3);
  box-shadow: 0 5px 0 var(--accent-edge), 0 10px 12px -4px rgba(13, 42, 87, .5), 0 1px 0 rgba(255, 255, 255, .45) inset;
  margin-top: -2px;
}
.sub-h { font-size: 1rem; margin: 1.5rem 0 .6rem; }
.sub-h .muted { font-size: .86rem; margin-left: .35rem; }
.notes { display: grid; gap: .5rem; margin-top: 1.1rem; }
.note { font-size: .9rem; color: var(--ink-2); padding: .55rem .8rem; border-radius: 10px; background: var(--well); border-left: 4px solid var(--line-strong); margin-top: .6rem; }
.notes .note { margin-top: 0; }
.note.why { border-left-color: var(--accent); background: var(--accent-wash); }
.note.where { border-left-color: var(--rec); }
.note.privacy { border-left-color: var(--warning); background: var(--warning-wash); }
.term { border-bottom: 2px dotted var(--accent); cursor: help; font-weight: 600; }

/* ---------------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  font: inherit; font-weight: 650; font-size: .95rem; line-height: 1.2; text-decoration: none; cursor: pointer;
  color: var(--ink); background: linear-gradient(#fff, #eef2f7);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: .62rem 1.05rem;
  box-shadow: 0 4px 0 var(--edge), 0 8px 12px -6px rgba(20, 33, 61, .35);
  transition: transform .07s ease, box-shadow .07s ease, background .12s;
}
.btn:hover { background: #fff; }
.btn:active, .btn.is-busy { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge), 0 2px 5px -2px rgba(20, 33, 61, .35); }
.btn[disabled] { cursor: not-allowed; opacity: .55; transform: none; }
.btn-primary { color: #fff; background: linear-gradient(var(--accent-hi), var(--accent)); border-color: #164a96; box-shadow: 0 4px 0 var(--accent-edge), 0 12px 16px -8px rgba(31, 95, 191, .7); }
.btn-primary:hover { background: linear-gradient(#3a7ee3, #2466c9); }
.btn-primary:active, .btn-primary.is-busy { box-shadow: 0 1px 0 var(--accent-edge), 0 3px 6px -2px rgba(31, 95, 191, .6); }
.btn-ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--well); border-color: var(--line); }
.btn-ghost:active { transform: none; box-shadow: none; }
.btn-sm { font-size: .85rem; padding: .4rem .7rem; border-radius: 8px; box-shadow: 0 3px 0 var(--edge), 0 5px 8px -5px rgba(20, 33, 61, .3); }
.btn-ghost.btn-sm { box-shadow: none; }
.btn-lg { font-size: 1.02rem; padding: .8rem 1.3rem; }
.btn-xl { font-size: 1.12rem; padding: 1rem 1.7rem; border-radius: 13px; box-shadow: 0 6px 0 var(--accent-edge), 0 18px 22px -10px rgba(31, 95, 191, .75); }
.btn-xl:active, .btn-xl.is-busy { transform: translateY(5px); }
.danger { color: var(--critical-ink); }
.icon-btn { width: 30px; height: 30px; padding: 0; border-radius: 8px; font-size: 1.05rem; color: var(--muted); background: transparent; border: 1px solid transparent; cursor: pointer; }
.icon-btn:hover { background: var(--critical-wash); color: var(--critical-ink); border-color: #f3c2c2; }

.field { display: flex; flex-direction: column; gap: .3rem; font-size: .86rem; font-weight: 650; color: var(--ink-2); min-width: 0; }
.field > span { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.field > .seg { align-self: flex-start; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .82rem; }
.input {
  font: inherit; font-weight: 400; color: var(--ink); width: 100%; min-width: 0;
  background: #fbfcfe; border: 1px solid var(--line-strong); border-radius: 9px; padding: .52rem .7rem;
  box-shadow: inset 0 2px 3px rgba(20, 33, 61, .11);
}
.input:focus { outline: 3px solid rgba(31, 95, 191, .3); outline-offset: 0; border-color: var(--accent); background: #fff; }
.input::placeholder { color: #98a3b6; }
textarea.input { resize: vertical; min-height: 4.2rem; }
select.input { appearance: auto; padding-right: .3rem; }
.input.num { text-align: right; font-variant-numeric: tabular-nums; }
.money { position: relative; display: block; }
.money::before { content: "$"; position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.money .input { padding-left: 1.35rem; }
.pct { position: relative; display: block; }
.pct::after { content: "%"; position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.pct .input { padding-right: 1.5rem; }

.grid { display: grid; gap: .9rem 1rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.stack { display: grid; gap: .9rem; }

/* yes / no: a recessed track with one raised key */
.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 10px; background: #dfe5ee; box-shadow: inset 0 2px 3px rgba(20, 33, 61, .2); flex-wrap: wrap; }
.seg button {
  font: inherit; font-size: .88rem; font-weight: 650; color: var(--ink-2); cursor: pointer;
  border: 1px solid transparent; border-radius: 8px; background: transparent; padding: .34rem .85rem; min-width: 3.4rem;
}
.seg button:hover { background: rgba(255, 255, 255, .6); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); border-color: var(--line-strong); box-shadow: 0 3px 0 var(--edge), 0 4px 6px -3px rgba(20, 33, 61, .35); transform: translateY(-2px); }
.seg.yes-no button[aria-pressed="true"][data-v="true"] { background: var(--accent); color: #fff; border-color: #164a96; box-shadow: 0 3px 0 var(--accent-edge); }
.seg.yes-no button[aria-pressed="true"][data-v="false"] { background: var(--ink); color: #fff; border-color: #000; box-shadow: 0 3px 0 #000; }

/* ---------------------------------------------------------------- Step 1 tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; padding-bottom: 10px; }
.tile { display: block; cursor: pointer; position: relative; }
.tile input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tile-face {
  display: flex; flex-direction: column; gap: .45rem; height: 100%;
  padding: 1.15rem 1.25rem 1.3rem; border-radius: 14px; background: linear-gradient(#fff, #f6f8fc);
  border: 1px solid var(--line-strong);
  box-shadow: 0 10px 0 var(--edge), 0 22px 22px -12px rgba(20, 33, 61, .35);
  transition: transform .09s ease, box-shadow .09s ease, border-color .12s;
}
.tile:hover .tile-face { transform: translateY(-2px); box-shadow: 0 12px 0 var(--edge), 0 26px 24px -12px rgba(20, 33, 61, .38); }
.tile input:focus-visible + .tile-face { outline: 3px solid rgba(31, 95, 191, .45); outline-offset: 3px; }
.tile input:checked + .tile-face {
  transform: translateY(7px); border-color: var(--accent); background: linear-gradient(#f3f8ff, var(--accent-wash));
  box-shadow: 0 3px 0 var(--accent-edge), 0 8px 12px -8px rgba(31, 95, 191, .7), 0 0 0 2px var(--accent) inset;
}
.tile input:checked + .tile-face::after {
  content: "✓ Selected"; position: absolute; top: .9rem; right: 1rem; font-size: .76rem; font-weight: 700;
  color: #fff; background: var(--accent); border-radius: 99px; padding: .12rem .6rem;
}
.tile-kicker { font-size: .78rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }
.tile-title { font-size: 1.08rem; line-height: 1.3; padding-right: 5.5rem; }
.tile ul { display: grid; gap: .28rem; margin-top: .35rem; font-size: .92rem; color: var(--ink-2); }
.tile li { padding-left: 1.15rem; position: relative; }
.tile li::before { content: ""; position: absolute; left: .15rem; top: .55em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.tile-note { margin-top: auto; padding-top: .6rem; font-size: .82rem; color: var(--warning-ink); }

/* ---------------------------------------------------------------- tables for typing */
.table-wrap { overflow-x: auto; margin-top: 1.1rem; border-radius: 12px; }
.in-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 640px; }
.in-table th { text-align: left; font-size: .8rem; font-weight: 700; color: var(--ink-2); padding: .4rem .45rem; border-bottom: 2px solid var(--line-strong); white-space: nowrap; }
.in-table th.num { text-align: right; }
.in-table td { padding: .32rem .3rem; vertical-align: middle; }
.in-table td:first-child, .in-table th:first-child { padding-left: 0; }
.in-table tfoot td { padding-top: .7rem; font-weight: 700; font-size: .88rem; }
.in-table .name-cell { font-weight: 650; white-space: nowrap; padding-right: .8rem; }
.check-ok { color: var(--good-ink); } .check-bad { color: var(--critical-ink); }
.w-pct { width: 7.2rem; } .w-money { width: 11rem; } .w-type { width: 11.5rem; } .w-x { width: 2.4rem; }
.row-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }
.total-line { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- Step 3 documents */
.checklist { display: grid; grid-template-columns: 1.15fr 1fr; gap: .4rem 2rem; }
.checklist ol { counter-reset: doc; display: grid; gap: .45rem; }
.checklist ul { display: grid; gap: .45rem; align-content: start; }
.checklist li { position: relative; padding-left: 2rem; font-size: .93rem; }
.checklist li span { display: block; font-size: .82rem; color: var(--muted); }
.checklist ol li::before {
  counter-increment: doc; content: counter(doc); position: absolute; left: 0; top: .1rem; width: 1.4rem; height: 1.4rem;
  display: grid; place-items: center; border-radius: 6px; font-size: .76rem; font-weight: 800; color: #fff; background: var(--ink); box-shadow: 0 2px 0 #000;
}
.checklist ul li::before { content: "+"; position: absolute; left: 0; top: .1rem; width: 1.4rem; height: 1.4rem; display: grid; place-items: center; border-radius: 6px; font-weight: 800; color: var(--ink-2); background: var(--well); border: 1px solid var(--line-strong); }
.upload { margin-top: 1.3rem; }
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: .15rem; cursor: pointer; text-align: center;
  padding: 1.25rem 1rem; border-radius: 13px; background: var(--well); border: 2px dashed var(--line-strong);
  box-shadow: inset 0 3px 6px rgba(20, 33, 61, .1);
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-wash); }
.dropzone input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.dropzone:focus-within { outline: 3px solid rgba(31, 95, 191, .45); outline-offset: 2px; }
.dz-main { font-weight: 700; } .dz-sub { font-size: .84rem; color: var(--muted); }
.doc-list { display: grid; gap: .45rem; margin-top: .8rem; }
.doc-list li { display: flex; align-items: center; gap: .7rem; padding: .45rem .5rem .45rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 3px 0 var(--edge); font-size: .92rem; }
.doc-list .doc-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-list .doc-meta { color: var(--muted); font-size: .82rem; margin-left: auto; white-space: nowrap; }
.read-box { margin-top: 1.2rem; }
.progress { margin-left: .8rem; font-size: .9rem; color: var(--ink-2); font-weight: 600; }
.proposal { margin-top: 1.2rem; padding: 1.1rem 1.2rem; border: 1px solid #8fb0e2; border-radius: 13px; background: var(--accent-wash); box-shadow: 0 5px 0 #9fb6d9; }
.proposal h3 { font-size: 1.1rem; margin-bottom: .35rem; }
.proposal h4 { font-size: .92rem; margin: .95rem 0 .3rem; }
.found { display: grid; gap: .3rem; font-size: .9rem; }
.found li { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: .45rem .7rem; }
.found.open li { border-left: 4px solid var(--warning); }
.src { display: block; font-size: .8rem; color: var(--muted); margin-top: .15rem; }
.proposal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; margin-top: 1rem; }
.count { display: inline-block; min-width: 1.4rem; text-align: center; font-size: .76rem; font-weight: 700; background: var(--ink); color: #fff; border-radius: 99px; padding: .02rem .4rem; vertical-align: middle; }

/* ---------------------------------------------------------------- Step 4 debts */
.debt-list { display: grid; gap: 1.3rem; margin-top: 1.1rem; }
.debt-card { border: 1px solid var(--line-strong); border-radius: 13px; background: linear-gradient(#fff, #fafbfd); box-shadow: 0 6px 0 var(--edge), 0 14px 16px -12px rgba(20, 33, 61, .3); padding: 1rem 1.1rem 1.15rem; }
.debt-card > header { display: flex; align-items: center; gap: .7rem; margin-bottom: .8rem; }
.debt-tag { font-size: .76rem; font-weight: 800; letter-spacing: .05em; color: #fff; background: var(--ink); border-radius: 6px; padding: .12rem .5rem; box-shadow: 0 2px 0 #000; }
.debt-card > header strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choice { display: grid; gap: .35rem; }
.choice-hint { font-size: .82rem; font-weight: 400; color: var(--muted); }
.empty { padding: 1.1rem; text-align: center; color: var(--muted); border: 2px dashed var(--line-strong); border-radius: 12px; background: var(--well); }

/* ---------------------------------------------------------------- Step 5 questions */
.question { border: 1px solid var(--line-strong); border-radius: 13px; padding: 1rem 1.1rem; margin-top: 1.1rem; background: #fff; box-shadow: 0 5px 0 var(--edge); }
.question > header { display: grid; grid-template-columns: auto 1fr auto; gap: .8rem; align-items: start; }
.question h3 { font-size: 1.02rem; font-weight: 650; }
.q-n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--ink); color: #fff; font-weight: 800; font-size: .9rem; box-shadow: 0 3px 0 #000; }
.q-help { font-size: .88rem; color: var(--muted); margin: .45rem 0 0 calc(28px + .8rem); }
.q-body { margin-top: .9rem; padding-top: .9rem; border-top: 1px dashed var(--line-strong); }
.q-body:empty { display: none; }
.question.unanswered { border-color: #e9c46a; box-shadow: 0 5px 0 #ecd9a4; }
.q-rows { display: grid; gap: .55rem; }
.q-row { display: grid; grid-template-columns: minmax(10rem, 1.1fr) 2fr; gap: .8rem; align-items: center; padding: .45rem .6rem; border-radius: 10px; background: var(--well); }
.q-row > strong { font-size: .92rem; overflow: hidden; text-overflow: ellipsis; }
.q-row .inline { display: flex; flex-wrap: wrap; gap: .5rem .9rem; align-items: flex-end; min-width: 0; }
.q-row .inline > .input { width: auto; flex: 2 1 13rem; min-width: 0; }
.q-row .inline > .money, .q-row .inline > .pct { flex: 1 1 8.5rem; }
.q-row .inline > label.field { flex: 1 1 12rem; }
.q-row .inline > div.field { flex: 0 0 auto; }
.ob-card { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .6rem .7rem; padding: .8rem; border-radius: 11px; background: var(--well); border: 1px solid var(--line); align-items: end; }
.ob-card .c3 { grid-column: span 3; } .ob-card .c4 { grid-column: span 4; } .ob-card .c5 { grid-column: span 5; }
.ob-card .c2 { grid-column: span 2; } .ob-card .c6 { grid-column: span 6; } .ob-card .c12 { grid-column: 1 / -1; }
.ob-card .ob-x { grid-column: span 1; justify-self: end; }
.ob-warn { grid-column: 1 / -1; font-size: .84rem; color: var(--warning-ink); background: var(--warning-wash); border-radius: 8px; padding: .35rem .6rem; }

details.options { margin-top: 1.4rem; border: 1px solid var(--line); border-radius: 12px; padding: .2rem .9rem; background: var(--well); }
details.options[open] { padding-bottom: 1rem; }
details > summary { cursor: pointer; font-weight: 650; padding: .6rem 0; }

/* ---------------------------------------------------------------- Step 7 */
.run-row { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; margin-top: 1.2rem; padding-bottom: 8px; }
.alert { padding: .7rem .9rem; border-radius: 11px; font-size: .92rem; border: 1px solid; margin-top: 1rem; }
.alert.critical { background: var(--critical-wash); border-color: #f0b4b4; color: var(--critical-ink); }
.alert.warning { background: var(--warning-wash); border-color: #f1d58a; color: var(--warning-ink); }
.alert.info { background: var(--accent-wash); border-color: #b9d1f5; color: #173f7c; }
.alert.good { background: var(--good-wash); border-color: #a9dcb2; color: var(--good-ink); }
.alert ul { list-style: disc; padding-left: 1.2rem; margin-top: .3rem; }
.alert.stale { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 0 0 1.4rem; position: sticky; top: 64px; z-index: 5; box-shadow: 0 5px 0 #ecd9a4; }

/* ---------------------------------------------------------------- output */
.results { margin-top: .5rem; }
.results.is-stale .slab.out, .results.is-stale .sheets { opacity: .55; }
/* a stack of workpapers: two sheets peeking out from under the top one */
.sheets { position: relative; margin: 1rem 0 3.2rem; }
.sheets::before, .sheets::after { content: ""; position: absolute; inset: 0; border-radius: 6px 22px 6px 6px; background: #fff; border: 1px solid var(--line-strong); }
.sheets::before { transform: translate(14px, 14px) rotate(.9deg); box-shadow: 0 16px 22px -12px rgba(20, 33, 61, .4); background: #f1f4f9; }
.sheets::after { transform: translate(7px, 7px) rotate(.4deg); background: #f8fafc; }
.sheet { position: relative; z-index: 1; background: #fff; border: 1px solid var(--line-strong); border-radius: 6px 22px 6px 6px; padding: 1.7rem 1.9rem 1.6rem; box-shadow: 0 2px 5px rgba(20, 33, 61, .08); }
.sheet::after { content: ""; position: absolute; top: -1px; right: -1px; width: 30px; height: 30px; border-radius: 0 22px 0 8px; background: linear-gradient(225deg, var(--page) 48%, #cbd4e2 50%, #fff 62%); border-left: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.sheet h2 { font-size: 1.6rem; margin: .3rem 0 .2rem; }
.sub { color: var(--ink-2); }
.badges { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 1.15rem; }
.badge { display: inline-flex; align-items: center; gap: .4rem; font-size: .84rem; font-weight: 650; border-radius: 99px; padding: .22rem .75rem .22rem .3rem; border: 1px solid; }
.badge b { display: inline-grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 50%; color: #fff; font-size: .78rem; }
.badge.good { background: var(--good-wash); border-color: #a9dcb2; color: var(--good-ink); } .badge.good b { background: var(--good-ink); }
.badge.critical { background: var(--critical-wash); border-color: #f0b4b4; color: var(--critical-ink); } .badge.critical b { background: var(--critical); }
.badge.warning { background: var(--warning-wash); border-color: #f1d58a; color: var(--warning-ink); } .badge.warning b { background: #b98300; }
.badge.neutral { background: var(--well); border-color: var(--line-strong); color: var(--ink-2); padding-left: .75rem; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: .8rem; padding-bottom: 6px; }

.slab.out h3 { font-size: 1.25rem; display: flex; align-items: center; gap: .7rem; }
.letter { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--ink); color: #fff; font-size: 1rem; font-weight: 800; box-shadow: 0 4px 0 #000; flex: none; }
.slab.out > .lead { margin: .45rem 0 0 calc(34px + .7rem); }

.k1-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(318px, 1fr)); gap: 1.4rem; margin-top: 1.3rem; }
.k1 { border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; box-shadow: 0 7px 0 var(--edge), 0 18px 18px -12px rgba(20, 33, 61, .32); overflow: hidden; display: flex; flex-direction: column; }
.k1 > header { display: flex; align-items: baseline; justify-content: space-between; gap: .8rem; padding: .7rem .9rem; background: var(--ink); color: #fff; }
.k1 h4 { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; }
.k1-total { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.k1-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.k1-table thead th { font-size: .7rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; padding: .5rem .75rem .3rem .3rem; text-align: right; vertical-align: bottom; }
.k1-table thead th:first-child { padding-left: .9rem; }
.k1-table thead th:first-child { text-align: left; }
.k1-table tbody th { text-align: left; font-weight: 600; padding: .42rem .3rem .42rem .9rem; line-height: 1.3; }
.k1-label { display: flex; gap: .45rem; align-items: baseline; }
.k1-label .sw { position: relative; top: 1px; }
.k1-table td { text-align: right; padding: .42rem .75rem .42rem .3rem; width: 1%; font-variant-numeric: tabular-nums; white-space: nowrap; }
.k1-table td:last-child { font-weight: 800; background: var(--accent-wash); }
.k1-table tbody tr + tr > * { border-top: 1px solid var(--line); }
.k1-boxes { display: grid; gap: .35rem; padding: .7rem .9rem; border-top: 1px solid var(--line); font-size: .84rem; color: var(--ink-2); }
.k1-boxes li { display: flex; gap: .55rem; align-items: flex-start; }
.box { flex: none; display: inline-grid; place-items: center; width: 1.15rem; height: 1.15rem; border: 2px solid var(--ink); border-radius: 3px; font-size: .8rem; font-weight: 800; line-height: 1; margin-top: .1rem; }
.k1-boxes li.on { color: var(--ink); font-weight: 600; } .k1-boxes li.on .box { background: var(--ink); color: #fff; }
.k1-change { margin-top: auto; padding: .6rem .9rem; font-size: .86rem; border-top: 1px solid var(--line); background: var(--well); }
.k1-change b { display: block; font-size: .98rem; }
.k1-change.up b { color: var(--good-ink); } .k1-change.down b { color: var(--critical-ink); }
.k1-change.down { background: var(--critical-wash); }

.chart { margin: 1.8rem 0 0; padding: 1rem 1.1rem .6rem; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: inset 0 2px 4px rgba(20, 33, 61, .07); }
.chart figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem 1.2rem; font-size: .93rem; margin-bottom: .4rem; }
.legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .84rem; color: #666; }
.legend-item { display: inline-flex; align-items: center; gap: .4rem; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: #e7e7e7; stroke-width: 1; } .chart .axis { stroke: #c2c2c2; stroke-width: 1; }
.chart .tick { font-size: 11px; fill: #666; } .chart .cat { font-size: 13px; fill: #191919; font-weight: 600; }
.chart .total { font-size: 13px; fill: #191919; font-weight: 700; font-variant-numeric: tabular-nums; }
.chart .seg-label { font-size: 11.5px; fill: #fff; font-weight: 700; pointer-events: none; }
.chart .seg { cursor: default; } .chart .seg:hover, .chart .seg:focus { opacity: .82; outline: none; }

.flag-group { display: flex; align-items: center; gap: .55rem; font-size: .98rem; margin: 1.3rem 0 .55rem; }
.flag-icon { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; color: #fff; font-weight: 800; font-size: .86rem; }
.flag-group.action .flag-icon { background: var(--critical); } .flag-group.review .flag-icon { background: #b98300; } .flag-group.info .flag-icon { background: var(--accent); }
.flags { display: grid; gap: .6rem; }
.flag { padding: .7rem .9rem; border-radius: 11px; border: 1px solid var(--line); border-left-width: 5px; background: #fff; font-size: .92rem; box-shadow: 0 3px 0 var(--edge); }
.flag.action { border-left-color: var(--critical); } .flag.review { border-left-color: var(--warning); } .flag.info { border-left-color: var(--accent); }
.flag p { color: var(--ink-2); margin-top: .15rem; }
.cite { display: inline-block; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.flag .cite { margin-top: .3rem; }

.debt-out { border: 1px solid var(--line-strong); border-radius: 13px; padding: 1rem 1.1rem; margin-top: 1.2rem; box-shadow: 0 5px 0 var(--edge); background: #fff; }
.debt-out.excluded { background: var(--well); }
.debt-out > header { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.debt-out h4 { font-size: 1.04rem; } .debt-bal { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 1.05rem; }
.split { width: 100%; height: 14px; display: block; margin-top: .75rem; border-radius: 4px; overflow: hidden; }
.split-key { display: flex; flex-wrap: wrap; gap: .25rem 1.1rem; font-size: .84rem; color: #666; margin-top: .4rem; }
.split-key span { display: inline-flex; align-items: center; gap: .4rem; }
.trail { counter-reset: t; display: grid; gap: .4rem; margin-top: .9rem; }
.trail li { counter-increment: t; position: relative; padding-left: 2rem; font-size: .92rem; }
.trail li::before { content: counter(t); position: absolute; left: 0; top: .05rem; width: 1.4rem; height: 1.4rem; display: grid; place-items: center; border-radius: 50%; font-size: .74rem; font-weight: 800; background: var(--accent-wash); color: var(--accent); border: 1px solid #b9d1f5; }
.out-table { width: 100%; border-collapse: collapse; font-size: .88rem; min-width: 560px; }
.out-table th, .out-table td { padding: .42rem .6rem; border-bottom: 1px solid var(--line); }
.out-table thead th { text-align: left; font-size: .76rem; color: var(--ink-2); background: var(--well); border-bottom: 2px solid var(--line-strong); vertical-align: bottom; }
.out-table thead th.num { text-align: right; white-space: nowrap; }
.out-table thead th.wrap { white-space: normal; min-width: 6.5rem; }
.out-table tbody th { text-align: left; font-weight: 600; white-space: nowrap; }
.out-table tfoot th, .out-table tfoot td { font-weight: 700; border-top: 2px solid var(--line-strong); border-bottom: 0; text-align: left; }
.out-table tfoot td.num { text-align: right; }
.out-table td.bad { color: var(--critical-ink); font-weight: 800; background: var(--critical-wash); }
.out-table td.warn { color: var(--warning-ink); font-weight: 800; background: var(--warning-wash); }
.out-table td.up { color: var(--good-ink); font-weight: 700; } .out-table td.down { color: var(--critical-ink); font-weight: 700; }

details.wp { border: 1px solid var(--line); border-radius: 12px; margin-top: .9rem; padding: 0 .9rem; background: #fff; box-shadow: 0 3px 0 var(--edge); }
details.wp[open] { padding-bottom: .9rem; }
details.wp h5 { font-size: .95rem; margin: .9rem 0 .4rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
details.wp .fine { margin-top: .6rem; }
.tests { display: grid; gap: .35rem; font-size: .9rem; }
.tests li { display: flex; gap: .6rem; align-items: flex-start; }
.mark { flex: none; display: inline-grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 50%; color: #fff; font-size: .76rem; font-weight: 800; margin-top: .1rem; }
.tests .pass .mark { background: var(--good-ink); } .tests .fail .mark { background: var(--critical); } .tests .open .mark { background: #b98300; }
.pill { display: inline-block; font-size: .76rem; font-weight: 700; border-radius: 99px; padding: .1rem .6rem; border: 1px solid; white-space: nowrap; }
.pill.good { background: var(--good-wash); border-color: #a9dcb2; color: var(--good-ink); }
.pill.warning { background: var(--warning-wash); border-color: #f1d58a; color: var(--warning-ink); }
.pill.neutral { background: var(--well); border-color: var(--line-strong); color: var(--ink-2); }

.needs { display: grid; gap: .7rem; margin-top: 1.1rem; }
.need { padding: .8rem 1rem; border-radius: 12px; background: var(--critical-wash); border: 1px solid #f0b4b4; box-shadow: 0 4px 0 #ecc0c0; font-size: 1rem; }
.need b { color: var(--critical-ink); font-size: 1.12rem; } .need .muted { display: block; font-size: .86rem; }
.scenario { border: 1px solid var(--line-strong); border-radius: 13px; padding: 1rem 1.1rem; margin-top: 1.3rem; background: #fff; box-shadow: 0 6px 0 var(--edge), 0 14px 16px -12px rgba(20, 33, 61, .3); }
.scenario > header { display: flex; justify-content: space-between; align-items: flex-start; gap: .8rem; margin-bottom: .4rem; }
.scenario h4 { font-size: 1.04rem; }
.sc-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.5rem; margin-top: .9rem; font-size: .9rem; }
.sc-cols h5 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .3rem; }
.sc-cols ul, .memo ul, .improve { list-style: disc; padding-left: 1.15rem; display: grid; gap: .25rem; }
.timing { margin-top: .5rem; }
.scenario > .cite { margin-top: .7rem; }
.block-h { font-size: 1.05rem; margin: 1.8rem 0 .6rem; padding-top: 1.2rem; border-top: 1px dashed var(--line-strong); }
.improve { font-size: .92rem; }
.memo-wait { display: flex; gap: .9rem; align-items: flex-start; padding: .9rem 1rem; border-radius: 12px; background: var(--accent-wash); border: 1px solid #b9d1f5; }
.spinner { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 3px solid #b9d1f5; border-top-color: var(--accent); animation: spin .9s linear infinite; margin-top: .1rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.memo-head { font-size: 1.02rem; font-weight: 600; padding: .8rem 1rem; border-radius: 12px; background: var(--accent-wash); border-left: 5px solid var(--accent); }
.memo-item { border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; margin-top: .9rem; box-shadow: 0 3px 0 var(--edge); }
.memo-item > header { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .5rem; }
.memo-item h5 { font-size: 1rem; flex: 1; min-width: 12rem; }
.memo-n { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 800; font-size: .82rem; }
.memo dl { display: grid; grid-template-columns: 8.5rem 1fr; gap: .35rem .9rem; margin: 0; font-size: .92rem; }
.memo dt { font-weight: 700; color: var(--ink-2); } .memo dd { margin: 0; }
.memo-h { font-size: .95rem; margin: 1.2rem 0 .4rem; }
.memo-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.5rem; font-size: .92rem; }
.ai-line { margin-top: .9rem; padding-top: .7rem; border-top: 1px dashed var(--line-strong); }
.disclaimer { font-size: .82rem; color: var(--muted); text-align: center; max-width: 70ch; margin: 0 auto; }
.page-foot { margin-top: 2.5rem; font-size: .82rem; color: var(--muted); text-align: center; }
.page-foot p { max-width: 72ch; margin: 0 auto; }

/* Single-column lists must never grow wider than their container, however long a name is. */
.debt-list, .q-rows, .stack, .flags, .doc-list, .eng-list, .notes, .needs, .found, .tests, .trail,
.checklist ol, .checklist ul, .improve { grid-template-columns: minmax(0, 1fr); }
.debt-card, .question, .scenario, .debt-out, .k1, .memo-item { min-width: 0; }

/* ---------------------------------------------------------------- tooltip */
.tip { position: absolute; z-index: 50; max-width: 300px; padding: .5rem .7rem; border-radius: 9px; background: var(--ink); color: #fff; font-size: .84rem; line-height: 1.4; box-shadow: 0 4px 0 #000, 0 12px 18px -8px rgba(0, 0, 0, .55); pointer-events: none; }

/* ---------------------------------------------------------------- sign-in and lists */
.centered { display: grid; min-height: 100vh; place-items: center; }
.login-wrap { width: min(430px, 92vw); display: grid; gap: 1.2rem; }
.login { display: grid; gap: .8rem; justify-items: start; margin: 0; padding: 2rem; }
.login h1 { font-size: 1.5rem; } .login form { width: 100%; margin-top: .4rem; } .login .alert { margin-top: 0; width: 100%; }
.login-wrap > .fine { text-align: center; }
.page.narrow h1 { font-size: 1.6rem; } .page.narrow h2 { font-size: 1.15rem; margin-bottom: .8rem; }
.new-row { display: flex; gap: 1rem; align-items: flex-end; margin-top: 1.2rem; flex-wrap: wrap; padding-bottom: 6px; }
.grow { flex: 1 1 16rem; }
.eng-list { display: grid; gap: .8rem; }
.eng-list li { display: flex; align-items: center; gap: .8rem; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; box-shadow: 0 5px 0 var(--edge); padding: .3rem .5rem .3rem 0; }
.eng-list form { margin: 0; }
.eng-link { flex: 1; display: grid; padding: .6rem 1rem; text-decoration: none; color: var(--ink); min-width: 0; }
.eng-link span { font-size: .84rem; }
.eng-link:hover strong { color: var(--accent); text-decoration: underline; }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 820px) {
  .page { padding: 1.2rem .8rem 4rem; }
  .slab { padding: 1.2rem 1.05rem 1.3rem; }
  .hero { padding: 1.4rem 1.1rem 1.2rem; }
  .flow, .tiles, .checklist, .sc-cols, .memo-cols { grid-template-columns: minmax(0, 1fr); }
  .flow { gap: 1.9rem; align-items: stretch; }
  .flow-block { margin-bottom: 0 !important; }
  .flow-block + .flow-block::before { left: 50%; top: -1.55rem; border: 9px solid transparent; border-top: 13px solid var(--line-strong); transform: translateX(-50%); }
  .grid.three, .grid.four, .grid.two { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .question > header { grid-template-columns: auto 1fr; }
  .question > header .yn { grid-column: 1 / -1; }
  .q-help { margin-left: 0; }
  .q-row { grid-template-columns: minmax(0, 1fr); }
  .ob-card > * { grid-column: 1 / -1 !important; }
  .topbar { flex-wrap: wrap; padding: .5rem .8rem; gap: .4rem .8rem; }
  .topbar-nav { margin-left: auto; }
  .topbar-mid { order: 3; flex-basis: 100%; justify-content: space-between; }
  .brand-name { display: none; }
  .tile-title { padding-right: 0; padding-top: 1.4rem; }
  .memo dl { grid-template-columns: 1fr; }
  .slab.out > .lead { margin-left: 0; }
  .step::before { left: 38px; }
  .sheets::before { transform: translate(7px, 10px) rotate(.5deg); }
  .sheets::after { transform: translate(3px, 5px) rotate(.25deg); }
  .sheet { padding: 1.3rem 1.1rem 1.2rem; }
}

/* ---------------------------------------------------------------- print: the output only */
@media print {
  body { background: #fff; font-size: 11pt; }
  .topbar, .hero, .step, .page-foot, .sheet-actions, .stale, .tip, #stale-banner { display: none !important; }
  .page { max-width: none; padding: 0; }
  .slab, .sheet, .k1, .debt-out, .scenario, .flag, details.wp, .memo-item, .need { box-shadow: none !important; }
  .sheets::before, .sheets::after, .sheet::after { display: none; }
  .slab.out { border: 0; padding: 0; margin-bottom: 1.4rem; }
  .k1, .debt-out, .scenario, .flag, .memo-item { break-inside: avoid; }
  details.wp { border: 0; padding: 0; }
  details.wp > summary { list-style: none; font-size: 1.05rem; }
  .results.is-stale .slab.out, .results.is-stale .sheets { opacity: 1; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 0s !important; scroll-behavior: auto !important; }
}
