/* ===========================================================================
   app/ui/app.css — the visual system, defined once
   ===========================================================================
   REDESIGN, 2026-11. Same rules as before, new look. Every class name the app
   already uses keeps its meaning; new pieces have plain new names and are
   marked NEW. Each section says which screen it belongs to.

   A NEUTRAL TOOL WITH ONE ACCENT. Tim's scheme: Space cadet for the sidebar
   and the text, Bice blue as the one accent (something you can act on),
   French gray tints for lines and the ground. Red still means "not priced"
   or "does not qualify". Every colour is a variable in :root below: change
   the scheme there and every screen follows.

   THREE THINGS ARE LOAD-BEARING AND ARE NOT STYLE:

   1 · A COMPUTED CELL IS FLAT GREY WITH A RIGHT-ALIGNED FIGURE AND NO EDGE.
       Never blue, never a box.

   2 · PROVENANCE IS A 3px LEFT STRIPE, nothing else. Chinese Violet from
       Velocity, Lion (gold) edited or assumed or your own figure, nothing at
       all typed here. It is drawn as an inset shadow so it sits inside a
       cell's box whether or not the box shows. Explained once in Settings,
       never as a legend on every page.

   3 · WHAT YOU CAN TYPE IN LOOKS TYPEABLE. On the Options board a typed cell
       is a white box with an edge. In Client's tables it is plain until you
       point at it. An empty cell the app needs has a dashed edge, red dashes
       when nothing prices until it is filled in.
   =========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  /* Tim's scheme */
  --space-cadet: #2E364F;
  --bice-blue: #0E6BA8;
  --french-gray: #ABB8C3;
  --mint-cream: #F8FFFE;
  --chinese-violet: #81667A;
  --lion: #B09869;

  /* What each colour is for. Change these, not the screens. */
  --ink: var(--space-cadet);
  --ink-2: #4A536B;           /* secondary text */
  --ink-3: #5F6880;           /* labels and hints; 4.5:1 on white and on --bg */
  --placeholder: #6A738B;     /* defaults and examples not typed yet */
  --line: #D5DCE1;            /* French gray lightened: card and box edges */
  --line-2: #E6EAEE;          /* row lines, column lines */
  --bg: #EEF1F3;              /* French gray lightened: the ground */
  --surface: #FFFFFF;
  --hover: #F6F8F9;
  --accent: var(--bice-blue); /* primary button, links, the tab you are on, focus */
  --accent-2: #0B5888;        /* accent on hover */
  --accent-soft: #E4EFF5;
  --computed: #EEF1F3;        /* a worked-out cell */
  --pulled: var(--chinese-violet);  /* stripe: from Velocity */
  --edited: var(--lion);            /* stripe: edited, assumed, your own figure */
  --edited-text: #7A6435;     /* Lion darkened, for the rare text in it */
  --refuse: #B42318;          /* failed, does not qualify, not priced */
  --refuse-soft: #FDEEEC;
  --refuse-line: #F1D2CD;
  --notice: var(--bice-blue); /* "1 to read": blue, because gold now means edited */
  --notice-soft: var(--accent-soft);
  --needed: #93A1AD;          /* dashed edge of an empty cell the app needs */

  --sidebar: var(--space-cadet);
  --sidebar-ink: var(--mint-cream);
  --sidebar-muted: var(--french-gray);
  --sidebar-hover: rgba(248, 255, 254, 0.08);

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --row: 40px;                /* every grid row, every band row (was 32) */
  --labelcol: 220px;          /* the board's sticky label column */
  --optioncol: 200px;         /* one option column, minimum */
  --optioncol-max: 232px;     /* and at most, so figures stay near their labels */
  --bar: 52px;
  --sidebar-w: 240px;
  --radius: 8px;              /* buttons and boxes */
  --radius-card: 14px;        /* cards */
  --shadow-pop: 0 14px 34px rgba(46, 54, 79, 0.2);
}

* { box-sizing: border-box; }
/* Pop-ups, folded rows and menus are in the markup with `hidden`; no layout
   class may show them. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 var(--sans);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 26px; letter-spacing: -0.02em; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 8px; }
a { color: var(--accent); }
a:hover { color: var(--accent-2); }

/* Sentence case throughout; no uppercase labels anywhere. */
button, input, select, textarea { font: inherit; color: inherit; font-variant-numeric: inherit; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
::placeholder { color: var(--placeholder); }

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

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: #B9C4CD; }
.btn:disabled { background: var(--surface); border-color: var(--line-2); color: #8A93A6; cursor: not-allowed; opacity: 1; }
/* One blue button per area. */
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-primary:disabled { background: #D6E5F0; border-color: #D6E5F0; color: #3D6584; }
.btn-danger { color: var(--refuse); border-color: transparent; background: transparent; }
.btn-danger:hover { background: var(--refuse-soft); border-color: var(--refuse-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); border-color: var(--line-2); }
.btn-small { height: 28px; padding: 0 10px; border-radius: 6px; font-size: 12.5px; }
.btn-link {
  border: 0; background: none; padding: 0; height: auto;
  color: var(--accent); text-decoration: none; font-weight: 500; cursor: pointer;
}
.btn-link:hover { color: var(--accent-2); text-decoration: underline; }
.btn .count {
  display: inline-block; min-width: 18px; height: 18px; margin-left: 2px; padding: 0 5px; border-radius: 9px;
  background: var(--line-2); color: var(--ink); font-size: 11.5px; line-height: 18px; text-align: center;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------- NEW · the app shell
   A dark sidebar on the left, the screen on the right. Markup:
   #app > .app-shell > nav.appnav + .app-main > (header.filebar | .page-head) + .screen */
.app-shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.app-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.appnav {
  flex: 1 1 var(--sidebar-w); max-width: 100%;
  display: flex; flex-direction: column; gap: 20px; padding: 20px 14px;
  background: var(--sidebar); color: var(--sidebar-ink);
}
.appnav-brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px; font-weight: 600; font-size: 15px; }
.appnav-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: grid; place-items: center; background: var(--sidebar-ink); color: var(--sidebar);
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
}
.appnav-search {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px;
  border: 1px solid rgba(248, 255, 254, 0.14); border-radius: var(--radius);
  background: rgba(248, 255, 254, 0.06); color: var(--sidebar-muted);
}
.appnav-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--sidebar-ink); }
.appnav-search input::placeholder { color: var(--sidebar-muted); }
.appnav-links { display: flex; flex-direction: column; gap: 2px; }
.appnav-link {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border: 0;
  border-radius: var(--radius); background: transparent; color: var(--sidebar-ink);
  font-weight: 500; text-decoration: none; cursor: pointer; text-align: left;
}
.appnav-link:hover { background: var(--sidebar-hover); color: var(--sidebar-ink); }
.appnav-link.is-on { background: var(--accent); color: #fff; }
.appnav-link svg { width: 18px; height: 18px; flex: none; }
.appnav-label { padding: 0 12px 6px; font-size: 12px; font-weight: 500; color: var(--sidebar-muted); }
.appnav-file {
  display: flex; flex-direction: column; gap: 1px; padding: 8px 12px; border-radius: var(--radius);
  color: var(--sidebar-ink); text-decoration: none;
}
.appnav-file:hover { background: var(--sidebar-hover); color: var(--sidebar-ink); }
.appnav-file.is-on { background: var(--sidebar-hover); }
.appnav-file .code { font: 600 12.5px/1.3 var(--mono); }
.appnav-file .who { font-size: 13px; color: var(--sidebar-muted); }
/* The old ⌂ button is the sidebar's Files link now. */
.app-shell .homebtn { display: none; }

/* ------------------------------------- NEW · page head on screens with no file
   Quick quote, Calculator, Settings, Home. The old .home-top bar is restyled
   to the same look, so either markup works. */
.page-head, .home-top {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px;
  padding: 28px 32px 0; height: auto; background: transparent; border-bottom: 0;
}
.page-title { display: flex; flex-direction: column; gap: 4px; }
.page-title h1 { margin: 0; }
.page-sub { font-size: 14px; color: var(--ink-3); }
.page-meta { font-size: 13px; color: var(--ink-3); }
.home-top .brand { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); }

