/*
  Visual language, taken from the three reference screens.

  What those screens actually share, underneath the subject matter: a warm
  neutral canvas rather than white; content in white cards that float on soft
  wide shadows instead of sitting inside borders; large radii everywhere and
  pill shapes for anything small; one black element per screen carrying the
  emphasis; a single restrained accent; big numerals with small grey labels
  under them; and dashed borders to mark something that is suggested rather
  than settled.

  The last one is the reason this reads as more than a repaint. In the journey
  screen a dashed lilac card means "generated, not confirmed". Here it means a
  value the supplier has priced nowhere — an option that exists, can be chosen,
  and stops the quotation going out until someone settles it. Same signal,
  earned rather than borrowed.

  The density is not the references' density. Those screens carry eight
  elements; a quotation carries a hundred and fifty-eight rows. So the language
  is applied at the scale this tool needs: the radii and shadows and the black
  emphasis stay, the whitespace is compressed where a table has to stay
  readable, and nothing that was legible before has been traded for air.
*/

:root {
  /* surfaces */
  --canvas: #efeeec;
  --surface: #ffffff;
  --surface-2: #f7f6f4;
  --surface-3: #edebe8;
  --surface-ink: #17181b;
  --surface-ink-2: #24262b;

  /* ink */
  --ink: #16171a;
  --ink-2: #5e6166;
  --ink-3: #63676e;   /* was #9a9ea6 — 2.35:1 on the canvas, which fails AA at 11px */
  --ink-on-dark: #ffffff;
  --ink-on-dark-2: rgba(255, 255, 255, 0.62);

  --hairline: rgba(18, 19, 23, 0.07);
  --hairline-2: rgba(18, 19, 23, 0.13);

  /* The studio's mark on a client document. Separate from --accent, which
     means "look at this". */
  --brandmark: #6e1a20;

  /* the one accent, used for attention and nothing else */
  --accent: #d99228;
  --accent-soft: #fdf4e4;
  --held: #8b5cf6;
  --held-soft: #f6f1ff;

  /* margin scale — the only place saturated colour carries meaning */
  --m-negative: #cf4141;
  --m-thin: #d99228;
  --m-healthy: #2f8f5b;
  --m-strong: #17714a;

  --shadow-card: 0 1px 2px rgba(16, 17, 20, .04), 0 10px 26px -14px rgba(16, 17, 20, .12);
  --shadow-raised: 0 2px 6px rgba(16, 17, 20, .06), 0 22px 48px -22px rgba(16, 17, 20, .22);
  --shadow-sheet: 0 -8px 60px rgba(16, 17, 20, .18);
  --shadow-pop: 0 2px 8px rgba(16, 17, 20, .10);

  --r-xs: 8px;
  --r-sm: 12px;
  --r: 18px;
  --r-lg: 26px;
  --r-pill: 999px;

  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 36px;
  --s-7: 52px;

  --fs-xs: 11px;
  --fs-sm: 12.5px;
  --fs-md: 14px;
  --fs-lg: 17px;
  --fs-xl: 22px;
  --fs-2xl: 30px;

  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, "Helvetica Neue", Arial, sans-serif;
  --font-num: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --topbar-h: 60px;
  --totals-h: 62px;
  --side-w: 258px;
  --sum-w: 248px;   /* was 312px: the quotation gets the width back */
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.021em; }
p { margin: 0 0 var(--s-2); }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::placeholder { color: var(--ink-3); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: var(--r-xs); }

.num, .n { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.grow { flex: 1; }
.internal { }

/* ------------------------------------------------------------------ shell */

#app { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: var(--canvas); }
#app > .work3, #app > .work2 { flex: 1; min-height: 0; }
#app > .panel { flex: 1; min-height: 0; overflow-y: auto; }

/* Keep one screen-sized workspace. Focus and off-screen descendants must not
   scroll the document itself and leave the application cut off above a gap. */
@media screen {
  html, body { overflow: hidden; overscroll-behavior: none; }
  #app { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; }
  #app > .work3, #app > .work2 { overflow: hidden; }
}

.top {
  flex: none; height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--s-4);
  padding: 0 var(--s-4);
  background: var(--surface);
  box-shadow: 0 1px 0 var(--hairline);
  z-index: 40;
}
.mark { display: flex; align-items: baseline; gap: 6px; padding-right: var(--s-2); }
.mark b { font-size: var(--fs-lg); letter-spacing: -0.03em; position: relative; }
/* the single amber mark, the way the task screen dots its wordmark */
.mark b::after {
  content: ''; position: absolute; top: -1px; right: -6px;
  width: 5px; height: 5px; border-radius: 2px; background: var(--accent);
}
.mark span { font-size: var(--fs-sm); color: var(--ink-3); }
.spacer { flex: 0 1 var(--s-2); }

/* min-width:0 is what lets this shrink. Without it the strip stays at its
   content width on a phone and shoves the wordmark over the buttons. */
.views { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1 1 auto; }
.views::-webkit-scrollbar { display: none; }
.views button {
  border: 0; background: transparent; cursor: pointer; white-space: nowrap;
  padding: 7px var(--s-3); border-radius: var(--r-pill);
  font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px;
}
.views button:hover { background: var(--surface-2); color: var(--ink); }
.views button[aria-selected="true"] { background: var(--ink); color: var(--ink-on-dark); }
.badge {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: var(--r-pill);
  background: var(--m-negative); color: #fff; font-size: 10px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}
.views button[aria-selected="true"] .badge { background: var(--accent); color: var(--ink); }

.top label { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-sm); color: var(--ink-3); }
.top select {
  border: 1px solid var(--hairline-2); background: var(--surface); border-radius: var(--r-pill);
  padding: 5px var(--s-3); font-size: var(--fs-sm); color: var(--ink);
}
.hide-sm { display: flex; }

/* ----------------------------------------------------------------- layout */

.work3 { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr) var(--sum-w); min-height: 0; }
.work2 { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 0; }
.work3 > *, .work2 > * { min-height: 0; }
.mid { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }

.dochead {
  flex: none; display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s-4); padding: var(--s-5) var(--s-5) var(--s-3);
}
.dochead h1 { font-size: var(--fs-xl); }
.dochead .sub { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 2px; }
.facts { display: flex; gap: var(--s-2); flex: none; }

.tools {
  flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2);
  padding: 0 var(--s-5) var(--s-3);
}
.tools input[type=search] {
  flex: 1; min-width: 180px; max-width: 300px;
  border: 0; background: var(--surface); border-radius: var(--r-pill);
  padding: 9px var(--s-4); font-size: var(--fs-sm); box-shadow: var(--shadow-card);
}
.tools label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ink-3); }
.tools select, .bulk select {
  border: 0; background: var(--surface); border-radius: var(--r-pill);
  padding: 7px var(--s-3); font-size: var(--fs-sm); box-shadow: var(--shadow-card); cursor: pointer;
}
.count { font-size: var(--fs-xs); color: var(--ink-3); font-family: var(--font-num); margin-left: auto; }

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

.btn {
  border: 0; background: var(--surface); color: var(--ink); cursor: pointer;
  border-radius: var(--r-pill); padding: 8px var(--s-4);
  font-size: var(--fs-sm); font-weight: 500; box-shadow: var(--shadow-card);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { box-shadow: var(--shadow-pop); transform: translateY(-1px); }
.btn:active { transform: none; }
.btn.primary { background: var(--ink); color: var(--ink-on-dark); }
.btn.danger { color: var(--m-negative); }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--ink-on-dark); }
.btn:disabled { opacity: .4; cursor: default; box-shadow: none; transform: none; }
.btn.small { padding: 5px var(--s-3); font-size: var(--fs-xs); }
.btn.full { width: 100%; justify-content: center; }
.linkbtn { border: 0; background: transparent; color: var(--ink-2); cursor: pointer; padding: 0; font-size: var(--fs-xs); text-decoration: underline; text-underline-offset: 2px; }
.linkbtn:hover { color: var(--ink); }
.x {
  border: 0; background: transparent; color: var(--ink-3); cursor: pointer;
  width: 22px; height: 22px; border-radius: var(--r-pill); line-height: 1; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.x:hover { background: var(--surface-3); color: var(--m-negative); }

/* ------------------------------------------------------------- left rail */

.side { display: flex; flex-direction: column; min-height: 0; background: var(--canvas); padding: var(--s-3) var(--s-2) 0 var(--s-4); }
.sidehead {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  padding: var(--s-2) var(--s-2) var(--s-2);
}
.sidehead b { font-size: var(--fs-lg); letter-spacing: -0.025em; }
.sidehead .c { font-size: var(--fs-sm); color: var(--ink-3); font-family: var(--font-num); }
.sidesearch { padding: 0 var(--s-2) var(--s-2); }
.sidesearch input {
  width: 100%; border: 0; background: var(--surface); border-radius: var(--r-pill);
  padding: 9px var(--s-4); font-size: var(--fs-sm); box-shadow: var(--shadow-card);
}
.sidehint { padding: 0 var(--s-2) var(--s-3); margin: 0; font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.4; }
.sidepad { padding: var(--s-2); }
.sidelist { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: var(--s-6); }
.sidecat { margin-bottom: var(--s-3); }
.sidecathead {
  padding: var(--s-2) var(--s-2) var(--s-1);
  font-size: 10px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3);
}
.scopepill {
  display: flex; width: 100%; gap: var(--s-2); align-items: flex-start; text-align: left;
  border: 0; background: transparent; cursor: grab; font: inherit;
  padding: 9px var(--s-3); border-radius: var(--r-sm); color: var(--ink); font-size: var(--fs-sm);
  margin-bottom: 1px;
}
.scopepill:hover { background: var(--surface); box-shadow: var(--shadow-card); }
.scopepill:active { cursor: grabbing; }
.scopepill.flat { cursor: pointer; }
.scopepill.on { background: var(--ink); color: var(--ink-on-dark); box-shadow: var(--shadow-pop); }
.scopepill.on .meta { color: var(--ink-on-dark-2); }
.scopepill .grip { color: var(--ink-3); opacity: .5; line-height: 1.3; flex: none; }
.scopepill .n { flex: 1; min-width: 0; }
.scopepill .meta { display: block; font-size: var(--fs-xs); color: var(--ink-3); font-family: var(--font-num); margin-top: 1px; }
.filebtn {
  display: inline-block; background: var(--surface); border-radius: var(--r-pill);
  padding: 8px var(--s-4); font-size: var(--fs-sm); cursor: pointer; box-shadow: var(--shadow-card);
}
.filebtn input { display: none; }

/* --------------------------------------------------------- bulk selection */

.bulk {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2);
  width: 100%; margin-top: var(--s-2); padding: var(--s-2) var(--s-3);
  background: var(--ink); border-radius: var(--r-pill); font-size: var(--fs-sm);
}
.bulk b { color: var(--ink-on-dark); padding-left: var(--s-2); }
.bulk select, .bulk .btn { box-shadow: none; }
.bulk .btn { background: rgba(255, 255, 255, .12); color: var(--ink-on-dark); }
.bulk .btn:hover { background: rgba(255, 255, 255, .2); }
.bulk .btn.danger { color: #ff9b9b; }
.bulk select { background: rgba(255, 255, 255, .12); color: var(--ink-on-dark); }
.bulk select option { color: var(--ink); }

/* --------------------------------------------------------------- sections */

.sheetbody { padding: 0 var(--s-5) var(--s-7); }
.grp { margin-bottom: var(--s-7); border-radius: var(--r-lg); transition: background .12s, outline-color .12s; }
.grp.dropping { outline: 2px dashed var(--ink); outline-offset: var(--s-3); background: rgba(255, 255, 255, .5); }
.grphead { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); padding: 0 var(--s-1) var(--s-3); }
.kicker { font-size: 10px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.grphead h2 { font-size: var(--fs-2xl); letter-spacing: -0.03em; line-height: 1.08; margin-top: 3px; }
.grpfigs { text-align: right; flex: none; }
.grpfigs .amt { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.02em; }
.grpfigs .meta { font-size: var(--fs-xs); color: var(--ink-3); font-family: var(--font-num); }
.grpnote {
  display: block; width: 100%; margin: 0 0 var(--s-3);
  border: 0; background: transparent; border-radius: var(--r-sm);
  padding: 6px var(--s-3); font-size: var(--fs-sm); color: var(--ink-2); font-family: inherit;
}
.grpnote:hover { background: rgba(255, 255, 255, .6); }
.grpnote:focus { background: var(--surface); box-shadow: var(--shadow-card); outline: none; }
.grpnotetext { font-size: var(--fs-sm); color: var(--ink-2); margin: 0 0 var(--s-3); padding: 0 var(--s-3); }
.asms { display: flex; flex-direction: column; gap: var(--s-2); }
.addhere {
  margin-top: var(--s-2); border: 1px dashed var(--hairline-2); background: transparent;
  border-radius: var(--r); padding: var(--s-3) var(--s-4); width: 100%;
  color: var(--ink-3); cursor: pointer; font: inherit; font-size: var(--fs-sm); text-align: left;
}
.addhere:hover { border-color: var(--ink); color: var(--ink); background: rgba(255, 255, 255, .55); }
.subhead { font-weight: 600; font-size: var(--fs-sm); color: var(--ink-2); padding: var(--s-3) var(--s-3) var(--s-1); }
.empty { color: var(--ink-3); padding: var(--s-7); text-align: center; }

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

.asm {
  display: flex; background: var(--surface); border-radius: var(--r);
  box-shadow: var(--shadow-card); overflow: hidden;
}
.asm:hover { box-shadow: var(--shadow-pop); }
.asm.open { box-shadow: var(--shadow-raised); }
.asm.sel { outline: 2px solid var(--ink); outline-offset: -2px; }
.asm .stripe { width: 4px; flex: none; align-self: stretch; margin: var(--s-3) 0 var(--s-3) var(--s-3); border-radius: var(--r-pill); }
.asm .stripe.none { background: var(--surface-3); }
.asm .stripe.negative { background: var(--m-negative); }
.asm .stripe.thin { background: var(--m-thin); }
.asm .stripe.healthy { background: var(--m-healthy); }
.asm .stripe.strong { background: var(--m-strong); }
.asmmain { flex: 1; min-width: 0; }
.asmtop { display: flex; gap: var(--s-3); align-items: center; cursor: pointer; padding: var(--s-3) var(--s-4); }
.asmtop > input[type=checkbox] { flex: none; width: 16px; height: 16px; accent-color: var(--ink); }
.asmname { flex: 1; min-width: 0; }
.asmname .nm { font-weight: 600; font-size: var(--fs-md); display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; letter-spacing: -0.012em; }
.modcount {
  font-weight: 500; font-size: 10px; font-family: var(--font-num);
  color: var(--ink-2); background: var(--surface-2); border-radius: var(--r-pill); padding: 2px 8px;
}
.asmname .sd { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 2px; white-space: pre-line; }
.asmname .bd { display: flex; flex-wrap: wrap; gap: var(--s-1); margin-top: 6px; }
.asmfigs {
  display: flex; align-items: center; gap: var(--s-3); flex: none; white-space: nowrap;
  font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--fs-sm);
}
.asmfigs > span { white-space: nowrap; }
.asmfigs .x { color: var(--ink-3); width: auto; height: auto; }
.asmfigs .q, .asmfigs .r { color: var(--ink-2); }
/* big numeral, small label — the pattern every reference screen uses */
.asmfigs .a { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -0.02em; min-width: 104px; text-align: right; }
.asmfigs .m { min-width: 56px; text-align: right; font-size: var(--fs-xs); }
.asmfigs .chev {
  width: 26px; height: 26px; border-radius: var(--r-pill); background: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); font-size: 10px;
}
.ed { border-radius: var(--r-xs); padding: 1px 4px; cursor: text; }
.ed:hover, .ed:focus { background: var(--surface-2); outline: none; }
input.cell {
  font-family: var(--font-num); width: 92px; text-align: right;
  border: 0; border-radius: var(--r-xs); padding: 2px 6px; background: var(--surface-3);
}

/* -------------------------------------------------------------- open card */

.asmopen { border-top: 1px solid var(--hairline); background: var(--surface-2); }
.variants { padding: var(--s-4); }
.variants .f, .card2 .f { margin-bottom: var(--s-3); }
.variants label, .card2 .f > label { display: block; font-size: var(--fs-xs); color: var(--ink-3); margin-bottom: 4px; }
.variants input, .variants select, .variants textarea,
.card2 input, .card2 select, .card2 textarea {
  width: 100%; border: 0; border-radius: var(--r-sm); background: var(--surface);
  padding: 8px var(--s-3); font-size: var(--fs-sm); box-shadow: inset 0 0 0 1px var(--hairline);
}
.variants input:focus, .variants select:focus, .variants textarea:focus,
.card2 input:focus, .card2 select:focus, .card2 textarea:focus { box-shadow: inset 0 0 0 1.5px var(--ink); outline: none; }
.variants textarea, .card2 textarea { resize: vertical; }
.vrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: var(--s-3); }
.hint { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 4px; }
.note { background: var(--accent-soft); color: #7a5312; font-size: var(--fs-xs); padding: var(--s-3); border-radius: var(--r-sm); margin-bottom: var(--s-3); }

.subs { padding: 0 var(--s-4) var(--s-4); }
.subshead { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--s-2); font-size: var(--fs-sm); }
.subshead b { letter-spacing: -0.012em; }
.subshead span { font-family: var(--font-num); color: var(--ink-2); }
.subs .row { display: flex; gap: var(--s-2); margin-top: var(--s-3); }

.asmmoney {
  display: flex; flex-wrap: wrap; gap: var(--s-5); padding: var(--s-4);
  background: var(--surface); border-top: 1px solid var(--hairline);
}
.asmmoney > div { display: flex; flex-direction: column; }
.asmmoney span { font-size: var(--fs-xs); color: var(--ink-3); }
.asmmoney b { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--fs-md); font-weight: 600; }
.asmacts {
  display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center;
  padding: var(--s-3) var(--s-4); background: var(--surface); border-top: 1px solid var(--hairline);
}
.asmacts .k { font-size: var(--fs-xs); color: var(--ink-3); }
.asmacts .row { display: flex; gap: 4px; }

/* ------------------------------------------------------------- slot grid */

