/* Canguard measure — mobile-first, one-handed, outdoors.
   Light-only by design: reps use this in daylight where high contrast wins.

   Visual system "Wells" (see docs/design-handoff/from-design/design-spec.md).
   Hierarchy comes from fills rather than lines: the page ground is darker than
   the cards so white separates without a border, inputs are borderless wells so
   the typable thing is the darker thing, labels are sentence case throughout,
   and a selected control is always a solid fill — accent for a value, navy for
   a mode — never a border that vanishes in sunlight. Contrast is bought with
   surfaces and edges, not with bigger type: body copy is the size it always
   was, because these screens are dense and scaling up costs rows. */

:root {
  /* brand — anchored: app bar, tab bar, PWA theme-color, PDF header band */
  --brand:            #12314f;
  --brand-ink:        #0b2138;   /* tabbar top border */
  --accent:           #1668c4;
  --accent-press:     #0f4e96;
  --accent-wash:      #e8effa;   /* press wash, ghost accent fills */

  /* Job status — saturated mid-to-dark tones, legible in sunlight and under
     common colour-vision deficiencies. Do not lighten. Internal only. */
  --status-lead:      #F59E0B; /* amber */
  --status-quoted:    #2563EB; /* blue */
  --status-scheduled: #DB2777; /* pink — install booked. Deliberately not purple:
     a rep has blue/purple colour deficiency and purple reads as the deposit blue;
     pink's red base stays clearly distinct. */
  --status-completed: #16A34A; /* green */
  --status-lost:      #64748B; /* slate: decided, not waiting on anyone */
  --on-amber:         #1a1206; /* white on amber is unreadable */
  --on-green:         #08240f; /* white on green only reaches 3.3:1 */

  /* Calendar event colours. The same hues as the status strips (Lead /
     Scheduled), but a distinct meaning — they never share a screen with the Home
     strips, so they get their own names rather than reusing --status-*. */
  --event-quote:      var(--status-lead);
  --event-install:    var(--status-scheduled);
  --quote-tint:       #fdf0d4;
  --install-tint:     #fce7f1;
  --install-ink:      #b01d63;

  /* surfaces — six near-identical off-whites became four with distinct jobs */
  --bg:               #eef1f6;   /* page ground */
  --surface:          #ffffff;   /* cards, sheets, filled inputs */
  --surface-sunk:     #f6f8fb;   /* a card inside a card */
  --track:            #eaeef5;   /* segmented + status control grounds */
  --weekend:          #e6eaf1;

  /* ink — 4.5:1 minimum on any surface above */
  --ink:              #0f1a2b;
  --ink-2:            #2c3542;   /* body on tinted fills */
  --muted:            #5b6b80;   /* labels, sub-lines */
  --mark:             #8794a6;   /* chevrons and rules — never words or digits */

  /* lines */
  --line:             #d3dbe6;
  --line-soft:        #e7ecf3;   /* a division inside a card */
  --line-strong:      #cfd8e4;   /* outline button */
  --rule-empty:       #c3cddb;   /* finalize: dashed rule on an empty value */

  /* feedback */
  --danger:           #c62828;
  --danger-ink:       #a81f1f;   /* text on --danger-wash */
  --danger-wash:      #fdecea;
  --warn-wash:        #fdf0d4;
  --warn-ink:         #7a5f22;
  --warn-ink-strong:  #5c4715;
  --stop-ink:         #8c2318;
  --toast:            #101827;
  /* The pipeline's aging pill has three steps — under 2 days, 2 to 4, over 4 —
     and only the "everything is fine" end had no token. --danger-wash/-ink and
     --warn-wash/-ink already cover red and yellow; this is the green third of
     the same scale, named to match. */
  --ok-wash:           #eaf3de;
  --ok-ink:            #27500a;

  /* type */
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text',
          'Segoe UI', Roboto, system-ui, sans-serif;
  --w-body:   400;
  --w-value:  500;
  --w-label:  600;   /* every label and control */
  --w-figure: 700;   /* money and totals only */

  /* space — one 4px scale */
  --s-1: 4px;   --s-2: 8px;   --s-3: 12px;  --s-4: 16px;
  --s-5: 20px;  --s-6: 24px;
  --pad: var(--s-4);
  --tap: 52px;                 /* now the real floor, not an aspiration */
  --tabbar-h: 56px;

  /* radii — by size, not by whim */
  --r-chip:   8px;   /* a filled status colour reads as a state, not a button */
  --r-sm:    12px;
  --r-md:    14px;
  --r-lg:    16px;
  --r-xl:    18px;   /* dimension input */
  --r-sheet: 20px;
  --r-pill:  999px;

  /* edges */
  --b-hair:    1px;
  --b-control: 1.5px;
  --b-focus:   2px;
  --strip:     8px;  /* row status strip */
  --edge:      5px;  /* banner + calendar event left edge */

  /* elevation */
  --sh-card:  0 1px 2px rgba(15, 26, 43, .07);
  --sh-sheet: 0 -6px 20px -8px rgba(15, 26, 43, .18);
  --ring:     0 0 0 2px var(--accent), 0 0 0 5px rgba(22, 104, 196, .28);
  --ring-lg:  0 0 0 2px var(--accent), 0 0 0 6px rgba(22, 104, 196, .28);
  --scrim:    rgba(15, 23, 39, .45);

  /* motion */
  --m-press: 120ms ease-out;
  --m-fade:  160ms ease;
  --m-rise:  200ms cubic-bezier(.22, 1, .36, 1);

  /* The 0px fallback matters on anything that does not implement env(): without
     it the whole calc() this feeds becomes invalid and the padding collapses. */
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-size: 16px;
  line-height: 1.45;
}

button, input, select, textarea { font-family: inherit; }
button { touch-action: manipulation; cursor: pointer; }

/* The native tap highlight is off everywhere, so a control with no rule here
   has no press feedback at all. Every interactive surface below gets one. */
.btn, .row, .chip, .frac, .seg__btn, .win__body, .win__more, .cal__cell,
.cal__upRow, .cal__evMain, .cal__evAdd, .area-bar, .section__head,
.link-btn, .tabbar__item, .appbar button, .finl-ed {
  transition: background-color var(--m-press), box-shadow var(--m-press),
              color var(--m-press);
}

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

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

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--brand);
  color: #fff;
  padding: calc(var(--safe-top) + 10px) var(--pad) 10px;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.appbar__row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

/* The optional second row: a screen that needs its own controls under the
   title — so far just the pipeline's filter chips and sort line — passes a
   node through setBar's `below`, and this wraps it. Empty and collapsed for
   every other screen, so the `gap` above adds no space and the bar is exactly
   as tall as it always was. */