/* ------------------------------------------------------------- the file bar
   Same markup as before. Laid out as a page head now: the deal code small
   on top, the client's name as the title, the actions on the right, and the
   tabs underneath with a line under the one you are on. */
.filebar {
  flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px;
  padding: 22px 32px 0; background: transparent; border-bottom: 0;
  position: static; height: auto;
}
.filebar-id { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.filebar-line { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.dealcode {
  font: 600 12.5px var(--mono); color: var(--ink-2); background: none; border: 1px solid transparent;
  border-radius: 6px; padding: 1px 4px; margin-left: -5px; min-width: 90px; max-width: 220px;
}
.dealcode:hover { border-color: var(--line); background: var(--surface); }
.clientname {
  font-size: 26px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); background: none;
  border: 1px solid transparent; border-radius: 8px; padding: 0 5px; margin-left: -6px; min-width: 220px; max-width: 560px;
}
.clientname:hover { border-color: var(--line); background: var(--surface); }
.clientname::placeholder { color: var(--placeholder); font-style: normal; }
.filebar-sub { font-size: 13px; color: var(--ink-3); padding-left: 0; }
.filebar-sub .is-dirty { color: var(--edited-text); }
.filebar-sub .is-degraded { color: var(--ink-2); border-bottom: 1px dotted var(--ink-3); cursor: help; }
.filebar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }

.tabs {
  order: 10; flex-basis: 100%; display: flex; gap: 4px; margin: 4px 0 0;
  border-bottom: 1px solid var(--line); overflow-x: auto;
}
.tab {
  height: 44px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  border-radius: 0; background: none; cursor: pointer; color: var(--ink-3); font-weight: 500;
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.tab:hover { background: none; color: var(--ink); }
.tab.is-on { background: none; color: var(--accent); font-weight: 500; border-bottom-color: var(--accent); }
.tab .dot { width: 7px; height: 7px; border-radius: 50%; }
.tab .dot.is-refuse { background: var(--refuse); }
.tab .dot.is-notice { background: var(--notice); }
.tab .count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--line-2); color: var(--ink-2); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center;
}
.tab.is-on .count { background: var(--accent-soft); color: var(--accent); }
.homebtn { width: 38px; height: 38px; display: grid; place-items: center; }

/* ------------------------------------------------------------------ layout */
.screen { flex: 1; min-height: 0; }
.wrap { max-width: 1400px; margin: 0; padding: 20px 32px 56px; }
.wrap-narrow { max-width: 1400px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }

/* --------------------------------------------------------------- cards */
.block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); overflow: clip; scroll-margin-top: 84px; }
.block-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 18px 20px 12px;
  border-bottom: 0;
}
.block-head h2 { font-size: 16px; }
.block-head .hint { flex-basis: 100%; font-size: 13px; color: var(--ink-3); line-height: 1.45; }
.block-body { padding: 4px 20px 20px; }
.block-foot { padding: 10px 20px 14px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); }
/* NEW · a card that folds to one line (Client, shorter page) */
.block-head .fold-btn { margin-left: auto; }
.block-sum { flex-basis: 100%; font-size: 13px; color: var(--ink-2); }
.block.is-folded .block-body, .block.is-folded .block-foot, .block.is-folded .grid-wrap { display: none; }
.block.is-folded .block-head .hint { display: none; }

/* ------------------------------------------------------------------ fields */
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px 18px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 120px; }
.field > label { font-size: 13px; font-weight: 500; color: var(--ink); }
.field .note { font-size: 12px; color: var(--ink-3); line-height: 1.45; }
.field input, .field select, .field textarea {
  height: 38px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 11px; background: var(--surface);
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: #AFBBC5; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field textarea { height: auto; min-height: 84px; padding: 9px 11px; line-height: 1.5; resize: vertical; }
.prose-area {
  width: 100%; min-height: 84px; border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 11px;
  background: var(--surface); line-height: 1.5; resize: vertical;
}
.prose-area:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
/* NEW · a box with its unit written inside: [ 4,400   per year ] */
.box {
  display: flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.box:hover { border-color: #AFBBC5; }
.box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.box.is-needed { border-style: dashed; border-color: var(--needed); }
.box input, .box select {
  flex: 1; min-width: 0; height: auto; padding: 0; border: 0; outline: 0; background: transparent;
  text-align: right; -webkit-appearance: none; appearance: none;
}
.box select { text-align: left; cursor: pointer; }
.box input:focus, .box select:focus, .field .box input:focus { box-shadow: none; border: 0; }
.box select.cell, .box input.cell { padding: 0; height: auto; border: 0; }
.box .unit { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }

/* ------------------------------------------------------------ small parts */
.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; background: var(--line-2); color: var(--ink-2);
}
.pill.is-blocker { background: var(--refuse); color: #fff; }
.pill.is-notice { background: var(--notice-soft); color: var(--notice); }
.pill.is-ok { background: var(--accent-soft); color: var(--accent); }
.pill.is-refuse { background: var(--refuse-soft); color: var(--refuse); }
/* NEW · a neutral label, e.g. Purchase, BC, From this file */
.tag {
  display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 6px;
  background: #E1E7EB; color: var(--ink-2); font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
.tag.is-round { border-radius: 999px; background: var(--line-2); font-size: 12px; height: 22px; }
/* NEW · how many things a section still needs, drawn like a needed box */
.need-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 6px;
  border: 1px dashed var(--needed); border-radius: 999px; font-size: 11.5px; font-weight: 600; color: var(--ink-2);
}
/* NEW · a chip that opens a pop-up under itself (Quotes, Quick quote, Home filters) */
.chip-wrap { position: relative; z-index: 41; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 14px; max-width: 100%;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink);
  cursor: pointer; font-size: 13.5px;
}
.chip:hover { border-color: #AFBBC5; }
.chip.is-on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); color: var(--ink); }
.chip .chip-key { font-weight: 600; white-space: nowrap; }
.chip .chip-val { color: var(--ink-3); white-space: nowrap; }
.pop {
  position: absolute; top: calc(100% + 8px); left: 0; width: 360px; max-width: 90vw;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); box-shadow: var(--shadow-pop);
}
.pop-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 10px 6px 16px; }
.pop-head h3 { font-size: 15px; }
.pop-body { padding: 0 16px 14px; }
/* Clicking anywhere outside an open pop-up closes it: a clear button over the
   whole screen, under the chips. */