.slotgrid { border-radius: var(--r); overflow: hidden; background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline); }
.slothead, .slotrow {
  display: grid;
  grid-template-columns: minmax(120px, 1.25fr) minmax(150px, 1.5fr) 76px minmax(104px, 1fr) 84px 84px 96px 40px;
  gap: var(--s-2); align-items: center; padding: 9px var(--s-3);
  font-size: var(--fs-sm);
}
.slothead {
  background: var(--surface-2);
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 650;
}
.slotrow { border-top: 1px solid var(--hairline); opacity: .5; }
.slotrow.on, .slotrow.main { opacity: 1; }
.slotrow.main { background: var(--surface-2); font-weight: 600; border-top: 0; }
/* dashed and tinted, the way the reference marks something not yet settled */
.slotrow.held {
  opacity: 1; background: var(--held-soft);
  box-shadow: inset 0 0 0 1.5px var(--held); border-radius: var(--r-sm);
  border-top-color: transparent;
}
.slotrow.held .lb, .slotrow.held .vl select { color: #5b21b6; }
.slotrow .lb { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.slotrow .vl { min-width: 0; }
.slotrow .n { font-family: var(--font-num); font-variant-numeric: tabular-nums; text-align: right; color: var(--ink-2); }
.slotrow .n.b { color: var(--ink); font-weight: 600; }
.slothead .n { text-align: right; }
.slotrow select, .slotrow input[type=text] {
  width: 100%; border: 0; border-radius: var(--r-xs); background: transparent;
  padding: 3px 6px; font-size: var(--fs-sm); color: inherit;
}
.slotrow .n input[type=text] { text-align: right; font-family: var(--font-num); }
.slotrow select:hover, .slotrow input[type=text]:hover { background: var(--surface-2); }
.slotrow select:focus, .slotrow input[type=text]:focus { background: var(--surface); box-shadow: 0 0 0 1.5px var(--ink); outline: none; }
.slotrow .why {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: var(--r-pill); background: var(--surface-3);
  font-size: 9px; color: var(--ink-2); cursor: help;
}

.optblock { margin-top: var(--s-3); }
.optblock details { border-radius: var(--r-sm); margin-bottom: var(--s-1); background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline); }
.optblock summary { padding: 9px var(--s-3); cursor: pointer; font-size: var(--fs-sm); list-style: none; }
.optblock summary::-webkit-details-marker { display: none; }
.optblock summary::before { content: '＋ '; color: var(--ink-3); }
.optblock details[open] summary::before { content: '－ '; }
.optlist { padding: 0 var(--s-3) var(--s-3); }
.optrow { display: grid; grid-template-columns: minmax(140px, 1.6fr) 88px 88px minmax(0, 2fr) 24px; gap: var(--s-2); align-items: center; padding: 3px 0; }
.optrow.held { color: #5b21b6; }
.optrow input { border: 0; border-radius: var(--r-xs); padding: 4px var(--s-2); font-size: var(--fs-sm); background: var(--surface-2); }
.optrow input:nth-child(2), .optrow input:nth-child(3) { text-align: right; font-family: var(--font-num); }
.onote { font-size: var(--fs-xs); color: var(--ink-3); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ tags */

.tag {
  display: inline-flex; align-items: center; font-size: 10px; font-weight: 500;
  padding: 2px 8px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink-2);
}
.tag.warn { background: var(--accent-soft); color: #8a5b13; }
.tag.t { background: var(--ink); color: var(--ink-on-dark); }
.tagwrap { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.tagchip {
  border: 0; background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline);
  border-radius: var(--r-pill); padding: 4px var(--s-3); font-size: var(--fs-xs);
  cursor: pointer; color: var(--ink-2);
}
.tagchip.on { background: var(--ink); color: var(--ink-on-dark); box-shadow: none; }
.tagchip:disabled { opacity: .45; cursor: default; }

/* --------------------------------------------------------- summary column */

.summary { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: var(--s-3) var(--s-4) var(--s-6) var(--s-2); gap: var(--s-2); }
.sumblock { background: var(--surface); border-radius: var(--r); padding: var(--s-4); box-shadow: var(--shadow-card); }
/* the one black element: contract value, the way the reference screens give
   a single card the emphasis and leave the rest quiet */
.sumblock.grand-card { background: var(--surface-ink); color: var(--ink-on-dark); box-shadow: var(--shadow-raised); }
.sumblock.grand-card .sline span { color: var(--ink-on-dark-2); }
.sumblock.grand-card .sline b { color: var(--ink-on-dark); }
.sumblock.grand-card .sline.grand { border-top-color: rgba(255, 255, 255, .16); }
/* At 312px a 30px numeral and its label cannot share a line, so the label
   goes above it — which is the references' pattern anyway. */
.sumblock.grand-card .sline.grand { flex-direction: column; align-items: flex-start; gap: 2px; }
.sumblock.grand-card .sline.grand span { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: rgba(255, 255, 255, .45); }
.sumblock.grand-card .sline.grand b { font-size: var(--fs-2xl); letter-spacing: -0.03em; line-height: 1.1; }
.sumblock.grand-card .sublabel { color: rgba(255, 255, 255, .45); }
.sumblock.internal { background: var(--accent-soft); }
.sublabel { font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-bottom: var(--s-2); }
.sline { display: flex; justify-content: space-between; gap: var(--s-2); font-size: var(--fs-sm); padding: 3px 0; }
.sline span { color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sline b { font-family: var(--font-num); font-variant-numeric: tabular-nums; flex: none; }
.sline.grand { border-top: 1px solid var(--hairline); margin-top: var(--s-2); padding-top: var(--s-3); align-items: baseline; }
.sline.grand span { color: var(--ink); }
.sline.grand b { font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.02em; }
.sumnote { font-size: var(--fs-xs); color: var(--ink-3); margin-top: var(--s-2); line-height: 1.45; }
.sumblock.internal .sumnote { color: #8a6a30; }
.sumbars { display: flex; flex-direction: column; gap: 2px; }
/* the day-selector blobs, restated as filter rows */
.sumbar {
  position: relative; display: flex; justify-content: space-between; gap: var(--s-2);
  border: 0; background: transparent; cursor: pointer; text-align: left; font: inherit;
  font-size: var(--fs-sm); padding: 6px var(--s-3) 9px; border-radius: var(--r-sm); color: var(--ink);
}
.sumbar:hover { background: var(--surface-2); }
.sumbar.on { background: var(--ink); color: var(--ink-on-dark); }
.sumbar .l { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sumbar .v { font-family: var(--font-num); font-variant-numeric: tabular-nums; flex: none; }
.sumbar i { position: absolute; left: var(--s-3); bottom: 4px; height: 2px; border-radius: var(--r-pill); background: var(--ink); opacity: .18; }
.sumbar.on i { background: var(--accent); opacity: 1; }

/* ---------------------------------------------------------------- totals */

.totals {
  flex: none; height: var(--totals-h); display: flex; align-items: center; gap: var(--s-5);
  padding: 0 var(--s-5); background: var(--surface); box-shadow: 0 -1px 0 var(--hairline); overflow-x: auto;
}
.totals .t { display: flex; flex-direction: column; flex: none; }
.totals .k { font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.totals .v { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.02em; }
.totals .t.internal .k { color: #a8802f; }
.li-card[data-client-hidden="true"] { border-style: dashed; }
.li-visibility { min-height: 36px; white-space: nowrap; }
@media (max-width: 600px) {
  .totals { height: auto; min-height: var(--totals-h); display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; padding: 10px 16px; }
  .totals .grow, .totals > .t:last-child { display: none; }
  .totals .v { font-size: 16px; }
}

/* --------------------------------------------------------------- panels */

.panel { padding: var(--s-5) var(--s-5) var(--s-7); max-width: 880px; }
/* A wide panel is a dashboard, not an article. It was capped at 1180px and
   pinned to the left edge, so a 1920px screen showed 740px of nothing down the
   right-hand side. It now uses the width it is given, with a ceiling only
   where lines of running text would otherwise become unreadable, and it is
   centred rather than hugging one edge. */
.panel.wide { max-width: min(1680px, 100%); margin-inline: auto; width: 100%; }
.panel.wide > p { max-width: 76ch; }
.panel h2 { font-size: var(--fs-xl); margin-bottom: var(--s-2); }
.panel h3 { font-size: var(--fs-lg); margin: var(--s-6) 0 var(--s-3); }
.panel > p { color: var(--ink-2); max-width: 68ch; }

.card { background: var(--surface); border-radius: var(--r); padding: var(--s-4); box-shadow: var(--shadow-card); margin-bottom: var(--s-2); }
.card h4 { font-size: var(--fs-md); margin-bottom: 4px; }
.card p { font-size: var(--fs-sm); color: var(--ink-2); margin: 0; }
.card.risk { background: #fdf0f0; }
.card.check { background: var(--accent-soft); }
.card.note { background: var(--surface); }
.card2 { background: var(--surface); border-radius: var(--r); padding: var(--s-5); margin-bottom: var(--s-3); box-shadow: var(--shadow-card); }
.card2 h3 { margin: 0 0 var(--s-3); font-size: var(--fs-lg); display: flex; gap: var(--s-2); align-items: baseline; }
.card2 h3 .c { font-family: var(--font-num); color: var(--ink-3); font-weight: 400; font-size: var(--fs-sm); }
.card2 .muted { font-size: var(--fs-sm); margin: 0 0 var(--s-3); max-width: 76ch; }
.card2 > .btn { margin-right: var(--s-2); }

.check { display: flex; gap: var(--s-3); padding: var(--s-3) 0; border-bottom: 1px solid var(--hairline); }
.check .dot { width: 9px; height: 9px; border-radius: var(--r-pill); margin-top: 6px; flex: none; }
.check .dot.PASS { background: var(--m-healthy); }
.check .dot.WARN { background: var(--accent); }
.check .dot.FAIL { background: var(--m-negative); }
.check .dot.NONE { background: var(--surface-3); }
.check .lbl { font-weight: 550; font-size: var(--fs-sm); }
.check .det { font-size: var(--fs-sm); color: var(--ink-2); }

/* ------------------------------------------------------------------ P&L */

.plsum { display: flex; flex-wrap: wrap; gap: var(--s-6); margin-bottom: var(--s-5); }
.plsum > div { display: flex; flex-direction: column; }
.plsum .k { font-size: var(--fs-xs); color: var(--ink-3); }
.plsum b { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.02em; }
.plgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: var(--s-3); }
.pl { background: var(--surface); border-radius: var(--r); padding: var(--s-4); box-shadow: var(--shadow-card); }
.plhead { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--fs-sm); }
.plhead b { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--fs-md); }
.plbar { position: relative; height: 8px; margin: var(--s-3) 0; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; }
.plbar i { position: absolute; left: 0; top: 0; height: 100%; display: block; border-radius: var(--r-pill); }
.plbar i.sell { background: var(--ink); opacity: .16; }
.plbar i.cost { background: var(--ink); }
.plfoot { display: flex; justify-content: space-between; gap: var(--s-2); font-size: var(--fs-xs); color: var(--ink-3); }

/* ------------------------------------------------------------- templates */

.tplgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(292px, 1fr)); gap: var(--s-3); }
.tpl { background: var(--surface); border-radius: var(--r); padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-2); box-shadow: var(--shadow-card); }
.tpl h4 { font-size: var(--fs-lg); }
.tpl p { margin: 0; font-size: var(--fs-sm); color: var(--ink-2); flex: 1; }
.tplmeta { display: flex; gap: var(--s-3); font-size: var(--fs-xs); color: var(--ink-3); font-family: var(--font-num); }
.tpl .btn { align-self: flex-start; }

.scopeblank { padding: var(--s-6) var(--s-5); max-width: 66ch; }
.scopeblank h2 { font-size: var(--fs-2xl); margin-bottom: var(--s-3); }
.scopeblank p { color: var(--ink-2); }
.scopestats { display: flex; flex-wrap: wrap; gap: var(--s-6); margin-top: var(--s-6); }
.scopestats > div { display: flex; flex-direction: column; }
.scopestats b { font-family: var(--font-num); font-size: var(--fs-2xl); letter-spacing: -0.03em; }
.scopestats span { font-size: var(--fs-xs); color: var(--ink-3); }
.scopepad { padding: 0 var(--s-5) var(--s-7); }
.preview { background: var(--surface-2); box-shadow: none; }
.pvline { display: flex; justify-content: space-between; gap: var(--s-4); padding-bottom: var(--s-3); border-bottom: 1px solid var(--hairline); }
.pvname { font-weight: 600; }
.pvname .sd { font-weight: 400; font-size: var(--fs-sm); color: var(--ink-2); white-space: pre-line; }
.pvfigs { display: flex; gap: var(--s-3); align-items: baseline; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--fs-sm); flex: none; }
.pvfigs b { font-size: var(--fs-lg); }
.pvmod { display: flex; justify-content: space-between; gap: var(--s-3); padding: 5px 0 5px var(--s-3); font-size: var(--fs-sm); font-family: var(--font-num); }
.pvmod.off { color: var(--ink-3); }

/* ----------------------------------------------------------------- plan */

.plan { position: relative; margin: 0 var(--s-5) var(--s-6); background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-card); overflow: hidden; }
.plan.arming { cursor: crosshair; box-shadow: 0 0 0 2px var(--ink), var(--shadow-raised); }
.plan img { display: block; width: 100%; }
.plansvg { display: block; width: 100%; height: auto; }
/* Both plans, the studio's and the client's.

   These named `.plansvg` only, and the client's copy is `.planart` \u2014 so its
   rooms had no fill rule and fell back to SVG's default, which is black. The
   client was sent a page of black rectangles. */
.plansvg .room, .planart .room { fill: var(--surface-2); stroke: var(--hairline-2); stroke-width: 2; rx: 10; }
.plansvg .room.on { fill: var(--surface-3); stroke: var(--ink); }
.plansvg .roomlabel, .planart .roomlabel { font: 650 15px var(--font-ui); fill: var(--ink-2); }
.plansvg .roomsum, .planart .roomsum { font: 13px var(--font-num); fill: var(--ink-3); }
/* Printed, the fills must not come out as grey blocks either. */
@media print {
  .planart .room { fill: #fff; stroke: #c9ccd2; }
  .planart .roomlabel { fill: #14161a; }
}
.pins { position: absolute; inset: 0; pointer-events: none; }
.pin { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; display: flex; align-items: center; gap: 6px; border: 0; background: transparent; cursor: pointer; padding: 0; }
.pin .dot { width: 12px; height: 12px; border-radius: var(--r-pill); background: var(--ink); box-shadow: 0 0 0 3px var(--surface); flex: none; }
.pin .lbl { background: var(--surface); border-radius: var(--r-pill); padding: 3px var(--s-3); font-size: var(--fs-xs); white-space: nowrap; box-shadow: var(--shadow-pop); }

/* --------------------------------------------------------- overlay sheet */

.overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(18, 19, 23, .42);
  display: flex; align-items: center; justify-content: center; padding: var(--s-5);
  backdrop-filter: blur(3px);
}
/* the reference's bottom sheet: heavy radius, lifted off a dimmed page */
.picker {
  width: min(720px, 100%); max-height: 82vh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-sheet); overflow: hidden;
}
.picker.narrow { width: min(480px, 100%); }
.nudge { border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 13px;
  padding: 2px 4px; border-radius: 4px; line-height: 1; }
.nudge:hover { background: var(--surface-2); color: var(--ink); }
.nudge.sectiondel:hover { color: #a3241d; }
.livehere.editing { color: #8a6a1f; }
.livehere.editing i { background: #8a6a1f; }
.picker .pad textarea.titlebox { width: 100%; font: inherit; resize: vertical; min-height: 58px; }
.subhead .ed { cursor: text; border-radius: 4px; padding: 1px 4px; margin: -1px -4px; }
.subhead .ed:hover { background: var(--surface-2); }
.subhead-edit { width: 100%; font: inherit; border: 0; background: var(--surface-2); border-radius: 6px; padding: 4px 8px; }
.subhead .subhead-x { visibility: hidden; margin-left: var(--s-2); }
.subhead:hover .subhead-x { visibility: visible; }
.addrow { display: flex; gap: var(--s-2); align-items: center; }
.addrow .addhere { flex: none; }
.picker header { display: flex; gap: var(--s-2); padding: var(--s-4); border-bottom: 1px solid var(--hairline); align-items: center; }
.picker header input {
  flex: 1; border: 0; background: var(--surface-2); border-radius: var(--r-pill);
  padding: 11px var(--s-4); font-size: var(--fs-md);
}
.picker header input:focus { outline: none; box-shadow: 0 0 0 1.5px var(--ink); }
.picker header b { font-size: var(--fs-lg); }
.picker .pad {
  padding: var(--s-5);
  /* the dialog caps at 82vh; on a short window a tall form (New project with
     its key-scope chips, Add somebody) was CLIPPED with no way to reach the
     buttons — the pad scrolls now, the header stays put */
  overflow-y: auto; min-height: 0;
}
.picker .pad .f { margin-bottom: var(--s-4); }
.picker .pad label { display: block; font-size: var(--fs-xs); color: var(--ink-3); margin-bottom: 4px; }
.picker .pad input, .picker .pad select {
  width: 100%; border: 0; background: var(--surface-2); border-radius: var(--r-sm); padding: 9px var(--s-3); font-size: var(--fs-sm);
}
.picker .row { display: flex; gap: var(--s-2); justify-content: flex-end; margin-top: var(--s-4); }
.pickernote { padding: var(--s-2) var(--s-4); font-size: var(--fs-xs); color: var(--ink-2); background: var(--surface-2); }
.pickfoot { padding: var(--s-3) var(--s-4); border-top: 1px solid var(--hairline); display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; font-size: var(--fs-sm); }
.list { flex: 1; min-height: 0; overflow-y: auto; padding: var(--s-2); }
.pick {
  display: flex; justify-content: space-between; gap: var(--s-4); align-items: center;
  padding: var(--s-3); border-radius: var(--r-sm); cursor: pointer;
}
.pick:hover, .pick[aria-selected="true"] { background: var(--surface-2); }
.pick.held { background: var(--held-soft); box-shadow: inset 0 0 0 1.5px var(--held); margin-bottom: 2px; }
.pick .n { font-size: var(--fs-sm); font-weight: 550; }
.pick .m { font-size: var(--fs-xs); color: var(--ink-3); font-family: var(--font-num); }
.pick .p { text-align: right; font-family: var(--font-num); font-size: var(--fs-sm); flex: none; }
.pick .p small { display: block; font-size: 10px; color: var(--ink-3); }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--totals-h) + var(--s-4));
  z-index: 300; background: var(--surface-ink); color: var(--ink-on-dark);
  padding: 10px var(--s-5); border-radius: var(--r-pill); font-size: var(--fs-sm); box-shadow: var(--shadow-raised);
}

/* ------------------------------------------------------------ client copy */

.exportbar { display: flex; gap: var(--s-5); align-items: flex-start; flex-wrap: wrap; margin-bottom: var(--s-4); }
.exportbar > div:first-child { flex: 1; min-width: 280px; }
.exportbar p { font-size: var(--fs-sm); color: var(--ink-2); max-width: 62ch; }
.exportbar .row { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.sheet { background: var(--surface); border-radius: var(--r-lg); padding: var(--s-6); box-shadow: var(--shadow-card); margin-top: var(--s-4); }
.sheet table { width: 100%; border-collapse: collapse; }
.sheet thead th { text-align: left; font-size: var(--fs-xs); color: var(--ink-3); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; padding: 0 var(--s-2) var(--s-2); border-bottom: 1px solid var(--hairline-2); }
.sheet thead th.num { text-align: right; }
.sheet td { padding: 9px var(--s-2); border-bottom: 1px solid var(--hairline); font-size: var(--fs-sm); vertical-align: top; }
.sheet td.num { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sheet tr.group td { background: var(--surface-2); font-weight: 650; font-size: var(--fs-md); padding-top: var(--s-4); }
.sheet tr.heading td { font-weight: 600; color: var(--ink-2); }
.sheet tr.mod td { border-bottom: 0; padding-top: 0; padding-bottom: 4px; color: var(--ink-2); }
.sheet tr.mod .desc { padding-left: var(--s-5); }
.branch { color: var(--ink-3); margin-right: 6px; }
.sheet .sub { font-size: var(--fs-xs); color: var(--ink-2); white-space: pre-line; }
.sheet .remark { font-size: var(--fs-xs); color: var(--ink-3); font-style: italic; }
.gnotetext { font-weight: 400; font-size: var(--fs-sm); color: var(--ink-2); margin-top: 2px; }
.printhead { display: none; }
.printtotals { margin: var(--s-5) 0 0 auto; max-width: 380px; }
.printtotals > div { display: flex; justify-content: space-between; padding: 4px var(--s-2) 4px 0; font-size: var(--fs-sm); }
.printtotals b { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.printtotals .grand { border-top: 1px solid var(--hairline-2); margin-top: var(--s-2); padding-top: var(--s-3); font-size: var(--fs-lg); font-weight: 650; }

/* ----------------------------------------------------------------- tests */

.runbar { display: flex; align-items: center; gap: var(--s-3); margin: var(--s-4) 0; }
.tally { font-family: var(--font-num); font-size: var(--fs-sm); padding: 5px var(--s-3); border-radius: var(--r-pill); }
.tally.ok { background: #e8f5ee; color: var(--m-strong); }
.tally.no { background: #fdecec; color: var(--m-negative); }
.tgroup { margin-bottom: var(--s-5); }
.tgroup h3 { font-size: var(--fs-md); margin: var(--s-4) 0 var(--s-2); }
.trow { display: flex; gap: var(--s-3); padding: 7px 0; border-bottom: 1px solid var(--hairline); font-size: var(--fs-sm); }
.st { font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: var(--r-pill); height: fit-content; flex: none; }
.st.ok { background: #e8f5ee; color: var(--m-strong); }
.st.no { background: #fdecec; color: var(--m-negative); }
.trow .det { color: var(--ink-3); font-size: var(--fs-xs); margin-top: 2px; }

/* ----------------------------------------------------------- margin scale */

.m-negative { color: var(--m-negative); }
.m-thin { color: var(--m-thin); }
.m-healthy { color: var(--m-healthy); }
.m-strong { color: var(--m-strong); }
.m-none { color: var(--ink-3); }

kbd { display: inline-block; background: var(--surface-2); border-radius: 5px; padding: 1px 6px; font-family: var(--font-num); font-size: 10px; margin-right: 4px; }

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

@media (min-width: 1280px) { #app > .work3 ~ .totals { display: none; } }
@media (max-width: 1279px) {
  .work3 { grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .work3 > .summary { display: none; }
}
@media (max-width: 900px) {
  /* Hiding the rail on a phone removed the only way to pick a subcontractor in
     the scope builder, and the only way to add scope to a quotation. It
     becomes a horizontal strip instead: same content, same order, reachable. */
  .work3, .work2 { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .work3 > .side, .work2 > .side {
    display: block; max-height: 168px; overflow: hidden;
    border-right: 0; border-bottom: 1px solid var(--hairline);
    padding: var(--s-2) var(--s-3) 0;
  }
  .side .sidehead { padding: 0 0 var(--s-1); }
  .side .sidehint, .side .sidetags, .side .subfilter { display: none; }
  .side .sidesearch { padding: 0 0 var(--s-2); }
  .side .sidesearch .btn, .side .sidesearch .scopefilter { display: none; }
  .side .sidelist {
    display: flex; flex-direction: row; align-items: stretch;
    overflow-x: auto; overflow-y: hidden; gap: var(--s-2); padding: 0 0 var(--s-2);
  }
  .sidecat { margin: 0; display: flex; align-items: stretch; gap: var(--s-2); }
  .sidecathead {
    position: static; display: flex; align-items: center; padding: 0 var(--s-1);
    white-space: nowrap; border: 0; writing-mode: horizontal-tb;
  }
  .sidecat > div { display: flex; gap: var(--s-2); }
  .scopepill { min-width: 172px; margin-bottom: 0; }
  /* .top label outranks a bare .hide-sm, so this has to match at least as
     specifically or the role selector never hides. */
  .top .hide-sm { display: none; }
  .mark span { display: none; }
  .tools .count, .tools label:has(select[onchange]) { display: none; }
  .dochead { flex-wrap: wrap; }
  .dochead h1 { font-size: var(--fs-lg); }
  .tools input[type=search] { max-width: none; }
  .top { gap: var(--s-2); padding: 0 var(--s-3); }
  .sheetbody, .dochead, .tools, .panel { padding-left: var(--s-3); padding-right: var(--s-3); }
  .grphead h2 { font-size: var(--fs-xl); }
  .asmtop { flex-wrap: wrap; }
  /* The rate is a working figure, not a headline. On a phone it stays in the
     open card and the header keeps the quantity, the amount and the margin —
     the big-numeral-small-label shape the references use. */
  .asmfigs { width: 100%; justify-content: space-between; gap: var(--s-2); }
  .asmfigs .r, .asmfigs .x { display: none; }
  .asmfigs .a { min-width: 0; }
  .asmfigs .m { min-width: 0; }
  .overlay { padding: 0; align-items: flex-end; }
  .picker { width: 100%; max-height: 88vh; border-radius: var(--r-lg) var(--r-lg) 0 0; }
}

/* ---------------------------------------------------------------- print */

@media print {
  @page { size: A4; margin: 16mm 14mm; }
  html, body { background: #fff; color: #000; font-size: 10pt; }
  #app { height: auto; overflow: visible; display: block; background: #fff; }
  .top, .totals, .tools, .side, .summary, .noprint, .exportbar, .toast,
  .asmacts, .asmmoney, .subs, .variants { display: none !important; }
  .work3, .work2 { display: block; }
  .panel, .panel.wide { padding: 0; max-width: none; }
  .sheet { box-shadow: none; padding: 0; border-radius: 0; }
  .printhead { display: block; margin-bottom: 8mm; }
  .printhead h1 { font-size: 16pt; margin: 0 0 2mm; }
  .printhead div { font-size: 9pt; color: #444; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; }
  .sheet tr.group td { background: #eee !important; }
  .card, .printtotals { break-inside: avoid; box-shadow: none; border: 0.5pt solid #ccc; }
}

/* Scope items carry a room and tags, so the rail has to show both without
   turning every row into three lines of grey text. */
.sidetags { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 var(--s-2) var(--s-2); }
.sidetags .tagchip { font-size: 10px; padding: 3px var(--s-2); }
.pillbadges { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.pillbadges .tag { font-size: 9px; padding: 1px 6px; }
.tag.room { background: var(--surface-3); color: var(--ink-2); }
.scopepill.on .tag.room, .scopepill.on .tag.t { background: rgba(255, 255, 255, .16); color: var(--ink-on-dark); }

/* Discount and payment-stage editing, inline in the summary where the effect
   is visible. Six controls in a 312px column, so everything is compact. */
/* Five controls will not fit across 312px without truncating the label to
   "Desigr", so the label takes its own line and the rest sit under it. */
.moneyrow { display: grid; grid-template-columns: 46px 1fr 76px 22px; gap: 4px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--hairline); }
.moneyrow:last-of-type { border-bottom: 0; }
.moneyrow > input:first-child { grid-column: 1 / -1; }
.moneyrow input, .moneyrow select {
  border: 0; background: var(--surface-2); border-radius: var(--r-xs);
  padding: 4px 6px; font-size: var(--fs-xs); min-width: 0;
}
.moneyrow input.v { text-align: right; font-family: var(--font-num); }
.moneyrow input:focus, .moneyrow select:focus { box-shadow: 0 0 0 1.5px var(--ink); outline: none; }
.moneyrow .res { font-family: var(--font-num); font-size: var(--fs-xs); text-align: right; color: var(--ink-2); }
.moneyrow .res.bad { color: var(--m-negative); font-weight: 600; }
.sumnote.warn { color: #8a5b13; }
.sublabel { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.sumblock .btn.small { margin-top: var(--s-2); }

/* The measurement cell holds two decisions: the unit, and what it is measured
   against. Stacked, because a 104px column cannot take them side by side. */
.slotrow .meas { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.slotrow .meas select { width: 100%; }
.slotrow .meas select.basis { font-size: 10px; color: var(--ink-3); }
.slotrow .meas .fixedmeas { font-size: var(--fs-sm); color: var(--ink-2); padding: 3px 6px; }
.slotrow .lb input[type=text] { font-weight: inherit; }

/* ==========================================================================
   Second pass against the references. What the first pass took was the
   surface — canvas, cards, shadows, the single black element. What it left on
   the table was the size contrast, the breathing room, and the one interaction
   worth stealing outright: the horizontal day picker.
   ========================================================================== */

:root {
  --r: 20px;
  --r-lg: 28px;
  --fs-3xl: 38px;
}

/* Size contrast: the references let a section title be genuinely large, and
   the space above it do the separating rather than a rule. */
.grphead h2 { font-size: var(--fs-3xl); letter-spacing: -0.035em; }
.grphead { padding-bottom: var(--s-4); }
.grp { margin-bottom: calc(var(--s-7) + var(--s-4)); }
.sheetbody { padding-top: var(--s-2); }
.dochead h1 { font-size: var(--fs-2xl); letter-spacing: -0.03em; }

/* Cards breathe. The first pass kept the old table padding inside new
   shapes, which is why it read as a repaint. */
.asmtop { padding: var(--s-4) var(--s-4) var(--s-4) var(--s-3); gap: var(--s-4); }
.asm .stripe { margin: var(--s-4) 0 var(--s-4) var(--s-4); }
.asmname .nm { font-size: var(--fs-lg); letter-spacing: -0.02em; }
.asmfigs .a { font-size: var(--fs-xl); min-width: 120px; }
.sumblock { padding: var(--s-4) var(--s-5); }
.pl, .tpl, .card2 { padding: var(--s-5); }

/* A real control rather than a 10px glyph. */
.asmfigs .chev {
  width: 34px; height: 34px; font-size: 14px; font-weight: 400;
  background: var(--surface-2); color: var(--ink-2);
}
.asm:hover .chev { background: var(--surface-3); }
.asm.open .chev { background: var(--surface-ink); color: var(--ink-on-dark); }

/* The premium banner is not flat black — it has a gradient and a dot field.
   Both are cheap and both are why it reads as the one thing on the screen. */
.sumblock.grand-card {
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .07) 1px, transparent 0) 0 0 / 12px 12px,
    linear-gradient(145deg, #2a2d33 0%, #17181b 58%, #101114 100%);
}
.sumblock.grand-card .sline.grand b { font-size: var(--fs-3xl); }

/* Two figures side by side with their labels under them. */
.metricpair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); margin-bottom: var(--s-3); }
.metricpair > div { display: flex; flex-direction: column; }
.metricpair b { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.025em; }
.metricpair span { font-size: var(--fs-xs); color: var(--ink-3); }
.sumblock.internal .metricpair span { color: #a8802f; }

@media (max-width: 900px) {
  .grphead h2 { font-size: var(--fs-xl); }
  .asmname .nm { font-size: var(--fs-md); }
  .asmfigs .a { font-size: var(--fs-lg); min-width: 0; }
}

/* ==========================================================================
   Bordered scope rows, the collapsed modifier strip, and a compressed open
   card.
   ========================================================================== */

/* Each scope item as its own card, so the eye can separate them without
   hovering. Two-line items were running into each other before. */
.scopepill {
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline);
  border-radius: var(--r-sm); margin-bottom: var(--s-2); padding: var(--s-3);
}
.scopepill:hover { box-shadow: inset 0 0 0 1px var(--hairline-2), var(--shadow-card); }
.scopepill.on { box-shadow: var(--shadow-pop); }
.scopepill .n { font-weight: 550; }
.scopefilter {
  width: 100%; margin-top: var(--s-2); border: 0; background: var(--surface);
  border-radius: var(--r-pill); padding: 8px var(--s-4); font-size: var(--fs-sm);
  box-shadow: var(--shadow-card); cursor: pointer;
}

/* The sub-items on a collapsed card: name, quantity, price, amount — the
   quantity and the price both editable where they sit. */
.modstrip { padding: 0 var(--s-4) var(--s-3) calc(var(--s-4) + 28px); display: flex; flex-direction: column; }
.ms {
  display: grid; grid-template-columns: 14px minmax(0, 1fr) 62px 58px 84px 92px;
  gap: var(--s-2); align-items: center; font-size: var(--fs-sm); padding: 3px 0;
}
.ms .br { color: var(--ink-3); font-family: var(--font-num); }
.ms .n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.ms .q, .ms .r, .ms .am { font-family: var(--font-num); font-variant-numeric: tabular-nums; text-align: right; }
.ms .u { font-size: var(--fs-xs); color: var(--ink-3); }
.ms .q, .ms .r { color: var(--ink-2); }
.ms .am { color: var(--ink); }
.ms .ed { display: inline-block; min-width: 34px; }

/* Compressed open card: one grid for every field, the money on the action
   row, tighter padding throughout. An opened line now fits a screen. */
.variants { padding: var(--s-3) var(--s-4); }
.vrow { grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)); gap: var(--s-2) var(--s-3); }
.vrow .f { margin-bottom: 0; }
.vrow .f.wide { grid-column: span 2; }
.variants input, .variants select { padding: 6px var(--s-3); }
.subs { padding: 0 var(--s-4) var(--s-3); }
.slothead, .slotrow { padding: 7px var(--s-3); }
.asmacts { padding: var(--s-2) var(--s-4); }
.moneyline { display: flex; align-items: baseline; gap: 6px; font-size: var(--fs-xs); flex-wrap: wrap; }
.moneyline b { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--fs-sm); }
.moneyline span { color: var(--ink-3); margin-right: var(--s-2); }
.optblock summary { padding: 6px var(--s-3); }

@media (max-width: 900px) {
  .ms { grid-template-columns: 14px minmax(0, 1fr) 54px 76px; }
  .ms .u, .ms .am { display: none; }
  .vrow .f.wide { grid-column: span 1; }
}

/* ==========================================================================
   Projects, the project dashboard, settings — and a quotation header that
   carries its own filters so the middle column keeps its width.
   ========================================================================== */

.crumbs { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); min-width: 0; }
.crumb { border: 0; background: transparent; cursor: pointer; color: var(--ink-2); padding: 4px 6px; border-radius: var(--r-xs); font: inherit; white-space: nowrap; }
.crumb:hover { background: var(--surface-2); color: var(--ink); }
.crumb.now { color: var(--ink); font-weight: 600; cursor: default; overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { color: var(--ink-3); }

.dochead.tight { align-items: center; padding: var(--s-4) var(--s-5) var(--s-3); gap: var(--s-5); }
.dochead .dh { min-width: 0; }
.dochead .dh h1 { font-size: var(--fs-xl); }
.dochead .sub { display: flex; align-items: center; gap: var(--s-2); }
.dhfilters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); justify-content: flex-end; flex: 1; }
.dhfilters input[type=search] {
  width: 130px; border: 0; background: var(--surface); border-radius: var(--r-pill);
  padding: 7px var(--s-3); font-size: var(--fs-sm); box-shadow: var(--shadow-card);
}
.dhfilters select {
  border: 0; background: var(--surface); border-radius: var(--r-pill);
  padding: 6px var(--s-3); font-size: var(--fs-sm); box-shadow: var(--shadow-card); cursor: pointer; max-width: 150px;
}
.dhfilters .count { margin-left: 0; }

/* One line, no price block. */
.grphead { display: flex; align-items: baseline; gap: var(--s-3); border: 0; padding-bottom: var(--s-2); }
.grphead h2 { font-size: var(--fs-xl); }
.gcount { font-size: var(--fs-xs); color: var(--ink-3); font-family: var(--font-num); }
.grp { margin-bottom: var(--s-6); }
.sheetbody { padding-top: 0; }

.pghead { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-5); margin-bottom: var(--s-5); flex-wrap: wrap; }
.pghead p { color: var(--ink-2); font-size: var(--fs-sm); max-width: 62ch; }
.projgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s-3); }
.projcard { background: var(--surface); border-radius: var(--r); padding: var(--s-5); box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: var(--s-2); }
.projcard.on { box-shadow: var(--shadow-pop), inset 0 0 0 1.5px var(--ink); }
.projcard h3 { font-size: var(--fs-lg); }
.pkicker { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 650; }
.pclient { font-size: var(--fs-sm); color: var(--ink-2); }
.pscopes { display: flex; flex-wrap: wrap; gap: 3px; }
.pfigs b { font-family: var(--font-num); font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.025em; display: block; }
.pfigs span { font-size: var(--fs-xs); color: var(--ink-3); }
.projcard .btn { align-self: flex-start; }

.qlist { display: flex; flex-direction: column; gap: var(--s-2); }
.qrow { display: flex; align-items: center; gap: var(--s-4); background: var(--surface); border-radius: var(--r); padding: var(--s-3) var(--s-4); box-shadow: var(--shadow-card); }
.qrow.on { box-shadow: var(--shadow-pop), inset 0 0 0 1.5px var(--ink); }
.qmain { flex: 1; min-width: 0; }
.qtitle { display: flex; align-items: center; gap: var(--s-2); font-weight: 600; flex-wrap: wrap; }
.qmeta { font-size: var(--fs-xs); color: var(--ink-3); font-family: var(--font-num); margin-top: 2px; }
.qamt { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--fs-lg); font-weight: 650; letter-spacing: -0.02em; }

.mastercard {
  margin-top: var(--s-5); padding: var(--s-5); border-radius: var(--r-lg);
  background:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,.07) 1px, transparent 0) 0 0 / 12px 12px,
    linear-gradient(145deg, #2a2d33 0%, #17181b 58%, #101114 100%);
  color: var(--ink-on-dark); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-5);
  box-shadow: var(--shadow-raised);
}
.mastercard > div:first-child { flex: 1; min-width: 260px; }
.mastercard .kicker { color: rgba(255,255,255,.45); }
.mastercard p { color: rgba(255,255,255,.68); font-size: var(--fs-sm); margin: var(--s-2) 0 0; }
.mfigs { display: flex; gap: var(--s-5); align-items: center; flex-wrap: wrap; }
.mfigs b { font-family: var(--font-num); font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.025em; display: block; }
.mfigs span { font-size: var(--fs-xs); color: rgba(255,255,255,.5); }
.tag.ok { background: rgba(47,143,91,.22); color: #7fe0ab; }
.mastercard .btn { background: var(--surface); color: var(--ink); }

.frow2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--s-3); }
.panel section.card2 .vrow { gap: var(--s-3); }

@media (max-width: 1100px) {
  .dochead.tight { flex-wrap: wrap; }
  .dhfilters { justify-content: flex-start; }
}
@media (max-width: 900px) {
  /* Hiding every link left a phone with no way back to the project from
     inside a quotation. The parent stays, as a back link; the current step is
     already the heading underneath it. */
  .crumbs .sep { display: none; }
  .crumbs .crumb:first-child { display: none; }
  .crumbs .crumb.now { display: none; }
  .crumbs .crumb:not(.now) { padding-left: 0; }
  .crumbs .crumb:not(.now)::before { content: '\2039\00a0'; }
  .qrow { flex-wrap: wrap; }
}

/* One values panel per line rather than one per sub-item. */
.valtoggle { border: 0; background: transparent; color: var(--ink-2); cursor: pointer; font: inherit; font-size: var(--fs-xs); padding: 4px 0; }
.valtoggle:hover { color: var(--ink); }
.valgrp { background: var(--surface); border-radius: var(--r-sm); padding: var(--s-2) var(--s-3); margin-bottom: 4px; box-shadow: inset 0 0 0 1px var(--hairline); }
.valname { font-size: var(--fs-xs); color: var(--ink-3); margin-bottom: 2px; }
.slothead, .slotrow { padding: 5px var(--s-3); }
.variants { padding: var(--s-3) var(--s-4) var(--s-2); }
.subshead { margin-bottom: var(--s-1); }

/* Quotation status: draft, issued, accepted, superseded. */
.tag.st-draft { background: var(--surface-2); color: var(--ink-2); }
.tag.st-issued { background: var(--accent-soft); color: #8a5b13; }
.tag.st-ok { background: #e8f5ee; color: var(--m-strong); }
.tag.st-muted { background: var(--surface-3); color: var(--ink-3); }
.qrow.faded { opacity: .55; }
.qrow.faded:hover { opacity: 1; }

.statline { display: flex; flex-wrap: wrap; gap: var(--s-6); margin: 0 0 var(--s-5); }
.st-fig b { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.025em; display: block; }
.st-fig span { font-size: var(--fs-xs); color: var(--ink-3); }
.st-fig.ok b { color: var(--m-strong); }
.st-fig.muted b { color: var(--ink-3); }

.issuebar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); margin: var(--s-5) 0; }
.lockednote { flex: 1; min-width: 240px; background: var(--surface); border-radius: var(--r); padding: var(--s-3) var(--s-4); box-shadow: var(--shadow-card); }
.lockednote b { display: block; font-size: var(--fs-sm); }
.lockednote span { font-size: var(--fs-xs); color: var(--ink-2); }
.sendnote { background: var(--surface-2); border-radius: var(--r-sm); padding: var(--s-3); font-size: var(--fs-xs); color: var(--ink-2); margin-bottom: var(--s-3); }
.picker .pad textarea { width: 100%; border: 0; background: var(--surface-2); border-radius: var(--r-sm); padding: var(--s-3); font: inherit; font-size: var(--fs-sm); resize: vertical; }

/* ==========================================================================
   The expanded card as one grid: main item on the first row, sub-items under
   it, one of each field and nothing repeated.
   ========================================================================== */

.asmopen .slotgrid { margin: 0; border-radius: 0; box-shadow: none; border-top: 1px solid var(--hairline); }
.asmopen .slothead, .asmopen .slotrow {
  grid-template-columns:
    minmax(110px, 1.15fr) minmax(120px, 1.35fr) 64px 82px 74px 96px 90px minmax(104px, 0.9fr);
  gap: var(--s-2); padding: 5px var(--s-3); align-items: center;
}
.asmopen .slotrow.main { background: var(--surface-2); }
.asmopen .slotrow .ed { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 4px; border-radius: var(--r-xs); }
.asmopen .slotrow .ed.strong { font-weight: 600; }
.asmopen .slotrow .ed:hover { background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline-2); }
.asmopen .slotrow .n .ed { text-align: right; }
.ph { color: var(--ink-3); font-style: normal; }
input.cell.t { width: 100%; text-align: left; font-family: var(--font-ui); }
input.cell.t.wide { min-width: 220px; }
.slotrow .sel select { width: 100%; }
.slotrow .sel.two { display: flex; flex-direction: column; gap: 1px; }
.slotrow .sel.two select { font-size: var(--fs-xs); }
.slotrow .endcell { display: flex; align-items: center; gap: 2px; min-width: 0; }
.slotrow .endcell select.basis { flex: 1; min-width: 0; font-size: 10px; color: var(--ink-3); }

/* Everything that is not a priced row, on one short line. */
.asmfoot {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-3); background: var(--surface); border-top: 1px solid var(--hairline);
}
.asmfoot .tagwrap { gap: 3px; }
.asmfoot .tagchip { font-size: 10px; padding: 2px var(--s-2); }
.asmfoot .moneyline { margin-right: var(--s-2); }
.ruleapply {
  border: 0; background: var(--surface-2); border-radius: var(--r-pill);
  padding: 5px var(--s-3); font-size: var(--fs-xs); cursor: pointer;
}

.priceset { display: flex; gap: var(--s-2); align-items: center; }
.priceset input { flex: 1; min-width: 0; }
.priceset .btn { flex: none; }
.scopebulk { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; background: var(--ink); color: var(--ink-on-dark); border-radius: var(--r-sm); padding: var(--s-2); margin-bottom: var(--s-2); font-size: var(--fs-xs); }
.scopebulk b { padding-left: 4px; }
.scopebulk select { border: 0; border-radius: var(--r-pill); padding: 4px var(--s-2); font-size: var(--fs-xs); background: rgba(255,255,255,.14); color: var(--ink-on-dark); }
.scopebulk select option { color: var(--ink); }
.scopebulk .btn { background: rgba(255,255,255,.14); color: var(--ink-on-dark); box-shadow: none; }
.scopepill.flat { display: flex; gap: var(--s-2); align-items: flex-start; cursor: default; }
.scopepill.flat .n { cursor: pointer; }
.btn.small.full { width: 100%; justify-content: center; margin-bottom: var(--s-2); }


/* ==========================================================================
   Three destinations in the header. The views of an open quotation sit on the
   quotation, because that is what they are views of.
   ========================================================================== */

.gear {
  border: 0; background: transparent; cursor: pointer; font-size: 17px; line-height: 1;
  width: 34px; height: 34px; border-radius: var(--r-pill); color: var(--ink-2); flex: none;
}
.gear:hover { background: var(--surface-2); color: var(--ink); }
.gear.on { background: var(--ink); color: var(--ink-on-dark); }
.views button { padding: 8px var(--s-4); font-size: var(--fs-md); }

.segbar { display: flex; gap: 2px; background: var(--surface-2); border-radius: var(--r-pill); padding: 3px; flex: none; }
.seg {
  border: 0; background: transparent; cursor: pointer; font: inherit; font-size: var(--fs-sm);
  padding: 5px var(--s-3); border-radius: var(--r-pill); color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.seg:hover { color: var(--ink); }
.seg.on { background: var(--surface); color: var(--ink); font-weight: 550; box-shadow: var(--shadow-card); }

.dochead .crumbs { margin-bottom: 2px; }
.dochead .crumb { padding: 2px 4px; font-size: var(--fs-xs); }
.docpanel { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.docpanel > .panel { max-width: none; padding-top: 0; }

/* Readiness, then what they get, then how it goes out. */
.readybar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3);
  background: var(--surface); border-radius: var(--r); padding: var(--s-4);
  box-shadow: var(--shadow-card); margin-bottom: var(--s-3);
}
.readystate { display: flex; gap: var(--s-3); align-items: flex-start; min-width: 240px; }
.readystate b { display: block; font-size: var(--fs-md); }
.readystate span { font-size: var(--fs-sm); color: var(--ink-2); }
.rdot { width: 11px; height: 11px; border-radius: var(--r-pill); margin-top: 6px; flex: none; }
.rdot.ok { background: var(--m-healthy); }
.rdot.no { background: var(--m-negative); }

.checkblock { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-card); margin-bottom: var(--s-4); }
.checkblock > summary { padding: var(--s-3) var(--s-4); cursor: pointer; font-size: var(--fs-sm); font-weight: 550; list-style: none; }
.checkblock > summary::-webkit-details-marker { display: none; }
.checkblock > summary::before { content: '\203A '; display: inline-block; transition: transform .12s; }
.checkblock[open] > summary::before { transform: rotate(90deg); }
.checkblock > div { padding: 0 var(--s-4) var(--s-3); }
.checkblock .check:last-of-type { border-bottom: 0; }
.findings { margin-top: var(--s-4); }
.findings h4 { font-size: var(--fs-sm); color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: var(--s-2); }
.findings .card { box-shadow: none; background: var(--surface-2); }
.findings .card.risk { background: #fdf0f0; }
.findings .card.check { background: var(--accent-soft); }

@media (max-width: 1100px) {
  .segbar { order: -1; }
}
@media (max-width: 900px) {
  .views button { padding: 6px var(--s-3); font-size: var(--fs-sm); }
  .seg { padding: 4px var(--s-2); font-size: var(--fs-xs); }
}

/* ==========================================================================
   Project costing, subcontractors, and per-subcontractor rates.
   ========================================================================== */

.segbar.wide { display: inline-flex; margin-bottom: var(--s-4); }
/* Four figures as cards rather than as floating text.

   They were a figure with its name printed underneath and nothing between
   them, so the two ran together when read: "$19,200.00Contract value, 2
   quotations". Each is now a card with the label above the figure, a hairline
   between them, and tabular figures so the columns line up down the row. */
.costsum {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px; background: var(--hairline); border-radius: var(--r);
  overflow: hidden; box-shadow: var(--shadow-card); margin-bottom: var(--s-4);
}
.costsum .cs {
  background: var(--surface); padding: var(--s-4) var(--s-4) var(--s-3);
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
/* The figure that is the reason for the page. */
.costsum .cs.lead { background: #fffdf6; box-shadow: inset 0 2px 0 var(--m-warn-line, #dcc78a); }
.costsum .cs .k {
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); font-weight: 650; white-space: nowrap;
}
.costsum .cs .sub { font-size: 11px; color: var(--ink-3); line-height: 1.35; }
.costsum .cs b.warn { color: #8a6a1f; }
.costsum .cs b.ok { color: var(--m-positive, #1e6b3a); }
.cs b {
  font-family: var(--font-num); font-variant-numeric: tabular-nums;
  font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.025em;
  display: block; line-height: 1.2; margin: 1px 0 2px;
  overflow: hidden; text-overflow: ellipsis;
}
.cs span { font-size: var(--fs-xs); color: var(--ink-3); }

.twoprofit { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s-3); margin-bottom: var(--s-3); }
.pf { background: var(--surface); border-radius: var(--r); padding: var(--s-4); box-shadow: var(--shadow-card); }
.pf .pk { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 650; }
.pf b { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--fs-2xl); font-weight: 650; letter-spacing: -0.03em; display: block; margin: 2px 0; }
.pf span { font-size: var(--fs-xs); color: var(--ink-2); }
.pf.ok b { color: var(--m-strong); }
.pf.no b { color: var(--m-negative); }
.costnote { background: var(--accent-soft); color: #7a5312; border-radius: var(--r); padding: var(--s-3) var(--s-4); font-size: var(--fs-sm); margin-bottom: var(--s-4); }

.ledger { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-card); overflow: hidden; margin-bottom: var(--s-3); }
.lhead, .lrow { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 96px 96px 100px 24px; gap: var(--s-2); align-items: center; padding: 7px var(--s-4); font-size: var(--fs-sm); }
.lhead { background: var(--surface-2); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 650; }
.lrow { border-top: 1px solid var(--hairline); }
.lrow .n { font-family: var(--font-num); font-variant-numeric: tabular-nums; text-align: right; }
.lhead .n { text-align: right; }
.lrow .sup, .lrow .dt { font-size: var(--fs-xs); color: var(--ink-3); }
.lrow.total { background: var(--surface-2); font-weight: 650; }
.lrow.total.big { background: var(--surface-ink); color: var(--ink-on-dark); border-radius: var(--r); margin-top: var(--s-3); padding: var(--s-3) var(--s-4); }
.lrow input { width: 100%; border: 0; background: transparent; border-radius: var(--r-xs); padding: 2px 4px; font: inherit; font-size: var(--fs-sm); min-width: 0; }
.lrow .n input { text-align: right; font-family: var(--font-num); }
.lrow input:hover { background: var(--surface-2); }
.lrow input:focus { background: var(--surface); box-shadow: 0 0 0 1.5px var(--ink); outline: none; }

.tradeblock { margin-bottom: var(--s-4); }
.thead { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); padding: 0 var(--s-1) var(--s-2); }
.thead b { font-size: var(--fs-md); }
.tsub { font-size: var(--fs-xs); color: var(--ink-3); margin-left: var(--s-2); }
.tfigs { display: flex; gap: var(--s-3); align-items: baseline; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.tfigs span { font-size: var(--fs-xs); color: var(--ink-3); }
.tfigs b { font-size: var(--fs-md); }

.subgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s-3); }
.subcard { background: var(--surface); border-radius: var(--r); padding: var(--s-4); box-shadow: var(--shadow-card); }
.subcard.on { box-shadow: var(--shadow-pop), inset 0 0 0 1.5px var(--ink); }
.stitle { font-weight: 600; font-size: var(--fs-sm); margin-bottom: var(--s-2); }
.subcard select { width: 100%; border: 0; background: var(--surface-2); border-radius: var(--r-sm); padding: 7px var(--s-3); font-size: var(--fs-sm); }
.nosub { font-size: var(--fs-xs); color: var(--ink-3); }

.ratelist { display: flex; flex-direction: column; gap: 2px; }
.raterow { display: grid; grid-template-columns: minmax(0, 1fr) 110px 140px; gap: var(--s-3); align-items: center; padding: 5px 0; border-bottom: 1px solid var(--hairline); }
.raterow:last-child { border-bottom: 0; }
.rn { font-size: var(--fs-sm); }
.rn .hint { display: inline; margin-left: var(--s-2); }
.raterow input { border: 0; background: var(--surface-2); border-radius: var(--r-xs); padding: 5px var(--s-2); text-align: right; font-family: var(--font-num); font-size: var(--fs-sm); }
.rp { font-size: var(--fs-xs); color: var(--ink-3); font-family: var(--font-num); text-align: right; }

.subfilter { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: 0 var(--s-2) var(--s-2); }
.subfilter .sidehint { padding: 0; }
.dupicon {
  border: 0; background: transparent; color: var(--ink-3); cursor: pointer; font-size: 14px;
  width: 26px; height: 26px; border-radius: var(--r-pill); flex: none;
}
.dupicon:hover { background: var(--surface-2); color: var(--ink); }

@media (max-width: 900px) {
  .lhead, .lrow { grid-template-columns: minmax(0, 1.6fr) 84px 84px 24px; }
  .lhead > span:nth-child(2), .lrow > span:nth-child(2),
  .lhead > span:nth-child(5), .lrow > span:nth-child(5) { display: none; }
}

/* The builder entered through the firm. */
.lrow.inherited .n input { color: var(--ink-3); }
.lrow.inherited { opacity: .82; }
.scopename { cursor: pointer; font-weight: 550; }
.scopename:hover { text-decoration: underline; text-underline-offset: 2px; }
.lrow.scoperow { cursor: pointer; }
.lrow.scoperow:hover { background: var(--surface-2); }
.dochead .kicker { margin-bottom: 2px; }
.mid > .scopepad.scroll > section:first-child { margin-top: var(--s-2); }

/* ==========================================================================
   The client-facing quotation: three levels, each a heading with its own line
   under it, each stepping right. A client reads the shape before the numbers.
   ========================================================================== */

.sheet tr.lvl1 td { background: transparent; padding: var(--s-5) 0 var(--s-2); border-bottom: 2px solid var(--ink); }
.h1t { font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.025em; }
.h1s { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 2px; max-width: 70ch; }
.sheet tr.lvl1:first-child td { padding-top: 0; }

.sheet tr.lvl1b td { padding: var(--s-3) 0 var(--s-1) var(--s-4); font-weight: 600; color: var(--ink-2); border-bottom: 0; }

.sheet tr.lvl2 td { padding: var(--s-3) var(--s-2); border-bottom: 1px solid var(--hairline); vertical-align: top; }
.sheet tr.lvl2 .desc { padding-left: var(--s-4); }
.h2t { font-weight: 600; font-size: var(--fs-md); }
.h2s { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 2px; white-space: pre-line; max-width: 62ch; }
.h2r { font-size: var(--fs-xs); color: var(--ink-3); font-style: italic; margin-top: 2px; }
.sheet tr.lvl2 .amt { font-weight: 600; }

.sheet tr.lvl3 td { padding: 2px var(--s-2); border-bottom: 0; color: var(--ink-2); }
.sheet tr.lvl3 .desc { padding-left: calc(var(--s-4) + var(--s-5)); position: relative; }
.sheet tr.lvl3 .desc::before {
  content: ''; position: absolute; left: calc(var(--s-4) + var(--s-3)); top: 0; bottom: 0;
  width: 1px; background: var(--hairline-2);
}
.h3t { font-size: var(--fs-sm); }
.h3s { font-size: var(--fs-xs); color: var(--ink-3); }
.sheet tr.lvl3 + tr.lvl2 td { padding-top: var(--s-4); }

.sheet tr.gsub td { padding: var(--s-2) var(--s-2) var(--s-4); border-bottom: 0; font-weight: 600; color: var(--ink-2); }
.sheet tr.gsub .desc { padding-left: var(--s-4); font-size: var(--fs-sm); }
.sheet tr.gsub .num { font-family: var(--font-num); font-variant-numeric: tabular-nums; border-top: 1px solid var(--hairline-2); }

.hcount { font-size: var(--fs-xs); color: var(--ink-3); font-family: var(--font-num); font-weight: 400; margin-left: var(--s-2); }
.tradeblock.empty .thead { opacity: .62; }
.tfigs .btn { margin-left: var(--s-2); }

@media print {
  .sheet tr.lvl1 td { padding-top: 6mm; border-bottom: 1pt solid #000; }
  .h1t { font-size: 13pt; }
  .h1s, .h2s { color: #444; }
  .sheet tr.lvl3 .desc::before { background: #ccc; }
}

/* The set: a main item and its sub-items priced together by one firm. */
.setdisc {
  border: 0; background: var(--surface-2); color: var(--ink-2); cursor: pointer;
  width: 20px; height: 20px; border-radius: var(--r-pill); font-size: 11px; margin-right: 6px; flex: none;
}
.setdisc:hover { background: var(--surface-3); color: var(--ink); }
.scopename { display: flex; align-items: center; gap: 0; }
.scopename > span { cursor: pointer; }
.lrow .setc { color: var(--ink); font-weight: 600; }

.lrow.slotline, .lrow.slotfoot { background: var(--surface-2); border-top: 0; padding-top: 4px; padding-bottom: 4px; }
.lrow.slotline .sl, .lrow.slotfoot .sl { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ink-2); padding-left: var(--s-3); }
.lrow.slotline .br { color: var(--ink-3); font-family: var(--font-num); }
.optcells { grid-column: span 3; display: flex; flex-wrap: wrap; gap: var(--s-2); }
.optcell { display: flex; align-items: center; gap: 4px; background: var(--surface); border-radius: var(--r-pill); padding: 2px 4px 2px var(--s-3); box-shadow: inset 0 0 0 1px var(--hairline); }
.optcell.on { box-shadow: inset 0 0 0 1.5px var(--ink); }
.optcell .ol { font-size: var(--fs-xs); color: var(--ink-2); white-space: nowrap; }
.optcell input { width: 68px; border: 0; background: var(--surface-2); border-radius: var(--r-pill); padding: 3px var(--s-2); text-align: right; font-family: var(--font-num); font-size: var(--fs-xs); }
.optcell input:focus { box-shadow: 0 0 0 1.5px var(--ink); outline: none; }
.setnote { grid-column: span 3; font-size: var(--fs-xs); color: var(--ink-3); }
.slotfoot .btn { margin-right: var(--s-2); }

/* ==========================================================================
   The scope editor as two columns — the item on the left, what arrives on the
   right — with the cross-firm comparison underneath both.
   ========================================================================== */

.scopework { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s-4); align-items: start; }
.scopemain { min-width: 0; }
.scopeside { position: sticky; top: 0; min-width: 0; }
.scopeside .card2 { margin-bottom: var(--s-3); }
.scopeside .preview { background: var(--surface); }
.scopeside .pvline { flex-direction: column; align-items: flex-start; gap: var(--s-2); }
.scopeside .pvfigs { flex-wrap: wrap; }

/* A firm's scope, in the quotation's shape. */
.setblock { margin-bottom: var(--s-3); }
.setblock .slotgrid { box-shadow: inset 0 0 0 1px var(--hairline); }
.setblock .slothead, .setblock .slotrow {
  grid-template-columns: minmax(120px, 1.3fr) minmax(120px, 1.2fr) 62px 82px 82px 84px 88px 96px;
  gap: var(--s-2); padding: 6px var(--s-3); align-items: center;
}
.setblock .slotrow { opacity: 1; }
.setblock .slotrow.main { background: var(--surface-2); }
.setblock .slotrow .lb { display: flex; align-items: center; gap: 6px; min-width: 0; }
.setblock .slotrow .lb.strong { font-weight: 600; cursor: pointer; }
.setblock .slotrow .lb.strong:hover { text-decoration: underline; text-underline-offset: 2px; }
.setblock .slotrow .br { color: var(--ink-3); font-family: var(--font-num); }
.setblock .slotrow .n input { width: 100%; text-align: right; font-family: var(--font-num); border: 0; background: var(--surface-2); border-radius: var(--r-xs); padding: 3px 5px; font-size: var(--fs-sm); }
.setblock .slotrow .n input:focus { background: var(--surface); box-shadow: 0 0 0 1.5px var(--ink); outline: none; }
.setblock .slotrow .vl.muted, .setblock .slotrow .sel.muted { color: var(--ink-3); font-size: var(--fs-xs); }
.setblock .slotrow.foot { background: var(--surface-2); }
.setblock .slotrow.foot .setnote { grid-column: span 5; font-size: var(--fs-xs); color: var(--ink-3); }
.setblock .endcell { justify-content: flex-end; }
.setblock .endcell .tag { font-size: 9px; }

/* A card that is entirely a target reads as one. */
.projcard { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.projcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); }
.projcard:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.mastercard { cursor: pointer; }
.mastercard:hover { box-shadow: var(--shadow-raised), 0 0 0 1px rgba(255,255,255,.12) inset; }
.mastercard .btn { pointer-events: none; }

@media (max-width: 1200px) {
  .scopework { grid-template-columns: minmax(0, 1fr); }
  .scopeside { position: static; }
}

/* ==========================================================================
   The firm's page: details as a strip, the scope list with the height.
   ========================================================================== */

.subpage { display: flex; flex-direction: column; min-height: 0; }
.detailstrip { flex: none; margin: 0 var(--s-5) var(--s-3); background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-card); }
.dsline { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); min-width: 0; }
.dstoggle { border: 0; background: var(--surface-2); border-radius: var(--r-pill); padding: 4px var(--s-3); font-size: var(--fs-xs); cursor: pointer; color: var(--ink-2); flex: none; }
.dstoggle:hover { background: var(--surface-3); color: var(--ink); }
.dsfacts { font-size: var(--fs-xs); color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsnote { font-size: var(--fs-xs); color: var(--ink-3); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsform { padding: 0 var(--s-3) var(--s-3); border-top: 1px solid var(--hairline); }
.dsform .vrow { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s-2) var(--s-3); padding-top: var(--s-3); }
.dsform .f { margin-bottom: 0; }
.dsform .f.wide { grid-column: span 2; }
.dsform input, .dsform select { padding: 5px var(--s-3); }

.scopehead { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); padding: 0 var(--s-5) var(--s-2); }
.scopehead b { font-size: var(--fs-lg); letter-spacing: -0.02em; }
.scopesearch { width: 150px; border: 0; background: var(--surface); border-radius: var(--r-pill); padding: 6px var(--s-3); font-size: var(--fs-sm); box-shadow: var(--shadow-card); }
.scopefilterbtn { border: 0; background: var(--surface); border-radius: var(--r-pill); padding: 6px var(--s-3); font-size: var(--fs-sm); box-shadow: var(--shadow-card); cursor: pointer; }
.scopebulkbar { flex: none; margin: 0 var(--s-5) var(--s-2); }
/* the scope list takes what is left, which on a normal window is most of it */
.scopescroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 var(--s-5) var(--s-6); }
.muted.pad { padding: var(--s-4) 0; }
.muted.tiny { font-size: var(--fs-xs); color: var(--ink-3); padding-top: var(--s-4); }
.setblock .slotrow.main .lb.strong input[type=checkbox] { margin-right: 6px; accent-color: var(--ink); flex: none; }