.appbar__below {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.appbar__below:empty { display: none; }

/* Four white alphas on the bar, not twelve: .14 surface, .20 raised,
   .62 subtitle, 1.0 title. */
.appbar__title {
  font-size: 17px;
  font-weight: var(--w-label);
  letter-spacing: -.01em;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appbar__sub {
  display: block;
  font-size: 12px;
  font-weight: var(--w-body);
  letter-spacing: 0;
  color: rgba(255, 255, 255, .62);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appbar button {
  background: rgba(255, 255, 255, .14);
  color: #fff;
  border: 0;
  border-radius: var(--r-md);
  min-height: 40px;
  padding: 0 var(--s-3);
  font-size: 15px;
  font-weight: var(--w-label);
}
.appbar button:active { background: rgba(255, 255, 255, .20); }
.appbar .icon-btn { min-width: 40px; padding: 0 10px; font-size: 20px; line-height: 1; }

/* The summary's primary way into measuring — a filled accent button that
   stands out on the dark bar, unlike the translucent default. Its label is set
   in app.js off the window count: "Start measuring" on an empty job, "Add
   windows" once there are windows. */
.appbar button.appbar__cta {
  background: var(--accent);
  min-height: 40px;
  font-size: 14px;
}
.appbar button.appbar__cta:active { background: var(--accent-press); }

/* The pipeline's filter chips and sort line, painted into .appbar__below (see
   ui/pipeline.js and setBar's `below`). Smaller than the body's own .chip and
   .link-btn, and every override below is explicit rather than partial: these
   are still <button> elements inside .appbar, so without it they would
   inherit that selector's 40px min-height and 15px type and not read as
   "smaller" at all.

   No border: 1px solid — see the file header — so the outline a chip needs is
   an inset box-shadow instead, and every colour here is one of the bar's four
   white alphas (.14 / .20 / .62 / 1.0, see the comment above .appbar__title)
   rather than a fifth invented for this row. */
/* One line, always. At 375px the four chips needed 350px against a 343px row
   and wrapped, which put the bar at 151px — 19% of the screen before a single
   card. Tighter padding brings them to 334px and fits; nowrap plus a hidden
   scrollbar means a narrower phone scrolls them sideways rather than growing
   the header again. Measured in the browser, not guessed. */
.pipe__chips--bar {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.pipe__chips--bar::-webkit-scrollbar { display: none; }
.pipe__chips--bar .chip {
  flex: none;
  min-height: 0;
  padding: 4px 8px;
  border-radius: var(--r-pill);
  background: transparent;
  box-shadow: inset 0 0 0 var(--b-focus) rgba(255, 255, 255, .20);
  color: rgba(255, 255, 255, .62);
  font-size: 11.5px;
}
.pipe__chips--bar .chip:active { background: rgba(255, 255, 255, .14); }
/* Fills solid white with navy ink rather than its own status colour. The
   status hues are tuned for contrast on a white card (.chip--on.chip--st-*
   above), not on navy, and four different fills fighting the bar would read
   louder than the counts they're supposed to be labelling. One white fill
   keeps every chip legible and leaves status colour living in exactly one
   place on this screen: the stripe on each card. */
.pipe__chips--bar .chip--on {
  background: #fff;
  color: var(--brand);
  box-shadow: none;
}


main {
  flex: 1;
  padding: var(--pad);
  padding-bottom: calc(var(--safe-bottom) + var(--s-6));
}

/* ---------- bottom tab bar ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: none;
  background: var(--brand);
  border-top: var(--b-hair) solid var(--brand-ink);
  padding-bottom: var(--safe-bottom);
}
body.has-tabbar .tabbar { display: flex; }
body.is-login .tabbar { display: none; }

.tabbar__item {
  flex: 1;
  min-height: var(--tabbar-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, .62);
  font-size: 11px;
  font-weight: var(--w-label);
}
.tabbar__item--on { color: #fff; }
.tabbar__ico { display: flex; line-height: 1; }

/* Reserve space so fixed-bottom content clears the bar. */
body.has-tabbar main {
  padding-bottom: calc(var(--safe-bottom) + var(--tabbar-h) + var(--s-6));
}
/* Home's sticky New Job bar rides above the tab bar rather than under it. */
body.has-tabbar .sticky-actions {
  bottom: calc(var(--safe-bottom) + var(--tabbar-h));
}

/* ---------- the assistant tab (ui/assistant.js) ---------- */

/* A column that fills what is left of the screen, so the composer sits at the
   foot of it without being fixed to the viewport. The command bar this
   replaced WAS fixed, and had to publish its own measured height for main's
   padding, the pinned totals and the measure screen's add button to clear —
   a custom property rewritten on every reply, because a constant could not
   know how tall a wrapped reply would be. None of that is needed by a screen
   that is simply the last thing in the flow.

   The height comes from the shell rather than from a number: #app is already a
   100dvh flex column and main already has flex: 1, so main's used height IS
   what is left below the app bar. Making main a column on this one screen —
   matched with :has, the way .sticky-actions already matches a danger button —
   hands that height straight to the tab, with nothing to keep in step when the
   app bar grows a subtitle or the tab bar changes height. */
main:has(> .asst) { display: flex; flex-direction: column; }
.asst {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.asst__top { flex: 1; display: flex; flex-direction: column; gap: var(--s-3); }

/* The job the tab is about, and the way out of it. A pill so it reads as
   something you can act on rather than a caption. */
.asst__chipJob {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 var(--s-3);
  border: var(--b-hair) solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--sh-card);
  color: var(--ink);
  font-size: 13px;
  font-weight: var(--w-label);
}
.asst__chipJob:active { background: var(--surface-sunk); }
.asst__chipText { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asst__chipX { color: var(--muted); font-size: 17px; line-height: 1; }

/* The opening sentence. Muted, because it is read once and then never again —
   a rep who has used the tab before should be able to look straight past it. */
.asst__opener {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  max-width: 34ch;
}
.asst__opener[hidden] { display: none; }

/* The three lines. Stacked and full width, because two of them are sentences
   and a sentence in a pill wraps into a shape nobody reads. */
.asst__try { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.asst__try[hidden] { display: none; }
.asst__tryLabel { color: var(--muted); font-size: 12px; font-weight: var(--w-label); }
.asst__trySay {
  min-height: 38px;
  padding: 0 var(--s-3);
  border: var(--b-hair) solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  text-align: left;
}
.asst__trySay:active { background: var(--surface-sunk); }
/* The one that acts on a tap looks like the button it is; the ones that only
   fill the box look like the text they are. A rep should be able to tell which
   of the two they are about to get without having to try one. */
.asst__tryRun {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: var(--w-label);
}
/* Typing needs signal; a sentence for the box is useless without it. Greyed
   rather than removed, so a rep learns that the tab does more when there is a
   bar — a line that vanished would just look like a shorter list. The one that
   runs is untouched: it is a real command and needs nothing. */
.asst--offline .asst__trySay:not(.asst__tryRun) { opacity: .45; pointer-events: none; }

/* Where the rest of it is done by hand, with no signal. Plain links rather than
   buttons: these are not things the assistant is offering to do, they are
   directions. */
.asst__byHand { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.asst__byHand[hidden] { display: none; }
.asst__byHandLink {
  min-height: 36px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: var(--w-label);
  text-align: left;
}
.asst__byHandLink:active { opacity: .6; }

/* Pinned to the bottom of the column and in thumb reach, and it stays there
   once a command has run: a rep who has just watched a change land is usually
   about to describe the next one, and a box that moved would cost them the
   tap they had already aimed. */
.asst__composer { position: sticky; bottom: var(--s-2); }
.asst__input {
  width: 100%;
  min-height: var(--tap);
  padding: 0 var(--s-4);
  border: var(--b-hair) solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface-sunk);
  box-shadow: var(--sh-card);
  color: var(--ink);
  font-size: 16px;              /* 16px or iOS zooms the page on focus */
}
.asst__input::placeholder { color: var(--muted); }
.asst--offline .asst__input { background: var(--bg); }
.asst--thinking .asst__input { opacity: .65; }

/* One slot above the input, holding whichever of the three the tab last had
   to say: a card, a confirmation, or a line of prose. One at a time and in one
   place, so a rep looks in the same spot every time and never has to work out
   which of two boxes is the current one. */
.asst__panel {
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-card);
}
.asst__panel[hidden] { display: none; }

.asst__card { border: var(--b-hair) solid var(--line); padding: var(--s-3) var(--s-4); }
.asst__card--danger { border-color: var(--danger); background: var(--danger-wash); }
/* The button, not a .btn--danger — that class is a pale wash meant to stand out
   against white, and on a card that is already washed red it disappears. The
   accent fill is what a rep's eye is trained on for "this is the one that
   acts"; only its colour changes. */
.asst__card--danger .btn--primary { background: var(--danger); }
.asst__card--danger .btn--primary:active { background: var(--danger-ink); }
/* The card's own rule sits on the ink colour everywhere else; against a red
   wash it reads as a mistake rather than as emphasis. */
.asst__card--danger .asst__total { border-top-color: var(--danger); }
.asst__cardHead { font-weight: var(--w-label); font-size: 15px; }
.asst__cardBody { margin-top: var(--s-2); }
.asst__scope { color: var(--muted); font-size: 13px; }

.asst__lines, .asst__steps { margin: var(--s-2) 0 0; padding: 0; list-style: none; }
/* The steps of a plan keep their numbers: they run in this order, and an
   unnumbered list would be read as a set of unrelated changes. */
.asst__steps { list-style: decimal; padding-left: var(--s-5); }
.asst__step { margin-bottom: 2px; font-size: 13px; }
.asst__stepWhat { font-weight: var(--w-label); }
.asst__stepWhere { color: var(--muted); margin-left: 6px; }

/* Label left, figures right, and the two figures never wrap apart from each
   other — a "$164.00" alone at the end of a line with its "→ $0.00" on the
   next one reads as the new price rather than the old one. */
.asst__line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  font-size: 13px;
  padding: 3px 0;
}
.asst__line + .asst__line { border-top: var(--b-hair) solid var(--line); }
.asst__lineLabel { color: var(--muted); min-width: 0; }
.asst__lineMove { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.asst__was { color: var(--muted); text-decoration: line-through; }
.asst__arrow { color: var(--muted); }
.asst__now { font-weight: var(--w-label); font-variant-numeric: tabular-nums; }
.asst__lineNote { color: var(--muted); font-style: italic; }

/* The job-level row, set apart because it is the figure the customer sees. */
.asst__total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: var(--s-2);
  padding-top: var(--s-2);
  border-top: var(--b-hair) solid var(--ink);
  font-size: 14px;
}
.asst__total .asst__lineLabel { color: var(--ink); font-weight: var(--w-label); }

/* The arguments, opened for correction. Label above control rather than
   beside it: a select of window descriptions ("First Floor › Bathroom, 48\" ×
   24\" interior 14 MIL") needs the whole width, and a two-column form on a phone
   gives it a third of one. */
.asst__fields { margin-top: var(--s-3); display: flex; flex-direction: column; gap: var(--s-2); }
.asst__field { display: flex; flex-direction: column; gap: 2px; }
.asst__fieldLabel { font-size: 12px; color: var(--muted); }
.asst__control {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--s-3);
  border: var(--b-hair) solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;              /* 16px or iOS zooms the page on focus */
}
.asst__editError {
  margin-top: var(--s-2);
  color: var(--danger-ink);
  font-size: 13px;
}
.asst__editError[hidden] { display: none; }

/* The candidates, stacked full width rather than in a row. A window's label is
   a sentence — "First Floor › Bathroom, 48" × 24" interior 14 MIL" — and side by
   side they would each get a third of a phone and wrap to four lines. */
.asst__choices { display: flex; flex-direction: column; gap: 6px; margin-top: var(--s-3); }
/* Two classes deep, because .btn is defined further down this file and centres
   its own content — a window description is a sentence and a centred sentence
   in a stack of them is unreadable. */
.asst__choices .asst__choice { justify-content: flex-start; text-align: left; min-height: 44px; }

.asst__cardActions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

/* An answer. Quieter than a card and shaped like a sentence rather than a
   ledger, because it is one — and it carries no button, because there is
   nothing to do to it. */
.asst__answer { padding: var(--s-3) var(--s-4); border: var(--b-hair) solid var(--line); }
.asst__answerText { margin: 0; font-size: 14px; line-height: 1.5; }

/* What the card becomes once it has been applied. Quieter than the card — the
   decision is behind the rep now — but it keeps the figure they approved. */
.asst__done {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-left: 3px solid var(--accent);
  border-radius: 0;
  background: var(--accent-wash);
  font-size: 13px;
}
.asst__doneMain { flex: 1 1 60%; min-width: 0; }
.asst__doneHead { display: flex; gap: 6px; font-weight: var(--w-label); }
.asst__tick { color: var(--accent); }
.asst__doneTotal { margin-top: 2px; font-variant-numeric: tabular-nums; }

.asst__reply {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-left: 3px solid var(--line);
  border-radius: 0;
  background: var(--surface-sunk);
  font-size: 13px;
}
.asst__reply[hidden] { display: none; }
.asst__reply--ok  { background: var(--accent-wash); border-left-color: var(--accent); }
.asst__reply--no  { background: var(--danger-wash); border-left-color: var(--danger); }
.asst__reply--no .asst__replyDetail { color: var(--danger-ink); }
.asst__reply--ask { background: var(--warn-wash); border-left-color: var(--status-lead); }
.asst__reply--ask .asst__replyDetail { color: var(--warn-ink); }
/* Not a fourth kind of answer, so it carries no wash — a pulse on the rule
   instead, which says "still going" without claiming an outcome. */
.asst__reply--wait .asst__replyText { color: var(--muted); }
.asst__reply--wait { animation: asst-wait 1.2s ease-in-out infinite; }
@keyframes asst-wait { 50% { border-left-color: var(--accent); } }
.asst__replyMain { flex: 1 1 60%; min-width: 0; }
.asst__replyText { font-weight: var(--w-label); }
.asst__replyDetail { color: var(--muted); }
.asst__replyActions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.asst__reply .btn { background: var(--surface); }
.asst__undo { font-weight: var(--w-label); }

/* ---------- calendar ---------- */
.cal__head { display: flex; align-items: center; gap: var(--s-2); margin-bottom: var(--s-3); }
.cal__title { flex: 1; text-align: center; font-weight: var(--w-label); font-size: 18px; }
.cal__head .icon-btn {
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-card);
  color: var(--ink);
  min-width: 44px;
  min-height: 44px;
  font-size: 20px;
  line-height: 1;
}
.cal__head .icon-btn:active { background: var(--accent-wash); }
/* "Today" is a jump, not a setting — the one filled control in the header. */
.cal__head .btn--sm {
  min-height: 44px;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: #fff;
  box-shadow: none;
  padding: 0 var(--s-4);
}
.cal__head .btn--sm:active { background: var(--brand-ink); }

.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal__wd {
  text-align: center;
  font-size: 11px;
  font-weight: var(--w-label);
  color: var(--muted);
  letter-spacing: .06em;
  padding-bottom: var(--s-1);
}
/* Cells carry fill rather than hairlines — a hairline grid is the first thing
   to disappear in sun. */
.cal__cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 6px;
  font-variant-numeric: tabular-nums;
}
/* The weekday headers occupy the first seven slots, so column position is
   simply nth-child across the whole grid — Sunday 7n+1, Saturday 7n+7. */
.cal__grid > :nth-child(7n + 1),
.cal__grid > :nth-child(7n + 7) { background: var(--weekend); }
.cal__grid > .cal__wd:nth-child(7n + 1),
.cal__grid > .cal__wd:nth-child(7n + 7) { background: none; }
.cal__grid > .cal__cell:nth-child(7n + 1) .cal__num,
.cal__grid > .cal__cell:nth-child(7n + 7) .cal__num { color: var(--muted); }
.cal__cell--empty { background: transparent; }
.cal__grid > .cal__cell--empty:nth-child(7n + 1),
.cal__grid > .cal__cell--empty:nth-child(7n + 7) { background: transparent; }

/* A day takes the tint of what it holds. The cell carries no event class — the
   dots are the only per-event markup — so the tint is driven off them with
   :has(), which this app can rely on: it shipped in the same Safari release as
   the 100dvh above. A day holding both splits the tint on a diagonal. */
.cal__cell:has(.cal__dot--quote) { background: var(--quote-tint); }
.cal__cell:has(.cal__dot--install) { background: var(--install-tint); }
.cal__cell:has(.cal__dot--quote):has(.cal__dot--install) {
  background: linear-gradient(105deg,
    var(--quote-tint) 0 50%, var(--install-tint) 50% 100%);
}

/* One treatment for today, not a border plus an inset ring saying it twice. */
.cal__cell--today { box-shadow: 0 0 0 2.5px var(--accent); }
.cal__cell--today .cal__num { color: var(--accent); }
.cal__cell:active { background: var(--accent-wash); }

.cal__num { font-size: 13px; font-weight: var(--w-label); }
.cal__dots { display: flex; gap: 3px; margin-top: 3px; min-height: var(--s-2); }
.cal__dot { width: var(--s-2); height: var(--s-2); border-radius: 50%; }
.cal__dot--quote { background: var(--event-quote); }
.cal__dot--install { background: var(--event-install); }

.cal__legend {
  display: flex; gap: var(--s-4); justify-content: center;
  margin-top: var(--s-4); font-size: 12px; color: var(--muted);
}
.cal__legItem { display: inline-flex; align-items: center; gap: 6px; }

/* upcoming strip — a glanceable summary below the grid, not a second calendar */
.cal__upcoming { margin-top: var(--s-5); }
.cal__upTitle {
  font-size: 11px; font-weight: var(--w-label); text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted); margin-bottom: var(--s-1);
}
/* The row wraps rather than ellipsising: the customer name is what a rep is
   scanning for, so the date drops to its own line instead of squeezing it. */
.cal__upRow {
  width: 100%; display: flex; flex-wrap: wrap; align-items: center;
  gap: 2px var(--s-2);
  background: transparent; border: 0; border-radius: var(--r-sm);
  padding: 10px var(--s-1); text-align: left; color: var(--ink);
  min-height: var(--tap);
}
.cal__upRow + .cal__upRow { box-shadow: inset 0 1px 0 var(--line-soft); }
.cal__upWho {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: var(--w-label); font-size: 15px;
}
/* Customer name + rep tag share a shrinking group; the name ellipsizes first so
   the (First) rep tag stays visible on long names. */
.cal__upMain { flex: 1 1 100%; min-width: 0; display: flex; align-items: baseline; gap: 2px; }
.cal__upMain .cal__upWho { flex: 0 1 auto; }
.cal__upRep { flex: 0 0 auto; color: var(--muted); font-weight: var(--w-body); font-size: 13px; }
.cal__upWhen {
  flex: 0 0 auto; font-size: 12.5px; color: var(--muted);
  font-variant-numeric: tabular-nums; padding-left: var(--s-4);
}
.cal__upRow:active { background: var(--accent-wash); }
.cal__upEmpty { padding: var(--s-2) var(--s-1); }