.scrim { position: fixed; inset: 0; z-index: 40; border: 0; padding: 0; margin: 0; background: transparent; cursor: default; }
/* NEW · one-click choice: [ No | Yes ] */
.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--line-2); }
.seg button {
  height: 30px; min-width: 46px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent;
  font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer;
}
.seg button.is-on, .seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(46, 54, 79, 0.15); }
/* NEW · an on/off switch. A plain checkbox with class="switch", so the
   screen code keeps reading .checked as before. */
input[type="checkbox"].switch {
  -webkit-appearance: none; appearance: none; position: relative; flex: none; margin: 0;
  width: 38px; height: 22px; border-radius: 999px; background: #C3CDD5; cursor: pointer; transition: background 0.15s;
}
input[type="checkbox"].switch::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(46, 54, 79, 0.25); transition: left 0.15s;
}
input[type="checkbox"].switch:checked { background: var(--accent); }
input[type="checkbox"].switch:checked::before { left: 19px; }
input[type="checkbox"].switch:disabled { opacity: 0.5; cursor: not-allowed; }
input[type="checkbox"].switch, .tool-row input[type="checkbox"].switch { border: 0; padding: 0; width: 38px; height: 22px; }
/* NEW · a blue note: something to read, not something wrong */
.note-box {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  background: var(--notice-soft); color: var(--ink); font-size: 13.5px; line-height: 1.5;
}
.note-box.is-quiet { background: #F3F6F8; color: var(--ink-2); }
.empty { padding: 26px 16px; text-align: center; color: var(--ink-3); }
.empty.is-box { border: 1px dashed var(--line); border-radius: 12px; background: #FAFBFC; }

/* -------------------------------------------------------------------- Home */
.brand { font-weight: 600; color: var(--ink); }
.home-actions { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search {
  height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); min-width: 260px;
}
.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.filelist { width: 100%; border-collapse: separate; border-spacing: 0; }
.filelist th {
  text-align: left; font-weight: 500; color: var(--ink-3); font-size: 12.5px;
  padding: 0 16px; height: 40px; background: #F7F9FA; border-bottom: 1px solid var(--line);
}
.filelist td { padding: 0 16px; height: 54px; border-bottom: 1px solid var(--line-2); }
.filelist tbody tr { cursor: pointer; }
.filelist tbody tr:hover td { background: var(--hover); }
.filelist .code { font: 600 13px var(--mono); }
.filelist .num { text-align: right; }

/* ------------------------------------------------------------ notice strip */
.notices { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: 460px; }
.notice-card {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--ink-3);
  border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow-pop);
  display: flex; gap: 10px; align-items: flex-start;
}
.notice-card.is-bad { border-left-color: var(--refuse); }
.notice-card.is-warn { border-left-color: var(--notice); }
.notice-card.is-ok { border-left-color: var(--accent); }
.notice-card .body { flex: 1; }
.notice-card .acts { display: flex; gap: 6px; margin-top: 8px; }

/* --------------------------------------------------------------- the panel */
.attention { background: var(--notice-soft); border: 0; }
.attention.is-blocker { background: var(--refuse-soft); }
.attn-item { padding: 12px 14px; border-top: 1px solid rgba(46, 54, 79, 0.08); }
.attn-item:first-child { border-top: 0; }
.attn-head { display: flex; align-items: center; gap: 8px; }
.attn-do { color: var(--ink-2); margin-top: 3px; }
.attn-acts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* ----------------------------------------------- the grid (Client's tables)
   Plain cells: a typed cell shows no box until you point at its row (faint)
   or at it (full), and a blue ring while you type. Grey cells are worked out.
   Dashed boxes are needed and empty. */
.grid-wrap { overflow-x: auto; }
table.grid { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line-2); }
table.grid thead th {
  position: sticky; top: 0; z-index: 3; background: #FAFBFC;
  text-align: left; font-weight: 500; color: var(--ink-3); font-size: 12px;
  padding: 9px 10px; white-space: nowrap; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2);
}
table.grid thead th.num { text-align: right; }
table.grid thead th .unit { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 400; }
table.grid td { height: 48px; padding: 6px 3px; background: var(--surface); }
table.grid tbody tr:hover td { background: var(--hover); }
table.grid td.computed { background: var(--computed); color: var(--ink); text-align: right; padding: 0 14px; }
table.grid tbody tr:hover td.computed { background: var(--computed); }
table.grid td.computed.is-bad { color: var(--refuse); font-weight: 600; }
table.grid td.is-unpriced { color: var(--refuse); font-style: italic; }
table.grid td.is-derived { padding: 0 14px; color: var(--ink-2); text-align: right; background: var(--computed); }
table.grid td.is-derived-bool { background: var(--computed); }
table.grid td.is-derived.is-text { text-align: left; }
table.grid tfoot td { background: var(--surface); font-weight: 600; padding: 0 14px; height: 44px; border-top: 1px solid var(--line); }
table.grid tfoot td.num { text-align: right; }
table.grid td.rowhead, table.grid th.rowhead {
  position: sticky; left: 0; z-index: 2; width: 40px; min-width: 40px; text-align: center; color: var(--ink-2);
  font: 600 12px var(--sans);
}
table.grid td.rowhead { background: var(--surface); }
table.grid thead th.rowhead { z-index: 4; }
table.grid td.actions { padding: 0 4px; text-align: right; white-space: nowrap; background: var(--surface); }

/* One cell, one input. The stripe is the provenance. */
.cell {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid transparent; border-radius: 7px;
  background: transparent; color: var(--ink);
}
.cell.num { text-align: right; }
.cell::placeholder { color: var(--placeholder); }
select.cell { padding-left: 8px; cursor: pointer; }
/* A select is as wide as its longest choice plus its padding, and four of them
   sit in a row of debts: the arrow needs no padding after it. This is what
   keeps Liabilities inside 1440px beside the sidebar (ui.test.mjs). */