/* One column header for the whole list, kept in view while it scrolls. */
.setlist { display: flex; flex-direction: column; }
.slothead.setcols {
  position: sticky; top: 0; z-index: 3;
  grid-template-columns: minmax(120px, 1.3fr) minmax(120px, 1.2fr) 62px 82px 82px 84px 88px 96px;
  gap: var(--s-2); padding: 6px var(--s-3);
  background: var(--canvas); border-radius: var(--r-sm); margin-bottom: 2px;
}
.setblock { margin-bottom: var(--s-2); }
.setblock .slotgrid { box-shadow: var(--shadow-card); }

/* ==========================================================================
   Rendering cost. A quotation is a long list of independent cards, which is
   exactly what content-visibility is for: the browser skips layout and paint
   for the ones off screen. The intrinsic size keeps the scrollbar honest so
   nothing jumps as they come into view.
   ========================================================================== */

.asm { content-visibility: auto; contain-intrinsic-size: auto 74px; }
.asm.open { content-visibility: visible; }
.setblock { content-visibility: auto; contain-intrinsic-size: auto 46px; }
.sheet tr.lvl2, .sheet tr.lvl3 { contain: layout style; }

/* Scrolling containers get their own layer and stop scroll chaining, so a
   flick inside the quotation does not drag the page behind it. */