/* day sheet event rows */
.cal__ev { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--s-3); }
/* A grid rather than a flex row. As a row the title and the sub-line sat side
   by side, and the sub-line — time, job number and address — would not shrink,
   so "Install — Margaret Ellery (Daniel)" wrapped down four lines in a column
   an inch wide. Here the two stack in one column and the chevron takes its own,
   spanning both. */
.cal__evMain {
  text-align: left;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px var(--s-2);
  border: 0; border-left: var(--edge) solid transparent;
  border-radius: var(--r-sm);
  background: var(--surface); box-shadow: var(--sh-card);
  color: var(--ink); padding: var(--s-3) var(--s-3);
  min-height: var(--tap);
}
.cal__evMain .cal__evTitle {
  grid-column: 1; font-weight: var(--w-label); font-size: 15px;
}
.cal__evMain .cal__evSub { grid-column: 1; font-size: 12.5px; color: var(--muted); }
.cal__evMain .chev { grid-column: 2; grid-row: 1 / span 2; }
.cal__evTitle, .cal__evSub { display: block; min-width: 0; }
.cal__ev--quote { border-left-color: var(--event-quote); }
.cal__ev--install { border-left-color: var(--event-install); }
.cal__evMain:active { background: var(--accent-wash); }
.cal__evAdd {
  border: 0;
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--sh-card);
  color: var(--accent);
  font-size: 14px;
  font-weight: var(--w-label);
  padding: 0 var(--s-3);
  min-height: 44px;
}
.cal__evAdd:active { background: var(--accent-wash); }

/* ---------- schedule card (summary) ---------- */
.sched__row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px 0;
}
.sched__label { flex: 0 0 96px; font-weight: var(--w-label); font-size: 13px; color: var(--muted); }
.sched__inputs { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.sched__date, .sched__time {
  min-height: 44px;
  border: 0;
  border-radius: var(--r-sm);
  padding: 0 10px;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  font-weight: var(--w-value);
}
.sched__date:focus, .sched__time:focus {
  outline: none;
  background: var(--surface);
  box-shadow: var(--ring);
}

/* ---------- schedule picker banner (Jobs list) ---------- */
.picker-banner {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--accent-wash);
  border: 0;
  border-left: var(--edge) solid var(--accent);
  border-radius: var(--r-sm);
  padding: var(--s-3);
  margin-bottom: var(--s-3);
  color: var(--brand);
}
.picker-banner strong { display: block; font-weight: var(--w-label); }
.picker-banner .small { color: #3d5f88; }

/* ---------- typography ---------- */

h2 { font-size: 19px; margin: 0 0 10px; letter-spacing: -.01em; }
h3 { font-size: 15px; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* ---------- cards & lists ---------- */

/* No border: the page ground is darker than the card, so white separates on
   its own. That is the whole idea of the system. */
.card {
  background: var(--surface);
  border: 0;
  border-radius: var(--r-lg);
  box-shadow: var(--sh-card);
  padding: var(--pad);
  margin-bottom: var(--s-3);
}
.card--flush { padding: 0; overflow: hidden; }
/* A card nested inside another one recedes rather than stacking a second white. */
.card .card { background: var(--surface-sunk); box-shadow: none; border-radius: var(--r-md); }

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  background: none;
  border: 0;
  padding: var(--s-3) var(--pad);
  text-align: left;
  color: inherit;
  font-size: 16px;
  min-height: var(--tap);
}
/* The divider starts after the status strip so the list keeps one clean left
   edge. It is ::after because ::before is the strip. */
.row::after {
  content: '';
  position: absolute;
  left: var(--strip); right: 0; bottom: 0;
  height: var(--b-hair);
  background: var(--line-soft);
}
.row:last-child::after { display: none; }
/* Voided jobs are hidden from the list by default and revealed with the header
   toggle; when shown they read as greyed-out. */
/* A VOID pill sits inside .row__title, but the title
   ellipsises, so the pill was being truncated away along with the end of the
   name — the label was invisible on every row that carried it. Laying the title
   out as a row keeps the pill at its natural width beside the name. The trade is
   that an over-long voided name is clipped rather than ellipsised, which is the
   right way round: the pill is the part that carries meaning. */

/* A thin full-height accent strip on the row's left edge — the only status
   signal on the row. Transparent unless the row has a status: .row is also the
   plain navigation row on Settings and in the area picker, and a grey bar down
   the side of those would be saying something about nothing. 
   The card's overflow:hidden clips it to the rounded corners. */
.row::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: var(--strip);
  background: transparent;
}

/* The ledger status rows on Settings (ui/settings.js) — two counts that must
   never look like the same kind of thing. .row--warn is a rep's routine
   work, cleared by finalizing a job; .row--danger means the books are not
   reaching the sheet and someone has to go fix that. The two titles read as
   almost the same sentence, so the words cannot be what tells an admin
   which is which — the colour has to, at a glance, before either line is
   read. Same wash-plus-edge language the backup banner already uses for
   "worth a look" versus "actually broken" (.banner--warn / .banner--stop
   below), and the danger row pairs it with the alert glyph the backup chip
   turns to once it goes from waiting to failing (see app.js). The warn row
   gets neither the danger colour nor that glyph, on purpose — it is not
   allowed to read as an error. */
.row--warn { background: var(--warn-wash); color: var(--warn-ink); }
.row--warn::before { background: var(--status-lead); }
.row--warn .row__sub { color: var(--warn-ink); }

.row--danger { background: var(--danger-wash); color: var(--danger-ink); }
.row--danger::before { background: var(--danger); }
.row--danger .row__sub { color: var(--danger-ink); }

/* What these two rows list is what they are for — which jobs, and why a job is
   not reaching the sheet — so their sub-lines wrap where every other row's
   ellipsises. On one line a phone cut the Not syncing reason off before it
   said anything. Its reasons stack one to a line (notSyncingLines in
   ui/insights.js), with a little air between them so two wrapped reasons do not
   read as one. overflow-wrap is for an error carrying a long unbroken token,
   which would otherwise be clipped the way the whole line used to be. */
.row--warn .row__sub,
.row--danger .row__sub { white-space: normal; overflow-wrap: anywhere; }
.row--danger .row__sub + .row__sub { margin-top: var(--s-1); }

/* List header: the job count, with the quiet "Show voided (N)" toggle pushed to
   the far side. Aligned to the card gutter rather than floating near it. */
.row:active { background: var(--accent-wash); }
.row__main { flex: 1; min-width: 0; }
.row__title {
  font-weight: var(--w-label); font-size: 16px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row__sub {
  font-size: 12.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* One right-aligned stack rather than three loose values at three sizes. */
.row__end {
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px;
  text-align: right; font-variant-numeric: tabular-nums; flex-shrink: 0;
  font-size: 14px; font-weight: var(--w-label);
}
/* "Booked" indicator — soonest upcoming event, coloured by type and boxed as a
   pill so it reads as one thing rather than a stray coloured line. Independent
   of the left-edge status strip. */
.chev { color: var(--mark); font-size: 20px; flex-shrink: 0; }

/* ---------- forms ---------- */

.field { margin-bottom: var(--s-3); }
/* Sentence case, no tracking: an uppercase label at this weight outweighed the
   value beneath it, which is backwards. */
.field > label {
  display: block;
  font-size: 12px;
  font-weight: var(--w-label);
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: none;
  letter-spacing: 0;
}

/* A borderless well: the typable thing is the darker thing, and it stays the
   darker thing whether or not it has been filled in. The dimension input below
   does swap to white once it holds a number, but it can afford to — it carries
   a hairline in that state. A generic field has none, and these sit inside white
   cards, so lifting a filled one to white would erase the box entirely.
   16px minimum keeps iOS Safari from zooming the page on focus. */
input[type="text"], input[type="tel"], input[type="date"], input[type="search"],
input[type="password"], textarea, select {
  width: 100%;
  min-height: var(--tap);
  padding: var(--s-3) var(--s-3);
  font-size: 16px;
  font-weight: var(--w-value);
  color: var(--ink);
  background: var(--bg);
  border: 0;
  border-radius: var(--r-md);
  appearance: none;
}
/* A value shown rather than entered: same well, quieter, so it does not invite a tap. */
input[readonly] { color: var(--muted); }

input::placeholder, textarea::placeholder { color: #5f6b79; font-weight: var(--w-body); }

/* A dropdown, not a text box: layer a chevron on the right, since `appearance`
   above strips the native one. Fixed slate so it reads on either theme. */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238794a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s-3) center;
  padding-right: 40px;
}
textarea { min-height: 84px; resize: vertical; line-height: 1.4; }
input:focus, textarea:focus, select:focus {
  outline: none;
  background: var(--surface);
  box-shadow: var(--ring);
}

/* The one grouping the DOM allows without new markup: City and Postal code are
   the third and fourth fields of the job-details card, and pairing them breaks
   up an otherwise undifferentiated run of seven.

   Matched by shape rather than by a class, because there is no class to hang it
   on: the details card is the only card in the app with seven .field children
   directly inside it. The :not() keeps it from catching a longer card if one is
   ever added. */
.card:has(> .field:nth-of-type(7)):not(:has(> .field:nth-of-type(8))) {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 0 10px;
}
.card:has(> .field:nth-of-type(7)):not(:has(> .field:nth-of-type(8))) > .field {
  grid-column: 1 / -1;
}
.card:has(> .field:nth-of-type(7)):not(:has(> .field:nth-of-type(8))) > .field:nth-of-type(3) {
  grid-column: 1;
}
.card:has(> .field:nth-of-type(7)):not(:has(> .field:nth-of-type(8))) > .field:nth-of-type(4) {
  grid-column: 2;
}

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

/* Three weights: filled accent for the screen's one primary action, filled
   neutral for everything secondary, outline reserved for a sheet's Cancel.

   A secondary button is always a tone away from whatever is behind it, which
   means it cannot have one fill. On the page ground it lifts to white; inside a
   card or a sheet — both white — it recesses to the page tone instead. Give it
   a single fill and it disappears against one background or the other. */
/* A link styled as a button (the move banner's "Open new address"). */
a.btn { text-decoration: none; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: var(--tap);
  padding: 0 var(--s-5);
  border: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-card);
  color: var(--brand);
  font-size: 15px;
  font-weight: var(--w-label);
}
/* Secondary only. Without the :not()s this out-specifies .btn--primary and
   .btn--danger, which left a sheet's Save changes as white text on a pale grey
   slab — the most important control on the sheet, invisible.
   .pipe__card doesn't need a copy of this: every action it renders now is
   .btn--primary (Book quote visit, Book install — Call and Text are gone), so
   there is no plain .btn on a pipeline card left for this rule to protect. */