table.grid select.cell { padding-left: 6px; padding-right: 0; }
table.grid td.actions .btn-small { padding: 0 6px; }
table.grid tbody tr:hover .cell { border-color: var(--line-2); background: var(--surface); }
table.grid .cell:hover { border-color: var(--line); }
.cell:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
td.prov-pulled .cell { box-shadow: inset 3px 0 0 var(--pulled); }
td.prov-overridden .cell, td.prov-typedOver .cell, td.prov-assumed .cell { box-shadow: inset 3px 0 0 var(--edited); }
td.prov-pulled .cell:focus { box-shadow: inset 3px 0 0 var(--pulled), 0 0 0 3px var(--accent-soft); }
td.prov-overridden .cell:focus, td.prov-typedOver .cell:focus, td.prov-assumed .cell:focus { box-shadow: inset 3px 0 0 var(--edited), 0 0 0 3px var(--accent-soft); }
/* An empty cell. Needed: dashed. Needed before anything prices: red dashes. */
td.prov-empty .cell, table.grid tbody tr:hover td.prov-empty .cell { border-style: dashed; border-color: var(--line); }
td.prov-empty.is-required .cell, table.grid tbody tr:hover td.prov-empty.is-required .cell { border-style: dashed; border-color: var(--needed); }
td.prov-empty.is-blocking .cell, table.grid tbody tr:hover td.prov-empty.is-blocking .cell { border-color: var(--refuse); }
td.is-stale { background: var(--notice-soft); }
td.field-flag { background: var(--refuse-soft); }