.scroll, .sidelist, .summary, .scopescroll, .panel, .docpanel {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Touch targets. Anything tappable is at least 44px of touch area on a phone,
   which is the platform minimum; the visual size is unchanged, the padding is
   pushed out with a pseudo-element so nothing moves. */
@media (pointer: coarse) {
  .btn, .tagchip, .seg, .views button, .crumb, .scopepill, .dupicon, .x,
  .setdisc, .dstoggle, .gear, .linkbtn, .sumbar, .disc, .chev {
    position: relative;
  }
  .btn::after, .tagchip::after, .seg::after, .views button::after, .crumb::after,
  .dupicon::after, .x::after, .setdisc::after, .dstoggle::after, .gear::after,
  .linkbtn::after, .chev::after {
    content: ''; position: absolute; left: 50%; top: 50%;
    width: max(100%, 44px); height: max(100%, 44px);
    transform: translate(-50%, -50%);
  }
  input[type=checkbox] { width: 20px; height: 20px; }
  .asmtop { padding-top: var(--s-3); padding-bottom: var(--s-3); }
  select, input[type=text], input[type=search] { min-height: 40px; }
  .slotrow select, .slotrow input[type=text], .ms input, .modrow2 input { min-height: 34px; }
}

/* ==========================================================================
   Audit fixes: touch sizing on small screens, and the column header that did
   not follow its own grid when the grid collapsed.
   ========================================================================== */

/* The header nav was shrinking on small screens, which is backwards: that is
   where the finger is least precise. */
@media (max-width: 900px) {
  .views button { padding: 10px var(--s-3); font-size: var(--fs-sm); min-height: 40px; }
  .seg { padding: 9px var(--s-3); min-height: 38px; }
  .crumb { min-height: 34px; display: inline-flex; align-items: center; }
}

/* The header folds with its rows, in the single set of rules below. An
   earlier pair of blocks here hid a different set of columns from the ones the
   rows hid, which is how a heading ends up over the wrong figure. */

/* Option rows wrap rather than collide once the columns no longer fit. */
@media (max-width: 1100px) {
  .optrow { grid-template-columns: minmax(120px, 1fr) 76px 76px 24px; }
  .optrow .onote { display: none; }
}

/* Anything that carries a supplier name, a note or a label in a fixed cell
   truncates rather than spilling over its neighbour. */
.scopepill .n, .scopepill .meta, .sline span, .qmeta, .tsub, .dsfacts, .dsnote,
.pick .n, .pick .m, .lrow .sup, .modrow2 .nm, .ms .n, .onote, .rn {
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.scopepill .n, .pick .n, .modrow2 .nm, .rn { white-space: normal; overflow-wrap: anywhere; }

/* Remaining touch targets: the section note and the selection checkboxes were
   still under the threshold on a phone. */
@media (pointer: coarse) {
  input[type=checkbox] { width: 24px; height: 24px; }
  .grpnote { min-height: 42px; }
  .asmtop > input[type=checkbox] { margin: 0 4px; }
  .btn.small { min-height: 36px; }
  .linkbtn { min-height: 24px; display: inline-flex; align-items: center; }
}

/* Value rows now carry a charge type and a quantity rule, so they get a grid. */
.optlist.wide { padding: 0 var(--s-3) var(--s-3); }
.optrow2 {
  display: grid; grid-template-columns: minmax(110px, 1.3fr) 76px 76px minmax(120px, 1fr) minmax(150px, 1.2fr) 56px minmax(0, 1fr) 24px;
  gap: var(--s-2); align-items: center; padding: 3px 0;
}
.optrow2.held { color: #5b21b6; }
.optrow2.add { grid-template-columns: 1fr; }
.optrow2 input, .optrow2 select { border: 0; background: var(--surface-2); border-radius: var(--r-xs); padding: 4px var(--s-2); font-size: var(--fs-xs); min-width: 0; }
.optrow2 input:not(.ol) { text-align: right; font-family: var(--font-num); }
.optrow2 input:focus, .optrow2 select:focus { background: var(--surface); box-shadow: 0 0 0 1.5px var(--ink); outline: none; }
.optrow2 .qn { text-align: right; }
.savemod { float: right; margin-left: var(--s-3); }
.charged { display: block; font-size: 10px; color: var(--accent); font-family: var(--font-num); }

@media (max-width: 1200px) {
  .optrow2 { grid-template-columns: minmax(100px, 1.2fr) 70px 70px minmax(110px, 1fr) 24px; }
  .optrow2 > select.qr, .optrow2 > .qn, .optrow2 > .onote { display: none; }
}

/* A first-run screen should say what to do, not show an empty grid. */
.emptystate { background: var(--surface); border-radius: var(--r-lg); padding: var(--s-6); box-shadow: var(--shadow-card); max-width: 60ch; }
.emptystate h3 { font-size: var(--fs-lg); margin-bottom: var(--s-2); }
.emptystate p { color: var(--ink-2); font-size: var(--fs-sm); }
.emptystate .btn { margin-top: var(--s-3); }

/* Ticks in the app's own black, not the browser's blue. */
input[type=checkbox], input[type=radio] { accent-color: var(--ink); }

.signin { display: flex; align-items: center; justify-content: center; height: 100dvh; background: var(--canvas); }
.signcard { width: min(360px, 92vw); background: var(--surface); border-radius: var(--r-lg); padding: var(--s-6); box-shadow: var(--shadow-raised); }
.signcard .mark { margin-bottom: var(--s-4); }
.signcard h1 { font-size: var(--fs-xl); margin-bottom: var(--s-4); }
.signcard .f { margin-bottom: var(--s-3); }
.signcard label { display: block; font-size: var(--fs-xs); color: var(--ink-3); margin-bottom: 4px; }
.signcard input { width: 100%; border: 0; background: var(--surface-2); border-radius: var(--r-sm); padding: 10px var(--s-3); font-size: var(--fs-md); }
.signcard input:focus { background: var(--surface); box-shadow: 0 0 0 1.5px var(--ink); outline: none; }
.signerr { background: #fdecec; color: var(--m-negative); border-radius: var(--r-sm); padding: var(--s-2) var(--s-3); font-size: var(--fs-sm); margin-bottom: var(--s-3); }
.signnote { font-size: var(--fs-xs); color: var(--ink-3); margin-top: var(--s-4); line-height: 1.5; }
.grouplabel { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ink-3); }
.grouplabel select { border: 0; background: var(--surface); border-radius: var(--r-pill); padding: 7px var(--s-3); font-size: var(--fs-sm); box-shadow: var(--shadow-card); cursor: pointer; }

/* The column mapping, shown rather than assumed. */
.maprow { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--s-2) var(--s-3); margin-bottom: var(--s-3); }
.maprow .f { margin-bottom: 0; }
.maprow select { width: 100%; }

/* ==========================================================================
   Main item and sub-items, compact.

   The tick sat above its label because the label was a block, which turned
   every sub-item into two rows and halved how much of a quotation fits on a
   screen. Both now sit on one line, and the whole grid is tightened: the main
   item reads as the heading it is, the sub-items step in under it.
   ========================================================================== */

.asmopen .slotrow .lb { display: flex; align-items: center; gap: 6px; min-width: 0; }
.asmopen .slotrow .lb > .ed { display: inline-block; flex: 1; min-width: 0; padding: 1px 3px; }
.asmopen .slotrow .lb input[type=checkbox] { flex: none; width: 14px; height: 14px; margin: 0; }

/* Tighter rows: 24px instead of 32, which is four more line items a screen. */
.asmopen .slothead { padding: 4px var(--s-3); font-size: 9px; }
.asmopen .slotrow { padding: 2px var(--s-3); min-height: 24px; font-size: var(--fs-sm); }
.asmopen .slotrow select,
.asmopen .slotrow input[type=text] { padding: 1px 4px; font-size: var(--fs-sm); }
.asmopen .slotrow .sel.two { gap: 0; }
.asmopen .slotrow .sel.two select { font-size: 10px; padding: 0 3px; }

/* The main item reads as the heading of its own block. */
.asmopen .slotrow.main {
  background: var(--surface-2); min-height: 30px;
  box-shadow: inset 2px 0 0 var(--ink);
}
.asmopen .slotrow.main .lb.main > .ed { font-weight: 650; font-size: var(--fs-md); }
.asmopen .slotrow.main .n.b { font-weight: 650; }

/* Sub-items step in under it, with a rule joining them rather than a glyph
   on every row. */
.asmopen .slotrow .lb.sub { padding-left: var(--s-4); position: relative; }
.asmopen .slotrow .lb.sub::before {
  content: ''; position: absolute; left: var(--s-3); top: -2px; bottom: -2px;
  width: 1px; background: var(--hairline-2);
}
.asmopen .slotrow:last-of-type .lb.sub::before { bottom: 50%; }
.asmopen .slotrow.on .lb.sub > .ed { color: var(--ink); }
.asmopen .slotrow:not(.on) .lb.sub > .ed { color: var(--ink-3); }
.asmopen .slotrow:not(.on) { opacity: 1; }
.asmopen .slotrow:not(.on) .n, .asmopen .slotrow:not(.on) .sel { color: var(--ink-3); }
.asmopen .slotrow.held { background: var(--held-soft); box-shadow: inset 2px 0 0 var(--held); border-radius: 0; }

/* The collapsed card and its strip, tightened to match. */
.asmtop { padding: var(--s-3) var(--s-3) var(--s-3) var(--s-2); gap: var(--s-3); }
.asm .stripe { margin: var(--s-3) 0 var(--s-3) var(--s-3); }
.asmname .nm { font-size: var(--fs-md); }
.asmname .sd { font-size: var(--fs-xs); }
.asms { gap: 6px; }
.modstrip { padding: 0 var(--s-3) var(--s-2) calc(var(--s-2) + 26px); }
.ms { padding: 1px 0; }
.asmfoot { padding: var(--s-2) var(--s-3); }
.subs { padding: 0 var(--s-3) var(--s-2); }
.variants { padding: var(--s-2) var(--s-3); }
.asmopen .slotrow .sel select[data-unset] { color: var(--ink-3); font-style: italic; }

/* The upload preview: what came in, what it matched, what will happen. */
.matchlist .lhead, .matchlist .lrow {
  grid-template-columns: minmax(0, 1.5fr) 84px minmax(0, 1.6fr) minmax(150px, 1fr) 0 0;
  align-items: start; padding: 5px var(--s-4);
}
.matchlist .lrow select { width: 100%; border: 0; background: var(--surface-2); border-radius: var(--r-xs); padding: 3px var(--s-2); font-size: var(--fs-xs); }
.matchlist .lrow select:focus { background: var(--surface); box-shadow: 0 0 0 1.5px var(--ink); outline: none; }
.matchlist .lrow .hint { margin-top: 2px; }
.matchlist .lrow.inherited select { color: var(--ink-3); }
.matchlist .tag { margin-left: 4px; }
.crashmsg { background: var(--surface-2); border-radius: var(--r-sm); padding: var(--s-3); font-family: var(--font-num); font-size: var(--fs-xs); white-space: pre-wrap; margin: var(--s-3) 0; }
.printtotals .regno { font-size: var(--fs-xs); color: var(--ink-3); }
.printtotals .regno b { font-weight: 500; }

/* Sub-items, editable in the library. */
.lhead.subcols, .lrow.subrow {
  grid-template-columns: minmax(0,1.5fr) minmax(110px,1fr) 80px 80px 96px minmax(130px,1fr) 96px 60px;
  align-items: center;
}
.lrow.subrow .lb { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lrow.subrow .lb input[type=checkbox] { flex: none; }
.lrow.subrow select, .lrow.subrow input[type=text] {
  width: 100%; border: 0; background: transparent; border-radius: var(--r-xs);
  padding: 2px 4px; font: inherit; font-size: var(--fs-xs); min-width: 0;
}
.lrow.subrow select:hover, .lrow.subrow input:hover { background: var(--surface-2); }
.lrow.subrow select:focus, .lrow.subrow input:focus { background: var(--surface); box-shadow: 0 0 0 1.5px var(--ink); outline: none; }
.lrow.subrow .n input { text-align: right; font-family: var(--font-num); }
.lrow.subrow .n.muted { color: var(--ink-3); font-family: var(--font-num); }
.rulecell { display: flex; gap: 4px; align-items: center; min-width: 0; }
.rulecell .qn { width: 44px; flex: none; text-align: right; background: var(--surface-2); }

/* The save indicator: present, quiet, and loud only when it fails. */
.savestate { font-size: var(--fs-xs); color: var(--ink-3); white-space: nowrap; font-family: var(--font-num); }
.savestate.bad { color: var(--m-negative); font-weight: 600; }
@media (max-width: 900px) { .savestate { display: none; } }

/* ==========================================================================
   Printing. `window.print()` is the whole PDF path, so the rules have to do
   the work a renderer would: nothing splits mid-row, a section heading never
   lands alone at the foot of a page, and every page carries the quotation
   number and a page count.
   ========================================================================== */

@page {
  size: A4 portrait;
  margin: 16mm 14mm 18mm;
}

@media print {
  /* A row split across a page break reads as an error in the quotation. */
  .sheet tr.lvl2, .sheet tr.lvl3, .sheet tr.gsub { break-inside: avoid; page-break-inside: avoid; }
  .sheet tr.lvl1 { break-after: avoid; page-break-after: avoid; }
  .sheet tr.lvl1 td { break-inside: avoid; }
  /* A heading with nothing under it is worse than a heading on the next page. */
  .sheet tr.lvl1 + tr.lvl2 { break-before: avoid; page-break-before: avoid; }
  .printtotals, .printtotals .grand { break-inside: avoid; }
  .card { break-inside: avoid; }

  /* Column headings repeat on every page, which is what makes a long
     quotation readable rather than a wall of unlabelled figures. */
  .printable thead { display: table-header-group; }
  .printable tfoot { display: table-footer-group; }

  .printhead { display: block; }
  .printfoot { display: block; position: running(foot); }

  /* The client's own reference on every sheet, not only the first. */
  .printable { counter-reset: page; }
}

.printhead { display: none; }
@media print {
  .printhead {
    display: flex; justify-content: space-between; align-items: baseline;
    border-bottom: 1pt solid #000; padding-bottom: 3mm; margin-bottom: 5mm;
  }
  .printhead b { font-size: 12pt; }
  .printhead span { font-size: 9pt; color: #444; }
  .printnote { font-size: 8pt; color: #555; margin-top: 6mm; border-top: 0.5pt solid #bbb; padding-top: 3mm; }
}

/* Announced to a screen reader, invisible to everyone else. */
.srlive { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* The firm's grid uses the quotation's columns, so one stylesheet drives both. */
.setblock .slothead.setcols.inline {
  position: static; background: var(--surface-2); border-radius: 0; margin: 0;
  border-top: 1px solid var(--hairline);
}
.setblock .slotrow .lb.main input.nm { font-weight: 650; font-size: var(--fs-md); }
.setblock .slotrow .lb input[type=text] {
  width: 100%; border: 0; background: transparent; border-radius: var(--r-xs);
  padding: 2px 4px; font: inherit; min-width: 0;
}
.setblock .slotrow .lb input[type=text]:hover { background: var(--surface); box-shadow: inset 0 0 0 1px var(--hairline-2); }
.setblock .slotrow .lb input[type=text]:focus { background: var(--surface); box-shadow: 0 0 0 1.5px var(--ink); outline: none; }
.setblock .slotrow .lb input[type=checkbox] { flex: none; }
.setblock .slotrow .lb.sub { padding-left: var(--s-4); position: relative; }
.setblock .slotrow .lb.sub::before {
  content: ''; position: absolute; left: var(--s-3); top: -2px; bottom: -2px; width: 1px; background: var(--hairline-2);
}
.setblock .slotrow.on { background: var(--surface); }
.setblock .slotrow:not(.on):not(.main):not(.foot) .n,
.setblock .slotrow:not(.on):not(.main):not(.foot) .sel { color: var(--ink-3); }
.setblock .endcell { display: flex; align-items: center; gap: 2px; justify-content: flex-end; min-width: 0; }
.setblock .endcell select.basis { flex: 1 1 auto; min-width: 0; max-width: 96px; font-size: 10px; color: var(--ink-3); }
.setblock .endcell .qn { width: 36px; flex: none; }
.setblock .slotrow.foot .vl.setnote { grid-column: span 5; }
.lrow .endcell { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }

/* Where a price came from. */
.importlog { margin: 0 var(--s-5) var(--s-3); background: var(--surface); border-radius: var(--r); padding: var(--s-3) var(--s-4); box-shadow: var(--shadow-card); }
.importlog > b { font-size: var(--fs-xs); color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.improw { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(0,1.2fr) minmax(0,1fr) 90px; gap: var(--s-3); align-items: baseline; font-size: var(--fs-xs); padding: 3px 0; border-top: 1px solid var(--hairline); }
.improw .f { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.improw .w, .improw .n { color: var(--ink-3); }
.improw .h { color: var(--ink-3); font-family: var(--font-num); text-align: right; }
.rolelabel { font-size: var(--fs-sm); font-weight: 600; color: var(--ink); padding-left: 4px; }

/* The moment before the session question is answered. */
.signcard.boot { text-align: left; }
.bootbar { height: 3px; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; margin: var(--s-4) 0 var(--s-3); }
.bootbar i { display: block; height: 100%; width: 40%; background: var(--ink); border-radius: var(--r-pill); animation: bootslide 1.1s ease-in-out infinite; }
@keyframes bootslide { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) { .bootbar i { animation: none; width: 100%; opacity: .35; } }

/* ==========================================================================
   The rule column. Charge type and quantity rule had no heading and shared a
   cell with the delete button, so two controls deciding how much of a measured
   quantity is charged were abbreviated into nothing. They get a column.
   ========================================================================== */


.chargecell { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.chargecell > select,
.chargecell > span { color: var(--ink-2); }
.chargecell > select {
  width: 100%; border: 0; background: transparent; border-radius: var(--r-xs);
  padding: 1px 3px; min-width: 0;
}
.chargecell > select:hover { background: var(--surface-2); }
.chargecell > select:focus { background: var(--surface); box-shadow: 0 0 0 1.5px var(--ink); outline: none; }
.chargecell.muted { justify-content: center; color: var(--ink-3); }
/* The rule reads as a line of its own under the charge type, indented, so the
   hierarchy matches the rows: what it is, then how it is counted. */
.ruleline { display: flex; align-items: center; gap: 3px; min-width: 0; padding-left: 7px; position: relative; }
.ruleline::before {
  content: ''; position: absolute; left: 1px; top: 4px; bottom: 4px; width: 1px; background: var(--hairline-2);
}
.ruleline select, .ruleline > span {
  flex: 1; min-width: 0; font-size: 10px; color: var(--ink-3);
  border: 0; background: transparent; border-radius: var(--r-xs); padding: 0 2px;
  text-overflow: ellipsis;
}
.ruleline select:hover { background: var(--surface-2); color: var(--ink-2); }
.ruleline .qn {
  width: 34px; flex: none; text-align: right; font-family: var(--font-num); font-size: 10px;
  border: 0; background: var(--surface-2); border-radius: var(--r-xs); padding: 0 3px;
}
.asmopen .slotrow.main .chargecell,
.setblock .slotrow.main .chargecell { color: var(--ink-3); }




/* The studio's own reference for a line. Monospaced so C2 and C2-1 line up
   down the column, and narrow so it never competes with the description. */
.pcode { font-family: var(--font-num); font-weight: 600; margin-right: 6px; color: #333; }
@media print { .pcode { color: #000; } }

/* Billing by supplier, payments and invoices. */
.supplierledger { margin-bottom: var(--s-5); }
.lhead.firmcols, .lrow.firmcols { grid-template-columns: minmax(0,1.6fr) minmax(0,.9fr) 106px 106px 118px minmax(0,1.1fr) minmax(0,1fr); }
.lrow.firmcols.total { border-top: 1.5px solid var(--ink); font-weight: 650; }
.lhead.paycols, .lrow.paycols { grid-template-columns: 132px 104px minmax(0,1fr) minmax(0,1.2fr) 34px; }
.lhead.invcols, .lrow.invcols { grid-template-columns: minmax(0,1.8fr) 70px 78px minmax(0,1fr) 34px; }
.lrow.paycols input, .lrow.invcols input { width: 100%; border: 0; background: transparent; font: inherit; font-size: var(--fs-xs); padding: 2px 3px; border-radius: var(--r-xs); }
.lrow.paycols input:hover { background: var(--surface-2); }
.lrow.paycols input:focus { background: var(--surface); box-shadow: 0 0 0 1.5px var(--ink); outline: none; }
.lrow.paycols .n input { text-align: right; font-family: var(--font-num); }
.owed { display: block; font-size: 10px; font-weight: 500; margin-top: -1px; }
.owed.warn { color: var(--m-warn, #8a6a1f); }
.owed.bad { color: var(--m-negative); }
.costsum.tight { margin-bottom: var(--s-3); }
.linklike { border: 0; cursor: pointer; font: inherit; }
.lhead.sharecols, .lrow.sharecols { grid-template-columns: 132px 92px minmax(0,1.3fr) 92px 92px; }
.card.ok { border-left: 3px solid var(--m-positive, #1e6b3a); }


/* ==========================================================================
   ONE column template per grid, declared once.

   These grids were laid out in five places between them \u2014 a base rule and
   four media queries \u2014 and adding a column meant remembering all five. It was
   not remembered: the header carried eight columns and the rows carried nine
   at two breakpoints, so headings sat over the wrong figures.

   The template is now a variable on the container. The header and the rows
   both read it, so they cannot describe different grids, and a breakpoint
   changes one line rather than two. `npm run e2e` measures the header cells
   against the row cells and fails if they ever diverge again.
   ========================================================================== */

/* Declared high enough that every descendant inherits it. It was on .asmopen
   and .setblock \u2014 but the scope builder's column header is a sibling of the
   blocks, not a child, so it inherited nothing, var(--slotgrid) resolved to
   nothing, and the header fell back to a different grid entirely: 1,123 pixels
   of drift between a heading and the figures under it. */
#app {
  --slotgrid:
    /* The name gets the most room, because it is the only column whose
       content the studio wrote and the only one that reads as a sentence.
       Everything else is a figure or a short label with a knowable width. */
    minmax(210px, 2.1fr)    /* item + code */
    minmax(100px, 1.05fr)   /* value       */
    58px                    /* qty         */
    78px                    /* price/unit  */
    72px                    /* cost        */
    78px                    /* unit        */
    86px                    /* total       */
    minmax(132px, .95fr)    /* charged     */
    minmax(104px, .8fr)     /* trade/room  */
    56px;                   /* actions     */
}
.asmopen .slothead, .asmopen .slotrow,
.setblock .slothead, .setblock .slotrow,
.slothead.setcols {
  display: grid;
  grid-template-columns: var(--slotgrid);
  gap: var(--s-2);
  align-items: center;
}
/* The header and the rows must also agree on their horizontal padding, or the
   columns line up and the content inside them does not. */
.slothead.setcols, .setblock .slotrow, .setblock .slothead { padding-inline: var(--s-3); }

/* Font size belongs to the row, not the cell. Every cell in a row is the same
   size; the only deliberate step is between a main item and its sub-items,
   which is the hierarchy and not an accident. */
.asmopen .slothead, .setblock .slothead { font-size: var(--fs-xs); }
.asmopen .slotrow, .setblock .slotrow { font-size: var(--fs-sm); }
.asmopen .slotrow.main, .setblock .slotrow.main { font-size: var(--fs-md); }
.asmopen .slotrow.foot, .setblock .slotrow.foot { font-size: var(--fs-xs); }
.asmopen .slotrow *, .setblock .slotrow * { font-size: inherit; }
/* Declared after everything that might set a size inside a cell, so a row is
   one size throughout whatever a component wanted for itself. */
.asmopen .slotrow > *, .setblock .slotrow > *,
.asmopen .slotrow input, .setblock .slotrow input,
.asmopen .slotrow select, .setblock .slotrow select,
.asmopen .slotrow span, .setblock .slotrow span { font-size: inherit; }
/* The two that are deliberately smaller: a rule reads under its charge type,
   and a tag is a label rather than a figure. */
.asmopen .ruleline, .asmopen .ruleline *,
.setblock .ruleline, .setblock .ruleline * { font-size: var(--fs-xs); }
.asmopen .slotrow .tag, .setblock .slotrow .tag { font-size: 10px; }

@media (max-width: 1280px) {
  #app { --slotgrid: minmax(170px,1.8fr) minmax(86px,1fr) 52px 72px 68px 70px 78px minmax(110px,.9fr) minmax(90px,.75fr) 46px; }
}
@media (max-width: 1040px) {
  /* Cost, unit and the rule fold away before the grid starts crushing. The
     header folds with them, because a heading over a hidden column is worse
     than no heading. */
  #app { --slotgrid: minmax(150px,1.8fr) minmax(80px,1fr) 48px 72px 76px 44px; }
  .slothead.setcols > span:nth-child(5), .slothead.setcols > span:nth-child(6),
  .slothead.setcols > span:nth-child(8), .slothead.setcols > span:nth-child(9),
  .asmopen .slothead > span:nth-child(5), .setblock .slothead > span:nth-child(5),
  .asmopen .slotrow > *:nth-child(5), .setblock .slotrow > *:nth-child(5),
  .asmopen .slothead > span:nth-child(6), .setblock .slothead > span:nth-child(6),
  .asmopen .slotrow > *:nth-child(6), .setblock .slotrow > *:nth-child(6),
  .asmopen .slothead > span:nth-child(8), .setblock .slothead > span:nth-child(8),
  .asmopen .slotrow > *:nth-child(8), .setblock .slotrow > *:nth-child(8),
  .asmopen .slothead > span:nth-child(9), .setblock .slothead > span:nth-child(9),
  .asmopen .slotrow > *:nth-child(9), .setblock .slotrow > *:nth-child(9) { display: none; }
}
@media (max-width: 760px) {
  #app { --slotgrid: minmax(120px,1fr) 54px 72px 40px; }
  .slothead.setcols > span:nth-child(2),
  .asmopen .slothead > span:nth-child(2), .setblock .slothead > span:nth-child(2),
  .asmopen .slotrow > *:nth-child(2), .setblock .slotrow > *:nth-child(2) { display: none; }
}
.lhead.stagecols, .lrow.stagecols { grid-template-columns: 120px minmax(0,1.4fr) 120px 150px minmax(0,1fr); }
.panel2 { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-card); margin-bottom: var(--s-5); overflow: hidden; }
.panel2 .phead { display: flex; justify-content: space-between; align-items: baseline; padding: var(--s-4) var(--s-4) var(--s-2); }
.panel2 .phead b { font-size: var(--fs-md); }
.panel2 .row.pad, .panel2 p.pad { padding: var(--s-3) var(--s-4) var(--s-4); }
.costsum .cs b.muted { color: var(--ink-3); }
.pickfilters { display: flex; gap: var(--s-2); align-items: center; padding: var(--s-2) var(--s-4); border-bottom: 1px solid var(--hairline); flex-wrap: wrap; }
.pickfilters .meta { font-size: var(--fs-xs); color: var(--ink-3); white-space: nowrap; }


/* The line's own reference, as a field rather than a run of text. It was a
   borderless input that only showed itself on hover, so it read as part of the
   name; a code somebody types is a field and should look like one. */
.asmopen .slotrow .lb input.itemcode,
.setblock .slotrow .lb input.itemcode,
input.itemcode {
  flex: none; width: 58px; font-family: var(--font-num); font-weight: 600;
  color: var(--ink); text-align: center; letter-spacing: -.01em;
  border: 1px solid var(--hairline-2); background: var(--surface-2);
  border-radius: var(--r-xs); padding: 2px 4px;
}
.asmopen .slotrow .lb input.itemcode::placeholder,
input.itemcode::placeholder { color: var(--ink-3); font-weight: 400; }
.asmopen .slotrow .lb input.itemcode:hover, input.itemcode:hover { border-color: var(--ink-3); }
.asmopen .slotrow .lb input.itemcode:focus, input.itemcode:focus {
  background: var(--surface); border-color: var(--ink); box-shadow: 0 0 0 2px rgba(20,22,26,.08); outline: none;
}
.itemcode.ro {
  flex: none; width: 58px; text-align: center; font-family: var(--font-num); font-weight: 600;
  background: var(--surface-2); border-radius: var(--r-xs); padding: 2px 4px;
}
.slotrow .endcell { display: flex; gap: 1px; align-items: center; justify-content: flex-end; }
/* Always visible.
   
   These were revealed on hover, on the reasoning that a delete on every row is
   an invitation. That was wrong for this application: an estimator correcting
   a quotation hunts for a control that is not there, and on a touchscreen
   there is no hover at all. They are present and quiet instead \u2014 low
   contrast until the row is under the pointer, which is a difference in
   emphasis rather than in existence. */
.slotrow .endcell .x, .slotrow .endcell .dupicon {
  opacity: .45; transition: opacity .12s ease, color .12s ease;
  border: 0; background: none; cursor: pointer;
  color: var(--ink-3); font-size: 15px; line-height: 1; padding: 3px 4px; border-radius: var(--r-xs);
}
.slotrow:hover .endcell .x, .slotrow:hover .endcell .dupicon,
.slotrow .endcell .x:focus, .slotrow .endcell .dupicon:focus { opacity: 1; }
.slotrow .endcell .x:hover { color: var(--m-negative); background: var(--surface-2); }
.slotrow .endcell .dupicon:hover { color: var(--ink); background: var(--surface-2); }
.sel.two.muted { color: var(--ink-3); }

.setblock .slotrow .lb.main, .asmopen .slotrow .lb.main { min-width: 0; }
.setblock .slotrow .lb.main input.nm, .asmopen .slotrow .lb > .ed {
  flex: 1 1 auto; min-width: 0; text-overflow: ellipsis;
}

/* On the card header, where the line is read, rather than inside the expanded
   grid where it only appeared once somebody opened the row. */
.asmtop > input.itemcode {
  flex: none; width: 56px; align-self: flex-start; margin-top: 1px;
  font-family: var(--font-num); font-size: var(--fs-xs); font-weight: 650;
  color: var(--ink); text-align: center;
  border: 1px solid var(--hairline-2); background: var(--surface-2);
  border-radius: var(--r-xs); padding: 2px 4px;
}
.asmtop > input.itemcode::placeholder { color: var(--ink-3); font-weight: 400; }
.asmtop > input.itemcode:hover { border-color: var(--ink-3); }
.asmtop > input.itemcode:focus { background: var(--surface); border-color: var(--ink); box-shadow: 0 0 0 2px rgba(20,22,26,.08); outline: none; }
.asmtop > .itemcode.ro {
  flex: none; width: 56px; text-align: center; font-family: var(--font-num);
  font-size: var(--fs-xs); font-weight: 650; background: var(--surface-2);
  border-radius: var(--r-xs); padding: 2px 4px; align-self: flex-start; margin-top: 1px;
}
@media (max-width: 700px) {
  .asmtop > input.itemcode, .asmtop > .itemcode.ro { width: 46px; }
}

/* Expenses by trade. The generic ledger template gave the description 829px
   and the invoice buttons 100px; these are the proportions the row actually
   needs, and the header now uses the same ones. */
.lhead.expcols, .lrow.expcols {
  grid-template-columns: minmax(0, 1.9fr) minmax(0, 1.1fr) 112px 124px minmax(150px, .95fr) 32px;
}
.lrow.exp .dt { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.lrow.exp .dt .btn.small, .lrow.exp .dt .tag { white-space: nowrap; }
.lrow.total.big.expcols { border-top: 1.5px solid var(--ink); font-weight: 650; padding-top: var(--s-3); }
.lrow.total.big.expcols .dt { color: var(--ink-3); font-weight: 500; text-align: right; }
.tradeblock .ledger { padding-bottom: var(--s-2); }
.tradeblock.empty .thead { opacity: .72; }

/* The invoice control. An invoice is what an accountant asks for and what a
   dispute turns on, so attaching one looks like an action rather than a status
   label sitting quietly in a cell. */
.expacts { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.expacts .btn.small { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.expacts .btn.needsfile {
  border-color: var(--m-warn-line, #dcc78a); background: #fdf8ec; color: #7a5d13; font-weight: 600;
}
.expacts .btn.needsfile:hover { background: #f9f0dc; border-color: #c9ad63; }
.expacts .btn.hasfile { border-color: var(--hairline-2); color: var(--ink-2); }
.expacts .ic { font-size: 12px; line-height: 1; }
.paidcell { display: flex; flex-direction: column; align-items: flex-end; gap: 0; line-height: 1.25; }
.paidcell .owed { font-size: 10px; font-weight: 500; }
.paidcell .owed.ok { color: var(--ink-3); }
.paidcell .owed.warn { color: #8a6a1f; }
.paidcell .owed.bad { color: var(--m-negative); }

/* Invoice list and preview. */
.invacts { display: flex; gap: 4px; align-items: center; justify-content: flex-end; }
.linkname { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left; }
.linkname:hover { text-decoration: underline; text-underline-offset: 2px; }
.invpreview { margin-top: var(--s-3); border: 1px solid var(--hairline); border-radius: var(--r); overflow: hidden; background: var(--surface-2); }
.invpreview .ph { display: flex; justify-content: space-between; align-items: baseline; padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--hairline); background: var(--surface); }
.invpreview .ph b { font-size: var(--fs-sm); }
.invpreview iframe { display: block; width: 100%; height: 62vh; min-height: 340px; border: 0; background: #fff; }
.invpreview > p.muted { padding: var(--s-2) var(--s-3); margin: 0; font-size: var(--fs-xs); }
.lhead.invcols, .lrow.invcols { grid-template-columns: minmax(0,1.8fr) 68px 76px minmax(0,1fr) 188px; }

/* Duplicate and delete on the card header. Hidden until hover or focus, like
   the row controls: a delete on every card at all times is an invitation, and
   hover-only would leave anybody on a keyboard without it. */
.asmfigs .dupicon, .asmfigs .delicon {
  opacity: .45; transition: opacity .12s ease, color .12s ease; border: 0; background: none; cursor: pointer;
  color: var(--ink-3); line-height: 1; padding: 3px 5px; border-radius: var(--r-xs); flex: none;
}
.asmfigs .delicon { font-size: 16px; }
.asm:hover .asmfigs .dupicon, .asm:hover .asmfigs .delicon,
.asmfigs .dupicon:focus, .asmfigs .delicon:focus { opacity: 1; }
.asmfigs .delicon:hover { color: var(--m-negative); background: var(--surface-2); }
.asmfigs .dupicon:hover { color: var(--ink); background: var(--surface-2); }
/* Touch has no hover, so on a phone they stay visible rather than unreachable. */
@media (hover: none) {
  .asmfigs .dupicon, .asmfigs .delicon, .slotrow .endcell .x,
  .slotrow .endcell .dupicon, .swatches { opacity: .8; }
}

/* ==========================================================================
   Projected against actual. Two bars per trade on one scale, so the comparison
   is the picture rather than something the reader has to do in their head.
   ========================================================================== */
.varpanel .varlegend { display: flex; gap: var(--s-4); padding: 0 var(--s-4) var(--s-2); font-size: var(--fs-xs); color: var(--ink-3); }
.varlegend .sw { display: inline-block; width: 22px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.varlegend .sw.proj { background: var(--hairline-2); }
.varlegend .sw.act { background: var(--ink-2); }
.varrows { padding: 0 var(--s-4) var(--s-3); }
.varrow { display: grid; grid-template-columns: minmax(130px, 1.1fr) minmax(0, 3fr) 104px; gap: var(--s-3); align-items: center; padding: 7px 0; border-top: 1px solid var(--hairline); }
.varrow .vl b { display: block; font-size: var(--fs-sm); }
.varrow .vl .meta { font-size: 10px; color: var(--ink-3); }
.vbars { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
/* A track and a figure, each in its own column. The figure was positioned
   outside the bar, so a bar near full width pushed its label into the variance
   column beside it. */
.barrow { display: grid; grid-template-columns: minmax(0, 1fr) 92px; gap: var(--s-3); align-items: center; }
.barrow .track { height: 15px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.barrow .barval { font-family: var(--font-num); font-size: 11px; color: var(--ink-3); text-align: left; white-space: nowrap; }
.vbar { display: block; height: 100%; border-radius: 3px; min-width: 2px; transition: width .2s ease; }
.vbar.proj { background: var(--hairline-2); }
.vbar.act { background: var(--ink-2); }
.vbar.act.over { background: var(--m-negative); }
.vbar.act.under { background: var(--m-positive, #1e6b3a); }
.varrow .vv { text-align: right; font-family: var(--font-num); font-size: var(--fs-sm); font-weight: 650; }
.varrow .vv.bad { color: var(--m-negative); }
.varrow .vv.ok { color: var(--m-positive, #1e6b3a); }
.varfoot { padding: var(--s-2) var(--s-4) var(--s-4); font-size: var(--fs-xs); color: var(--ink-3); border-top: 1px solid var(--hairline); }

/* Expected → on actual cost → in hand. */
.profitrow { display: grid; grid-template-columns: 1fr 28px 1.15fr 28px 1fr; gap: var(--s-2); align-items: stretch; padding: var(--s-2) var(--s-4) var(--s-4); }
.pf3 { background: var(--surface-2); border-radius: var(--r); padding: var(--s-3) var(--s-4); display: flex; flex-direction: column; gap: 1px; }
.pf3.lead { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--ink); }
.pf3 .k { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 600; }
.pf3 b { font-family: var(--font-num); font-size: var(--fs-xl); letter-spacing: -.02em; line-height: 1.15; }
.pf3 b.bad { color: var(--m-negative); }
.pf3 b.ok { color: var(--m-positive, #1e6b3a); }
.pf3 .sub { font-size: 10.5px; color: var(--ink-3); line-height: 1.35; }
.profitrow .arrow { display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 17px; }
@media (max-width: 900px) {
  .profitrow { grid-template-columns: 1fr; }
  .profitrow .arrow { display: none; }
  .varrow { grid-template-columns: minmax(100px, 1fr) minmax(0, 2fr) 88px; }
}

/* Three fixed colours for marking a line. What they mean is for the studio to
   agree; the software only guarantees they are the same three everywhere. */
.swatches { display: inline-flex; gap: 3px; align-items: center; flex: none; opacity: .5; transition: opacity .12s ease; }
.asm:hover .swatches, .swatches:focus-within { opacity: 1; }
.swatches .sw {
  width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--hairline-2);
  cursor: pointer; padding: 0; background: var(--surface); position: relative;
}
.swatches .sw-blue { background: #2f6fd0; border-color: #2f6fd0; }
.swatches .sw-red { background: #c0392b; border-color: #c0392b; }
.swatches .sw-yellow { background: #e0a800; border-color: #e0a800; }
.swatches .sw-none { background: var(--surface); }
.swatches .sw-none::after {
  content: ''; position: absolute; inset: 2px; border-top: 1.5px solid var(--ink-3);
  transform: rotate(-45deg); transform-origin: center;
}
.swatches .sw.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--ink); }
.swatches .sw:hover { transform: scale(1.15); }
/* A line that carries a colour keeps its swatches visible, so the mark can be
   cleared without hunting for it. */
.asm:has(.stripe[class*="tag-"]) .swatches { opacity: 1; }
.stripe.tag-blue { background: #2f6fd0; }
.stripe.tag-red { background: #c0392b; }
.stripe.tag-yellow { background: #e0a800; }
@media (hover: none) { .swatches { opacity: .7; } }

/* A marked line on a client's document. Colour AND a word: a signed contract
   is photocopied, faxed and read by people who do not distinguish these three,
   and a bare coloured dot on a legal document means nothing to anybody. */
.pmark {
  display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 20px;
  font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  border: 1.2px solid currentColor; white-space: nowrap;
}
.pmark.pm-blue { color: #2f6fd0; }
.pmark.pm-red { color: #c0392b; }
.pmark.pm-yellow { color: #9a7400; }
.colourkey {
  display: flex; gap: var(--s-4); align-items: baseline; flex-wrap: wrap;
  border: 1px solid var(--hairline); border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-3); margin-bottom: var(--s-3); font-size: var(--fs-xs);
}
.colourkey > b { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.colourkey .keys { display: flex; gap: var(--s-4); flex-wrap: wrap; }
.colourkey .k { display: inline-flex; align-items: center; gap: 6px; }
.colourkey .k i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.colourkey .k i.pm-blue { background: #2f6fd0; }
.colourkey .k i.pm-red { background: #c0392b; }
.colourkey .k i.pm-yellow { background: #e0a800; }
@media print {
  .colourkey { border-color: #999; break-inside: avoid; }
  /* Print carries the border and the word; a colour fill does not survive a
     monochrome printer. */
  .pmark { border-color: #444; color: #000; }
}
.card2 label .swdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.card2 label .swdot.sw-blue { background: #2f6fd0; }
.card2 label .swdot.sw-red { background: #c0392b; }
.card2 label .swdot.sw-yellow { background: #e0a800; }


/* The tooltip. Immediate rather than after a second of hovering, on focus as
   well as hover, and it looks like part of the document. */
.tip {
  position: fixed; z-index: 9999; pointer-events: none;
  max-width: 280px; padding: 6px 10px; border-radius: var(--r-sm);
  background: var(--ink); color: #fff; font-size: var(--fs-xs); line-height: 1.35;
  box-shadow: 0 4px 14px rgba(0,0,0,.22);
  opacity: 0; transform: translateY(2px); transition: opacity .1s ease, transform .1s ease;
}
.tip.on { opacity: 1; transform: none; }
.tip::after {
  content: ''; position: absolute; left: 50%; margin-left: -5px;
  border: 5px solid transparent; border-top-color: var(--ink); top: 100%;
}
.tip.below::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .tip { transition: none; } }
@media (hover: none) { .tip { display: none; } }

/* ==========================================================================
   A subcontractor's details: one row, always visible, editable in place.

   This was a "+ Details" toggle over a joined string of facts. It hid eight
   short facts behind a click, and broke onto several lines whenever a firm had
   a long payment term. There is no edit mode now, and nothing to open.
   ========================================================================== */
.firmbar {
  display: flex; flex-wrap: wrap; align-items: stretch; gap: 0;
  background: var(--surface); border-radius: var(--r);
  box-shadow: var(--shadow-card); margin: 0 var(--s-5) var(--s-4);
  overflow: hidden;
}
.dcell {
  flex: 1 1 118px; min-width: 0; padding: var(--s-3) var(--s-4);
  display: flex; flex-direction: column; gap: 2px;
  border-left: 1px solid var(--hairline);
}
.dcell:first-child { border-left: 0; }
.dcell.grow { flex: 2 1 190px; }
.dcell.narrow { flex: 0 0 104px; }
.dlabel {
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); font-weight: 600; white-space: nowrap;
}
/* The value reads as text and behaves as a field. Explicit colours rather than
   inherited ones: an input that inherited a dark fill from elsewhere was
   rendering black-on-black and the text could not be read at all. */
.dcell .dval {
  font-size: var(--fs-sm); color: var(--ink); background: transparent;
  border: 1px solid transparent; border-radius: var(--r-xs);
  padding: 2px 5px; margin: -2px -5px; width: calc(100% + 10px);
  font-family: inherit; font-weight: 500; min-width: 0;
  text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
}
.dcell input.dval::placeholder { color: var(--ink-3); font-weight: 400; }
.dcell input.dval:hover, .dcell select.dval:hover {
  background: var(--surface-2); border-color: var(--hairline-2); cursor: text;
}
.dcell input.dval:focus, .dcell select.dval:focus {
  background: var(--surface); border-color: var(--ink);
  box-shadow: 0 0 0 2px rgba(20,22,26,.08); outline: none;
  text-overflow: clip; white-space: normal; overflow: visible;
}
.dcell select.dval { cursor: pointer; appearance: none; }
.dcell select.dval:hover { cursor: pointer; }
/* The percentage sign sits with the number rather than in the label, so the
   unit is where the figure is. */
.pctwrap { display: flex; align-items: baseline; gap: 1px; min-width: 0; }
.pctwrap .pct { text-align: right; width: 46px; margin-right: 0; }
.pctwrap i { font-style: normal; color: var(--ink-3); font-size: var(--fs-sm); }

@media (max-width: 1100px) {
  .dcell { flex: 1 1 140px; }
  .dcell.grow { flex: 1 1 200px; }
}
@media (max-width: 700px) {
  .firmbar { margin-inline: var(--s-3); }
  .dcell { flex: 1 1 45%; border-top: 1px solid var(--hairline); }
}

/* A trade's conditions: several lines, and bullets where they were written. */
textarea.grpnote {
  width: 100%; font: inherit; font-size: var(--fs-sm); color: var(--ink-2);
  background: transparent; border: 1px solid transparent; border-radius: var(--r-xs);
  padding: 4px 6px; margin: 0 0 var(--s-2); resize: vertical; min-height: 34px;
  line-height: 1.45;
}
textarea.grpnote::placeholder { color: var(--ink-3); }
textarea.grpnote:hover { background: var(--surface-2); border-color: var(--hairline-2); }
textarea.grpnote:focus { background: var(--surface); border-color: var(--ink); box-shadow: 0 0 0 2px rgba(20,22,26,.08); outline: none; }
textarea.presetnote {
  width: 100%; font: inherit; font-size: var(--fs-sm); line-height: 1.5;
  border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: var(--s-3);
  background: var(--surface); color: var(--ink); resize: vertical;
}
textarea.presetnote:focus { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(20,22,26,.08); outline: none; }
.presetpreview { margin-top: var(--s-3); padding: var(--s-3); background: var(--surface-2); border-radius: var(--r-sm); }
.h1s.notes p { margin: 0 0 3px; }
.h1s.notes ul { margin: 2px 0 4px; padding-left: 16px; }
.h1s.notes li { margin: 0 0 2px; }
.h1s.notes.ingrid { color: var(--ink-3); font-size: var(--fs-xs); margin-bottom: var(--s-2); }
@media print { .h1s.notes ul { padding-left: 14px; } .h1s.notes li { break-inside: avoid; } }

/* The sub-item editor. */
.picker.wide { max-width: 860px; width: 92vw; }
.picker .pad .vhead { display: flex; align-items: baseline; gap: var(--s-3); margin: var(--s-4) 0 var(--s-2); }
.picker .pad .vhead b { font-size: var(--fs-md); }
.picker .pad .hint { font-size: var(--fs-xs); color: var(--ink-3); }
.lhead.valcols, .lrow.valcols { grid-template-columns: minmax(0,1.6fr) 118px 118px 70px 36px; }
.lrow.valcols input[type=text] { width: 100%; }
input.vmoney {
  width: 100%; text-align: right; font-family: var(--font-num); font-size: var(--fs-sm);
  border: 1px solid var(--hairline); border-radius: var(--r-xs); padding: 3px 6px;
  background: var(--surface); color: var(--ink);
}
input.vmoney:focus { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(20,22,26,.08); outline: none; }
.row.end { display: flex; gap: var(--s-2); justify-content: flex-end; align-items: center; margin-top: var(--s-4); }
.picker .pad .f.grow { flex: 2 1 240px; }

/* Choosing which scope items carry a sub-item. */
/* Choosing which scope items carry a sub-item.

   The dialog is a column: header, filters, a list that scrolls, and a footer
   that does not. Capping the whole thing against the viewport rather than the
   list alone is what keeps the primary action on screen on a laptop. */
.picker.wide { display: flex; flex-direction: column; max-height: 86vh; }
.picker.wide > .list.carriers { flex: 1 1 auto; min-height: 120px; overflow-y: auto; padding: 0; }

.carrier {
  display: grid;
  /* The last column is a fixed width whether or not a tag is in it. It was
     `auto`, which collapsed to a fraction of a pixel on rows with no tag and
     moved every other column across on the rows that had one. */
  grid-template-columns: 18px minmax(0, 1.6fr) minmax(0, 1fr) 104px;
  gap: var(--s-3); align-items: center;
  padding: var(--s-3) var(--s-4);
  min-height: 44px;
  border-bottom: 1px solid var(--hairline); cursor: pointer;
}
.carrier:last-child { border-bottom: 0; }
.carrier:hover { background: var(--surface-2); }
.carrier.on { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--ink); }
.carrier.had { opacity: .58; cursor: default; }
.carrier .n { font-size: var(--fs-sm); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carrier .m { font-size: var(--fs-xs); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carrier input[type=checkbox] { width: 16px; height: 16px; margin: 0; flex: none; }
.carrier .tag { justify-self: end; white-space: nowrap; }

/* The footer had no padding at all, so the primary action sat flush against
   the bottom-right corner of the dialog. */
.picker .row.end {
  display: flex; gap: var(--s-3); justify-content: flex-end; align-items: center;
  padding: var(--s-4); margin: 0;
  border-top: 1px solid var(--hairline); background: var(--surface-2);
  flex: none;
}
.picker .row.end .btn { min-height: 38px; padding-inline: var(--s-4); }
.picker .pickfilters { padding: var(--s-3) var(--s-4); }
@media (max-width: 700px) {
  .carrier { grid-template-columns: 18px minmax(0,1fr) 92px; }
  .carrier .m { display: none; }
  .picker .row.end { flex-wrap: wrap; }
  .picker .row.end .btn { flex: 1 1 auto; }
}
.setblock .slotrow .why { color: var(--ink-2); font-size: var(--fs-xs); }

/* The drag handle on a quotation line. The card itself is not draggable: a
   draggable element swallows click-and-sweep, which made every field on a line
   impossible to select or correct by dragging across it. */
.asmtop .grip {
  flex: none; cursor: grab; color: var(--ink-3); font-size: 13px; line-height: 1;
  padding: 3px 4px; border-radius: var(--r-xs); opacity: .5; user-select: none;
  transition: opacity .12s ease, background .12s ease;
}
.asm:hover .asmtop .grip { opacity: 1; }
.asmtop .grip:hover { background: var(--surface-2); color: var(--ink); }
.asmtop .grip:active { cursor: grabbing; }
/* Text in a line behaves like text. */
.asm input, .asm select, .asm textarea, .asm .ed { user-select: text; }
@media (hover: none) { .asmtop .grip { opacity: .8; } }


/* The costing page reads down the left. Labels, headings and descriptions all
   start on the same line; only the figures are right-aligned, because a column
   of money is compared by its last digit and nothing else on the page is. */
.costsum .cs, .costsum .cs b, .costsum .cs span,
.pf3, .pf3 b, .pf3 .k, .pf3 .sub,
.varrow .vl, .varrow .vl b, .varpanel .phead, .profitpanel .phead,
.panel2 .phead b, .tradeblock .thead { text-align: left; }
.varfoot { text-align: left; }
.varrow .vv { text-align: right; }
.lrow .n, .lhead .n { text-align: right; }
/* Room between the blocks, and between a heading and what it heads. */
.varpanel .varrows { padding-block: var(--s-2) var(--s-3); }
.varrow { padding-block: var(--s-3); }
.profitrow { row-gap: var(--s-3); }
.costsum { margin-bottom: var(--s-4); }
.panel2 + .panel2 { margin-top: var(--s-4); }


/* A panel heading and its summary are two things, not one run of text.
   "Billing by supplier6 suppliers - $4,301,019.00 still owed" had nothing
   between the title and the figure beside it. */
/* Every panel heading on the costing page, whatever wraps it. The supplier
   ledger sits in its own block and was missed by a selector that named the
   panels one by one. */
.phead {
  display: flex; flex-wrap: wrap; align-items: baseline;
  justify-content: space-between; gap: var(--s-2) var(--s-5);
  padding: var(--s-4) var(--s-4) var(--s-3);
  border-bottom: 1px solid var(--hairline);
}
.phead > b { font-size: var(--fs-md); letter-spacing: -.01em; }
.phead > .meta {
  font-size: var(--fs-xs); color: var(--ink-3); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
@media (max-width: 620px) {
  .phead { flex-direction: column; align-items: flex-start; }
  .phead > .meta { white-space: normal; }
}

/* Conditions per trade. */
.tradenotes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s-3); margin: var(--s-3) 0; }
.tn { border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: var(--s-3); background: var(--surface); }
.tn.set { border-color: var(--hairline-2); box-shadow: inset 3px 0 0 var(--ink); }
.tnhead { display: flex; align-items: baseline; gap: var(--s-2); margin-bottom: var(--s-2); }
.tnhead b { font-size: var(--fs-sm); }
.tnhead .meta { font-size: 10px; color: var(--ink-3); margin-left: auto; white-space: nowrap; }
.tnhead .x { border: 0; background: none; cursor: pointer; color: var(--ink-3); font-size: 15px; line-height: 1; padding: 0 3px; }
.tnhead .x:hover { color: var(--m-negative); }
.tn textarea {
  width: 100%; font: inherit; font-size: var(--fs-xs); line-height: 1.45;
  border: 1px solid var(--hairline); border-radius: var(--r-xs); padding: 6px 8px;
  background: var(--surface); color: var(--ink); resize: vertical; min-height: 46px;
}
.tn textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(20,22,26,.08); outline: none; }
.lhead.tokcols, .lrow.tokcols { grid-template-columns: minmax(0,1.4fr) minmax(0,1.2fr) 130px 96px 96px; }
/* Sign out reads as an action, not as another small grey control in a row of
   them. Quiet until wanted, because it is not what anybody came to do. */
.top .btn.signout { border-color: var(--hairline-2); color: var(--ink-2); white-space: nowrap; }
.top .btn.signout:hover { border-color: var(--m-negative); color: var(--m-negative); background: var(--surface); }
.signcard .signnotice {
  background: #f1f7f3; color: var(--m-positive, #1e6b3a); border-radius: var(--r-sm);
  padding: var(--s-3); font-size: var(--fs-xs); line-height: 1.45; margin-bottom: var(--s-3);
}
/* What the offline copy is, said on the card rather than left to be guessed
   from the absence of a sign-up link. */
.signcard .signaside {
  margin-top: var(--s-4); padding-top: var(--s-4); border-top: 1px solid var(--hairline);
  font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.5;
}
.signcard .signaside b { display: block; color: var(--ink-2); font-size: var(--fs-xs); margin-bottom: 4px; }
.signcard .signaside p { margin: 0 0 6px; }
/* People first in Settings: it is the thing a director opens Settings to do. */
.card2.first { order: -1; }
.signcard .signlinks { display: flex; gap: var(--s-4); justify-content: center; margin-top: var(--s-3); flex-wrap: wrap; }
.signcard .signlinks .btn.link {
  border: 0; background: none; padding: 4px 2px; font-size: var(--fs-xs);
  color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.signcard .signlinks .btn.link:hover { color: var(--ink); }
.signcard .signlinks .btn.link:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: var(--r-xs); }
/* Somebody else is in this quotation. */
.livehere {
  display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs);
  color: var(--ink-2); background: var(--surface-2); border-radius: 20px;
  padding: 3px 10px; white-space: nowrap;
}
.livehere i { width: 7px; height: 7px; border-radius: 50%; background: var(--m-positive, #1e6b3a); flex: none; }
@media (max-width: 900px) { .livehere { display: none; } }
/* The line's code, on the pin. Big enough to read at a glance on a plan. */
.pins .pin .dot { min-width: 22px; height: 22px; border-radius: 11px; display: inline-flex;
  align-items: center; justify-content: center; font-family: var(--font-num);
  font-size: 10px; font-weight: 700; color: #fff; padding: 0 5px; }

/* The plan on the client's copy. Pins carry the line code so "C4" on page two
   and the mark on the plan are the same mark. */
.clientplan { margin: var(--s-5) 0; break-inside: avoid; }
.clientplan .cph { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--s-2); }
.clientplan .cph b { font-size: var(--fs-md); }
.clientplan .cph .meta { font-size: var(--fs-xs); color: var(--ink-3); }
.clientplan .planwrap { display: grid; grid-template-columns: minmax(0, 2fr) minmax(160px, 1fr); gap: var(--s-4); align-items: start; }
.clientplan .planbox { position: relative; border: 1px solid var(--hairline); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.clientplan .planart { display: block; width: 100%; height: auto; }
.clientplan .pins.client .pin { position: absolute; transform: translate(-50%, -50%); }
.clientplan .pins.client .dot {
  min-width: 22px; height: 22px; border-radius: 11px; display: inline-flex; align-items: center;
  justify-content: center; background: var(--ink); color: #fff; font-family: var(--font-num);
  font-size: 10px; font-weight: 700; padding: 0 5px; box-shadow: 0 0 0 2px #fff;
}
.clientplan .plankey { margin: 0; padding-left: 0; list-style: none; font-size: var(--fs-xs); line-height: 1.6; }
.clientplan .plankey li { display: flex; gap: 7px; align-items: baseline; }
.clientplan .plankey b { font-family: var(--font-num); min-width: 26px; }
@media (max-width: 760px) { .clientplan .planwrap { grid-template-columns: 1fr; } }
@media print { .clientplan { break-inside: avoid; } .clientplan .pins.client .dot { box-shadow: 0 0 0 1.5px #fff; } }

/* The layout's line list: every line, not only the pinned ones, because this
   list is how a pin is placed. */
.pinrow { display: flex; align-items: center; gap: var(--s-2); width: 100%; text-align: left; }
.pinrow .pincode {
  flex: none; min-width: 26px; height: 20px; border-radius: 10px; display: inline-flex;
  align-items: center; justify-content: center; font-family: var(--font-num); font-size: 10px;
  font-weight: 700; background: var(--surface-2); color: var(--ink-2); padding: 0 6px;
}
.pinrow.ispinned .pincode { background: var(--ink); color: #fff; }
.pinrow.arming { box-shadow: inset 0 0 0 2px var(--ink); }
.pinrow.arming .pincode { background: var(--m-positive, #1e6b3a); color: #fff; }
.pinrow .n { flex: 1 1 auto; min-width: 0; }
.pinrow .x { flex: none; opacity: .5; }
.pinrow:hover .x { opacity: 1; }
/* What is in each room, on the plan itself. */
text.roomitem { font-size: 11px; fill: var(--ink-2); font-family: var(--font-num); }
text.roomitem.more { fill: var(--ink-3); font-style: italic; }

/* A description being edited breaks out of its column: the column is not a
   sentence wide, and editing is the one moment somebody needs to see all of
   the text. */
.slotrow { position: relative; }
textarea.cell.t.wide {
  position: absolute; left: var(--s-3); right: var(--s-3); top: 2px; z-index: 6;
  font: inherit; font-size: var(--fs-sm); line-height: 1.4;
  padding: 6px 8px; border: 1px solid var(--ink); border-radius: var(--r-xs);
  background: var(--surface); color: var(--ink); resize: none; overflow: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,.10); min-height: 30px; max-height: 220px;
}
textarea.cell.t.wide:focus { outline: none; box-shadow: 0 0 0 2px rgba(20,22,26,.10), 0 4px 16px rgba(0,0,0,.14); }
/* A long description reads as one clipped line until it is opened or hovered. */
.slotrow .lb .ed { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The costing analysis: three figures, then the two profits they produce. */
.analysis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1px;
  background: var(--hairline); margin: 0 var(--s-4) var(--s-3); border-radius: var(--r); overflow: hidden; }
.analysis .an { background: var(--surface); padding: var(--s-4); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.analysis .an .k { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 650; white-space: nowrap; }
.analysis .an b { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--fs-xl);
  font-weight: 650; letter-spacing: -.02em; line-height: 1.2; margin: 1px 0 2px; }
.analysis .an .sub { font-size: 11px; color: var(--ink-3); line-height: 1.35; }
.analysis .an b.bad { color: var(--m-negative); }
.analysis .an b.ok { color: var(--m-positive, #1e6b3a); }
.analysis.profits { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.analysis.profits .an.lead { background: var(--surface-2); box-shadow: inset 0 2px 0 var(--ink); }
.vbar.profit { background: var(--m-positive, #1e6b3a); }
.vbar.profit.negative { background: var(--m-negative); }
.varlegend .sw.prof { background: var(--m-positive, #1e6b3a); }
.barrow .barval.ok { color: var(--m-positive, #1e6b3a); }
.barrow .barval.bad { color: var(--m-negative); }
/* The analysis reads first: it is the answer, and the two breakdowns below
   explain it. Ordered here rather than by moving markup. */
.profitpanel { order: -1; }
.mid > .costwrap, .panel.wide .costwrap { display: flex; flex-direction: column; }
/* A pin is picked up and put down, not re-placed. */
.pins .pin { cursor: grab; touch-action: none; }
.pins .pin:active { cursor: grabbing; }

/* The area grid: which part of the plan is which room. Half strength, so the
   plan underneath stays readable — this marks it, it does not replace it. */
.gridbar { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin-left: auto; }
.gridbar .btn.small.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.gridareas { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.gpick { display: inline-flex; align-items: center; gap: 5px; font: inherit; font-size: var(--fs-xs);
  padding: 3px 9px; border: 1px solid var(--hairline); border-radius: 20px; background: var(--surface);
  color: var(--ink-2); cursor: pointer; }
.gpick i { width: 9px; height: 9px; border-radius: 50%; background: var(--tint, var(--ink-3)); flex: none; }
.gpick.on { border-color: var(--ink); color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--ink); }
.gridsize { font-size: var(--fs-xs); color: var(--ink-3); display: inline-flex; align-items: center; gap: 5px; }
.gridsize select { font: inherit; font-size: var(--fs-xs); padding: 2px 5px; border: 1px solid var(--hairline);
  border-radius: var(--r-xs); background: var(--surface); color: var(--ink); }
.gridlayer { position: absolute; inset: 0; z-index: 3; touch-action: none; }
.gcell { position: absolute; border: 0; padding: 0; margin: 0; cursor: crosshair; background: transparent;
  box-shadow: inset 0 0 0 1px rgba(20,22,26,.14); display: flex; align-items: center; justify-content: center;
  overflow: hidden; }
.gcell:hover { box-shadow: inset 0 0 0 2px var(--ink); }
.gcell .gl { font-size: 9px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; padding: 0 2px; pointer-events: none; }
.plan.gridon .pins { z-index: 4; }
@media print { .gridlayer { display: none; } }

/* Areas drawn on the plan: a rectangle of the room's own size, rather than
   whichever grid cells it nearly covered. */
.zonelayer { position: absolute; inset: 0; z-index: 3; touch-action: none; }
.zonelayer.arming { cursor: crosshair; }
.zone { position: absolute; border: 1.5px solid; border-radius: 3px; cursor: move;
  display: flex; align-items: flex-start; justify-content: space-between; overflow: visible; }
.zone .zl { font-size: 10px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.55); padding: 3px 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.zone.sel { border-width: 2px; box-shadow: 0 0 0 2px #fff, 0 2px 10px rgba(0,0,0,.2); }
.zone.drawing { pointer-events: none; opacity: .8; }
.zone .zx { border: 0; background: #fff; color: var(--m-negative); border-radius: 50%; width: 18px; height: 18px;
  line-height: 1; font-size: 13px; cursor: pointer; margin: -8px -8px 0 0; flex: none;
  box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.zone .zgrip { position: absolute; right: -6px; bottom: -6px; width: 13px; height: 13px; border-radius: 3px;
  background: #fff; border: 1.5px solid currentColor; cursor: nwse-resize; }
@media print { .zonelayer { display: none; } }
/* The area's own figure, on the area. */
.zone .zl { display: flex; flex-direction: column; gap: 1px; line-height: 1.25; }
.zone .zl b { font-size: 10.5px; font-weight: 700; }
.zone .zl .zsum { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 11px; font-weight: 650; }
.zone .zl .zn { font-size: 9px; opacity: .85; }
/* A pin's label must not block the plan behind it: the first pin placed was
   swallowing clicks meant for the next one. */
.pins .pin .lbl { pointer-events: none; }
.segbar.mini .seg { font-size: 11px; padding: 3px 8px; }
.sidecathead .apptmark { margin-left: 6px; font-size: 10px; color: #1e6b3a; font-weight: 500; }

/* ---- Nothing in the quotation may push the page sideways ------------------
   Three things did: the "+ add to" / "+ heading" pair were each width:100% in
   one row (200% wide); the card header's control cluster was flex:none, so
   every control added to it crushed the item name to one word per line; and
   the open card's 8-column grid had fixed minimums wider than the column. */
.addrow .addhere { width: auto; flex: 1 1 0; min-width: 0; }
.addrow .addhere + .addhere { flex: 0 0 auto; }
.asmtop { flex-wrap: wrap; row-gap: var(--s-2); }
.asmname { min-width: 220px; flex: 1 1 260px; }
.asmfigs { flex: 0 1 auto; flex-wrap: wrap; justify-content: flex-end; row-gap: 4px; margin-left: auto; }
.asmopen .slothead, .asmopen .slotrow {
  grid-template-columns:
    minmax(0, 1.15fr) minmax(0, 1.35fr) 52px 76px 68px 84px 84px minmax(0, 0.9fr);
}
.asmopen .slotrow > *, .asmopen .slothead > * { min-width: 0; }
.asmopen .slotrow select { max-width: 100%; }
.asmopen .chargecell, .asmopen .chargecell * { overflow: hidden; text-overflow: ellipsis; }

/* The open card's grid matches its cells: 9 columns, 10 with Cost. It was
   declared with 8, so Trade/Room and the remove button wrapped onto a second
   line under every row. */
.asmopen .slotgrid .slothead, .asmopen .slotgrid .slotrow {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.3fr) 44px 74px 70px 72px minmax(0, .8fr) minmax(0, 1fr) 22px;
}
.asmopen .slotgrid.withcost .slothead, .asmopen .slotgrid.withcost .slotrow {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.3fr) 44px 74px 64px 70px 72px minmax(0, .8fr) minmax(0, 1fr) 22px;
}
.asmopen .slotrow:not(.main) { cursor: pointer; }
.asmopen .slotrow.focused { background: #fffaf0; box-shadow: inset 3px 0 0 #d99228; }
.subpanel { background: #fffaf0; border-top: 1px solid var(--hairline); padding: 8px var(--s-3) 10px calc(var(--s-4) + 20px); }
.subpanelhead, .subpanelrow { display: grid; grid-template-columns: minmax(140px, 1.6fr) 96px 96px minmax(0, 1fr) 24px; gap: var(--s-2); align-items: center; }
.subpanelhead { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; padding-bottom: 4px; }
.subpanelhead .n, .subpanelrow input.n { text-align: right; }
.subpanelrow { padding: 2px 0; }
.subpanelrow input { font: inherit; font-size: var(--fs-sm); border: 1px solid var(--hairline-2); border-radius: var(--r-xs); padding: 4px 6px; background: var(--surface); min-width: 0; }
.subpanelrow.chosen input:first-child { font-weight: 600; }
.subpanelrow .onote { font-size: var(--fs-xs); color: var(--ink-3); }
.subpanelfoot { display: flex; gap: var(--s-2); margin-top: 6px; }

/* ==========================================================================
   The line item card — Vallence's design (frontend.zip, Oct 2026).

   His stylesheet, scoped to .li-card and with his class names prefixed li-
   where they would collide with this app's (fig, tag, sel, pill, chip, rm…).
   Layout follows the card's own width (container queries), not the window,
   so it is the same card in the wide quotation and in a narrow split view.
   ========================================================================== */

.li-card {
  --li-card: #FFFFFF;
  --li-strip: #F7F6F2;
  --li-meta: #FAF9F5;
  --li-line: #E2E0D8;
  --li-line-soft: #ECEAE3;
  --li-row-line: #F1EFE9;
  --li-ink: #1A1A17;
  --li-ink-2: #4A4A44;
  --li-muted: #6B6B64;
  --li-black: #121210;
  --li-danger: #B3261E;
  --li-profit: #1E7F3A;
  --li-loss: #B3261E;
  --li-blue: #2F6FED;
  --li-red: #B3261E;
  --li-amber: #C68A12;
  --edge: 14px;
  --cb: 16px;
  --cb-gap: 12px;
  --li-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --li-arrow: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 16 16' fill='none' stroke='%236B6B64' stroke-width='1.6'><path d='M4 6l4 4 4-4'/></svg>");
  container-type: inline-size;
  container-name: licard;
  display: block;
  background: var(--li-card);
  border: 1px solid var(--li-line);
  border-radius: 16px;
  box-shadow: none;
  overflow: hidden;
  color: var(--li-ink);
  font-size: 14px;
  line-height: 1.35;
}
.li-card.asm:hover { box-shadow: var(--shadow-pop); }
.li-card.asm.open { box-shadow: var(--shadow-card); }
.li-card.asm.sel { outline: 2px solid var(--li-ink); outline-offset: -2px; }
/* A colour tag shows on the card's edge too, so a marked line is visible in
   the list without reading its toolbar. */
.li-card[data-colour="blue"] { box-shadow: inset 4px 0 0 var(--li-blue); }
.li-card[data-colour="red"] { box-shadow: inset 4px 0 0 var(--li-red); }
.li-card[data-colour="yellow"] { box-shadow: inset 4px 0 0 var(--li-amber); }
:where(.li-card) :where(button, select, input, textarea) { font: inherit; color: inherit; }
:where(.li-card) :where(button) { cursor: pointer; }
.li-card .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* header: two columns, locked — text left, figures right */
.li-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "title figures" "desc figures" ". tools";
  column-gap: 20px; row-gap: 2px;
  align-items: start;
  padding: 12px 12px 8px var(--edge);
}
.li-titlebar { grid-area: title; display: flex; align-items: flex-start; gap: var(--cb-gap); padding-top: 6px; min-width: 0; }
.li-descwrap { grid-area: desc; padding: 2px 16px 0 calc(var(--cb) + var(--cb-gap)); min-width: 0; align-self: start; }
.li-figures { grid-area: figures; }
.li-tools { grid-area: tools; margin-top: 2px; }
.li-select { width: var(--cb); height: var(--cb); margin: 4px 0 0; accent-color: var(--li-ink); flex-shrink: 0; }
.li-ref {
  flex-shrink: 0; width: 3.6em; height: 26px; padding: 0 6px; margin-top: -1px;
  font-family: var(--li-mono); font-size: 13px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; text-align: center;
  color: var(--li-ink); background: var(--li-strip); border: 1.5px solid var(--li-ink); border-radius: 6px; outline: none;
}
span.li-ref { display: inline-flex; align-items: center; justify-content: center; }
.li-ref::placeholder { color: var(--li-line); font-weight: 600; }
.li-ref:focus-visible { background: var(--li-card); box-shadow: 0 0 0 3px var(--li-line-soft); }
.li-title {
  margin: 0; padding: 0; width: 100%; min-width: 0; display: block;
  font-size: 17px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.3;
  border: 0; background: transparent; outline: none; overflow-wrap: anywhere;
  resize: none; overflow: hidden; field-sizing: content; min-height: 1.3em;
}
.li-title:focus-visible { box-shadow: 0 0 0 2px var(--li-line); border-radius: 4px; }
.li-desc {
  margin: 0; padding: 0; width: 100%; min-height: 1.4em; white-space: pre-wrap; display: block;
  font-size: 12.5px; line-height: 1.4; color: var(--li-muted);
  border: 0; background: transparent; outline: none; overflow-wrap: anywhere;
  resize: none; overflow: hidden; field-sizing: content;
}
.li-desc::placeholder { font-style: italic; color: var(--li-muted); opacity: .8; }
.li-desc:focus-visible { box-shadow: 0 0 0 2px var(--li-line); border-radius: 4px; }
.li-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }

/* figures */
.li-figures { display: flex; align-items: flex-start; gap: 14px; padding: 2px 2px 0 0; flex-wrap: nowrap; justify-content: flex-end; }
.li-fig { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.li-fig > .li-fig-value, .li-fig > select { height: 28px; display: flex; align-items: center; }
.li-fig-label { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--li-muted); white-space: nowrap; }
.li-fig-value { font-size: 15px; font-family: var(--li-mono); white-space: nowrap; }
.li-muted { color: var(--li-muted); }
.li-fig-input { width: 66px; min-width: 66px; max-width: 132px; field-sizing: content; text-align: right; border: 1px solid transparent; border-radius: 6px; padding: 1px 4px; background: transparent; }
.li-fig-input.li-fig-wide { width: 90px; }
.li-fig-input.li-fig-totalin { width: 112px; }
.li-fig-input:hover:not(:disabled) { border-color: var(--li-line-soft); }
.li-fig-input:focus-visible { outline: none; border-color: var(--li-ink); background: var(--li-card); }
.li-fig-input:disabled { opacity: 1; cursor: default; }
.li-fig-total { padding-left: 16px; border-left: 1px solid var(--li-line-soft); }
.li-fig-total .li-fig-label { color: var(--li-ink); }
.li-fig-total .li-fig-value { font-size: 19px; font-weight: 500; line-height: 1; }
.li-fig-profit .li-fig-value { font-size: 19px; font-weight: 500; line-height: 1; }
.li-fig-profit .li-fig-sub { font-size: 11.5px; font-family: var(--li-mono); margin-top: -2px; white-space: nowrap; }
.li-fig-profit[data-sign="profit"] { color: var(--li-profit); }
.li-fig-profit[data-sign="loss"] { color: var(--li-loss); }
.li-fig-profit[data-sign="none"] { color: var(--li-muted); }
.li-fig-unit { margin-left: -8px; }
.li-fig-unit select {
  font-size: 12px; color: var(--li-ink-2); background: var(--li-strip) var(--li-arrow) no-repeat right 5px center;
  border: 1px solid var(--li-line); border-radius: 6px; padding: 0 22px 0 8px; height: 26px; width: auto; min-width: 0;
  field-sizing: content; -webkit-appearance: none; appearance: none; box-shadow: none;
}

/* icon toolbar */
.li-tools { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; justify-content: flex-end; margin-right: 2px; }
.li-ibtn {
  width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 9px; color: var(--li-ink-2); padding: 0; box-shadow: none;
}
.li-ibtn:hover { background: var(--li-strip); }
.li-ibtn:focus-visible { outline: 2px solid var(--li-ink); outline-offset: -2px; }
.li-ibtn.li-danger { color: var(--li-danger); }
.li-ibtn.li-grip { cursor: grab; color: var(--li-muted); touch-action: none; }
.li-ibtn svg { width: 16px; height: 16px; }
.li-sep { width: 1px; height: 20px; background: var(--li-line); margin: 0 6px; flex: none; }
.li-tags { display: flex; align-items: center; }
.li-tag { width: 26px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; box-shadow: none; }
.li-tag:first-child { width: 32px; }
.li-tag span { width: 17px; height: 17px; border-radius: 50%; display: block; box-shadow: 0 0 0 0 transparent; transition: box-shadow .12s; }
.li-tag[aria-pressed="true"] span { box-shadow: 0 0 0 2px var(--li-card), 0 0 0 3.5px var(--li-ink); }
.li-tag[data-tag="none"] span { border: 1.5px solid var(--li-ink-2); }
.li-tag[data-tag="blue"] span { background: var(--li-blue); }
.li-tag[data-tag="red"] span { background: var(--li-red); }
.li-tag[data-tag="amber"] span { background: var(--li-amber); }
.li-tag:focus-visible { outline: 2px solid var(--li-ink); outline-offset: -2px; border-radius: 8px; }
.li-toggle {
  width: 40px; height: 40px; margin-left: 4px; align-self: center; display: inline-flex; align-items: center; justify-content: center;
  background: var(--li-black); border: 0; border-radius: 50%; color: #fff; flex-shrink: 0; padding: 0;
}
.li-card .li-toggle { color: #fff; }
.li-toggle svg { width: 16px; height: 16px; }
.li-toggle:focus-visible { outline: 2px solid var(--li-ink); outline-offset: 2px; }

/* trade / room */
.li-tradebar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 8px 14px; background: var(--li-meta); border-top: 1px solid var(--li-line-soft); }
.li-trade { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.li-lbl { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--li-muted); }
.li-sel { font-size: 13px; background: var(--li-card); border: 1px solid var(--li-line); border-radius: 8px; padding: 6px 10px; height: 32px; box-shadow: none; }
.li-sel:focus-visible { outline: 2px solid var(--li-ink); outline-offset: 1px; }
.li-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--li-muted); }
.li-meta .li-mono { font-family: var(--li-mono); }
.li-meta .li-addsub { height: 30px; font-size: 12.5px; font-weight: 600; }

/* the sub-item table */
.li-body { display: block; }
.li-table-wrap { overflow: visible; }
.li-table { width: 100%; border-collapse: collapse; table-layout: fixed; border-top: 1px solid var(--li-line-soft); }
.li-table thead tr { background: var(--li-strip); }
.li-table th {
  text-align: left; font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--li-muted); padding: 8px 10px; border-bottom: 1px solid var(--li-line-soft); background: none; position: static;
}
.li-table th:first-child { padding-left: var(--edge); }
.li-table th.num, .li-table td.num { text-align: right; }
.li-table td { padding: 9px 8px; border-bottom: 1px solid var(--li-row-line); vertical-align: middle; overflow-wrap: anywhere; color: var(--li-muted); font-size: 13.5px; }
.li-table td.num { padding-inline: 5px; }
.li-table td.li-item { padding-left: var(--edge); font-size: 14px; color: var(--li-ink); }
.li-sub[data-included="false"] td.li-item .li-cell { color: var(--li-muted); text-decoration: line-through; text-decoration-color: var(--li-line); }
.li-sub.held td { background: var(--held-soft); }
.li-sub.focused td { background: var(--li-meta); }
.li-inc { display: flex; align-items: center; gap: var(--cb-gap); }
.li-subidentity { display: flex; align-items: center; gap: 8px; }
.li-subidentity > .li-inc { flex: 1; min-width: 0; }
.li-suborder { display: flex; flex-direction: row; gap: 2px; flex-shrink: 0; }
.li-submove { display: grid; place-items: center; width: 22px; height: 24px; padding: 0;
  border: 1px solid var(--li-line-soft); border-radius: 6px; background: var(--li-card); color: var(--li-ink); cursor: pointer; }
.li-submove svg { width: 12px; height: 12px; }
.li-submove:hover:not(:disabled) { background: var(--li-strip); border-color: var(--li-line); }
.li-submove:focus-visible { outline: 2px solid var(--li-ink); outline-offset: 2px; }
.li-submove:disabled { opacity: 0.3; cursor: default; }
@container licard (width < 720px) {
  .li-subidentity { gap: 6px; }
  .li-submove { width: 28px; height: 32px; }
}
.li-inc input[type="checkbox"] { width: var(--cb); height: var(--cb); margin: 0; flex-shrink: 0; accent-color: var(--li-black); }
.li-cell {
  width: 100%; min-width: 0; border: 1px solid transparent; background: transparent; border-radius: 6px;
  padding: 2px 4px; margin: -2px -4px; font-family: var(--li-mono); box-shadow: none; height: auto;
}
.li-inc .li-cell { flex: 1 1 auto; font-family: inherit; margin: -2px 0; color: var(--li-ink); }
.li-cell:hover:not(:disabled) { border-color: var(--li-line-soft); }
.li-cell:focus-visible { outline: none; border-color: var(--li-ink); background: var(--li-card); }
.li-cell:disabled { opacity: 1; }
.li-table td.num .li-cell { text-align: right; }
.li-table td.num .charged { display: block; font-size: 10.5px; color: var(--accent); white-space: nowrap; }
.li-follow { font-family: var(--li-mono); }
.li-table td.li-total { font-family: var(--li-mono); font-size: 13.5px; white-space: nowrap; color: var(--li-ink); }
.li-table td.li-statuscell { padding-top: 5px; padding-bottom: 5px; }
.li-status, .li-status-fixed { font-size: 12.5px; color: var(--li-muted); }
select.li-status {
  width: 100%; min-width: 0; height: 28px; padding: 3px 18px 3px 4px; margin-left: -4px; color: var(--li-ink);
  background: transparent var(--li-arrow) no-repeat right 6px center; border: 1px solid transparent; border-radius: 7px;
  -webkit-appearance: none; appearance: none; box-shadow: none;
}
select.li-status:hover, select.li-status:focus-visible { border-color: var(--li-line); background-color: var(--li-card); outline: none; }
select.li-status[data-current="not included"] { color: var(--li-muted); font-style: italic; }
.li-newstatus { display: flex; align-items: center; gap: 6px; height: 28px; }
.li-newstatus > span { color: var(--li-muted); font-size: 14px; line-height: 1; }
.li-newstatus input { flex: 1 1 auto; min-width: 0; height: 28px; padding: 3px 6px; font-size: 13px; border: 1px solid var(--li-ink); border-radius: 7px; background: var(--li-card); outline: none; }
.li-table td.li-ctl select:not(.li-status) {
  width: 100%; min-width: 0; font-size: 12.5px; color: var(--li-ink-2); border: 1px solid var(--li-line); border-radius: 7px;
  padding: 3px 22px 3px 8px; height: 30px; -webkit-appearance: none; appearance: none; box-shadow: none;
  background: var(--li-card) var(--li-arrow) no-repeat right 7px center;
}
.li-rulenote { display: block; margin-top: 3px; font-size: 11px; color: var(--accent); }
.li-ruleline { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.li-ruleline select, .li-ruleline .qn { height: 30px; font-size: 12.5px; border: 1px solid var(--li-line); border-radius: 7px; background: var(--li-card); padding: 0 8px; box-shadow: none; }
.li-ruleline .qn { width: 4em; text-align: right; }
.li-rmcell { text-align: right; }
.li-rm {
  width: 28px; height: 28px; background: transparent; border: 0; border-radius: 7px; color: #8A8A80; padding: 0; box-shadow: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.li-rm:hover { background: var(--li-strip); color: var(--li-danger); }
.li-rm svg { width: 12px; height: 12px; }
.li-panelrow > td { padding: 0; background: var(--li-meta); }
.li-panelrow .subpanel { margin: 0; background: var(--li-meta); border-top: 0; padding: 4px 12px 12px calc(var(--edge) + var(--cb) + var(--cb-gap)); }
.li-empty { margin: 0; padding: 14px var(--edge); border-top: 1px solid var(--li-line-soft); color: var(--li-muted); font-size: 13px; font-style: italic; }
.li-card .note { margin: 0; padding: 8px var(--edge); font-size: 12px; color: var(--li-muted); border-top: 1px solid var(--li-line-soft); }
.li-card .optblock { margin: 0; padding: 10px var(--edge); border-top: 1px solid var(--li-line-soft); background: var(--li-meta); }

/* footer */
.li-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--li-line-soft); }
.li-foot-l, .li-foot-r { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.li-pill { height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--li-line); background: var(--li-card); font-size: 13px; box-shadow: none; color: var(--li-ink); }
.li-pill:hover { background: var(--li-strip); }
.li-pill.primary { background: var(--li-black); color: #fff; border-color: var(--li-black); font-weight: 600; padding-inline: 14px; }
.li-pill.ghost { border-color: transparent; color: var(--li-ink-2); padding-inline: 10px; }
.li-pill[aria-pressed="true"] { background: var(--li-black); color: #fff; border-color: var(--li-black); }
.li-pill:focus-visible { outline: 2px solid var(--li-ink); outline-offset: 2px; }
select.li-pill { padding: 0 26px 0 12px; -webkit-appearance: none; appearance: none; background: var(--li-card) var(--li-arrow) no-repeat right 10px center; }
.li-chip { height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--li-line-soft); background: var(--li-strip); color: var(--li-ink-2); font-size: 12px; box-shadow: none; }
.li-chip[aria-pressed="true"] { background: var(--li-black); color: #fff; border-color: var(--li-black); }
.li-chip:disabled { opacity: .5; cursor: default; }

@container licard (width < 1120px) {
  .li-head { column-gap: 16px; }
  .li-figures { gap: 12px; }
  .li-fig-value { font-size: 14px; }
  .li-fig-total .li-fig-value, .li-fig-profit .li-fig-value { font-size: 17px; }
  .li-fig-input { width: 58px; }
  .li-fig-input.li-fig-wide { width: 90px; }
  .li-fig-input.li-fig-totalin { width: 100px; }
  .li-fig-unit select { padding: 0 18px 0 6px; }
  .li-fig-total { padding-left: 12px; }
  .li-fig-label { font-size: 9.5px; letter-spacing: 0.08em; }
  .li-title { font-size: 16px; }
}

/* Not in his file: below ~900px the locked two columns left the title a
   hundred pixels wide beside the figures (this card sits between the scope
   rail and the summary). The figures move under the text instead, still in
   one row, until the phone layout takes over. */
@container licard (width < 900px) {
  .li-head { grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "desc" "figures" "tools"; row-gap: 6px; }
  .li-figures { justify-content: flex-start; flex-wrap: wrap; padding-left: calc(var(--cb) + var(--cb-gap)); padding-top: 6px; }
  .li-fig-total { margin-left: auto; }
  .li-descwrap { padding-right: 0; }
}

@container licard (width < 960px) {
  .li-table th, .li-table td { padding-inline: 5px; }
  .li-table th:first-child, .li-table td.li-item { padding-left: var(--edge); }
  .li-table th { font-size: 9.5px; letter-spacing: 0.06em; }
  .li-cell { margin: 0; padding: 2px 1px; font-size: 12px; }
  .li-table td.num { padding-inline: 3px; }
  .li-rm { width: 24px; height: 24px; }
  .li-table td.li-rmcell { padding-inline: 0 4px; }
  .li-table td.li-ctl select:not(.li-status) { padding-inline: 4px 2px; font-size: 12px; background-image: none; }
}

/* phone: the card's own width */
@container licard (width < 720px) {
  .li-head { grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "desc" "figures" "tools"; row-gap: 0; align-items: start; padding: 12px 14px 8px var(--edge); position: relative; }
  .li-titlebar { padding: 4px 48px 0 0; flex-wrap: wrap; }
  .li-titlebar .li-title { margin-top: 2px; flex: 1 1 100%; }
  .li-descwrap { padding: 2px 0 10px 0; }
  .li-figures { flex-direction: column; flex-wrap: nowrap; gap: 0; margin: 0; padding: 0; width: 100%; border-top: 1px solid var(--li-line-soft); }
  .li-toggle { position: absolute; top: 10px; right: 10px; margin: 0; }

  .li-fig { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 40px; padding: 4px 0; border-bottom: 1px solid var(--li-row-line); }
  .li-fig-label { font-size: 10.5px; }
  .li-fig-value { text-align: right; }
  .li-fig-input { width: 120px; padding: 5px 8px; border-color: var(--li-line-soft); background: var(--li-card); height: 32px; }
  .li-fig-input.li-fig-wide, .li-fig-input.li-fig-totalin { width: 132px; }
  .li-fig-unit { margin-left: 0; }
  .li-fig-unit select { height: 30px; font-size: 12.5px; padding: 0 22px 0 8px; background-color: var(--li-card); }
  .li-fig-total { padding-left: 0; border-left: 0; border-top: 1px solid var(--li-line); border-bottom: 0; margin-top: 2px; min-height: 48px; }
  .li-fig-total .li-fig-value { font-size: 20px; }
  .li-fig-profit { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; row-gap: 2px; align-items: center; border-bottom: 0; }
  .li-fig-profit .li-fig-label { grid-row: 1 / span 2; }
  .li-fig-profit .li-fig-value { font-size: 18px; justify-content: flex-end; }
  .li-fig-profit .li-fig-sub { text-align: right; }

  .li-tools { width: 100%; justify-content: flex-start; flex-wrap: nowrap; gap: 0; margin: 0; padding-top: 6px; }
  .li-ibtn { width: 32px; height: 34px; }
  .li-tag { width: 24px; }
  .li-tag:first-child { width: 28px; }
  .li-sep { margin: 0 2px; }
  .li-trade { width: 100%; }
  .li-trade .li-sel { flex: 1 1 140px; min-width: 0; }
  .li-tradebar { padding: 8px 12px; }

  .li-table, .li-table tbody, .li-table tr, .li-table td { display: block; }
  .li-table colgroup, .li-table thead { display: none; }
  .li-table tr { position: relative; padding: 10px 12px 10px var(--edge); border-bottom: 1px solid var(--li-line-soft); }
  .li-table tr.li-sub { background: var(--li-card); }
  .li-table td { padding: 4px 0; border-bottom: 0; display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 8px; }
  .li-table td::before { content: attr(data-label); font-family: var(--font-ui); font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--li-muted); }
  .li-table td.li-item { display: block; padding-left: 0; font-size: 15px; margin-bottom: 4px; padding-right: 36px; }
  .li-table td.li-item::before { content: none; }
  .li-table td.num, .li-table td.li-ctl { text-align: left; }
  .li-table td.num .li-cell { text-align: left; }
  .li-cell { margin: 0; padding: 4px 6px; border-color: var(--li-line-soft); background: var(--li-card); }
  .li-table td.li-rmcell { position: absolute; top: 8px; right: 8px; padding: 0; display: block; }
  .li-table td.li-rmcell::before { content: none; }
  .li-table td.li-total { padding-top: 6px; border-top: 1px dashed var(--li-line-soft); margin-top: 4px; }
  .li-table tr.li-panelrow { padding: 0; }
  .li-table tr.li-panelrow > td { display: block; padding: 8px var(--edge); }
  .li-table tr.li-panelrow > td::before { content: none; }
  .li-foot-r { width: 100%; }
  .li-foot-r .li-chip { flex: 1 1 auto; }
}

/* ==========================================================================
   Projected vs actual, by trade — Vallence's report (frontend.zip, Oct 2026).
   pva- prefixed; sized by its own width.
   ========================================================================== */
.pva {
  --pva-card: #FFFFFF; --pva-strip: #F7F6F2; --pva-meta: #FAF9F5; --pva-line: #E2E0D8; --pva-line-soft: #ECEAE3; --pva-row: #F1EFE9;
  --pva-track: #F1EFE9; --pva-muted: #6B6B64; --pva-faint: #8A8A80; --pva-cost: #C9C7BF; --pva-profit: #2E6B3A;
  --pva-actual: #3C3C37; --pva-over: #B3261E; --pva-tick: #2F6FED; --pva-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  container-type: inline-size; container-name: pva; padding: 0; overflow: hidden;
  background: var(--pva-card); border: 1px solid var(--pva-line); border-radius: 16px; box-shadow: none;
}
.pva-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; padding: 20px 24px 16px; }
.pva-head b { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.pva-head p { margin: 4px 0 0; font-size: 13px; color: var(--pva-muted); }
.pva-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pva-headline { font-size: 13px; color: var(--pva-muted); padding-top: 4px; }
.pva-sort {
  height: 34px; padding: 0 28px 0 10px; font-size: 13px; border: 1px solid var(--pva-line); border-radius: 8px; -webkit-appearance: none; appearance: none; box-shadow: none;
  background: var(--pva-strip) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 16 16' fill='none' stroke='%236B6B64' stroke-width='1.6'><path d='M4 6l4 4 4-4'/></svg>") no-repeat right 10px center;
}
.pva-sort:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

.pva-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--pva-line-soft); border-block: 1px solid var(--pva-line-soft); }
.pva-tile { background: var(--pva-card); padding: 14px 20px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pva-tile.actual { background: var(--pva-meta); }
.pva-val { font-size: 22px; font-weight: 500; font-family: var(--pva-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pva-tile .pva-note { font-size: 12px; color: var(--pva-muted); }
.pva-tile.profit .pva-val, .pva-tile.profit .pva-note { color: var(--pva-profit); }
.pva-val[data-sign="neg"] { color: var(--pva-over); }
.pva-val[data-sign="pos"] { color: var(--pva-profit); }
.pva-val[data-sign="none"] { color: var(--pva-faint); }

.pva-legend { display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; padding: 10px 24px; font-size: 12px; color: var(--pva-muted); border-bottom: 1px solid var(--pva-line-soft); }
.pva-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pva-sw { width: 14px; height: 9px; border-radius: 2px; display: inline-block; }
.pva-sw.cost { background: var(--pva-cost); }
.pva-sw.profit { background: var(--pva-profit); }
.pva-sw.billed { background: var(--pva-actual); }
.pva-sw.over { background: var(--pva-over); }
.pva-sw.tick { width: 3px; height: 12px; border-radius: 0; background: var(--pva-tick); }

.pva-grid { display: grid; grid-template-columns: minmax(150px, 1.3fr) minmax(220px, 2.2fr) repeat(5, minmax(92px, 1fr)); column-gap: 24px; align-items: center; }
.pva-colshead { padding: 12px 24px 8px; background: var(--pva-strip); border-bottom: 1px solid var(--pva-line-soft);
  font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--pva-muted); }
.pva-colshead span { font-family: var(--font-ui); }
.pva-colshead .num { text-align: right; }
.pva-barshead { padding-left: 96px; }
.pva-row { padding: 18px 24px; border-bottom: 1px solid var(--pva-row); }
.pva-rows .pva-row:last-child { border-bottom: 0; }
.pva-trade { display: flex; flex-direction: column; gap: 5px; min-width: 0; padding-right: 8px; }
.pva-trade b { font-size: 15px; font-weight: 600; line-height: 1.3; }
.pva-status { font-size: 12px; line-height: 1.35; color: var(--pva-faint); }
.pva-status[data-state="over"] { color: var(--pva-over); }
.pva-status[data-state="billed"] { color: var(--ink); }
.pva-bars { display: grid; grid-template-columns: 76px minmax(0, 1fr); grid-template-rows: 22px 14px; column-gap: 12px; row-gap: 8px; align-items: center; padding: 0 12px 0 8px; }
.pva-lbl { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--pva-muted); }
.pva-tile .pva-lbl { letter-spacing: .1em; }
.pva-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; background: var(--pva-track); }
.pva-bar.actual { height: 14px; border-radius: 5px; }
.pva-seg { flex: none; height: 100%; display: flex; align-items: center; padding: 0 8px; font-size: 11px; font-family: var(--pva-mono); white-space: nowrap; overflow: hidden; }
.pva-seg.cost { background: var(--pva-cost); color: var(--ink); }
.pva-seg.profit { background: var(--pva-profit); color: #fff; justify-content: flex-end; }
.pva-seg.billed { background: var(--pva-actual); padding: 0; }
.pva-seg.gap { padding: 0; }
.pva-seg.tick { width: 3px; background: var(--pva-tick); padding: 0; }
.pva-seg.over { background: var(--pva-over); padding: 0; }
.pva-seg:empty { padding: 0; } /* a sliver of a share stays a sliver, not 16px of padding */
.pva-figs { display: contents; }
.pva-fig { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; min-width: 0; }
.pva-vs { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; min-width: 0; }
.pva-v { font-family: var(--pva-mono); font-size: 14px; white-space: nowrap; }
.pva-s { font-size: 11px; white-space: nowrap; color: var(--pva-muted); }
.pva-fig.profit .pva-v, .pva-fig.profit .pva-s { color: var(--pva-profit); }
.pva-fig[data-sign="neg"] .pva-v, .pva-fig[data-sign="neg"] .pva-s { color: var(--pva-over); }
.pva-fig[data-sign="pos"] .pva-v, .pva-fig[data-sign="pos"] .pva-s { color: var(--pva-profit); }
.pva-fig[data-sign="none"] .pva-v, .pva-fig[data-var="none"] .pva-v { color: var(--pva-faint); }
.pva-fig[data-var="over"] .pva-s, .pva-fig[data-var="unquoted"] .pva-s { color: var(--pva-over); }
.pva-fig[data-var="under"] .pva-s { color: var(--pva-profit); }
.pva-k { display: none; }
.pva-totals { padding: 14px 24px; background: var(--pva-meta); border-top: 1px solid var(--pva-line); }
.pva-totals b { font-size: 13px; }
.pva-totals .pva-note { font-size: 12px; color: var(--pva-muted); }
.pva-totals .pva-v { font-weight: 500; }

@container pva (width < 1180px) {
  .pva-grid { grid-template-columns: minmax(130px, 1.2fr) minmax(180px, 2fr) repeat(5, minmax(84px, 1fr)); column-gap: 14px; }
  .pva-v { font-size: 13px; }
  .pva-bars { padding-right: 4px; grid-template-columns: 72px minmax(0, 1fr); column-gap: 10px; }
  .pva-seg.cost, .pva-seg.profit { font-size: 0; }
  .pva-barshead { padding-left: 82px; }
  .pva-val { font-size: 19px; }
}
@container pva (width < 860px) {
  .pva-head { padding: 16px 16px 12px; }
  .pva-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pva-tile { padding: 12px 14px; }
  .pva-tile:first-child { grid-column: 1 / -1; }
  .pva-legend { padding: 10px 16px; gap: 10px 16px; }
  .pva-grid { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
  .pva-colshead { display: none; }
  .pva-row { padding: 16px; }
  .pva-trade { padding: 0; }
  .pva-bars { padding: 0; grid-template-columns: 64px minmax(0, 1fr); column-gap: 10px; }
  .pva-figs { display: flex; flex-direction: column; border-top: 1px solid var(--pva-line-soft); padding-top: 4px; }
  .pva-fig { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; border-bottom: 1px solid var(--pva-row); }
  .pva-fig:last-child { border-bottom: 0; }
  .pva-k { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--pva-muted); }
  .pva-totals { padding: 14px 16px; }
  .pva-totals .pva-figs { border-top: 0; padding-top: 0; }
}

/* ==========================================================================
   Scope builder: scope items in the line item card.
   ========================================================================== */
.sc-list { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 16px; }
.scopemain > .li-card { margin-bottom: 16px; }
.li-meta .li-unpriced { color: var(--accent); }
/* Figures in the table read in ink, not grey: they are what is being set. */
.li-table td .li-cell, .li-table td.li-total, .li-table td select.li-status { color: var(--li-ink); }
.li-table td select.li-status[data-current="not included"] { color: var(--li-muted); }
/* A sub-item name wraps and shows in full rather than being cut off. */
.li-cell.li-cell-text {
  display: block; resize: none; overflow: hidden; field-sizing: content; min-height: 1.4em;
  white-space: pre-wrap; line-height: 1.35; font-family: inherit;
}

/* ==========================================================================
   The summary column, compact (Oct 2026): narrower, smaller type, and no
   scrollbar of its own — it is sized to fit, so the quotation beside it
   gets the room.
   ========================================================================== */
.work3 > .summary { padding: 10px 12px 16px 2px; gap: 6px; scrollbar-width: none; }
.work3 > .summary::-webkit-scrollbar { display: none; }
.summary .sidehead b { font-size: 15px; }
.summary .sumblock { padding: 10px 12px; border-radius: 12px; font-size: 12px; }
.summary .sline { font-size: 11.5px; padding: 2px 0; }
.summary .sumblock.grand-card .sline.grand b { font-size: 24px; }
.summary .sumblock.grand-card .sline.grand span, .summary .sublabel { font-size: 9.5px; }
.summary .metricpair { gap: 8px; margin-bottom: 6px; }
.summary .metricpair b { font-size: 16px; }
.summary .metricpair span, .summary .sumnote { font-size: 10.5px; }
.summary .moneyrow, .summary .sumbar, .summary .res { font-size: 11.5px; }
.summary .btn.small { font-size: 12px; padding-block: 5px; }

/* Carried over from the Costing analysis (Oct 2026). */
.pva-swing { display: inline-block; margin-top: 8px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--pva-strip); color: var(--pva-muted); }
.pva-swing.ok { background: #E7F2EA; color: var(--pva-profit); }
.pva-swing.bad { background: #FBEAEA; color: var(--pva-over); }
.pva-final { padding: 9px 24px; font-size: 12.5px; border-bottom: 1px solid var(--pva-line-soft); color: var(--pva-muted); }
.pva-final.notyet { background: #FDF6E3; color: #8a6420; }
@container pva (width < 860px) { .pva-final { padding: 9px 16px; } }

/* ==========================================================================
   Client document: letterhead, payment schedule and settlement, bank details,
   column labels per section (export update, Oct 2026).
   ========================================================================== */
.sheet td.colh { font-size: var(--fs-xs); font-weight: 650; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; font-family: var(--font-ui); font-variant-numeric: normal; vertical-align: bottom; white-space: nowrap; }
.sheet tr.lvl1 > td.colh { padding-left: var(--s-2); padding-right: var(--s-2); }
.sheet tr.lvl1n > td { padding-top: var(--s-2); border-bottom: 0; }
.sheet .h3t { line-height: 1.5; }
.sheet .h3n { color: var(--ink-2); }
.sheet .h3v { color: var(--ink); font-weight: 550; }
.sheet .h3v::before { content: '\00a0\2014\00a0'; color: var(--ink-3); font-weight: 400; }
.sheet td.num.inc { font-family: var(--font-ui); font-size: var(--fs-xs); color: var(--ink-3); font-variant-numeric: normal; letter-spacing: .01em; }
.payblock { margin-top: var(--s-6); break-inside: avoid; }
.payblock h4 { margin: 0 0 var(--s-3); font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.paysched { width: 100%; border-collapse: collapse; }
.paysched th { text-align: left; font-size: var(--fs-xs); font-weight: 650; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; padding: 0 var(--s-2) var(--s-2); border-bottom: 1px solid var(--hairline-2); }
.paysched th.num, .paysched td.num { text-align: right; }
.paysched th.n, .paysched td.n { width: 28px; text-align: right; color: var(--ink-3); font-family: var(--font-num); font-size: var(--fs-xs); }
.paysched th.st, .paysched td.st { text-align: right; white-space: nowrap; width: 1%; }
.paysched td { padding: 9px var(--s-2); border-bottom: 1px solid var(--hairline); font-size: var(--fs-sm); vertical-align: baseline; }
.paysched td.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.paysched td.amt { font-weight: 600; }
.paysched tr.settled td { color: var(--ink-2); }
.paysched tfoot td { border-bottom: 0; border-top: 1.5px solid var(--ink); font-weight: 650; padding-top: var(--s-3); }
.pstate { font-size: var(--fs-xs); font-weight: 650; letter-spacing: .02em; white-space: nowrap; }
.pstate.paid { color: var(--m-healthy); }
.pstate.part { color: var(--accent); font-family: var(--font-num); font-weight: 600; }
.pstate.due { color: var(--ink-3); }
.pstate.now { color: var(--brandmark); font-weight: 700; }
.pstate.over { color: var(--m-negative); font-weight: 700; }
.pstate.later { color: var(--ink-3); font-weight: 500; }
.paysched tr.atnow td { background: var(--surface-2); }
.paysched tr.atnow td:first-child { border-left: 2px solid var(--brandmark); }
.paysched tr.later td { color: var(--ink-3); }
.payhead { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.payhead h4 { margin-bottom: var(--s-3); }
.stageat { font-size: var(--fs-xs); color: var(--ink-2); font-weight: 600; }
.settle .srow.now { border-top: 1px solid var(--hairline); margin-top: var(--s-2); padding-top: var(--s-3); font-weight: 650; }
.settle .srow.now b { color: var(--brandmark); font-size: var(--fs-md); }
.paidlist { margin-top: var(--s-5); }
.paidlist table { width: 100%; border-collapse: collapse; }
.paidlist td { padding: 7px var(--s-2); border-bottom: 1px solid var(--hairline); font-size: var(--fs-sm); }
.paidlist td.when { width: 96px; color: var(--ink-3); font-family: var(--font-num); font-size: var(--fs-xs); white-space: nowrap; }
.paidlist td.num { text-align: right; font-family: var(--font-num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.paidlist td.amt { font-weight: 600; }
.paidlist .pref { color: var(--ink-3); font-size: var(--fs-xs); margin-left: var(--s-2); }
.settle { margin-top: var(--s-5); margin-left: auto; max-width: 380px; border-top: 1px solid var(--hairline-2); padding-top: var(--s-3); }
.settle .srow { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-4); padding: 5px var(--s-2) 5px 0; font-size: var(--fs-sm); }
.settle .srow b { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.settle .srow.grand { border-top: 1.5px solid var(--ink); margin-top: var(--s-2); padding-top: var(--s-3); font-size: var(--fs-md); font-weight: 650; }
.settle .srow.grand b { font-size: var(--fs-lg); letter-spacing: -.01em; }
.settle .srow.grand.owing b { color: var(--brandmark); }
.settle .srow.grand.clear b { color: var(--m-healthy); }
.letterhead { margin-bottom: var(--s-5); }
.lhtop { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-6); padding-bottom: var(--s-3); border-bottom: 1.5px solid var(--ink); }
.lhmark { font-size: 28px; font-weight: 700; letter-spacing: -.03em; line-height: 1; color: var(--brandmark); text-transform: lowercase; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lhmark.has-logo { overflow: visible; }
.lhmark img { display: block; max-width: 300px; max-height: 76px; width: auto; height: auto; }
.lhrows { display: grid; grid-template-columns: 76px 1fr; gap: 3px var(--s-4); margin: var(--s-4) 0 0; align-items: baseline; }
.lhrows dt { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); margin: 0; }
.lhrows dd { margin: 0; font-size: var(--fs-sm); color: var(--ink); }
.bankfoot { margin-top: var(--s-5); padding: var(--s-4) var(--s-5); border: 1px solid var(--hairline-2); border-radius: var(--r-sm); background: var(--surface-2); break-inside: avoid; }
.bankfoot h4 { margin: 0 0 var(--s-2); font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }

@media print {
  .top, .totals, .tools, .side, .summary, .noprint, .exportbar, .toast,
  .asmacts, .asmmoney, .subs, .variants,
  .dochead, .segbar, .readybar, .checkblock { display: none !important; }
  .docpanel { padding: 0; margin: 0; }
  .letterhead { break-inside: avoid; break-after: avoid; margin-bottom: 7mm; }
  .lhtop { border-bottom: 1pt solid #000; padding-bottom: 2.5mm; }
  .lhmark { font-size: 20pt; color: #000; }
  .lhmark img { max-width: 62mm; max-height: 20mm; }
  .lhco b { font-size: 9.5pt; }
  .lhco span { font-size: 8.5pt; color: #333; }
  .lhrows { margin-top: 4mm; gap: 1mm 6mm; grid-template-columns: 22mm 1fr; }
  .lhrows dt { font-size: 8pt; color: #000; }
  .lhrows dd { font-size: 9.5pt; }
  .bankfoot { background: none !important; border: 0.5pt solid #999; break-inside: avoid; margin-top: 6mm; padding: 3mm 4mm; }
  .bankfoot h4 { font-size: 8pt; color: #000; }
  .bankbody { font-size: 9.5pt; }
  .payblock, .paysched, .paidlist, .settle { break-inside: avoid; }
  .payblock { margin-top: 7mm; }
  .payblock h4 { font-size: 8pt; color: #000; }
  .paysched td, .paidlist td { font-size: 9.5pt; padding: 1.6mm 2mm; }
  .paysched tfoot td { border-top: 1pt solid #000; }
  .paysched tr.atnow td { background: none !important; }
  .paysched tr.atnow td:first-child { border-left: 1.5pt solid #000; }
  .pstate.now, .pstate.over, .pstate.later { color: #000; }
  .settle .srow.now b { color: #000; }
  .settle .srow { font-size: 10pt; }
  .settle .srow.grand { border-top: 1pt solid #000; font-size: 11pt; }
  .settle .srow.grand b { font-size: 13pt; }
  .pstate.paid, .pstate.part, .pstate.due { color: #000; }
  .printtotals { break-inside: avoid; box-shadow: none; border: 0; }
  .printtotals .grand { border-top: 1pt solid #000; }
}

.logoprev { max-height: 48px; max-width: 200px; border: 1px solid var(--hairline-2); border-radius: var(--r-xs); background: #fff; padding: 4px; }
/* The studio's details under the wordmark, one per line, set right. (The
   export update's excerpt carried only the print sizes for these.) */
.lhco { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; text-align: right; min-width: 0; }
.lhco b { font-size: var(--fs-md); }
.lhco span { font-size: var(--fs-sm); color: var(--ink-2); }

/* the in-app confirm and prompt (ask / askText), above any other sheet */
.overlay.askdlg { z-index: 400; }
.askdlg header b { line-height: 1.35; }
.askdlg .askbody { white-space: pre-line; color: var(--ink-2); font-size: var(--fs-sm); margin-bottom: var(--s-4); }
.askdlg .askbody p { margin: 0 0 var(--s-2); }
.askdlg .askbody p:last-child { margin-bottom: 0; }
.askdlg .f input, .askdlg .f select { width: 100%; }
.askdlg .askrow { justify-content: flex-end; gap: var(--s-2); }
.btn.dangerfill { background: var(--m-negative); border-color: var(--m-negative); color: #fff; }
.btn.dangerfill:hover { filter: brightness(.94); }
.askdlg .pad > .askrow:first-child { margin-top: 0; }

/* Approved warm studio design: shared navigation, quiet surfaces and readable
   scope hierarchy. Money continues to come from the calculation engine. */
:root {
  --canvas: #f5f3ef; --surface-2: #f8f6f2; --surface-3: #eee9e2;
  --ink: #242321; --ink-2: #5f5a54; --ink-3: #726e68;
  --surface-ink: #2d2927; --surface-ink-2: #39332f;
  --hairline: #eee9e2; --hairline-2: #e6e1da;
  --r: 15px; --r-lg: 20px;
  --shadow-card: 0 1px 3px rgb(36 35 33 / 4%);
}
* { scrollbar-width: thin; scrollbar-color: #8e857a transparent; }
*::-webkit-scrollbar { width: 7px; height: 7px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #8e857a; border-radius: 8px; }
.scroll, .docpanel, .scopescroll, .sidelist, .summary { scrollbar-gutter: stable; }
.work3 > .summary { scrollbar-width: thin; padding: 14px 14px 20px 2px; }
.work3 > .summary::-webkit-scrollbar { display: block; width: 7px; }
.quotation-shell { flex: none; min-width: 0; background: #fff; border-bottom: 1px solid var(--hairline-2); }
.quotation-heading.dochead.tight { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; height: 88px; padding: 10px 24px; margin: 0; gap: 24px; }
.quotation-heading .dh { min-width: 0; }
.quotation-heading .crumbs { gap: 6px; margin: 0 0 3px; line-height: 1.2; flex-wrap: nowrap; }
.quotation-heading .crumb { min-height: 0; padding: 0; font-size: 11px; line-height: 16px; color: var(--ink-2); border-radius: 3px; }
.quotation-heading .crumb:hover { color: var(--brandmark); background: none; text-decoration: underline; }
.quotation-heading .quote-project { overflow: hidden; text-overflow: ellipsis; }
.quotation-heading .sep { color: #9b9288; }
.quote-titleline { display: flex; align-items: center; gap: 10px; min-width: 0; }
.quotation-heading .dh h1 { min-width: 0; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 21px; line-height: 27px; letter-spacing: -.025em; }
.quote-status { display: inline-flex; align-items: center; gap: 5px; flex: none; padding: 3px 7px; border: 1px solid #e7dfd3; border-radius: 6px; background: #f8f4ec; color: #695437; font-size: 10px; font-weight: 600; line-height: 14px; }
.quote-status::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.quote-status.is-locked { color: #495c54; border-color: #dce5df; background: #f0f5f1; }
.quote-reference { margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; line-height: 15px; color: var(--ink-2); }
.quotation-nav { width: 356px; min-width: 0; padding: 0; height: 44px; }
.quotation-nav .segbar { display: flex; height: 100%; padding: 3px; gap: 3px; border: 1px solid #e9e3db; background: #f5f2ed; border-radius: 12px; }
.quotation-nav .seg { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 76px; height: 100%; padding: 0 15px; border: 1px solid transparent; border-radius: 8px; color: #615b54; font-size: 12px; font-weight: 500; white-space: nowrap; }
.quotation-nav .seg:hover { background: #ebe5dc; color: var(--ink); }
.quotation-nav .seg.on { background: #fff; color: var(--brandmark); border-color: #e7e0d7; box-shadow: 0 1px 3px rgb(36 35 33 / 7%); font-weight: 700; }
.quotation-nav .seg:focus-visible { outline: 2px solid var(--brandmark); outline-offset: 1px; }
@media (max-width: 900px) {
  .quotation-heading.dochead.tight { grid-template-columns: minmax(0, 1fr); grid-template-rows: 56px 40px; height: 105px; padding: 3px 12px 6px; gap: 0; }
  .quotation-heading .dh h1 { font-size: 18px; line-height: 23px; }
  .quotation-heading .crumbs { margin-bottom: 1px; }
  .quote-titleline { gap: 8px; }
  .quote-reference { margin-top: 1px; font-size: 10px; line-height: 14px; }
  .quote-status { padding: 2px 5px; font-size: 9px; }
  .quotation-nav { width: 100%; height: 40px; }
  .quotation-nav .seg { flex: 1; min-width: 0; padding: 0 7px; font-size: 12px; }
}
#app > .docpanel { flex: 1; min-height: 0; }
.docpanel > .panel { padding-top: 20px; }
.work3 .mid > .dochead.tight { padding: 7px 16px; gap: 8px; }
.work3 .mid > .dochead .dhfilters { justify-content: flex-start; }
.btn.primary { background: var(--brandmark); }
.summary .sumblock { border: 1px solid var(--hairline-2); padding: 13px; border-radius: 15px; }
.summary .sumblock.grand-card { border-color: var(--surface-ink); }
.summary .sumblock.internal { background: #fff; }
.summary .sumblock.internal .metricpair b { color: #277352; }
.summary .sumblock.internal .metricpair span { color: var(--ink-2); }
.summary .sumblock.internal .sline { border-top: 1px solid var(--hairline); margin-top: 9px; padding-top: 9px; }
.summary .sline { font-size: 12px; }
.summary .metricpair span, .summary .sublabel { font-size: 11px; }
.grphead { align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 0; }
.grphead h2 { font-size: 18px; }
.group-amount { margin-left: auto; font-size: 13px; white-space: nowrap; }
.category-subtotal { display: flex; justify-content: space-between; gap: 16px; padding: 12px 4px; font-size: 12px; color: var(--ink-2); }
.li-card[data-client-hidden="true"] { border-style: dashed; background: #fbfaf8; }
.subitem-ref { font-family: var(--font-num); font-size: 10px; color: var(--ink-3); margin-right: 7px; white-space: nowrap; }
.sheet .client-columns th { padding: 8px; background: #f8f6f2; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.sheet .client-columns .num { text-align: right; }
.sheet tr.lvl1 td { padding: 12px 8px; background: #f1eae3; border-bottom: 1px solid #d9cec2; color: #523e34; }
.sheet tr.lvl1:first-child td { padding-top: 12px; }
.sheet tr.lvl1 .h1t { font-size: 14px; }
.sheet tr.scope-subtotal td { border: 0; padding: 7px 8px; font-size: 11px; font-weight: 600; background: #faf8f5; }
.sheet tr.scope-subtotal td:first-child { text-align: right; color: var(--ink-2); }
.sheet tr.gsub td { background: #f5f1ec; padding: 10px 8px; border-bottom: 1px solid #d9cec2; }
.sheet .h3t { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 3px; }
@media (min-width: 1280px) { :root { --side-w: 235px; --sum-w: 276px; } }
@media (max-width: 600px) {
  .work3 .mid > .dochead.tight { padding: 6px 12px; }
  .work3 .mid > .dochead .dhfilters { gap: 6px; }
  .grphead h2 { font-size: 16px; }
  .sheet .h3t { display: block; }
}
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; scrollbar-gutter: auto; }
  .quotation-shell { display: none !important; }
  #app > .docpanel { display: block; overflow: visible; }
  .docpanel > .panel { padding: 0; overflow: visible; }
  .sheet .lhmark { color:#282828; }
  .sheet .lhmark img,.sheet .clientplan,.sheet .planart { filter:grayscale(1); }
  .sheet .lhtop { border-bottom-color:#606060; }
  .sheet .pmark[class] { color:#444!important; background:white!important; border-color:#999!important; }
  .sheet .colourkey .k i { display:none; }
  .sheet .lines { width:100%; table-layout:fixed; border-collapse:separate; border-spacing:0; }
  .sheet .lines th:first-child { width: 58%; }
  .sheet .lines th:nth-child(2) { width: 13%; }
  .sheet .lines th:nth-child(3) { width: 13%; }
  .sheet .lines th:nth-child(4) { width: 16%; }
  .sheet .lines td { overflow-wrap: anywhere; }
  .sheet .lines .num { white-space: normal; }
  .sheet .client-columns th,.sheet tr.lvl1 td,.sheet tr.scope-subtotal td,.sheet tr.gsub td { background:white!important; color:#303030; border-bottom-color:#ccc; }
  .sheet tr.lvl1 td { padding:3mm 2mm; }
  .sheet tr.category-band td { background:#f0dddd!important; color:#581e25; border:0; }
  .sheet tr.category-band td:first-child { border-radius:7px 0 0 7px; }
  .sheet tr.category-band td:last-child { border-radius:0 7px 7px 0; }
  .sheet tr.category-band .h1t { color:#581e25; }
  .sheet tr.lvl2:has(+ tr.lvl3) { break-after: avoid; }
  .sheet tr.scope-subtotal { break-before: avoid; }
  .sheet tr.lvl3 td { padding-top: 1.2mm; padding-bottom: 1.2mm; }
  .sheet .bankfoot,.sheet .paysched tr.atnow td { background:white!important; border-color:#ccc; }
  .sheet .paysched tr.atnow td:first-child,.sheet .printtotals .grand { border-color:#666; }
  .sheet .pstate,.sheet .settle .srow.now b { color:#333; }
}
.summary .sumblock.internal[data-loss="true"] .metricpair b { color: #b3261e; }
.summary .sumblock.grand-card { background: #2d2927; }

@media print {
  .sheet tr.lvl2 td { padding-top: 2mm; padding-bottom: 2mm; font-size: 9pt; }
  .sheet tr.lvl3 td { font-size: 8.5pt; padding-top: .8mm; padding-bottom: .8mm; }
  .sheet .h3v { font-weight: 400; }
  .sheet .h3t { line-height: 1.35; }
  .sheet tr.lvl1 td, .sheet tr.lvl1:first-child td { padding-top: 2mm; padding-bottom: 2mm; }
  .sheet tr.scope-subtotal td { padding: 1.5mm 2mm; }
  .sheet tr.gsub td { padding: 2mm; }
  .sheet .payblock { margin-top: 5mm; }
}
.mobile-library-toggle { display: none; }
@media (max-width: 600px) {
  .mobile-library-toggle { display: inline-flex; margin-left: auto; }
  .scope-library[data-expanded="false"] > :not(.sidehead) { display: none; }
  .scope-library[data-expanded="false"] { height: auto; min-height: 0; }
  .scope-library .sidehead { gap: 8px; }
  .scope-library .sidehead b { font-size: 14px; }
}
@media print {
  @page { @bottom-right { content: counter(page) " / " counter(pages); font-family: Arial, sans-serif; font-size: 8pt; color: #726e68; } }
}

.change-tag-legend { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; padding: 0 16px 6px; color: var(--ink-2); font-size: 11px; }
.change-tag-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.project-profit .pghead { margin-bottom: 16px; }
@media (max-width: 600px) { .change-tag-legend { padding-inline: 12px; gap: 5px 12px; } }
@media print { .change-tag-legend { display: none; } }
.change-tag-legend .swdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.change-tag-legend .sw-blue { background: #2f6fd0; }
.change-tag-legend .sw-red { background: #c0392b; }
.change-tag-legend .sw-yellow { background: #e0a800; }

@media screen {
  :root { --topbar-h: 48px; }
}

.quotation-nav .client-nav-space { visibility:hidden; pointer-events:none }
.sub-colour { display:flex; flex-wrap:wrap; align-items:center; gap:2px 6px; margin-left:32px }
.sub-swatches { display:inline-flex; align-items:center; }
.sub-swatch { position:relative; display:grid; place-items:center; width:24px; height:24px; cursor:pointer }
.sub-swatch input { position:absolute; inset:0; width:100%; height:100%; margin:0; opacity:0; cursor:pointer }
.sub-swatch span { pointer-events:none; width:13px; height:13px; border-radius:50%; border:1px solid rgb(0 0 0 / 18%) }
.sub-swatch[data-colour="none"] span { border-color:#797970; background:linear-gradient(135deg,transparent 44%,#797970 46% 54%,transparent 56%) white }
.sub-swatch[data-colour="blue"] span { background:var(--li-blue) }
.sub-swatch[data-colour="red"] span { background:var(--li-red) }
.sub-swatch[data-colour="yellow"] span { background:#e0a800 }
.sub-swatch input:checked + span { box-shadow:0 0 0 2px white,0 0 0 3.5px var(--li-ink) }
.sub-swatch input:focus-visible { opacity:1; appearance:none; background:none; outline:2px solid var(--li-ink); outline-offset:-1px; border-radius:5px }
.sub-colour .pmark { font-size:10px }
.proposal-panel,.client-history { margin:12px 0; padding:16px; border:1px solid var(--hairline); border-radius:10px; background:var(--surface); overflow-wrap:anywhere }
.proposal-panel .row,.proposal-row { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px }
.proposal-row { border-top:1px solid var(--hairline); padding:10px 0 }
.proposal-panel p,.client-history li { margin:4px 0 }
.client-history ul { padding-left:18px }
@media print { .client-history li { break-inside:avoid } .client-history h4 { break-after:avoid } }

.client-history li small { display:block; color:var(--ink-2) }
.proposal-panel h3 { margin:0 }

@media print { .sheet .client-history.is-empty { display:none } }

.picker .scope-source { display:grid; gap:8px; }
.picker .scope-source .btn { min-height:44px; text-align:left; justify-content:flex-start; }

.client-link-panel {color:#201c1a;background:#fff}
.client-link-panel :is(p,span,label){color:#201c1a}
.share-history-choice {display:flex;align-items:center;gap:8px;padding:8px 0}
.share-url-actions {display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:12px 0}
.share-url-actions .share-url {flex:1 1 300px;min-width:0;width:100%;resize:vertical;font:14px/1.5 var(--font-num);padding:8px 10px;border:1px solid #aaa39a;border-radius:8px;color:#211c19;background:white;overflow-wrap:anywhere}

/* Project costing only: one summary, trade comparison, then supplier bills. */
.costing-page { --cost-ink: #252321; --cost-muted: #625e58; --cost-line: #e5e0d9; color: var(--cost-ink); container: costing / inline-size; display: flex; flex-direction: column; gap: 20px; padding-bottom: 28px; }
.costing-page h2, .costing-page h3, .costing-page p { margin: 0; }
.costing-header, .costing-bills-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.costing-header { padding-top: 8px; }
.costing-header h2 { font-size: 27px; letter-spacing: -.035em; line-height: 1.2; margin: 5px 0 7px; }
.costing-header p, .costing-bills-head p { color: var(--cost-muted); font-size: 13px; line-height: 1.5; }
.costing-eyebrow { font-size: 10px; letter-spacing: .13em; font-weight: 700; color: #791e28; }
.costing-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.costing-page .btn { min-height: 38px; box-shadow: none; border: 1px solid var(--cost-line); }
.costing-page .btn.primary { border-color: var(--accent); }
.costing-context { color: var(--cost-muted); font-size: 12px; margin-top: -9px; }
.costing-page .costing-overview { order: 0; display: grid; grid-template-columns: 3fr 2fr; margin: 0; border: 1px solid var(--cost-line); border-radius: 16px; overflow: hidden; box-shadow: none; }
.costing-page .analysis { margin: 0; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 0; background: white; border: 0; }
.costing-page .analysis.profits { grid-template-columns: repeat(2, minmax(0,1fr)); }
.costing-page .analysis .an { padding: 22px 18px; gap: 6px; border-right: 1px solid var(--cost-line); background: white; }
.costing-page .analysis.profits .an { background: #f0f4ef; }
.costing-page .analysis .an.lead { background: #f6f4ef; box-shadow: none; border: 0; }
.costing-page .analysis .an .k { color: #4e4a44; white-space: normal; font-size: 10px; letter-spacing: .06em; line-height: 1.5; }
.costing-page .analysis .an b { font-size: clamp(18px, 2vw, 27px); color: var(--cost-ink); overflow-wrap: anywhere; }
.costing-page .analysis .an b.ok { color: #285b39; }
.costing-page .analysis .an b.bad { color: #a52828; }
.costing-page .analysis .an .sub { font-size: 11px; color: #59574f; line-height: 1.5; }
.costing-page .varfoot { grid-column: 1 / -1; background: #fcfbf8; padding: 10px 18px; border-top: 1px solid var(--cost-line); font-size: 12px; color: var(--cost-muted); }
.costing-cash { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 20px; padding: 0 18px 4px; }
.costing-cash > div { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.costing-cash span { color: var(--cost-muted); font-size: 12px; }
.costing-cash b { font-family: var(--font-num); font-size: 15px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.costing-page .pva { margin: 0; border: 1px solid var(--cost-line); border-radius: 16px; box-shadow: none; --pva-muted: #615e57; --pva-faint: #666158; }
.costing-page .pva-head { padding: 20px; gap: 16px; }
.costing-page .pva-head b { font-size: 18px; }
.costing-page .pva-head p { margin-top: 6px; }
.costing-net-revenue { display: block; font-size: 12px; color: #57534d; margin-top: 6px; }
.costing-page .pva-controls { gap: 8px; max-width: 100%; }
.costing-page .pva-headline { flex-basis: 100%; font-size: 12px; padding: 0; }
.costing-page .pva-sort { min-height: 38px; color: var(--cost-ink); max-width: 100%; background-color: white; border-color: var(--cost-line); }
.costing-page .pva-legend { padding: 10px 20px; background: #fbfaf7; font-size: 11px; }
.costing-page .pva-row { padding: 18px 20px; }
.costing-page .pva-totals { padding: 16px 20px; }
.costing-page .pva-s { white-space: normal; }
.costing-page .pva-v { overflow-wrap: anywhere; white-space: normal; }
.costing-page .pva-colshead { padding-inline: 20px; }
.costing-empty { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 32px 20px; font-size: 13px; }
.costing-bills-head { scroll-margin-top: 24px; padding-top: 12px; outline-offset: 6px; }
.costing-bills-head h3 { font-size: 21px; letter-spacing: -.025em; margin: 5px 0 7px; }
.costing-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.costing-add label { font-size: 12px; font-weight: 600; }
.costing-add select { font: inherit; font-size: 13px; color: var(--cost-ink); background: white; border: 1px solid var(--cost-line); border-radius: 9px; min-height: 40px; padding: 8px 26px 8px 10px; max-width: 100%; }
.costing-page .tradeblock { border: 1px solid var(--cost-line); border-radius: 14px; overflow: hidden; margin-bottom: 12px; box-shadow: none; }
.costing-page .tradeblock .thead { padding: 14px 18px; background: #f8f6f2; flex-wrap: wrap; gap: 12px; }
.costing-page .tradeblock .thead b { font-size: 14px; }
.costing-page .tradeblock .tsub { color: var(--cost-muted); font-size: 12px; }
.costing-page .tradeblock .tfigs { flex-wrap: wrap; gap: 12px; font-size: 12px; }
.costing-page .tradeblock .ledger { margin: 0; box-shadow: none; border-radius: 0; padding: 0; }
.costing-page .expcols { grid-template-columns: minmax(180px, 1.5fr) minmax(120px,1fr) minmax(100px,.7fr) minmax(110px,.8fr) minmax(180px,1.2fr) 28px; gap: 12px; padding: 14px 18px; }
.costing-page .lhead { color: #5f5a51; font-size: 10px; }
.costing-page .lrow.exp input { color: var(--cost-ink); background: #fff; border: 1px solid var(--cost-line); border-radius: 7px; min-height: 38px; width: 100%; padding: 8px; }
.costing-page .lrow.exp input:hover { border-color: #b5aa9c; }
.costing-page .lrow.exp input:focus-visible, .costing-page select:focus-visible, .costing-page button:focus-visible { outline: 2px solid #791e28; outline-offset: 3px; }
.costing-page .paidcell { gap: 5px; }
.costing-page .expacts { display: flex; flex-wrap: wrap; gap: 6px; }
.costing-page .expacts .btn { font-size: 11px; }
.costing-page .lrow.total.big { margin-top: -8px; margin-inline: 1px; padding-inline: 18px; background: #f1eee8; border-radius: 12px; font-size: 13px; }
.costing-page .tradeblock .x { width: 28px; min-height: 36px; }
@container costing (width < 1000px) {
  .costing-page .costing-overview { grid-template-columns: 1fr; }
  .costing-page .analysis .an { padding: 16px; }
  .costing-page .analysis .an b { font-size: 23px; }
  .costing-page .analysis.profits { border-top: 1px solid var(--cost-line); }
  .costing-page .expcols { grid-template-columns: minmax(0,1.4fr) minmax(0,1fr) minmax(80px,.7fr) minmax(90px,.8fr) 28px; }
  .costing-page .lhead.expcols { display: none; }
  .costing-page .lrow.exp .expacts { grid-column: 1 / 5; grid-row: 2; }
  .costing-page .lrow.exp > span:last-child { grid-column: 5; grid-row: 1; }
  .costing-page .lrow.total.expcols { display: flex; flex-wrap: wrap; justify-content: space-between; }
  .costing-page .lrow.exp > span:nth-child(1)::before { content: 'DESCRIPTION'; }
  .costing-page .lrow.exp > span:nth-child(2)::before { content: 'SUPPLIER'; }
  .costing-page .lrow.exp > span:nth-child(3)::before { content: 'BILLED'; }
  .costing-page .lrow.exp > span:nth-child(4)::before { content: 'PAID'; }
  .costing-page .lrow.exp > span::before { display: block; color: #625e58; font-size: 9px; letter-spacing: .06em; margin-bottom: 6px; }
}
@container costing (width < 600px) {
  .costing-header h2 { font-size: 24px; }
  .costing-actions { width: 100%; }
  .costing-actions .btn { flex: 1; }
  .costing-page .btn { min-height: 44px; }
  .costing-page .analysis { grid-template-columns: 1fr 1fr; }
  .costing-page .analysis:not(.profits) .an:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--cost-line); }
  .costing-page .analysis .an b { font-size: 21px; }
  .costing-cash { grid-template-columns: 1fr; gap: 10px; padding: 0 6px; }
  .costing-cash > div { border-bottom: 1px solid var(--cost-line); padding-bottom: 10px; }
  .costing-page .pva-head, .costing-page .pva-row { padding: 16px; }
  .costing-page .pva-legend { padding: 12px 16px; }
  .costing-page .pva-controls { width: 100%; }
  .costing-page .pva-sort { flex: 1 1 140px; min-height: 44px; }
  .costing-add { width: 100%; }
  .costing-add label { width: 100%; }
  .costing-add select { flex: 1; min-width: 0; }
  .costing-page .tradeblock .thead { padding: 14px; }
  .costing-page .expcols { grid-template-columns: minmax(0,1fr) minmax(0,1fr) 28px; gap: 12px; padding: 14px; }
  .costing-page .lrow.exp > span:nth-child(1) { grid-column: 1 / 3; grid-row: 1; }
  .costing-page .lrow.exp > span:nth-child(2) { grid-column: 1 / 3; grid-row: 2; }
  .costing-page .lrow.exp > span:nth-child(3) { grid-column: 1; grid-row: 3; }
  .costing-page .lrow.exp > span:nth-child(4) { grid-column: 2; grid-row: 3; }
  .costing-page .lrow.exp .expacts { grid-column: 1 / -1; grid-row: 4; }
  .costing-page .lrow.exp > span:last-child { grid-column: 3; grid-row: 1; }
  .costing-page .lrow.exp input { min-height: 44px; font-size: 16px; }
  .costing-page .expacts .btn { font-size: 12px; }
}
.costing-page .lrow.total.big, .costing-page .lrow.total.big .n, .costing-page .lrow.total.big .dt { color: #292621; border-top: 0; }
.costing-page .tradeblock.empty { opacity: 1; }
.costing-page .pva-head > div:first-child { flex: 1 1 320px; }
.costing-page .pva-controls { flex: 1 1 340px; }
.costing-page .analysis.profits { border-radius: 0; }
.costing-page .tradeblock.empty { padding: 0; text-align: left; }
.costing-page .tradeblock.empty .thead { opacity: 1; }
.costing-page .lrow.exp .sup { display: block; }

/* Individual project page only. Quotation editor and scope builder are unchanged. */
.project-page { --brandmark: #252525; --accent: #252525; --surface: #fff; --surface-2: #f5f5f5; --surface-3: #ededed; --ink: #252525; --ink-2: #505050; --ink-3: #666; background: #fafafa; --project-line: #dfdfdf; --project-muted: #5d5d5d; color: #232323; }
.project-page > .project-header { margin-bottom: 18px; gap: 18px; align-items: center; }
.project-page .project-header > div:first-child { flex: 1 1 380px; min-width: 0; }
.project-page .project-header h2 { font-size: 28px; line-height: 1.25; letter-spacing: -.035em; margin: 8px 0 12px; overflow-wrap: anywhere; }
.project-page .project-back { font: inherit; font-size: 12px; font-weight: 600; color: #404040; border: 0; background: none; padding: 5px 0; cursor: pointer; }
.project-page .project-details { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 13px; line-height: 1.5; color: var(--project-muted); }
.project-page .project-details span { display: inline-flex; flex-wrap: wrap; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.project-page .project-details b { color: #2c2c2c; font-weight: 600; }
.project-page .project-header .tagwrap:empty { display: none; }
.project-page .project-header .tagwrap { margin-top: 10px; }
.project-page .project-header .btn, .project-page .project-quote-actions .btn, .project-page .project-empty .btn { min-height: 38px; box-shadow: none; border: 1px solid var(--project-line); }
.project-page > .project-tabs { display: flex; width: 100%; padding: 0; gap: 22px; margin: 0 0 24px; background: none; border-radius: 0; border-bottom: 1px solid var(--project-line); }
.project-page > .project-tabs .seg { position: relative; border-radius: 0; padding: 12px 2px; background: none; box-shadow: none; color: #5d5d5d; font-size: 13px; font-weight: 500; min-height: 46px; }
.project-page > .project-tabs .seg.on { color: #404040; font-weight: 700; }
.project-page > .project-tabs .seg.on::after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 3px; border-radius: 3px 3px 0 0; background: #404040; }
.project-page > .project-stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin: 0 0 20px; }
.project-page > .project-stats .st-fig { display: flex; flex-direction: column; gap: 7px; padding: 18px 20px; border: 1px solid var(--project-line); background: #fff; border-radius: 14px; min-width: 0; }
.project-page > .project-stats .st-fig span { order: 0; color: #484848; font-weight: 600; font-size: 11px; letter-spacing: .03em; }
.project-page > .project-stats .st-fig b { font-size: 25px; color: #252525; font-weight: 600; overflow-wrap: anywhere; }
.project-page > .project-stats .st-fig.ok { background: #f2f2f2; border-color: #dfdfdf; }
.project-page > .project-stats .st-fig.ok b { color: #3f3f3f; }
.project-page > .project-stats .st-fig small { color: var(--project-muted); font-size: 11px; }
.project-page > .mastercard { background: #f0f0f0; color: #252525; border: 1px solid #d6d6d6; border-radius: 14px; box-shadow: none; padding: 20px 22px; gap: 20px; margin: 0 0 28px; }
.project-page > .mastercard:hover { border-color: #a1a1a1; background: #ebebeb; }
.project-page > .mastercard > div:first-child { min-width: 0; flex: 1 1 330px; }
.project-page > .mastercard .kicker { color: #5b5b5b; font-size: 10px; letter-spacing: .1em; }
.project-page > .mastercard h3 { font-size: 18px; line-height: 1.3; margin: 6px 0; }
.project-page > .mastercard p { color: #5a5a5a; font-size: 12px; line-height: 1.5; margin: 0; }
.project-page > .mastercard .mfigs { gap: 12px; align-items: center; }
.project-page > .mastercard .mfigs b { font-size: 23px; color: #282828; }
.project-page > .mastercard .mfigs span { color: #5a5a5a; font-size: 11px; }
.project-page > .mastercard .mfigs .tag.ok { color: #454545; background: #e5e5e5; }
.project-page > .mastercard .btn { border: 1px solid #cbcbcb; color: #383838; background: #fff; box-shadow: none; min-height: 38px; display: inline-flex; align-items: center; }
.project-page .project-quote-tools { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.project-page .project-quote-tools h3 { font-size: 21px; letter-spacing: -.025em; margin: 0 0 4px; }
.project-page .project-quote-tools p { font-size: 12px; color: var(--project-muted); margin: 0; }
.project-page .project-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.project-page .project-filters input, .project-page .project-filters select { min-height: 40px; font: inherit; font-size: 13px; background: white; color: #232323; border: 1px solid var(--project-line); border-radius: 9px; padding: 9px 12px; min-width: 0; }
.project-page .project-filters input { width: 250px; }
.project-page .project-filters input::placeholder { color: #6a6a6a; }
.project-page > .qlist { gap: 12px; }
.project-page > .qlist .qrow { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px 24px; padding: 20px; box-shadow: none; border: 1px solid var(--project-line); border-radius: 14px; background: white; }
.project-page > .qlist .qrow.on { box-shadow: none; border-color: #a1a1a1; }
.project-page > .qlist .qrow.faded { opacity: 1; background: #f5f5f5; }
.project-page > .qlist .qtitle { gap: 6px; align-items: center; }
.project-page > .qlist .qtitle h4 { margin: 0; flex: 1 0 100%; font-size: 17px; line-height: 1.4; font-weight: 600; letter-spacing: -.015em; overflow-wrap: anywhere; }
.project-page > .qlist .qtitle .tag { font-size: 10px; color: #555555; border-radius: 5px; }
.project-page > .qlist .qtitle .st-ok { color: #424242; background: #ebebeb; }
.project-page > .qlist .qtitle .st-issued { color: #4f4f4f; background: #ebebeb; }
.project-page > .qlist .qmeta { font-family: var(--font-ui); font-size: 12px; line-height: 1.6; margin-top: 8px; color: var(--project-muted); overflow-wrap: anywhere; }
.project-page > .qlist .qamt { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; align-self: start; padding-top: 3px; }
.project-page > .qlist .qamt span { font-family: var(--font-ui); font-size: 10px; color: var(--project-muted); font-weight: 500; }
.project-page > .qlist .qamt b { font-size: 22px; font-weight: 600; overflow-wrap: anywhere; }
.project-page > .qlist .project-quote-actions { grid-column: 1 / -1; border-top: 1px solid #ebebeb; padding-top: 12px; gap: 8px; }
.project-page .project-quote-actions .project-open { border-color: #c6c6c6; color: #404040; font-weight: 600; }
.project-page .project-empty { padding: 32px 20px; background: white; border: 1px dashed #d0d0d0; border-radius: 14px; text-align: center; }
.project-page .project-empty h4 { margin: 0 0 8px; font-size: 16px; }
.project-page .project-empty p { margin: 0 0 16px; color: var(--project-muted); font-size: 13px; }
.project-page .project-section-head { margin-bottom: 20px; }
.project-page .project-section-head h3 { font-size: 23px; margin: 0 0 6px; letter-spacing: -.025em; }
.project-page .project-section-head p { font-size: 13px; margin: 0; color: var(--project-muted); }
.project-page > .project-section .subcard { box-shadow: none; border: 1px solid var(--project-line); border-radius: 14px; }
.project-page > .project-section .subcard.on { border-color: #b9b9b9; }
.project-page > .project-section .subcard select { min-height: 40px; }
.project-page > .project-section .costsum { border: 1px solid var(--project-line); border-radius: 14px; overflow: hidden; }
.project-page > .project-section .costsum .cs .k, .project-page > .project-section .costsum .cs .sub { color: #5d5d5d; }
.project-page .project-back:focus-visible, .project-page > .project-tabs .seg:focus-visible, .project-page > .mastercard:focus-visible, .project-page .project-filters :focus-visible, .project-page .project-quote-actions .btn:focus-visible { outline: 2px solid #404040; outline-offset: 3px; }
@media (max-width: 650px) {
  .project-page .project-header > div:first-child { flex-basis: 100%; }
  .project-page .project-header h2 { font-size: 25px; }
  .project-page .project-header > .row { width: 100%; }
  .project-page .project-header > .row .btn { flex: 1; min-height: 44px; }
  .project-page > .project-tabs { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; padding: 4px; border: 1px solid var(--project-line); border-radius: 12px; background: #eaeaea; }
  .project-page > .project-tabs .seg { padding: 10px 6px; border-radius: 8px; font-size: 12px; min-height: 44px; }
  .project-page > .project-tabs .seg.on { background: white; box-shadow: 0 1px 3px #25252512; }
  .project-page > .project-tabs .seg.on::after { display: none; }
  .project-page > .project-stats { gap: 8px; }
  .project-page > .project-stats .st-fig { padding: 12px 9px; gap: 6px; border-radius: 10px; }
  .project-page > .project-stats .st-fig span { font-size: 10px; min-height: 28px; }
  .project-page > .project-stats .st-fig b { font-size: 17px; }
  .project-page > .project-stats .st-fig small { font-size: 10px; line-height: 1.5; }
  .project-page > .mastercard { padding: 18px; gap: 16px; }
  .project-page > .mastercard .mfigs { flex: 1; }
  .project-page > .mastercard .mfigs b { font-size: 21px; }
  .project-page > .mastercard .btn { min-height: 44px; font-size: 12px; }
  .project-page .project-filters { width: 100%; }
  .project-page .project-filters input { width: 100%; font-size: 16px; min-height: 44px; }
  .project-page .project-filters select { width: 100%; min-height: 44px; }
  .project-page > .qlist .qrow { padding: 16px; gap: 12px; grid-template-columns: minmax(0,1fr); }
  .project-page > .qlist .qamt { flex-direction: row; align-items: baseline; justify-content: space-between; }
  .project-page > .qlist .qamt b { font-size: 21px; }
  .project-page > .qlist .project-quote-actions .btn { min-height: 44px; }
}
.project-page > .project-section .costsum .cs b.muted { color: #2c2c2c; }
.project-page > .project-section .panel2 { box-shadow: none; border: 1px solid var(--project-line); border-radius: 14px; }
.project-page > .project-section .phead { flex-wrap: wrap; gap: 8px 16px; }
.project-page > .project-section .phead .meta { color: #5d5d5d; }
.project-page > .project-section .paycols input, .project-page > .project-section .paycols select { min-height: 40px; border: 1px solid var(--project-line); border-radius: 7px; background: #fff; color: #232323; padding: 8px; max-width: 100%; }
.project-page > .project-section .paycols select { width: 100%; margin-top: 6px; font: inherit; font-size: 12px; }
.project-page > .project-section .btn { min-height: 38px; border: 1px solid var(--project-line); box-shadow: none; }
.project-page > .project-section .paycols > span:last-child { display: block; }
@media (max-width: 800px) {
  .project-page > .project-section .lhead.paycols, .project-page > .project-section .lhead.stagecols { display: none; }
  .project-page > .project-section .lrow.paycols { grid-template-columns: minmax(0,1fr) minmax(0,1fr) 30px; padding: 16px; gap: 14px 12px; }
  .project-page > .project-section .paycols > span:nth-child(1) { grid-column: 1; grid-row: 1; }
  .project-page > .project-section .paycols > span:nth-child(2) { grid-column: 2; grid-row: 1; }
  .project-page > .project-section .paycols > span:nth-child(3) { grid-column: 1 / 3; grid-row: 2; }
  .project-page > .project-section .paycols > span:nth-child(4) { grid-column: 1 / 3; grid-row: 3; }
  .project-page > .project-section .paycols > span:nth-child(5) { grid-column: 3; grid-row: 1; }
  .project-page > .project-section .paycols > span::before { display: block; font-size: 10px; color: #5d5d5d; margin-bottom: 6px; text-align: left; }
  .project-page > .project-section .paycols > span:nth-child(1)::before { content: 'DATE RECEIVED'; }
  .project-page > .project-section .paycols > span:nth-child(2)::before { content: 'AMOUNT'; }
  .project-page > .project-section .paycols > span:nth-child(3)::before { content: 'REFERENCE'; }
  .project-page > .project-section .paycols > span:nth-child(4)::before { content: 'PAYMENT FOR / QUOTATION'; }
  .project-page > .project-section .paycols input { min-height: 44px; font-size: 16px; min-width: 0; }
  .project-page > .project-section .paycols select, .project-page > .project-section .btn { min-height: 44px; }
  .project-page > .project-section .lrow.stagecols { grid-template-columns: minmax(0,1fr) auto; gap: 10px; padding: 16px; }
  .project-page > .project-section .stagecols > span:nth-child(1) { grid-column: 1 / -1; }
  .project-page > .project-section .stagecols > span:nth-child(2) { grid-column: 1; }
  .project-page > .project-section .stagecols > span:nth-child(3) { grid-column: 2; }
  .project-page > .project-section .stagecols > span:nth-child(4) { grid-column: 1 / -1; }
}
@media (max-width: 650px) {
  .project-page > .project-stats { grid-template-columns: minmax(0,1fr); gap: 0; border: 1px solid var(--project-line); border-radius: 12px; overflow: hidden; background: white; }
  .project-page > .project-stats .st-fig { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 14px; padding: 13px 14px; border: 0; border-bottom: 1px solid var(--project-line); border-radius: 0; }
  .project-page > .project-stats .st-fig:last-child { border-bottom: 0; }
  .project-page > .project-stats .st-fig span { min-height: 0; font-size: 11px; }
  .project-page > .project-stats .st-fig b { grid-column: 2; grid-row: 1 / 3; align-self: center; font-size: 19px; white-space: nowrap; }
  .project-page > .project-stats .st-fig small { grid-column: 1; }
}
.project-page > .project-section .lrow.paycols > span,
.project-page > .project-section .lrow.stagecols > span { display: block; }
#app:has(> .project-page) { background: #fafafa; }
.project-page > .project-section .subcard.on { border-color: #aaa; }
.project-page > .project-section .costsum .cs.lead { background: #f4f4f4; box-shadow: inset 0 2px 0 #777; }
.project-page .costing-page { --cost-line: #e3e3e3; --cost-muted: #626262; --cost-ink: #252525; }
.project-page .costing-eyebrow, .project-page .costing-header p, .project-page .costing-bills-head p { color: #555; }
.project-page .costing-page .analysis.profits .an, .project-page .costing-page .analysis .an.lead,
.project-page .costing-page .tradeblock .thead, .project-page .costing-page .lrow.total.big { background: #f4f4f4; }
.project-page .costing-page .varfoot, .project-page .costing-page .pva-legend { background: #fafafa; color: #626262; }
.project-page .costing-page .analysis .an .sub, .project-page .costing-page .analysis .an .k,
.project-page .costing-net-revenue { color: #555; }
.project-page .costing-page .pva { --pva-strip: #f5f5f5; --pva-meta: #f4f4f4; --pva-line: #ddd; --pva-line-soft: #eee; --pva-row: #eee; --pva-muted: #626262; --pva-faint: #666; }
.project-page .costing-page .expacts .btn.needsfile { background: #fff; color: #444; border-color: #ccc; }


.quotation-doc-actions { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px }
#quotation-report-print { display:none }
@media print {
  body .client-history, body .quotation-doc-actions { display:none!important }
  body.printing-quotation-history { display:block!important; position:static!important; height:auto!important; overflow:visible!important; background:white!important }
  body.printing-quotation-history > :not(#quotation-report-print) { display:none!important }
  body.printing-quotation-history > #quotation-report-print { display:block!important; margin:0; color:#242424; font:10pt/1.45 Arial,sans-serif; background:white }
  #quotation-report-print > small { font-weight:bold; letter-spacing:.1em; color:#555 }
  #quotation-report-print h1 { margin:2mm 0; font-size:20pt }
  #quotation-report-print > p { margin:1mm 0; font-size:10pt }
  #quotation-report-print .client-history { display:block!important; margin:5mm 0 0; border:0; border-top:1pt solid #555; padding:2mm 0; border-radius:0; background:white }
  #quotation-report-print .client-history :is(h3,h4) { margin:4mm 0 1mm; font-size:11pt; break-after:avoid }
  #quotation-report-print .client-history ul { list-style:none; margin:0; padding:0 }
  #quotation-report-print .client-history li { margin:0; padding:1.5mm 0; border-bottom:.4pt solid #ccc; break-inside:avoid; overflow-wrap:anywhere }
  #quotation-report-print .client-history small { display:block; color:#555 }
}