.card .btn:not(.btn--primary):not(.btn--danger),
.sheet .btn:not(.btn--primary):not(.btn--danger) {
  background: var(--bg);
  box-shadow: none;
}
.btn:active { background: var(--accent-wash); }
.btn--primary {
  min-height: 56px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
}
.btn--primary:active { background: var(--accent-press); }
.btn--danger { background: var(--danger-wash); color: var(--danger-ink); }
.btn--danger:active { background: #fbdcd8; }
.btn--ghost { background: none; color: var(--accent); }
.btn--ghost:active { background: var(--accent-wash); }
.btn--block { display: flex; width: 100%; }
.btn--lg { min-height: 58px; font-size: 17px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }

/* The summary screen's ways out (Preview / Download / Finalize), scrolling in
   flow above the pinned totals rather than sharing their bar. */
.review-actions { margin-top: var(--s-4); }

/* The "Finalized · date" milestone between the quote and invoice actions — a
   small accent badge instead of muted footnote text, so it's easy to see the
   job has been finalized. Content-width, so it reads as a tag, not a full row. */
.finalized-tag {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  margin: var(--s-2) 0;
  padding: 5px var(--s-3);
  border-radius: var(--r-pill);
  background: var(--accent-wash);
  color: var(--accent);
  font-size: 13px;
  font-weight: var(--w-label);
}

/* ---------- measure screen ---------- */

/* Context, not warning. This used to share the cream of the staleness banner
   three screens over; cream now means warning only, so the area bar takes a
   navy tint instead. */
.area-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: #dfe7f2;
  border: 0;
  border-radius: var(--r-lg);
  padding: 11px var(--s-3);
  min-height: var(--tap);
  margin-bottom: var(--s-3);
  text-align: left;
  color: inherit;
  font-size: 16px;
}
.area-bar:active { background: #d3ddec; }
.area-bar__label { flex: 1; min-width: 0; }
.area-bar__name {
  font-weight: var(--w-label);
  color: var(--brand);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.area-bar__hint {
  font-size: 11px; color: #3d5f88;
  text-transform: uppercase; letter-spacing: .09em; font-weight: var(--w-label);
}
.area-bar__change { color: var(--accent); font-weight: var(--w-label); font-size: 14px; }

.dims {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}
.dims__x { padding-bottom: 22px; font-size: 20px; color: var(--mark); font-weight: var(--w-label); }

/* Big, tabular, thumb-friendly number entry — the app's most-used control, and
   the one the brief allowed to grow.

   Empty is a recessed well and filled lifts to white with a hairline, so with
   two boxes side by side the recessed one is visibly the one still missing a
   number, readable at arm's length in sun.

   Qualified with the element on purpose. The generic input rule above is
   (0,1,1) and out-specifies a bare class, so `.dim-input` alone silently lost
   every property they share — these fields rendered at the generic 16px/52px
   for a long time rather than the 30px declared here. Same reason
   input.rate__input below is written the same way. Don't shorten either. */
input.dim-input {
  width: 100%;
  min-height: 74px;
  padding: var(--s-2) 10px;
  font-size: 30px;
  font-weight: var(--w-label);
  letter-spacing: -.02em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  border: 0;
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: inset 0 0 0 var(--b-control) var(--line);
  color: var(--ink);
  appearance: none;
}
input.dim-input:placeholder-shown {
  background: var(--bg);
  box-shadow: none;
}
input.dim-input:focus {
  outline: none;
  background: var(--surface);
  box-shadow: var(--ring-lg);
}
.dim-label {
  display: block;
  font-size: 12px;
  font-weight: var(--w-label);
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 5px;
  text-align: center;
}

/* ---------- side & film pickers ---------- */

/* Interior / Exterior. One continuous track rather than two loose buttons: it
   is chosen on every single window, so it has to read as one control and be
   hittable at arm's length. */
.seg {
  display: flex;
  gap: 2px;
  margin-bottom: var(--s-3);
  padding: 3px;
  background: var(--track);
  border-radius: var(--r-lg);
}
.seg__btn {
  flex: 1;
  min-height: var(--tap);
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: #4d5c70;
  font-size: 15px;
  font-weight: var(--w-label);
  letter-spacing: 0;
}
.seg__btn:active { background: rgba(255, 255, 255, .6); }
/* Navy for a mode, accent for a value — a solid fill either way, never a
   border a rep cannot see in sun. */
.seg__btn--on {
  background: var(--brand);
  color: #fff;
}

.chips {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--s-3);
}
.chips__label {
  font-size: 12px;
  font-weight: var(--w-label);
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  margin-right: 2px;
}
/* Add was refused because no film is picked. A toast alone is easy to miss
   when a rep is moving fast, and a button that appears to do nothing reads as
   broken rather than as a question. */
/* The product list under Other can outgrow one row; chips wrap and keep a
   comfortable minimum width rather than squeezing. */
.chips--wrap { flex-wrap: wrap; }
.chips--wrap .chip { flex: 1 1 30%; padding: 0 12px; }
.product-new { margin-top: 0; }
.product-name { flex: 1; text-align: left; }

.chips--needed .chip {
  background: var(--danger-wash);
  box-shadow: inset 0 0 0 var(--b-focus) var(--danger);
  color: var(--danger-ink);
}
.chips--needed .chips__label { color: var(--danger); }

.chip {
  flex: 1;
  min-height: 48px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--sh-card);
  color: var(--ink-2);
  font-size: 15px;
  font-weight: var(--w-label);
}
.chip:active { background: var(--accent-wash); }
.chip--on { background: var(--accent); color: #fff; box-shadow: none; }
/* The active status chip fills with its own status colour instead of the app
   accent, matching the Home strip. Amber and green take dark ink — white on
   either is too low-contrast to read; blue and pink keep the inherited white. */
.chip--on.chip--st-lead      { background: var(--status-lead); color: var(--on-amber); }
.chip--on.chip--st-quoted    { background: var(--status-quoted); color: #fff; }
.chip--on.chip--st-scheduled { background: var(--status-scheduled); color: #fff; }
.chip--on.chip--st-completed { background: var(--status-completed); color: var(--on-green); }
.chip--on.chip--st-lost { background: var(--status-lost); color: #fff; }

/* Four statuses as one continuous control rather than four loose pills, so they
   read as one question with four answers. The label sits on its own line above
   them, and the group stays flex-wrap even though none of the four labels
   (Lead, Quoted, Scheduled, Completed) is long enough to need it today. Scoped
   to the status card — the film pickers keep their default chips. */
.chips--status {
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  background: var(--track);
  border-radius: var(--r-md);
}
.chips--status .chips__label {
  flex: 1 0 100%; margin: 0 0 6px; padding: 3px 3px 0;
}
.chips--status .chip {
  flex: 1 1 0; min-width: 0;
  min-height: 46px;
  border-radius: var(--r-chip);
  background: transparent;
  box-shadow: none;
  color: #4d5c70;
  font-size: 12px;
  font-weight: var(--w-label);
  line-height: 1.12;
  padding: 0 6px;
}
.chips--status .chip:active { background: rgba(255, 255, 255, .6); }
/* Restated inside the status track because `.chips--status .chip` above and
   `.chip--on.chip--st-*` further up carry the same specificity, and the track
   rule wins on source order — which left the selected status unfilled. */
.chips--status .chip--on { box-shadow: none; color: #fff; }
.chips--status .chip--on.chip--st-lead       { background: var(--status-lead); color: var(--on-amber); }
.chips--status .chip--on.chip--st-quoted     { background: var(--status-quoted); color: #fff; }
.chips--status .chip--on.chip--st-scheduled { background: var(--status-scheduled); color: #fff; }
.chips--status .chip--on.chip--st-completed { background: var(--status-completed); color: var(--on-green); }

/* Change password, on My info. The three boxes are unlabelled — placeholders
   say enough for a form this short — so they need their own rhythm rather than
   the .field wrapper the details above use. The panel inverts to a recessed
   tone with white boxes inside it, so it reads as a self-contained job with its
   own button rather than a second half of the card above. */
.card--pw {
  background: #e9edf4;
  box-shadow: none;
}
.card--pw input[type="password"] { margin-bottom: 10px; background: var(--surface); }
/* Navy, not accent: this leaves exactly one accent action on the screen. */
.card--pw .btn {
  margin-top: var(--s-1);
  background: var(--brand);
  color: #fff;
}
.card--pw .btn:active { background: var(--brand-ink); }
.card--pw .login__error { margin-bottom: 10px; }

/* A short number with its unit beside it: the thickness field under a lit
   "Other" chip ("MIL"), and the window editor's discount ("%"). Structurally
   the same idea as .rate__field and its "$": the unit is a label sitting beside
   the box, not text inside it, so it can't be selected, deleted or typed over. */
.unitfield {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin: -2px 0 var(--s-3);
}
.unitfield__label {
  font-size: 12px;
  font-weight: var(--w-label);
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}
/* Qualified with the element for the same reason input.rate__input below is:
   the generic input[type="text"] rule out-specifies a bare class and would put
   its own width and padding back. 16px keeps iOS Safari from zooming the page
   when the field takes focus. */
input.unitfield__input {
  width: 72px;
  min-height: 44px;
  margin: 0;
  padding: 0 10px;
  font-size: 16px;
  font-weight: var(--w-label);
  text-align: right;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--ink);
}
input.unitfield__input:focus {
  outline: none;
  background: var(--surface);
  box-shadow: var(--ring);
}
.unitfield__unit { font-size: 14px; font-weight: var(--w-label); color: var(--muted); }
/* Add was refused for want of a thickness — same argument as .chips--needed. */
.unitfield--needed input.unitfield__input {
  background: var(--danger-wash);
  box-shadow: inset 0 0 0 var(--b-focus) var(--danger);
}
.unitfield--needed .unitfield__label { color: var(--danger); }

/* Banner shown while an entry is aimed at an existing window's second side. */
.pending {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--warn-wash);
  border: 0;
  border-left: var(--edge) solid var(--status-lead);
  border-radius: var(--r-sm);
  padding: 10px var(--s-3);
  margin-bottom: var(--s-2);
  font-size: 13px;
  color: var(--warn-ink);
}
.pending span { flex: 1; }

/* Sixteenths as tap targets.
   The iOS numeric keypad has no space bar and no slash, so a rep physically
   cannot type "53 3/8" on a phone even though the parser accepts it. Whole
   number on the keypad, fraction with one tap.

   One uniform fill across all sixteen — weight and colour alone separate the
   common fractions from the sixteenths, so the grid reads as one field of
   targets rather than two competing sets. */
.fracs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: var(--s-3);
}

.frac {
  min-height: 46px;
  padding: 0 2px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-card);
  color: var(--ink);
  font-size: 15px;
  font-weight: var(--w-label);
  font-variant-numeric: tabular-nums;
}
.frac:active { background: var(--accent-wash); }
.frac--none { color: var(--muted); }
/* The sixteenths recede. They land on the even positions because the grid is
   "—" followed by the fifteen fractions in order, so every second button is an
   odd sixteenth: 1/16, 3/16, 5/16 and so on. */
.frac:nth-child(even) { font-size: 14px; font-weight: var(--w-value); color: var(--muted); }
.frac--on {
  background: var(--accent);
  box-shadow: none;
  color: #fff;
  font-size: 15px;
  font-weight: var(--w-label);
}

/* Enough of a container to stop reading as a caption, without spending a whole
   card on two numbers. */
.live {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-6);
  min-height: 38px;
  margin-bottom: var(--s-3);
  padding: 0 var(--s-3);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--sh-card);
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.live b {
  color: var(--ink); font-size: 16px; font-weight: var(--w-label);
  font-variant-numeric: tabular-nums;
}
.live--empty { opacity: .35; }

/* ---------- window list ---------- */

.grp { margin-bottom: var(--s-5); }
.sub__head {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  padding: var(--s-2) 2px var(--s-1);
  font-size: 14px;
  font-weight: var(--w-label);
  color: var(--ink);
}
.sub__count { font-size: 12px; font-weight: var(--w-body); color: var(--muted); }

/* A window is a container: one row per side, plus an action to add the side it
   doesn't have yet. */
.win {
  background: var(--surface);
  border: 0;
  border-radius: var(--r-md);
  box-shadow: var(--sh-card);
  margin-bottom: var(--s-2);
  overflow: hidden;
}
.win--pending { box-shadow: inset 0 0 0 var(--b-focus) var(--status-lead); }

.win__body {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  background: none;
  border: 0;
  padding: 10px 10px 10px var(--s-3);
  text-align: left;
  color: inherit;
  font-size: 16px;
}
.win__body:active { background: var(--accent-wash); }
.win__n {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--w-label);
  display: grid;
  place-items: center;
}
.win__sides { flex: 1; min-width: 0; }

/* Two lines per side. Five columns (label, dims, film, calc, price) will not
   fit across a 375px phone without wrapping the dimensions mid-value, so the
   label spans and the numbers drop to a second line. */
.side {
  display: grid;
  grid-template-columns: 66px 1fr auto;
  grid-template-areas:
    "tag dims  film"
    "tag calc  price";
  align-items: baseline;
  gap: 1px var(--s-2);
  padding: 2px 0;
}
.side + .side { border-top: 1px dashed var(--line-soft); padding-top: 6px; margin-top: 5px; }

.side__tag {
  grid-area: tag;
  align-self: start;
  font-size: 11px;
  font-weight: var(--w-label);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--brand);
}
.side__dims {
  grid-area: dims;
  font-weight: var(--w-label);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.side__film {
  grid-area: film;
  text-align: right;
  font-size: 12px;
  font-weight: var(--w-label);
  color: var(--accent);
  white-space: nowrap;
}
.side__film.muted { color: var(--mark); font-weight: var(--w-body); }
/* A custom thickness whose rate row is still empty. Coloured rather than muted:
   the price beside it is a real caulking-only figure, not the $0.00 that mutes
   a None, and greying it would claim the side costs nothing on purpose. */
.side__film--needed { color: var(--danger); }
.side__calc {
  grid-area: calc;
  display: flex;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
/* "15.27 sq ft" must not break after the number — a unit orphaned onto its own
   line reads as a second figure. */
.side__calc > div { white-space: nowrap; }

.side__price {
  grid-area: price;
  text-align: right;
  font-size: 13px;
  font-weight: var(--w-label);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* A side with no film is genuinely $0.00, not missing data — say so quietly. */
.side__price.muted { color: var(--mark); font-weight: var(--w-body); }

.win__sub {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  border-top: var(--b-hair) solid var(--line-soft);
  background: var(--surface-sunk);
  padding: 6px var(--s-3);
  font-size: 12px;
  color: var(--muted);
}
.win__sub span:first-child { flex: 1; min-width: 0; }
.win__subv { font-weight: var(--w-figure); color: var(--ink); font-variant-numeric: tabular-nums; }

.win__more {
  display: block;
  width: 100%;
  background: var(--surface-sunk);
  border: 0;
  border-top: var(--b-hair) solid var(--line-soft);
  padding: 9px var(--s-3);
  text-align: left;
  color: var(--accent);
  font-size: 13px;
  font-weight: var(--w-label);
  min-height: 42px;
}
.win__more:active { background: var(--accent-wash); }

/* Adding the second side. The two faces of a window are usually the same size,
   so copying takes the width and a different size sits beside it as the
   exception. The copy label ellipsises rather than wrapping the row onto two
   lines on a narrow phone — the pending banner restates it in full anyway. */
.win__add {
  display: flex;
  border-top: var(--b-hair) solid var(--line-soft);
}
.win__add .win__more { border-top: 0; }

.win__more--copy {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.win__more--alt {
  flex: 0 0 auto;
  width: auto;
  border-left: var(--b-hair) solid var(--line-soft);
  color: var(--muted);
  font-weight: var(--w-label);
}

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

/* One strip of three equal columns rather than three separate tiles, one of
   which used to be a different colour and a fixed width. */
.totals {
  display: flex;
  gap: 0;
  /* Sits inline at the end of the window list, so it carries its own top gap
     rather than leaning on the footer padding it used to live inside. */
  margin: var(--s-4) 0 var(--s-3);
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-card);
  overflow: hidden;
}
.tot {
  flex: 1 1 0;
  min-width: 0;
  background: var(--surface);
  color: var(--ink);
  border-radius: 0;
  padding: 10px var(--s-3);
  text-align: center;
}
.tot + .tot { box-shadow: inset 1px 0 0 var(--line-soft); }
.tot__k {
  font-size: 12px; text-transform: none; letter-spacing: 0;
  font-weight: var(--w-body); color: var(--muted);
}
.tot__v {
  font-size: 20px; font-weight: var(--w-label); color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.tot__u { font-size: 13px; font-weight: var(--w-body); color: var(--muted); }

/* ---------- sticky footer actions ---------- */

/* Solid rather than a fade: at this height a translucent bar let list rows
   show through and read as a rendering glitch. */
.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 15;
  background: var(--bg);
  border-top: var(--b-hair) solid var(--line);
  box-shadow: 0 -10px 18px -10px rgba(15, 26, 43, .16);
  padding: var(--s-3) 0 calc(var(--safe-bottom) + 10px);
  margin-top: var(--s-4);
}

.signed-in {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin: var(--s-5) 2px 0;
  font-size: 12px;
  color: var(--muted);
}
.signed-in span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Settings: the running version, small and out of the way (app/js/ui/settings.js). */
.appversion {
  text-align: center;
  padding: var(--s-4) var(--pad) var(--s-2);
}

/* Settings: the floating "signed in as" line joins the card below it as that
   card's own recessed header, so one card holds the whole screen and the space
   beneath reads as deliberate rather than unfinished.

   Identified by position, not by a class: on Settings this line is main's first
   child, whereas on My info it sits between two cards. */
main > .signed-in:first-child {
  display: block;
  margin: 0;
  padding: var(--s-3) var(--s-4);
  background: var(--surface-sunk);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--sh-card);
  font-size: 12px;
}
main > .signed-in:first-child span { display: block; word-break: break-all; }
main > .signed-in:first-child + .card { border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* Sign out has nothing to scroll past, so it stops being a pinned bar and just
   sits below the card. Settings is the only screen whose footer holds a danger
   button, which is what this matches on. */
.sticky-actions:has(> .btn--danger) {
  position: static;
  background: none;
  border-top: 0;
  box-shadow: none;
  padding: 0;
  margin-top: var(--s-3);
}

/* ---------- sign in ---------- */

/* Dark by design, but this is worn outdoors in daylight, so contrast is a
   requirement rather than a mood. Everything interactive here clears 4.5:1
   against the background. The screen now shares the app's radii, control
   heights and focus ring, so the jump into the Jobs list stops being jarring;
   twelve white alphas reduce to four. */

.login {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + var(--s-6)) var(--s-5) calc(var(--safe-bottom) + var(--s-6));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Keeps the dark from reading as an unfinished flat fill. Sits behind the
   logo, picking up the accent at low opacity rather than adding a new hue. */
.login__glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 70% at 50% 26%, #123a63, transparent 62%),
    radial-gradient(140% 50% at 50% 104%, #17497c, transparent 60%);
}

.login__inner {
  position: relative;
  width: 100%;
  max-width: 380px;
  margin: auto;
}

.login__brand {
  display: flex;
  justify-content: center;
  margin-bottom: 34px;
}
/* Constrained by width, not height: the lockup is nearly 3:1, so sizing by
   height overflows a phone long before it looks large. height:auto lets the
   browser hold the artwork's real ratio with no arithmetic to get wrong. */
.login__logo {
  display: block;
  width: 100%;
  max-width: 290px;
  height: auto;
}
.login__wordmark {
  font-size: 24px;
  font-weight: var(--w-figure);
  letter-spacing: .5px;
  color: #fff;
  text-align: center;
}

/* A panel a shade lighter than the page, at the sheet's radius so it belongs
   to the same system as everything behind it. */
.login__panel {
  background: rgba(255, 255, 255, .06);
  border: var(--b-hair) solid rgba(255, 255, 255, .12);
  border-radius: var(--r-sheet);
  padding: var(--s-5);
}

/* Qualified with the element for the same reason as input.dim-input: the
   generic input rule is (0,1,1) and would otherwise win. */
input.login__input {
  display: block;
  width: 100%;
  min-height: 60px;
  padding: 0 var(--s-4);
  margin-bottom: var(--s-3);
  /* Sized against the measure screen's dimension fields — thumb-first. 17px
     also keeps iOS from zooming the page on focus. */
  font-size: 17px;
  font-weight: var(--w-value);
  color: #fff;
  background: rgba(255, 255, 255, .08);
  border: 0;
  border-radius: var(--r-lg);
  appearance: none;
}
input.login__input::placeholder { color: rgba(255, 255, 255, .55); font-weight: var(--w-body); }
input.login__input:focus {
  outline: none;
  background: rgba(255, 255, 255, .10);
  box-shadow: var(--ring-lg);
}

.login__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  width: 100%;
  min-height: 60px;
  margin-top: var(--s-1);
  border: 0;
  border-radius: var(--r-lg);
  background: var(--accent);
  color: #fff;
  font-size: 17px;
  font-weight: var(--w-label);
  letter-spacing: 0;
  transition: background-color var(--m-press);
}
.login__btn:active { background: var(--accent-press); }
.login__btn[disabled] { opacity: .65; pointer-events: none; }

/* --danger is tuned for white backgrounds; at 2.4:1 here it would be
   unreadable, so this is the same red lifted for a dark surface. */
.login__error {
  display: none;
  margin: 2px 2px var(--s-3);
  font-size: 13.5px;
  font-weight: var(--w-value);
  color: #ff9d96;
}
.login__error--on { display: block; }

/* The same slot as an error, in a colour that does not read as one. Used for
   the reset confirmation, which is good news. */
.login__error--info { color: #9fd8b4; }

/* A quieter action than the sign-in button, on the same dark panel. */
.login__link {
  display: block;
  width: 100%;
  margin-top: var(--s-4);
  padding: 6px;
  background: none;
  border: 0;
  font-size: 14px;
  font-weight: var(--w-label);
  color: #8fb6e4;
  text-align: center;
}
.login__link:active { color: #fff; }

/* A sentence of explanation above a form, on the dark panel. */
.login__msg {
  margin: 0 0 var(--s-4);
  font-size: 15px;
  line-height: 1.45;
  color: rgba(255, 255, 255, .82);
}

.login__help {
  margin: var(--s-5) 0 0;
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, .62);
}

/* The app chrome is hidden entirely on this screen. */
body.is-login .appbar,
body.is-login main { display: none; }

/* ---------- collapsible form sections ---------- */

/* Office-only detail is folded away so the measure path stays one card long.
   A filled chevron disc marks it as a thing that opens, so a closed section
   stops looking like a card of content. */
.section__head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: var(--tap);
  padding: 0;
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  text-align: left;
  color: inherit;
  font-size: 16px;
}
.section__head:active { background: var(--accent-wash); }
.section__head + div { padding-top: var(--s-3); }
.section__head .chev {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--brand);
  font-size: 15px;
}

/* ---------- per-job rates ---------- */

/* A grid rather than a flex row, because the number of rates is no longer three:
   a job grows one more for every custom thickness it uses. Two across on a
   phone gives each label room to be read rather than truncated. */
.rates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3) var(--s-2);
}
.rate { min-width: 0; }
/* A custom thickness has no default rate — there is no sensible price for an
   arbitrary film — so a row sitting at $0.00 is a question nobody has answered
   yet, not a decision. Same treatment as .chips--needed, for the same reason. */