/* ---------------------------------------------------------- the row drawer */
.drawer-row td { background: #FAFBFC; padding: 12px 16px; }
.drawer-fields { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; }

/* --------------------------------------------------- NEW · Client's pieces */
/* One bar of section links that stays at the top while you scroll, with each
   section's key figure and how many things it still needs. */
.section-bar {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 6px 16px rgba(46, 54, 79, 0.08); overflow: hidden;
}
.section-bar a {
  display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 10px 12px;
  border-left: 1px solid var(--line-2); color: var(--ink); text-decoration: none;
}
.section-bar a:first-child { border-left: 0; }
.section-bar a:hover { background: var(--hover); color: var(--ink); }
.section-bar .sb-key { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.section-bar .sb-val { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.section-bar .sb-val small { font-size: 12px; font-weight: 400; color: var(--ink-3); }
/* In a narrow window the bar wraps to several rows, and stuck to the top it
   would cover most of the screen. */
@media (max-width: 860px) { .section-bar { position: static; } }
/* File on one line */
.file-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: 12px 20px; }
.file-strip h2 { margin-right: 6px; }
.file-strip .field { flex-direction: row; align-items: center; gap: 10px; min-width: 0; }
.file-strip .field > label { font-weight: 400; color: var(--ink-3); white-space: nowrap; }
.file-strip .field select { width: 150px; }
/* Credit, one small panel per borrower, inside Liabilities */
.credit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 12px; }
.credit-card {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 12px;
  border: 1px solid var(--line-2); border-radius: 10px; background: #FAFBFC;
}
.credit-card .who { min-width: 110px; font-weight: 600; }
/* Its cells sit outside a table; the prov-* class is on the label around them. */
.credit-card .cell:hover { border-color: var(--line); background: var(--surface); }
.credit-card .prov-empty .cell { border-style: dashed; border-color: var(--line); }
.credit-card .prov-empty.is-required .cell { border-color: var(--needed); }
.credit-card .prov-pulled .cell { box-shadow: inset 3px 0 0 var(--pulled); }
.credit-card .prov-overridden .cell, .credit-card .prov-typedOver .cell, .credit-card .prov-assumed .cell { box-shadow: inset 3px 0 0 var(--edited); }
.credit-card .prov-empty.is-blocking .cell { border-color: var(--refuse); }
.credit-card .is-stale .cell { background: var(--notice-soft); }
.credit-card .has-flag { position: relative; }
.credit-card .has-flag::after {
  content: ""; position: absolute; top: -2px; right: -4px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--notice);
}
/* Needed before anything prices: the count and the box go red, like the cell. */
.need-count.is-blocking { border-color: var(--refuse); color: var(--refuse); }
.box.is-needed.is-blocking { border-color: var(--refuse); }
.sub-head { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
/* A borrower's income notes, on a line under the borrower */
tr.notes-row td { height: auto; padding-top: 0; }
/* A borrower and their notes line read as one group: no line between them. */
table.grid tbody tr:has(+ tr.notes-row) td { border-bottom-color: transparent; }
.inline-label { display: flex; align-items: center; gap: 8px; min-width: 0; }
.inline-label > span { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.private-tag {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px;
  background: #F1EDF0; color: #6B5366; font-size: 12px; font-weight: 600; white-space: nowrap;
}

/* ------------------------------------------------------------- the options board */
.board-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 12px; padding: 0 0 14px; flex-wrap: wrap; }
.board-head h2 { font-size: 16px; }
/* The property facts used to sit in a strip above the board. They are a card
   in the board's top-left corner now (th.lbl in the head row). The old strip
   class still works if it is left where it was. */
.propchip, .board-corner {
  display: flex; flex-direction: column; gap: 9px; padding: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; font-size: 13px;
}
.propchip .bit { display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; }
.propchip .bit button { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; font-weight: 500; }
.propchip .bit .differs { color: var(--edited-text); }

.board-scroll { overflow-x: auto; background: transparent; border: 0; border-radius: 0; }
.board-scroll.has-hbar { scrollbar-width: none; }
.board-hbar {
  position: sticky; bottom: 0; z-index: 8; overflow-x: auto; overflow-y: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 0 0 10px 10px;
}
.board-hbar-span { height: 1px; }
.board-hbar::-webkit-scrollbar { height: 14px; }
.board-hbar::-webkit-scrollbar-track { background: var(--line-2); }
.board-hbar::-webkit-scrollbar-thumb { background: var(--french-gray); border-radius: 7px; border: 3px solid var(--line-2); }
.board-hbar::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

table.board { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
table.board th, table.board td { border-bottom: 0; vertical-align: middle; }
table.board col.labelcol { width: var(--labelcol); }
table.board .lbl {
  position: sticky; left: 0; z-index: 2; background: var(--surface);
  width: var(--labelcol); min-width: var(--labelcol); max-width: var(--labelcol);
  text-align: left; font-weight: 400; padding: 0 12px 0 20px; height: var(--row);
  color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
table.board .lbl .unit { color: var(--ink-3); font-size: 12px; margin-left: 6px; }
table.board .lbl .departed { color: var(--edited-text); margin-left: 6px; }
/* Each option a lane: a thin line down its left edge, head card to last row.
   The "+ Option" column takes the slack (width: 100%), which holds every option
   column at its MINIMUM, so the minimum here is the 232 Tim settled on. At 200
   the ratios and "Use the max" wrapped onto a second line. */
table.board td.opt {
  min-width: var(--optioncol-max); width: var(--optioncol-max); padding: 4px 6px;
  background: var(--surface); border-left: 1px solid var(--line-2);
}
table.board td.opt .cell {
  height: 32px; border: 1px solid var(--line); background: var(--surface); text-align: right;
}
table.board td.opt .cell:hover { border-color: #AFBBC5; }
/* Scrolled to from above the window, a cell stops clear of the pinned summary. */
table.board .cell { scroll-margin-top: 84px; }
table.board td.opt .cell:focus { border-color: var(--accent); }
table.board td.opt select.cell { text-align-last: right; padding-right: 24px; }
table.board td.opt .cell::placeholder { color: var(--placeholder); }
table.board td.opt.computed {
  background: var(--computed); color: var(--ink); text-align: right; padding: 0 16px; vertical-align: middle;
}
/* A white margin inside the cell, so a computed td looks like the grey box of a
   computed input beside it. */
table.board td.opt.computed {
  box-shadow: inset 6px 0 0 var(--surface), inset -6px 0 0 var(--surface), inset 0 4px 0 var(--surface), inset 0 -4px 0 var(--surface);
}
table.board td.opt.computed.is-bad { color: var(--refuse); font-weight: 600; }
table.board td.opt.is-unpriced { color: var(--refuse); font-style: italic; }
/* A worked-out figure that is still an input (td.prov-calculated): grey, no
   edge, like every computed cell. Typing in it shows the box again. */
table.board td.opt.prov-calculated .cell { background: var(--computed); border-color: transparent; }
table.board td.opt.prov-calculated .cell:focus { background: var(--surface); border-color: var(--accent); }
/* Notes in an option column: a box a few lines tall */
table.board td.opt textarea.cell { height: auto; min-height: 64px; padding: 8px 10px; text-align: left; line-height: 1.45; resize: vertical; }
/* NEW · where the options do not all agree, the figures are bold */
table.board td.opt.differs, table.board td.opt.differs .cell { font-weight: 600; }
/* NEW · pointing at a column tints it, head card included */
table.board td.opt.is-col-hover { background: #F1F7FB; }
table.board td.opt.computed.is-col-hover { background: #E3EDF3; }
table.board tbody tr:hover td.opt:not(.computed), table.board tbody tr:hover th.lbl { background: var(--hover); }

/* The head row: one card per option, sitting on the ground. */
table.board thead th { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 0; vertical-align: top; }
table.board thead th.lbl { z-index: 6; padding: 6px 6px 6px 0; height: auto; white-space: normal; }
.opt-head {
  min-width: var(--optioncol-max); width: var(--optioncol-max); padding: 14px; text-align: left; font-weight: 400;
  background: var(--surface); background-clip: padding-box; border: 6px solid transparent; border-radius: 18px;
  box-shadow: inset 0 0 0 1px var(--line);
}
.opt-head.is-refused { background-color: #FFF9F8; box-shadow: inset 0 0 0 1px var(--refuse-line); }
/* The head row's own rule (ground, no padding) outranks .opt-head: restate the card. */
table.board thead th.opt-head { background: var(--surface); background-clip: padding-box; padding: 14px; }
table.board thead th.opt-head.is-refused { background-color: #FFF9F8; }
table.board thead th.lbl { background: var(--bg); }
.opt-head.is-col-hover { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft); }
.opt-head-top { display: flex; align-items: center; gap: 6px; }
.opt-name {
  font-weight: 600; font-size: 14.5px; border: 1px solid transparent; background: none; border-radius: 6px;
  padding: 1px 4px; min-width: 0; flex: 1;
}
.opt-name:hover { border-color: var(--line); }
.opt-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; min-height: 18px; overflow: hidden; }
.opt-off { font-size: 12px; color: var(--ink-3); }
.opt-head .grip { color: var(--french-gray); cursor: grab; font-size: 12px; }
.opt-head [draggable].is-drop { outline: 2px dashed var(--accent); outline-offset: 2px; border-radius: 8px; }

.results { border-left: 0; padding: 0; margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.results .big { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.results .big .per { font-size: 13px; font-weight: 400; color: var(--ink-3); }
.results .heloc-add { font-size: 12.5px; color: var(--ink-2); }
.results .ratios { display: flex; gap: 16px; font-size: 13px; font-weight: 600; color: var(--ink); padding-top: 10px; border-top: 1px solid var(--line-2); }
.results .ratios .over { color: var(--refuse); }
.results .cash { font-size: 13px; color: var(--ink-2); }
.results .cash.is-bad { color: var(--refuse); font-weight: 600; }
.results .notice-line { font-size: 12.5px; color: var(--notice); }
.results .refusal { color: var(--refuse); font-size: 12.5px; }
.results .refusal li { margin: 0 0 4px; }
.results .refusal ul { margin: 0; padding-left: 16px; }

/* Bands are cards: a strip of ground above each band's head. Add class
   "band-last" to the last row of a band for its rounded bottom corners. */
.bandhead td, .bandhead th {
  background: var(--surface); height: 52px;
  border-top: 16px solid var(--bg); border-bottom: 1px solid var(--line-2);
}
table.board .bandhead .lbl { background: var(--surface); font-weight: 600; color: var(--ink); }
.bandhead th:first-child { border-top-left-radius: 0; }
tr.band-last th.lbl { border-bottom-left-radius: 14px; }
tr.band-last td:last-child { border-bottom-right-radius: 14px; }
.band-toggle {
  border: 0; background: none; cursor: pointer; font: inherit; font-size: 15px; font-weight: 600; color: var(--ink);
  display: flex; align-items: center; gap: 8px; padding: 0; height: 52px;
}
.band-note { padding: 4px 12px; font-size: 12.5px; color: var(--ink-3); }
.subrow .lbl, table.board .subrow .lbl { padding-left: 34px; color: var(--ink-2); }
.expander { border: 0; background: none; cursor: pointer; color: var(--ink-3); padding: 0 6px 0 0; font-size: 11px; }
/* NEW · Product rows that still hold defaults fold under one line */
tr.more-row th, tr.more-row td { height: 40px; border-top: 1px solid var(--line-2); background: var(--surface); }
.more-toggle {
  display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; cursor: pointer;
  font-weight: 500; font-size: 13px; color: var(--accent);
}
.more-toggle .more-hint { font-weight: 400; color: var(--ink-3); white-space: nowrap; }
/* The button sits in the label column, which stays put sideways; the list of
   what is folded runs on over the empty row beside it. */
table.board tr.more-row th.lbl { overflow: visible; }
.board-head .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--notice); }
.opt-head .grip { display: inline-flex; }
/* The "+ Option" column takes the slack, as before. */
.ghostcol { min-width: 150px; padding: 10px; width: 100%; border-left: 1px solid var(--line-2); }
table.board tbody td.ghostcol { background: var(--surface); }

/* NEW · the slim summary that pins to the top once the head cards scroll off.
   board.js shows it (.is-on) from an IntersectionObserver on the head row and
   copies the board's scrollLeft into .board-pin-scroll so it moves sideways
   with the columns. Its table uses the board's column widths. */
/* No height of its own: the strip hangs below a zero-height sticky box, so
   showing it never moves the board under it (a negative margin moved it 14px). */
.board-pin { display: none; position: sticky; top: 0; z-index: 30; height: 0; }
.board-pin.is-on { display: block; }
.board-pin-scroll {
  overflow: hidden; height: 68px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 8px 20px rgba(46, 54, 79, 0.12);
}
/* Fixed layout: board.js sets each column to the board's measured width, and a
   long option name must not push its column past it. */
.board-pin table { border-collapse: separate; border-spacing: 0; height: 100%; table-layout: fixed; }
.board-pin td { padding: 0 8px; text-align: center; border-left: 1px solid var(--line-2); vertical-align: middle; }
.board-pin td:first-child { position: sticky; left: 0; background: var(--surface); text-align: left; padding-left: 16px; border-left: 0; }
.board-pin .pin-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-pin .pin-pay { font-size: 15px; font-weight: 600; }
.board-pin .pill { height: 20px; font-size: 11.5px; padding: 0 7px; }

/* ------------------------------------------------------------- tools drawer */
.board-layout { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.board-main { flex: 999 1 520px; min-width: 0; }
.tools { width: 340px; flex: 1 1 300px; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
.tool-head { padding: 16px 18px 10px; border-bottom: 0; font-weight: 600; font-size: 15px; }
.tool-body { padding: 0 18px 16px; display: flex; flex-direction: column; gap: 6px; }
.tool-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; }
.tool-row > label { color: var(--ink); }
.tool-row input, .tool-row select {
  width: 130px; height: 36px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 10px;
  text-align: right; background: var(--surface);
}
.tool-row input:focus, .tool-row select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tool-out { border-top: 1px solid var(--line-2); padding-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.tool-out > div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; }
.tool-out .is-total { font-weight: 600; border-top: 1px solid var(--line-2); padding-top: 8px; }
.tool-out .is-bad { color: var(--refuse); }
.tool-note { font-size: 12.5px; color: var(--ink-3); line-height: 1.45; }

/* ------------------------------------------------------------- deliverable */
.deliver { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.deliver-outline { width: 460px; flex: 1 1 400px; max-width: 480px; display: flex; flex-direction: column; gap: 16px; }
.deliver-preview { flex: 999 1 520px; min-width: 0; position: sticky; top: 16px; }
/* The section list: one card, a row per section, an on/off switch on each
   (the old checkbox with class="switch"). Only the exception is spelled out. */
.sec-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
.sec-card.is-dragging { opacity: 0.5; }
.sec-card.is-drop { border-color: var(--accent); }
.sec-head { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 16px 0 12px; cursor: pointer; }
.sec-head:hover { background: var(--hover); }
.sec-head .grip { color: var(--french-gray); cursor: grab; }
.sec-head .where { font-size: 12.5px; color: var(--ink-3); margin-left: auto; white-space: nowrap; }
/* NEW · all sections in one card: each .sec-card is a lined row in it */
.sec-list .sec-card { border: 0; border-top: 1px solid var(--line-2); border-radius: 0; }
/* NEW · one small card per option under Your options */
.deliver-option { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.deliver-option-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.deliver-option-name { flex: 1; min-width: 120px; font-weight: 600; }
.deliver-option-name .muted { font-weight: 400; }
.sec-head .where.is-on-page { display: none; }
.sec-head input[type="checkbox"].switch { margin-left: 8px; }
.sec-head.is-off b, .sec-head.is-off .sec-name { color: var(--placeholder); font-weight: 400; }
.sec-body { padding: 14px 16px 18px 46px; display: flex; flex-direction: column; gap: 16px; background: #FAFBFC; border-top: 1px solid var(--line-2); }
/* An option left off the page keeps only its switch, its name greyed. */
.deliver-option.is-off .deliver-option-name { color: var(--placeholder); font-weight: 400; }
/* Group and Price point side by side inside the option's card. */
.deliver-option .fields { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.preview-bar { display: flex; align-items: center; gap: 8px; padding: 0 0 12px; flex-wrap: wrap; }
.preview-warn { color: var(--notice); font-size: 13px; }
.preview-scaler { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-card); background: #fff; box-shadow: 0 8px 24px rgba(46, 54, 79, 0.08); }
.preview-frame { width: 1100px; height: 1400px; border: 0; transform-origin: top left; }
/* Phone: a phone-sized page in the middle of the ground, not a strip down the left of a white box. */
.preview-scaler.is-phone { display: flex; justify-content: safe center; padding: 20px 0; background: var(--bg); }
.preview-frame.is-phone { flex: none; width: 390px; height: 844px; border-radius: 22px; background: #fff; box-shadow: 0 0 0 1px var(--line), 0 8px 24px rgba(46, 54, 79, 0.12); }
.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mode-choice {
  min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 10px;
  cursor: pointer; display: flex; flex-direction: column; gap: 4px; background: var(--surface); font-weight: 600;
}
.mode-choice:hover { border-color: #AFBBC5; }
.mode-choice.is-on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: #F7FBFD; }
.mode-choice span { font-size: 12px; font-weight: 400; color: var(--ink-3); line-height: 1.4; }
button.mode-choice { text-align: left; font: inherit; font-weight: 600; color: var(--ink); }
.inline-check { display: flex; gap: 12px; align-items: flex-start; }

/* ------------------------------------------------------- NEW · publish */
.check-list { display: flex; flex-direction: column; }
.check-row { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 20px; border-top: 1px solid var(--line-2); font-size: 14.5px; }
.check-row .check-mark {
  width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.check-row.is-bad .check-mark { background: var(--refuse-soft); color: var(--refuse); }
.check-row .check-state { margin-left: auto; font-size: 13px; font-weight: 500; color: var(--accent); }
.check-row.is-bad .check-state { color: var(--refuse); }
.thumb { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
/* A check's words, and under a failed one, its fix. Still rendering: grey, neither tick nor cross. */
.check-row .check-text { display: flex; flex-direction: column; gap: 2px; padding: 12px 0; }
.check-row .check-fix { font-size: 13px; color: var(--ink-2); }
.check-row.is-wait .check-mark { background: var(--line-2); color: var(--ink-3); }
.check-row.is-wait .check-state { color: var(--ink-3); }
/* What the client will see: a picture of the page, not a page to click in. */
.publish-see { flex: 1 1 340px; max-width: 420px; min-width: 0; }
.publish-see .thumb { height: 460px; background: #fff; }
.publish-see .thumb .preview-frame { pointer-events: none; }
.publish-see .thumb .empty { height: 100%; display: grid; place-items: center; }
.publish-see .btn-link:disabled { color: var(--placeholder); cursor: default; text-decoration: none; }

/* ------------------------------------------------------------- quick quote
   The quote builder is now a column, not a sidebar: the deal along the top,
   Add an option as a wide card, then the quote's own card with its two
   settings as chips in its header. The table itself keeps its own look. */
.quote-form { width: auto; }
.quote-form .tool-row .quote-input { flex: 1; min-width: 0; width: auto; text-align: left; }
.quote-form .tool-row input.num { width: 96px; }
.deal-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 26px; padding: 12px 18px; }
.deal-item { display: flex; align-items: center; gap: 10px; }
.deal-item > label, .deal-item > span { font-size: 13.5px; color: var(--ink-2); white-space: nowrap; }
.deal-item select { height: 36px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 10px; background: var(--surface); }
.add-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; }
/* Beside the sidebar in a window under about 1080px, four boxes across leave
   "Your own row" no room to type in. */
@media (max-width: 1080px) { .add-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.add-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding-top: 12px; border-top: 1px solid var(--line-2);
}
.prop-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding-top: 12px;
  border-top: 1px solid var(--line-2); font-size: 14px;
}
.prop-line b { font-size: 13.5px; }
.prop-line .prop-val { color: var(--ink-2); }
.quote-input { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 11px; background: var(--surface); }
.quote-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.quote-stacked { display: flex; flex-direction: column; gap: 6px; color: var(--ink-2); }
.quote-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.quote-actions select { height: 38px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 10px; background: var(--surface); }
.quote-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--line-2);
}
.quote-frame-wrap { margin: 16px 18px 0; padding: 20px; border-radius: 12px; background: var(--hover); display: flex; justify-content: center; }
/* The client's page at its own 1100px width (.preview-frame), scaled to the
   card by the screen code, so the table keeps the look it is sent with. It
   starts 900px tall and the screen code grows it to the page's own height. */
.quote-frame { height: 900px; border: 0; }
/* The quote's card lets a chip's pop-up hang past its bottom edge. */
.quote-card { overflow: visible; }
/* In this quote: one removable pill per option, a row per table, the pills
   wrapping beside the row's name rather than under it */
.quote-options { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
.quote-options > .sub-head { flex: none; min-width: 92px; margin: 0; line-height: 30px; }
.quote-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1 1 320px; min-width: 0; min-height: 30px; }
.quote-option {
  display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 4px 0 12px; max-width: 100%;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13px;
}
.quote-option.is-on { border-color: var(--accent); background: var(--accent-soft); }
.quote-option-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote-option-actions { display: flex; gap: 2px; flex-shrink: 0; }
.quote-option-actions .btn:disabled { background: none; border-color: transparent; }
.quote-table-head { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-top: 6px; }
table.quote-sent { width: 100%; border-collapse: collapse; }
table.quote-sent td { padding: 8px 10px; border-top: 1px solid var(--line-2); }
table.quote-sent tr:first-child td { border-top: 0; }
table.quote-sent tr.is-on td { background: var(--accent-soft); }
table.quote-sent td.actions { text-align: right; white-space: nowrap; }
/* Before the first option: a faint outline of the table and three tips */
.ghost-table {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 12px 18px; padding: 18px;
  border: 1px dashed var(--line); border-radius: 12px; background: #FAFBFC;
}
.ghost-table span { display: block; height: 10px; border-radius: 5px; background: #E3E8EC; }
.ghost-table span.is-head { height: 14px; background: #D9E1E7; }
.tips { display: flex; flex-direction: column; gap: 12px; }
.tip { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.5; }
.tip .tip-n {
  width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 600;
}

/* ------------------------------------------------------ NEW · calculator */
.solve-row {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) 210px; align-items: center; gap: 10px;
  min-height: 50px; padding: 0 20px; border-top: 1px solid var(--line-2);
}
.solve-row.is-solving { background: #F7FAFC; }
.solve-row input[type="radio"] { width: 18px; height: 18px; margin: 0; cursor: pointer; }
.solve-row input.cell { height: 38px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.solve-row.is-solving input.cell, .solve-row .is-answer {
  border-color: transparent; background: var(--computed); font-weight: 600; color: var(--ink);
}
.solve-tag {
  margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft);
  color: var(--accent); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.answer { display: flex; flex-direction: column; gap: 12px; padding: 20px; border-radius: 12px; background: var(--hover); }
.answer.is-waiting { background: #FAFBFC; border: 1px dashed var(--line); }
.answer-key { font-size: 13px; color: var(--ink-3); }
.answer-big, .answer .big { font-size: 34px; font-weight: 600; letter-spacing: -0.02em; }
.answer-line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line-2); }
.answer-line > :first-child { color: var(--ink-2); }
.answer-line > :last-child { font-weight: 500; }
.room-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; }
.room-group { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.room-group h3 { font-size: 12.5px; color: var(--ink-2); }
/* NEW · label on the left, box on the right */
.room-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.room-row > span:first-child { font-size: 14px; }
.room-row .box { width: 150px; flex: none; }

/* -------------------------------------------------------- NEW · settings */
.settings-layout { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 24px; }
.subnav { flex: 1 1 190px; max-width: 220px; position: sticky; top: 20px; display: flex; flex-direction: column; gap: 2px; }
.subnav a {
  display: flex; align-items: center; height: 36px; padding: 0 12px; border-radius: var(--radius);
  font-weight: 500; color: var(--ink-2); text-decoration: none;
}
.subnav a:hover { background: var(--surface); color: var(--ink); }
.subnav a.is-on { background: var(--accent-soft); color: var(--accent); }
.settings-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
/* NEW · two columns that drop to one in a narrow window */
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px 24px; }
.footer-preview { padding: 12px 14px; border-radius: 10px; background: var(--hover); font-size: 13.5px; line-height: 1.5; }
.footer-preview .label { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-bottom: 4px; }
.rule-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; border-top: 1px solid var(--line-2); }
.rule-row select { width: 170px; height: 36px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 10px; background: var(--surface); }
/* The system's own rule, under the name of a kind of debt you have changed. */
.rule-row .rule-default { display: block; font-size: 12px; color: var(--ink-3); }
/* The key to the cells. .stripe-key keeps working; the sample cell is new. */
.stripe-key { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line-2); }
.stripe-key i { width: 3px; height: 16px; border-radius: 2px; display: inline-block; }
.key-sample {
  display: flex; align-items: center; justify-content: flex-end; height: 34px; padding: 0 10px;
  border: 1px solid transparent; border-radius: 7px; font-size: 14px;
}
.key-sample.is-typed { background: var(--surface); border-color: var(--line); }
.key-sample.is-pulled { background: var(--surface); border-color: var(--line); box-shadow: inset 3px 0 0 var(--pulled); }
/* White, not grey: an edited cell is something you typed (a white box on the
   board, plain on Client's tables). Grey is kept for calculated, and a grey
   sample here taught that an edited figure was a calculated one. */
.key-sample.is-edited { background: var(--surface); border-color: var(--line); box-shadow: inset 3px 0 0 var(--edited); }
.key-sample.is-computed { background: var(--computed); }
.key-sample.is-needed { justify-content: flex-start; color: var(--placeholder); border: 1px dashed var(--needed); }
.about-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; margin: 0; }
.about-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line-2); }
.about-list dt { color: var(--ink-3); }
.about-list dd { margin: 0; font: 500 13px var(--mono); }

/* -------------------------------------------------------------------- menu */
.menu-pop {
  position: fixed; z-index: 80; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow-pop); padding: 4px; min-width: 200px;
}
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: 0; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer;
}
.menu-item:hover { background: var(--accent-soft); }
.menu-item:disabled { color: var(--placeholder); background: none; cursor: default; }
.menu-item.is-danger { color: var(--refuse); }
.menu-item.is-danger:hover { background: var(--refuse-soft); }
.menu-sep { height: 1px; background: var(--line-2); margin: 4px 2px; }
.menu-label { padding: 6px 10px 2px; font-size: 12px; color: var(--ink-3); }

/* ------------------------------------------------------------------ dialog */
.dialog {
  border: 1px solid var(--line); border-radius: var(--radius-card); padding: 0; max-width: 860px; width: 92vw;
  max-height: 84vh; color: var(--ink); background: var(--surface); box-shadow: var(--shadow-pop);
}
.dialog::backdrop { background: rgba(46, 54, 79, 0.35); }
.dialog-head { padding: 16px 20px; border-bottom: 1px solid var(--line-2); font-weight: 600; font-size: 16px; }
.dialog-body { padding: 16px 20px; overflow: auto; max-height: 56vh; }
.dialog-foot { padding: 12px 20px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; justify-content: flex-end; }
.diff-list { list-style: none; margin: 0; padding: 0; }
.diff-list li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.diff-path { flex: 1; color: var(--ink-2); }
.diff-before { color: var(--refuse); }
.diff-after { color: var(--accent); }
.diff-kept { color: var(--ink-3); font-size: 12px; }
.dialog.is-wide { max-width: 1280px; width: 96vw; }
.dialog.is-wide .dialog-body { max-height: 66vh; }
.crm-gaps { margin-bottom: 14px; }
.crm-gap-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; }
.crm-review h2 { margin-bottom: 2px; }
.crm-line { color: var(--ink-2); margin-bottom: 4px; }
.crm-section h3 { margin: 14px 0 6px; }
.crm-table-wrap { overflow-x: auto; }
.crm-table { border-collapse: collapse; font-size: 12.5px; line-height: 1.35; }
.crm-table th, .crm-table td { border: 1px solid var(--line); padding: 4px 8px; vertical-align: top; text-align: left; }
.crm-table thead th { background: var(--line-2); font-weight: 600; white-space: nowrap; }
.crm-table .crm-label { background: var(--computed); font-weight: 600; min-width: 140px; max-width: 260px; }
.crm-table td { min-width: 90px; max-width: 280px; }
.crm-list { margin: 0; padding-left: 22px; }
.crm-list li { min-height: 1.45em; }
.crm-status { margin-right: auto; align-self: center; font-size: 12.5px; color: var(--ink-2); }
.crm-status.is-ok { color: var(--accent); }
.crm-status.is-warn { color: var(--notice); }
.crm-status.is-bad { color: var(--refuse); }

/* --------------------------------------------------------------- messages */
.explain { padding: 22px 26px; line-height: 1.6; max-width: 720px; }
.is-refuse-text { color: var(--refuse); }
.is-notice-text { color: var(--notice); }

/* A cell that carries a menu keeps both inside the td. THE BOX IS FULL WIDTH
   and the ⋯ sits over its left end, where a right-aligned figure never is: a
   button beside the box made Down payment and the caps 30px shorter than every
   other box in the column, and their figures stopped lining up (Tim, 2026-11-07). */
.cell-with-menu { position: relative; display: flex; align-items: center; }
.cell-with-menu .cell { flex: 1; min-width: 0; padding-left: 32px; }
.cell-with-menu .btn {
  position: absolute; left: 3px; top: 50%; transform: translateY(-50%);
  height: 24px; padding: 0 4px; opacity: 0;
}
td:hover .cell-with-menu .btn, .cell-with-menu .cell:focus + .btn, .cell-with-menu .btn:focus { opacity: 1; }
.cell-action { margin-left: 6px; }

.field-notice { background: var(--notice-soft); border-radius: 8px; padding: 8px; margin: -8px; }
.field .note.is-notice-text { color: var(--notice); }

table.codes { border-collapse: collapse; font-size: 13px; }
table.codes th { text-align: left; font-weight: 500; color: var(--ink-3); padding: 6px 14px 6px 0; border-bottom: 1px solid var(--line); }
table.codes td { padding: 6px 14px 6px 0; border-bottom: 1px solid var(--line-2); color: var(--ink); }
table.codes td.num { font-variant-numeric: tabular-nums; }
table.codes tr.is-removed td { color: var(--placeholder); }

td.has-flag { position: relative; }
td.has-flag::after {
  content: ""; position: absolute; top: 4px; right: 4px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--notice);
}

.share-list { list-style: none; margin: 0; padding: 0; }
.share-person { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.share-pick { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.share-sub { margin: 14px 0 4px; }
.share-foot { margin-top: 10px; }

.hold-banner {
  display: flex; align-items: center; gap: 12px; padding: 10px 32px;
  background: var(--notice-soft); border-bottom: 1px solid var(--line);
}
.screen.is-readonly input[readonly], .screen.is-readonly textarea[readonly], .screen.is-readonly select:disabled { opacity: 0.75; }

/* Narrow windows: the sidebar stacks on top, toolbars wrap, wide tables scroll
   in their own boxes (they already do). */
@media (max-width: 860px) {
  .filebar, .page-head, .home-top { padding-left: 16px; padding-right: 16px; }
  .wrap { padding-left: 16px; padding-right: 16px; }
  .add-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .room-grid { grid-template-columns: minmax(0, 1fr); }
  .subnav { position: static; max-width: none; flex-direction: row; flex-wrap: wrap; }
}