.rate--needed .rate__field {
  background: var(--danger-wash);
  box-shadow: inset 0 0 0 var(--b-focus) var(--danger);
}
.rate--needed .rate__label { color: var(--danger); }
.rate__label {
  font-size: 12px;
  font-weight: var(--w-label);
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: var(--s-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rate__field {
  display: flex;
  align-items: center;
  gap: 2px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--bg);
  padding: 0 10px;
}
.rate__field:focus-within {
  background: var(--surface);
  box-shadow: var(--ring);
}
.rate__cur { color: var(--muted); font-size: 14px; }

/* Qualified with the element on purpose: the generic input[type="text"] rule
   above is (0,1,1) and would otherwise out-specify a bare class, putting its
   14px side padding back and clipping the last digit of "15.00".
   16px keeps iOS Safari from zooming the page when the field takes focus. */
input.rate__input {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: none;
  font-size: 16px;
  font-weight: var(--w-label);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  appearance: none;
}
input.rate__input:focus { outline: none; box-shadow: none; background: none; }
.rate__unit { font-size: 11px; color: var(--muted); margin-top: 3px; white-space: nowrap; }

/* ---------- summary money block ---------- */

.jobmoney {
  padding: var(--s-3);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--sh-card);
}
.jobmoney__row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 26px;
}
/* [hidden] is a display:none the row's own display:flex would otherwise win
   against, and the discounted Sub-Total hides at 0%. */
.jobmoney__row[hidden] { display: none; }
.jobmoney__k { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); }
.jobmoney__v {
  font-size: 16px;
  font-weight: var(--w-figure);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* The reduction is a subtraction, not a total — it reads at the weight of the
   label it sits beside rather than competing with the two real figures. */
.jobmoney__v--off { font-size: 14px; font-weight: var(--w-body); color: var(--muted); }

/* The discounted Sub-Total is what the customer is being told, so it carries a
   hairline above it and the largest figure in the block. */
.jobmoney__row--net {
  margin-top: var(--s-2);
  padding-top: var(--s-2);
  border-top: var(--b-hair) solid var(--line-soft);
}
.jobmoney__row--net .jobmoney__k { color: var(--ink); font-weight: var(--w-label); }
.jobmoney__row--net .jobmoney__v { font-size: 19px; }

/* The one editable line. Sized to the three characters it can ever hold — a
   full-width input would read as the most important thing in the block, and it
   is the smallest. */
.jobmoney__pct {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  min-height: 34px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  background: var(--surface-sunk);
  box-shadow: inset 0 0 0 var(--b-hair) var(--line);
}
/* Qualified with the element for the reason input.rate__input is: the generic
   input[type="text"] rule out-specifies a bare class, and would otherwise give
   this a full-width 52px box with its own background inside the chip. */
input.jobmoney__input {
  width: 2.6em;
  min-height: 0;
  height: 30px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  font-size: 15px;
  font-weight: var(--w-figure);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
  appearance: none;
}
input.jobmoney__input:focus { outline: none; box-shadow: none; background: none; }
.jobmoney__sign { font-size: 13px; color: var(--muted); }

/* ---------- Additional Services ---------- */

/* An item reads name-first: the product as a plain bold title, its small
   numbers underneath — not a row of boxes fighting the name for room. The name
   is a textarea that grows with its text (review.js sizes it), so a long
   description shows in full. `textarea.` / `input.` beat the base rules so the
   fields stay small and the textarea loses its 84px floor; 16px keeps iOS
   Safari from zooming the page when a field takes focus. */
.svc__row { padding: 10px 0; border-bottom: var(--b-hair) solid var(--line-soft); }
.svc__top { display: flex; align-items: flex-start; gap: var(--s-2); }
textarea.svc__name {
  flex: 1; min-width: 0; min-height: 0;
  font-size: 16px; font-weight: var(--w-label); line-height: 1.35;
  padding: var(--s-1) 2px; border: 0; border-radius: 0; background: transparent;
  resize: none; overflow: hidden;
}
textarea.svc__name:focus {
  outline: none; box-shadow: none; background: transparent;
  border-bottom: var(--b-control) solid var(--accent);
}
.svc__del { flex-shrink: 0; font-size: 15px; line-height: 1; padding: var(--s-1) var(--s-2); }
.svc__bot { display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-1); }
.svc__lbl { font-size: 12px; color: var(--muted); }
input.svc__num {
  width: 76px; min-height: 44px; text-align: right; padding: 0 10px;
  font-size: 16px; font-variant-numeric: tabular-nums;
  background: var(--bg); border-radius: var(--r-sm);
}
/* A line still at $0.00: the same treatment as an unpriced custom film's rate
   field (.rate--needed), and like it, set aside while the rep is typing in it. */
input.svc__num--needed:not(:focus) {
  background: var(--danger-wash);
  box-shadow: inset 0 0 0 var(--b-focus) var(--danger);
}
.svc__total { margin-left: auto; font-weight: var(--w-figure); font-variant-numeric: tabular-nums; }
.svc__add { margin-top: var(--s-3); display: flex; flex-direction: column; gap: var(--s-2); }
.svc__picks { margin-bottom: 0; }
.chips--wrap .chip.svc__pick { font-size: 14px; line-height: 1.2; padding: 4px 10px; }
.svc__addRow { display: flex; align-items: flex-end; gap: var(--s-2); }
.svc__addRow textarea.svc__name {
  min-height: 44px; padding: 10px; font-weight: var(--w-body);
  background: var(--bg); border-radius: var(--r-sm);
}
.svc__addRow textarea.svc__name:focus { background: var(--surface); border-bottom: 0; box-shadow: var(--ring); }
.svc__addBtn { flex-shrink: 0; min-height: 44px; }

/* ---------- bottom sheet ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: var(--scrim);
  display: flex;
  align-items: flex-end;
  animation: fade var(--m-fade);
}
@keyframes fade { from { opacity: 0; } }

/* White, not page-coloured: the sheet reads as a layer above the screen rather
   than a screen that slid up. Its inner cards take the recessed tone. */
.sheet {
  width: 100%;
  max-height: 88dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: var(--sh-sheet);
  padding: 10px var(--pad) calc(var(--safe-bottom) + var(--s-4));
  animation: rise var(--m-rise);
}
@keyframes rise { from { transform: translateY(14%); } }

.sheet .card {
  background: var(--surface-sunk);
  box-shadow: none;
  border-radius: var(--r-lg);
}
/* The sheet's Cancel is the system's one outline button, so it stops competing
   with the sheet's primary action and stops reading like the delete. */
.sheet > .btn:last-child {
  background: none;
  box-shadow: inset 0 0 0 var(--b-control) var(--line-strong);
}
.sheet > .btn:last-child:active { background: var(--accent-wash); }

.sheet__grab {
  width: 38px;
  height: 5px;
  border-radius: var(--r-pill);
  background: var(--mark);
  margin: var(--s-1) auto var(--s-3);
}
.sheet__title { font-size: 17px; font-weight: var(--w-label); margin-bottom: var(--s-3); }
/* A sheet title with a control beside it (the window editor's "…" menu). The
   title keeps its own bottom margin; the row centres the button on the text. */
.sheet__head { display: flex; align-items: flex-start; gap: var(--s-2); }
.sheet__head .sheet__title { flex: 1; min-width: 0; }
.sheet__more {
  flex: 0 0 auto;
  width: 40px;
  height: 32px;
  margin-top: -6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--r-pill);
  background: none;
  color: var(--muted);
}
.sheet__more:active, .sheet__more[aria-expanded="true"] { background: var(--accent-wash); color: var(--ink); }

/* A set adjustment, stated in plain sight under the sides (editor) and on the
   window's card (list). Only the menu holding the control is tucked away. */
.adj-line {
  font-size: 12px;
  font-weight: var(--w-label);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin: 0 0 var(--s-2);
}
.win .adj-line { margin: 0; padding: 0 var(--s-3) var(--s-2) 44px; }

.side-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: var(--b-focus) solid var(--line);
}
.side-head h3 {
  font-size: 11px;
  font-weight: var(--w-label);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--brand);
}

.new-area {
  display: flex;
  gap: var(--s-2);
  align-items: stretch;
  margin-bottom: 10px;
}
.new-area input { flex: 1; }
.new-area .btn { flex-shrink: 0; padding: 0 var(--s-4); }

/* Area picker: the room name heading the card of its window sets. */
.areapick__group { margin-bottom: 10px; }
.areapick__newHead {
  font-size: 12px;
  font-weight: var(--w-label);
  color: var(--muted);
  margin-bottom: var(--s-2);
}
.areapick__add { color: var(--accent); }
.areapick__groupHead {
  padding: 10px var(--s-4);
  font-size: 11px;
  font-weight: var(--w-label);
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--surface-sunk);
  border-bottom: var(--b-hair) solid var(--line-soft);
}

/* The calendar's "schedule this day as…" pair. They borrow the event colours,
   so the choice is the same colour as the thing it creates. */
.sched__pick {
  border-left: var(--edge) solid transparent;
  justify-content: flex-start;
}
.sched__pick + .sched__pick { margin-top: var(--s-2); }

/* ---------- finalized document ---------- */

/* The on-screen mirror of the Invoice PDF: one continuous page rather than the
   app's usual stack of gapped cards, because that's what it is standing in for.
   Full bleed — it loses the card and main's padding, so a document does not sit
   inside a card inside a padded page. Smaller type throughout: a document reads
   dense on paper and should read dense here too. */
.finl {
  background: var(--surface);
  border: 0;
  border-radius: 0;
  margin: calc(var(--pad) * -1) calc(var(--pad) * -1) var(--s-3);
  padding: var(--s-5) var(--s-5) var(--s-6);
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
}

.finl__head {
  text-align: center;
  padding-bottom: var(--s-3);
  margin-bottom: var(--s-4);
  border-bottom: var(--b-focus) solid var(--brand);
}
.finl__brand {
  font-size: 11px;
  font-weight: var(--w-label);
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
}
.finl__doctitle {
  font-size: 22px;
  font-weight: var(--w-figure);
  letter-spacing: 0;
  color: var(--brand);
  margin-top: 2px;
}

.finl__section { margin-bottom: var(--s-5); }
.finl__section:last-child { margin-bottom: 0; }
.finl__section h3 {
  font-size: 11px;
  font-weight: var(--w-label);
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  margin-bottom: 6px;
}
.finl__group + .finl__group { margin-top: var(--s-4); }

/* One label/value pair from the client block. The value always renders, even
   empty, so a blank field still shows the dashed rule — the on-screen
   equivalent of the PDF's ruled line waiting to be filled in by hand. */
.finl__row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: var(--s-1) 0;
}
.finl__label {
  flex: 0 0 128px;
  font-size: 12px;
  color: var(--muted);
}
.finl__row .finl-ed { flex: 1; min-width: 0; }

/* ---- line table ---- */

.finl__line { padding: var(--s-2) 0; border-top: 1px dashed var(--line-soft); }
.finl__line:first-child { border-top: 0; }
.finl__lineHead { display: flex; align-items: baseline; gap: var(--s-2); }
.finl__lineNo {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: var(--w-label);
  display: grid;
  place-items: center;
}
.finl__lineSpacer { flex: 1; }
.finl__lineLabel { flex: 1; min-width: 0; font-weight: var(--w-label); }
.finl__lineAmt {
  flex-shrink: 0;
  font-weight: var(--w-figure);
  font-variant-numeric: tabular-nums;
}
.finl__side {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 3px 0 3px 28px;
  font-size: 12.5px;
}
.finl__sideTag {
  flex: 0 0 62px;
  font-size: 10.5px;
  font-weight: var(--w-label);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--brand);
}
.finl__sideDims { color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.finl__sideFilm { flex: 1; text-align: right; color: var(--accent); font-weight: var(--w-label); white-space: nowrap; }
.finl__sidePrice {
  flex: 0 0 auto;
  min-width: 68px;
  text-align: right;
  font-weight: var(--w-figure);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* The structural caulking under a side: a child of the row above it, so it is
   indented past that row's own indent, set smaller and muted, and carries no
   dashed underline because — unlike everything else on this screen — it is
   derived from the line's Amount rather than being an input of its own. */
.finl__caulk {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 0 3px 44px;
  font-size: 11px;
  color: var(--muted);
}
/* The adjustment row reuses the caulking row's geometry — the two stack under
   one line and a second indent would read as a second nesting level — but it
   states what the line comes to rather than itemizing part of it, so it carries
   the ink of a total instead of a sub-item. */
.finl__caulk--adj { color: var(--ink); }
.finl__caulk--adj .finl__caulkAmt { font-weight: var(--w-label); }

.finl__caulkLabel { flex: 1; min-width: 0; }
.finl__caulkAmt {
  flex: 0 0 auto;
  min-width: 68px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Additional Services rows in the finalized editor: name / qty / unit / total,
   each tappable via .finl-ed, then a compact ✕. */
.finl__svc { display: flex; align-items: baseline; gap: var(--s-2); padding: var(--s-2) 0; border-top: 1px dashed var(--line-soft); }
.finl__svc:first-child { border-top: 0; }
/* A service's full text, wrapped, with the rep's own line breaks. */
.finl__svcName { flex: 1; min-width: 0; font-weight: var(--w-label); white-space: pre-line; overflow-wrap: anywhere; }
.finl__svcQty { flex-shrink: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.finl__svcUnit { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.finl__svcTot { flex-shrink: 0; min-width: 64px; text-align: right; font-weight: var(--w-figure); font-variant-numeric: tabular-nums; }
.finl__svcDel { flex-shrink: 0; font-size: 15px; line-height: 1; padding: 2px var(--s-1); }

/* ---- money block ---- */

/* Only the two rows a rep actually reads carry weight. */
.finl__money { border-top: var(--b-focus) solid var(--line); padding-top: 10px; margin-bottom: var(--s-5); }
.finl__moneyRow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 5px 2px;
  font-size: 13px;
  font-weight: var(--w-body);
  color: var(--muted);
}
.finl__moneyRow .finl__moneyVal { font-size: 14px; font-weight: var(--w-value); color: var(--ink-2); }
.finl__moneyRow--strong {
  font-weight: var(--w-label);
  font-size: 14px;
  color: var(--ink);
  border-top: var(--b-hair) solid var(--line);
  padding-top: var(--s-2);
  margin-top: var(--s-1);
}
.finl__moneyRow--strong .finl__moneyVal { font-size: 17px; font-weight: var(--w-figure); color: var(--ink); }
/* The one row worth a rep's eye first — banded the same way the PDF bands it. */
.finl__moneyRow--balance {
  background: var(--brand);
  border-radius: var(--r-sm);
  border-top: 0;
  margin-top: var(--s-2);
  padding: 10px var(--s-3);
  color: #fff;
  font-size: 14px;
  font-weight: var(--w-label);
}
.finl__moneyRow--balance .finl__moneyVal { font-size: 18px; font-weight: var(--w-figure); color: #fff; }
.finl__moneyVal { font-variant-numeric: tabular-nums; }

.finl__notes { display: block; min-height: 1.4em; white-space: pre-wrap; }

/* Remove sits under a line's sides (or its label row, for an ad-hoc line),
   right-aligned so it reads as an action on that line rather than the next
   one — the same footer position windoweditor.js uses for "Remove side".
   Muted until pressed: seven saturated red links down one page were the
   loudest thing on a document nobody is meant to read in a panic. */
.finl__lineFoot { display: flex; justify-content: flex-end; margin-top: var(--s-1); }
.finl__lineFoot .link-btn--danger { color: #7c8899; font-size: 12px; font-weight: var(--w-body); }
.finl__lineFoot .link-btn--danger:active { color: var(--danger); }

/* The staleness banner: same warm "needs a look" palette as the app-shell
   .banner--warn, boxed to sit inside the document rather than running
   edge-to-edge under the app bar. */
.finl__stale {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--s-3);
  margin-bottom: var(--s-4);
  background: var(--warn-wash);
  border: 0;
  border-left: var(--edge) solid var(--status-lead);
  border-radius: var(--r-sm);
  color: var(--warn-ink);
  font-size: 12.5px;
  line-height: 1.35;
}
.finl__stale strong { display: block; font-weight: var(--w-figure); color: var(--warn-ink-strong); }
.finl__stale .btn { flex-shrink: 0; background: var(--surface); }

/* ---- terms ---- */

/* Locked: fixed contract text, so — unlike everything above — nothing in
   here carries finl-ed. The lock in the heading says so at a glance. */
.finl__terms {
  padding: var(--s-3);
  background: var(--surface-sunk);
  border: 0;
  border-radius: var(--r-sm);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}
.finl__termsHead {
  font-size: 11px;
  font-weight: var(--w-label);
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink);
  margin-bottom: var(--s-2);
}
.finl__terms p { margin: 0 0 var(--s-2); }
.finl__terms p:last-child { margin-bottom: 0; }
.finl__terms p.finl__terms--bold { font-weight: var(--w-figure); color: var(--ink); }
/* A section title inside the terms: bold and against the left margin, sitting
   tight against the paragraphs it introduces rather than floating between
   them and the clause above. */
.finl__terms p.finl__terms--head {
  font-weight: var(--w-figure);
  color: var(--ink);
  margin-bottom: var(--s-1);
}

/* The dashed rule marks an EMPTY value — which is what the PDF's blank ruled
   lines actually mean. A filled value is plain ink; putting a dash under all
   thirty of them made the mark say nothing. The affordance still shows on
   press, which matters because the app disables the default tap highlight
   everywhere (-webkit-tap-highlight-color, above) — without one, a tap on a
   value would show no feedback at all until its sheet opens.

   Negative margins on the pressed chip so the text does not shift when it
   appears. Only border-bottom and background here — every context above
   already owns its element's display and width, so this stays a pure visual
   overlay that can't fight them for layout. */
.finl-ed {
  cursor: pointer;
  padding-bottom: 1px;
}
.finl-ed:empty {
  border-bottom: var(--b-control) dashed var(--rule-empty);
}
.finl-ed:active {
  background: var(--accent-wash);
  border-radius: 5px;
  margin: -2px -5px;
  padding: 2px 5px 3px;
}

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

.empty {
  text-align: center;
  color: var(--muted);
  padding: 44px var(--s-5);
}
.empty__icon { display: flex; justify-content: center; color: var(--mark); margin-bottom: var(--s-3); }

/* ---------- icons ---------- */

/* Inline SVG in currentColor, so a glyph takes the colour of whatever it sits
   in and the tab bar's on and off states need no second copy. See ui/icons.js. */
.ico { display: block; flex-shrink: 0; }

/* An icon and its words as one run. The icon is nudged down a hair because a
   stroked glyph on a 24-grid optically sits high against a cap height. */
.icolabel {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.icolabel .ico { position: relative; top: .5px; }

/* The one input that sits on the page ground rather than inside a card, so the
   empty-well fill would be the same tone as the page and the box would vanish.
   It lifts to white instead — the same inversion the secondary button makes. */
.searchbar { margin-bottom: var(--s-3); }
.searchbar input {
  background: var(--surface);
  box-shadow: var(--sh-card);
}
.searchbar input:focus { box-shadow: var(--ring); }

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  background: var(--bg);
  color: var(--muted);
  font-size: 12px;
  font-weight: var(--w-label);
}

.link-btn {
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--accent);
  font-size: 14px;
  font-weight: var(--w-label);
  padding: 6px;
}
.link-btn:active { background: var(--accent-wash); }
.link-btn--danger { color: var(--danger); }

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 22px);
  /* Far enough to actually leave the screen. It has to clear its own height
     *plus* the gap it is held above the bottom, so the distance is written
     from the same terms as `bottom` above — the two have to move together.
     A percentage of its own height was not that distance: it left an 8px
     sliver on a desktop, and on a phone with a home indicator it left 42px of
     a 46px toast sitting there permanently, showing whatever the last message
     had been. Opacity carries the hiding on its own, so getting this distance
     wrong can never again put the box back on screen. */
  transform: translate(-50%, calc(100% + var(--safe-bottom) + 30px));
  opacity: 0;
  z-index: 90;
  max-width: min(90vw, 380px);
  background: var(--toast);
  color: #fff;
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: var(--w-value);
  text-align: center;
  transition: transform .22s cubic-bezier(.22, 1, .36, 1), opacity .18s linear;
  pointer-events: none;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }
#toast.err { background: var(--stop-ink); }

/* ---------- backup indicator ---------- */

/* Sits in the app bar, so it inherits the bar's button styling and only needs
   to override size and state colour. Quiet on purpose: it should be ignorable
   until it isn't. */
.syncchip {
  min-height: 32px !important;
  padding: 0 10px !important;
  font-size: 12.5px !important;
  font-weight: var(--w-label);
  border-radius: var(--r-pill) !important;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.syncchip--ok { color: rgba(255, 255, 255, .62); }
.syncchip--waiting { background: rgba(255, 255, 255, .20) !important; }

/* Under the top bar, empty almost always. Only for the two states a rep has to
   act on: work stuck long enough to mean a real failure, and a build too old to
   sync safely. Both used to be a small chip changing colour, which is visible
   without being readable. Each takes a coloured left edge, the same device the
   calendar day sheet uses — one language for "this strip has a severity". */
.banner:empty { display: none; }
.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px var(--s-3);
  font-size: 13px;
  line-height: 1.35;
  border-left: var(--edge) solid transparent;
}
.banner strong { display: block; font-weight: var(--w-figure); }
.banner .small { opacity: .85; }

.banner--warn {
  background: var(--warn-wash);
  border-left-color: var(--status-lead);
  color: var(--warn-ink);
}
.banner--warn strong { color: var(--warn-ink-strong); }
.banner--warn .btn { background: var(--surface); }
.banner--stop {
  background: var(--danger-wash);
  border-left-color: var(--danger);
  color: var(--stop-ink);
}
.banner--stop .btn { background: var(--surface); }

/* The "Update ready" strip (app/js/updates.js). Quiet on purpose: an update is
   never urgent, so it borrows no warning colour and sits under the banner,
   never over it. */
.updatebar:empty { display: none; }
.updatebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px var(--s-3);
  font-size: 13px;
  color: var(--ink-2);
  background: var(--surface-sunk);
  border-bottom: 1px solid var(--line-soft);
}
.updatebar .btn { background: var(--surface); }

/* The moved banner (app/js/ui/moved.js): the update strip's shape, in the
   app's navy so it reads as more than a passing notice. */
.movedbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px var(--s-3);
  font-size: 13px;
  font-weight: var(--w-label);
  color: var(--surface);
  background: var(--brand);
}
.movedbar .btn { background: var(--surface); color: var(--ink); }
.movedsteps { margin: 0 0 var(--s-3); padding-left: 1.2em; display: grid; gap: 4px; }

.btn--sm {
  min-height: 36px;
  border-radius: var(--r-sm);
  padding: 0 var(--s-3);
  font-size: 13px;
  flex: 0 0 auto;
}

/* The one state worth interrupting for: something has been stuck long enough
   that it is a failure rather than a dead zone. The only solid fill in the bar. */
.syncchip--stale {
  background: var(--danger) !important;
  color: #fff;
  opacity: 1;
}

.spinner--sm { width: 13px; height: 13px; border-width: 2px; }

.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ── Quick-view sheet ─────────────────────────────────────────────────────
   The four things a rep changes about a job without opening it. Rows rather
   than cards: the sheet is already a container, and a card inside a card reads
   as two boxes arguing. */
.jsheet__mark--lead      { background: var(--status-lead); }
.jsheet__mark--quoted    { background: var(--status-quoted); }

.jsheet__tel { font-weight: var(--w-label); color: var(--accent); text-decoration: none; }

/* No named --card / --r-card token exists in this stylesheet (see :root
   above). --surface-sunk and --r-md are the tokens this file already uses for
   exactly this situation — a filled row receding against the surface it sits
   in, the same pair `.card .card` and `.sheet .card` use. No border either:
   this file's hierarchy comes from fills, not lines (see the header comment),
   and a 1px border here would have been the only one in the whole stylesheet.
   Separation comes from the --surface-sunk fill alone, the same as `.card
   .card` — and it reads the same in both places this row is used, because
   both parents (.card and .sheet) share the same --surface white. */
.jsheet__dep {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  width: 100%; margin-top: 12px; padding: 10px 12px; text-align: left;
  border: 0; border-radius: var(--r-md); background: var(--surface-sunk);
}
.jsheet__depLabel { font-size: 13px; font-weight: var(--w-label); }
/* The toggle is drawn rather than an <input>: it has to sit inside a button
   that is itself the tap target, and a nested control would take the tap. */
.jsheet__tog {
  width: 42px; height: 24px; border-radius: var(--r-pill); background: var(--track);
  position: relative; flex: none; transition: background .15s;
}
.jsheet__tog::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; transition: transform .15s;
  box-shadow: 0 1px 2px rgba(15, 32, 56, .3);
}
.jsheet__tog--on { background: var(--status-completed); }
.jsheet__tog--on::after { transform: translateX(18px); }

/* The deposit amount, revealed under the toggle above when the deposit is on.
   Same sunk well as .jsheet__dep so the two read as one control; the input is
   borderless (the well is the frame) and 16px to stop iOS Safari zooming on
   focus, matching the note textarea's reasoning. */
.jsheet__depAmt {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px; padding: 10px 12px;
  border-radius: var(--r-md); background: var(--surface-sunk);
}
.jsheet__depAmt label { font-size: 13px; font-weight: var(--w-label); flex: none; }
.jsheet__depAmt .jsheet__depSign { color: var(--muted); }
.jsheet__depAmt input {
  flex: 1; min-width: 0; border: 0; background: none;
  font-size: 16px; font-variant-numeric: tabular-nums;
  text-align: right; color: var(--ink);
}
.jsheet__depAmt input:focus { outline: none; }

/* Everything but spacing already comes from the generic `textarea` rule near
   the top of this file (borderless well, var(--bg), 16px to keep iOS Safari
   from zooming the field on focus, resize: vertical) — this only adds the
   gap below the deposit row above it. */

/* ── The job's money block (ui/payments.js) ───────────────────────────────
   Figures line up in tabular numerals so a column of money reads as a column.
   The sheet's inputs are 16px, for the reason .jsheet__depAmt gives: anything less
   makes iOS Safari zoom on focus. */
.pay__line {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 4px 0; font-size: 14px;
}
.pay__amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pay__line--total {
  margin-top: 4px; padding-top: 8px; border-top: var(--b-hair) solid var(--line-soft);
  font-size: 16px; font-weight: var(--w-label);
}
.pay__line--good { color: var(--status-completed); }
.pay__line--warn { color: var(--warn-ink-strong); }
.pay__warn {
  margin: 8px 0; padding: 8px 10px; border-radius: var(--r-md);
  background: var(--warn-wash); color: var(--warn-ink); font-size: 13px;
}
.pay__list { margin-top: 10px; }
.pay__row {
  display: block; width: 100%; padding: 10px 0; text-align: left;
  background: none; border: 0; border-top: var(--b-hair) solid var(--line-soft);
  color: inherit; font: inherit;
}
.pay__rowTop { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.pay__label {
  display: block; margin: 12px 0 4px;
  font-size: 13px; font-weight: var(--w-label); color: var(--muted);
}
.pay__input {
  display: block; width: 100%; min-height: 52px; padding: 0 12px;
  border: 0; border-radius: var(--r-md); background: var(--bg);
  color: var(--ink); font-size: 16px;
}
.pay__check {
  display: flex; align-items: center; gap: 10px;
  min-height: 52px; font-size: 15px;
}
.pay__check input { width: 22px; height: 22px; }
.sheet .pay__warn + .pay__label { margin-top: 4px; }
.pay__save { margin-top: 14px; }
/* Five methods do not fit a phone's row, and "E-transfer" must not break in two. */
.pay__methods { flex-wrap: wrap; }
.pay__methods .chip { flex: 0 0 auto; white-space: nowrap; }

/* ── The Insights tab (ui/insights.js) ─────────────────────────────────────
   Three labelled groups rather than seven loose cards. Colour on a comparison means
   good or bad, not up or down, and the arrow beside it says which way it went. The
   one chart's bars are the app's accent against a recessive rule colour. */
.ins__periods { flex-wrap: nowrap; gap: 3px; margin-bottom: 4px; }
.ins__periods .chip { flex: 1 1 auto; min-width: 0; padding-left: 5px; padding-right: 5px; font-size: 12.5px; white-space: nowrap; }
/* These rows carry the figures an owner opened the list for, so they wrap rather
   than cutting off with an ellipsis. */
.ins__row .row__sub { white-space: normal; overflow: visible; text-overflow: clip; }
.ins__sect {
  margin: 16px 2px 6px;
  font-size: 13px; font-weight: var(--w-label); color: var(--muted);
}
.ins__fig { position: relative; cursor: pointer; margin-bottom: 8px; }
.ins__chev { position: absolute; right: 12px; top: 12px; }
.ins__label { padding-right: 14px; font-size: 13px; color: var(--muted); }
.ins__value {
  margin-top: 2px; font-size: 22px; font-weight: var(--w-label);
  font-variant-numeric: tabular-nums;
}
.ins__value--big { font-size: 28px; }
.ins__cmp { margin-top: 3px; font-size: 13px; color: var(--muted); }
.ins__cmp--good { color: var(--ok-ink); }
.ins__cmp--bad { color: var(--danger-ink); }
.ins__tag {
  display: inline-block; margin-top: 6px; padding: 2px 9px; border-radius: var(--r-pill);
  background: var(--track); color: var(--muted);
  font-size: 12px; font-weight: var(--w-label);
}
.ins__alerts .card { margin-bottom: 8px; }
.ins__foot { margin: 8px 2px 0; font-size: 12px; color: var(--muted); }
.ins__caveat {
  margin-top: 6px; padding: 6px 8px; border-radius: var(--r-md);
  background: var(--warn-wash); color: var(--warn-ink);
  font-size: 13px; font-weight: var(--w-label);
}
.ins__pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
/* A little less side padding, so "Accounts Receivable" stays on one line on an ordinary
   phone and the two values in a pair line up. */
.ins__pair .ins__fig { padding-left: 12px; padding-right: 12px; }
.ins__pair .ins__label { padding-right: 12px; }
.ins__pair .ins__chev { right: 9px; }
.ins__chart { margin-top: 12px; }
.ins__bars { display: flex; align-items: flex-end; gap: 6px; height: 72px; }
.ins__barCol { flex: 1; height: 100%; display: flex; align-items: flex-end; border-radius: 4px 4px 0 0; cursor: pointer; }
.ins__bar { width: 100%; background: var(--rule-empty); border-radius: 4px 4px 0 0; }
.ins__barCol--on .ins__bar { background: var(--accent); }
/* A month with no bar still shows it is the one selected, with a line that cannot be
   read as an amount. A wash behind the column looked like a tall bar over $0. */
.ins__barCol--on:empty::after { content: ''; width: 100%; height: 3px; border-radius: 2px; background: var(--accent); }
.ins__axis { display: flex; gap: 6px; margin-top: 4px; }
.ins__axis span { flex: 1; text-align: center; font-size: 12px; color: var(--muted); }
.ins__axis .ins__axisOn { color: var(--accent); font-weight: var(--w-label); opacity: 1; }
.ins__axis .ins__axisNone { opacity: .45; }
.ins__chartRead { min-height: 18px; margin-top: 2px; font-size: 13px; color: var(--muted); text-align: center; }
.ins__amt { flex: none; margin-left: 12px; font-variant-numeric: tabular-nums; font-weight: var(--w-label); }
.ins__total {
  display: flex; justify-content: space-between; margin: 10px 2px;
  font-size: 15px; font-weight: var(--w-label);
}
.ins__period { margin: 0 2px 8px; }
.ins__link { margin-bottom: 8px; }

/* ── The pipeline ─────────────────────────────────────────────────────────
   A queue. Everything on a card is something a rep decides on; addresses and
   window counts live on the summary, because they are not.

   No new surface or radius tokens: a card here is the same kind of thing
   `.card` already is (top-level, on the page ground, no border — see the
   header comment), so it takes --surface / --r-lg / --sh-card directly. The
   left status strip reuses --strip and the same --status-* colours the Home
   row already carries, rather than a second
   colour naming the same four stages. */
.pipe__chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 2px 0 10px; }

.pipe__cards { display: flex; flex-direction: column; gap: 10px; }

.pipe__card {
  position: relative; overflow: hidden; cursor: pointer;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-card);
  padding: var(--s-3) var(--s-3) var(--s-3) var(--pad);
}
/* The status strip, the same signal the old list carried on its rows —
   .row::before at var(--strip) wide, clipped to the rounded corner by this
   card's own overflow: hidden. */
.pipe__card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--strip); }
.pipe__card--lead::before      { background: var(--status-lead); }
.pipe__card--quoted::before    { background: var(--status-quoted); }
.pipe__card--scheduled::before { background: var(--status-scheduled); }
.pipe__card--completed::before { background: var(--status-completed); }
.pipe__card--lost::before      { background: var(--status-lost); }

.pipe__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
/* min-width: 0 so a long address wraps inside this column instead of pushing
   the job number and rep off the right edge — a flex item's default
   min-width: auto refuses to shrink below its content. */
.pipe__who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pipe__name { font-size: 15px; font-weight: var(--w-label); }
/* Job number and the owning rep stack on the right, right-aligned, both in
   the same small/muted voice the job number already had on its own — the rep
   is ownership, not a second headline, so it takes no more weight than the
   number it sits under. Only rendered when there is one (see ui/pipeline.js),
   so a job with no rep is a single line here, not an empty second one. */
.pipe__topmeta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
/* The job number — or "Lead" until one is claimed — is the card's second
   identifier, so it carries label weight rather than sitting at the same
   muted whisper as the rep beneath it. Still --ink-2 rather than full ink:
   it identifies the job, it is not competing with the customer's name. */
.pipe__jobno { font-size: 13px; font-weight: var(--w-label); color: var(--ink-2); }

.pipe__pill { margin-top: 9px; padding: 7px 13px; border-radius: var(--r-pill); font-size: 12.5px; line-height: 1.35; font-weight: var(--w-label); }
/* The three-step aging scale: --ok-* is new (see :root), --warn-* and
   --danger-* are the same wash/ink pairs Insights' alert rows (.row--warn,
   .row--danger) already use for "worth a look" and "actually late". */
.pipe__pill--green   { background: var(--ok-wash); color: var(--ok-ink); }
.pipe__pill--yellow  { background: var(--warn-wash); color: var(--warn-ink); }
.pipe__pill--red     { background: var(--danger-wash); color: var(--danger-ink); }
/* Neutral is not an aging colour. A booked install and a finished job are not
   waiting on anybody, and a colour on them would say they were. --track is
   already this file's token for a tinted ground inside a white surface (.seg,
   .chips--status use it the same way) and --ink-2 is its paired "body on a
   tinted fill" ink (see the :root comments) — no new tokens needed. */
.pipe__pill--neutral { background: var(--track); color: var(--ink-2); }

.pipe__note {
  margin-top: 9px; padding-top: 9px; border-top: var(--b-hair) dashed var(--line-soft);
  font-size: 12px; font-style: italic; color: var(--muted);
}
/* Pill and action on one row. The pill takes the slack and min-width: 0 lets
   it wrap inside its own bubble rather than pushing the button off the card;
   the button never shrinks, because a squeezed label is worse than a wrapped
   sentence. margin-top lives on the row now, so the pill's own is cleared. */
.pipe__pillrow { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.pipe__pillrow .pipe__pill { margin-top: 0; flex: 1; min-width: 0; }
.pipe__pillrow .btn { flex: none; }

.pipe__legend { display: flex; gap: 12px; padding: 12px 2px 0; font-size: 11.5px; color: var(--muted); }
.pipe__sw { display: inline-block; width: var(--s-2); height: var(--s-2); border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.pipe__sw--green  { background: var(--ok-wash); }
.pipe__sw--yellow { background: var(--warn-wash); }
.pipe__sw--red    { background: var(--danger-wash); }

/* Floating rather than the full-width sticky button the old list used: on a
   screen of cards, a bar across the bottom sits on top of the thing it is
   meant to be secondary to. Positioned the same way .tabbar itself and
   body.has-tabbar .sticky-actions already clear the bar — --safe-bottom +
   --tabbar-h — rather than a guessed pixel fallback; both tokens are real (see
   :root and the bottom-tab-bar block above). */
.pipe__fab {
  position: fixed; right: 16px; z-index: 15;
  bottom: calc(var(--safe-bottom) + var(--tabbar-h) + 16px);
  width: 54px; height: 54px; border-radius: 50%; border: 0;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(15, 32, 56, .35);
}

/* Tablet / desktop: keep it a phone-width column, centred. */
@media (min-width: 700px) {
  #app { max-width: 620px; margin: 0 auto; box-shadow: 0 0 0 1px var(--line); background: var(--bg); }
}

/* ---------- command bar anchor highlight (ui/anchors.js) ---------- */

/* Washes a translucent tint over the element a command just changed, then
   fades it back out on its own — the fade is timed inside the animation
   itself, not by ui/anchors.js's later classList.remove (that call is just
   cleanup, so a slow tab or a paused background render can never leave the
   tint stuck mid-fade). 'change' reuses --accent-wash, this app's existing
   "attention, not alarm" tint (already the press wash and ghost accent fill
   elsewhere); 'danger' reuses --danger-wash, the same tint Settings' ledger
   rows use for "actually late" — so the confirm treatment can never be
   mistaken for the ordinary after-the-fact one. Duration matches
   HIGHLIGHT_MS in ui/anchors.js. */
.anchor-wash-change,
.anchor-wash-danger {
  animation: anchor-wash 1.4s ease-out;
  border-radius: var(--r-sm);
}
.anchor-wash-change { --anchor-wash-tint: var(--accent-wash); }
.anchor-wash-danger { --anchor-wash-tint: var(--danger-wash); }
@keyframes anchor-wash {
  0%, 55% { background-color: var(--anchor-wash-tint); }
  100%    { background-color: transparent; }
}

/* The Job Summary: a compact header, then rows that open in place. */
.jobhead__top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.jobhead__menu { padding: 0 8px; font-size: 22px; line-height: 1; min-height: 28px; }
.jobhead__line { display: block; margin-top: 3px; }

.winhead {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2);
  margin: var(--s-4) 2px var(--s-2);
  font-size: 13px; color: var(--muted);
}
.winhead__count { font-weight: var(--w-label); color: var(--ink); }

.fold__head {
  display: flex; align-items: center; gap: var(--s-2);
  min-height: var(--tap);
  padding: 8px var(--pad);
  cursor: pointer;
}
.fold__head:active { background: var(--accent-wash); }
.fold__title { flex: none; max-width: 58%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--w-label); }
.fold__sum { flex: 1; min-width: 0; text-align: right; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fold__sum--warn { color: var(--warn-ink); font-weight: var(--w-label); }
.fold__menu { padding: 0 6px; font-size: 18px; line-height: 1; }
.fold__body[hidden] { display: none; }
.fold > .fold__head .chev { flex: none; width: 12px; text-align: center; }

.folds { margin-top: var(--s-3); }
.folds .fold + .fold { border-top: var(--b-hair) solid var(--line-soft); }
/* The card a row holds has no chrome of its own: the row is the card now. */
.fold__body > .card {
  margin: 0; padding: 0 var(--pad) var(--pad);
  background: transparent; box-shadow: none; border-radius: 0;
}

.grp.fold { margin-bottom: 8px; }
.grp.fold > .fold__head {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-card);
  padding-left: var(--s-3); padding-right: var(--s-3);
}
.grp.fold > .fold__body { padding-top: 4px; }

.jobmoney__top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.jobmoney__total { display: flex; flex-direction: column; min-width: 0; }
.jobmoney__total .jobmoney__k { flex: none; font-size: 12px; }
.jobmoney__row--net .jobmoney__v--off { font-size: 14px; }
/* The status card's chips end the card, so they keep no space beneath them. */
.jobhead + .card .chips--status { margin-bottom: 0; }
.jobmoney__top .jobmoney__row { flex: none; margin: 0; padding: 0; border: 0; }
.jobmoney__top .jobmoney__row .jobmoney__k { flex: none; }

/* The one job list: search in the navy bar, sort and count at the top of the list. */
.jobsearch {
  display: flex; align-items: center; gap: var(--s-2);
  margin-bottom: var(--s-2);
  padding: 0 10px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .14);
  color: rgba(255, 255, 255, .72);
}
.jobsearch:focus-within { background: var(--surface); color: var(--muted); }
input.jobsearch__input {
  flex: 1; min-width: 0; min-height: 36px;
  padding: 0; border: 0; border-radius: 0; box-shadow: none;
  background: transparent; color: #fff;
  font-size: 16px;
}
input.jobsearch__input::placeholder { color: rgba(255, 255, 255, .72); }
.jobsearch:focus-within input.jobsearch__input { color: var(--ink); outline: none; box-shadow: none; }
.jobsearch:focus-within input.jobsearch__input::placeholder { color: var(--muted); }
.pipe__listhead { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin: 0 2px var(--s-2); }
.pipe__voided { display: block; margin: var(--s-3) auto 0; font-size: 13px; }
.pipe__card--voided { opacity: .75; }
.pipe__card--voided::before { background: var(--rule-empty); }

/* Five statuses in one row, sized to their words so Lead and Lost give room to Completed. */
.jobhead + .card .chips--status .chip { flex: 1 1 auto; padding-left: 5px; padding-right: 5px; font-size: 11.5px; }
.chips--status .chip--on.chip--st-lost { background: var(--status-lost); color: #fff; }

/* The To Do list, which is what the Assistant tab opens on. */
.asst__todo[hidden] { display: none; }
.todo__sect { margin: var(--s-2) 2px 6px; font-size: 13px; font-weight: var(--w-label); color: var(--muted); }
.todo__groups { margin-top: 0; }
.todo__item {
  display: flex; align-items: center; gap: var(--s-2);
  min-height: var(--tap);
  padding: 8px var(--pad);
  border-top: var(--b-hair) solid var(--line-soft);
  cursor: pointer;
}
.card--flush > .todo__item:first-child { border-top: 0; }
.todo__item:active { background: var(--accent-wash); }
.fold__body > .todo__item { background: var(--surface-sunk); }
.todo__main { flex: 1; min-width: 0; }
.todo__name { font-weight: var(--w-label); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo__item .btn--sm { flex: none; }
a.btn.btn--sm { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.todo__menu { flex: none; padding: 0 4px; font-size: 18px; line-height: 1; }
.todo__empty { padding: var(--s-5) 0; }
.todo__done { font-weight: var(--w-label); color: var(--ink); }
@media (max-width: 340px) {
  .jobhead + .card .chips--status .chip { padding-left: 2px; padding-right: 2px; font-size: 11px; }
}
