/* BayLedger — the two typefaces are served from this app, so it still works
   with no internet at all. Nothing is fetched from anywhere. */

@font-face { font-family: Archivo; font-style: normal; font-weight: 500;
  src: url('fonts/archivo-latin-500-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: Archivo; font-style: normal; font-weight: 600;
  src: url('fonts/archivo-latin-600-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: Archivo; font-style: normal; font-weight: 700;
  src: url('fonts/archivo-latin-700-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: Archivo; font-style: normal; font-weight: 800;
  src: url('fonts/archivo-latin-800-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400;
  src: url('fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500;
  src: url('fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600;
  src: url('fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500;
  src: url('fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); font-display: swap; }

:root {
  /* Taken from the mockups. Ink first. */
  --ink: #13212C;
  --ink2: #33424D;
  --ink3: #55636E;
  --ink4: #7A8893;
  --faint: #9AA7B0;

  --floor: #EEF1F0;
  --card: #FFFFFF;
  --line: #8A959C;          /* control borders — 3.06:1 on white, the mockup's
                               #C9D1D6 reads at 1.55 and fails WCAG 1.4.11 */
  --line2: #E3E8EA;         /* card borders and rules */
  --rule: #EEF1F0;          /* the lightest divider, between table rows */
  --tablehead: #F7F9F9;

  /* Navy and yellow are the brand. */
  --navy: #17324A;
  --navy-dk: #13283B;       /* the top bar */
  --navy-lt: #24425F;       /* a selected sidebar row */
  --navy-input: #1F3D58;    /* the search box in the top bar */
  --navy-ink: #D5DEE6;      /* sidebar text */
  --navy-ink2: #8FA3B5;     /* sidebar secondary text */
  --yellow: #F5B700;

  --steel: #17324A;         /* kept: the old name is used all over the app */
  --steel-lt: #24425F;
  --steel-bg: #E3ECF8;
  --link: #1D5FBF;

  --amber: #5C4600;
  --amber-bg: #FFF4CC;
  --amber-line: #F0DC9A;
  --stop: #B42318;
  --stop-bg: #FDE7E4;
  --stop-line: #C77F72;     /* 3.13:1, so a danger button's edge is visible */
  --stop-ink: #5B2A24;
  --go: #22603B;
  --go-bg: #E3EFEA;
  --go-line: #8AB8A5;

  --display: Archivo, 'Arial Narrow', 'Segoe UI', system-ui, sans-serif;
  --body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, Menlo, monospace;

  --rail: 232px;
  --topbar: 58px;
  --r: 10px;                /* controls */
  --rc: 14px;               /* cards */
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--floor);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

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

/* ---------- shell ---------- */
/* ---------- shell: top bar, sidebar, page ---------- */

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

#topbar {
  height: var(--topbar); flex: 0 0 var(--topbar);
  background: var(--navy-dk); color: #fff;
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  position: sticky; top: 0; z-index: 40;
}
.tb-brand { display: flex; flex-direction: column; line-height: 1.1; text-decoration: none; color: inherit; }
.tb-brand b {
  font-family: var(--display); font-weight: 800; font-size: 19px;
  letter-spacing: .04em; color: #fff;
}
.tb-brand span { font-size: 11px; color: var(--navy-ink2); }

.tb-search {
  flex: 1 1 260px; max-width: 460px;
  display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 12px; border-radius: var(--r);
  background: var(--navy-input); color: #B9C7D3;
}
.tb-search input {
  flex: 1; min-width: 0; background: none; border: 0; outline: none;
  color: #fff; font: 400 14px var(--body);
}
.tb-search input::placeholder { color: #B9C7D3; }
.tb-search input::-webkit-search-cancel-button { filter: invert(1) opacity(.6); }

.tb-net {
  display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px;
  border-radius: 16px; background: var(--navy-input); font-size: 13px; color: #fff;
}
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 4px; background: #4ADE80; }
.dot.off { background: #FF8D80; }
/* Offline has to be noticeable without being read for — it is the answer to
   "is any of this saving?" */
.tb-net:has(.dot.off) { background: #5B2A24; color: #FFD9D5; font-weight: 600; }

.tb-me { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.tb-avatar {
  width: 34px; height: 34px; border-radius: 17px; flex-shrink: 0;
  background: var(--yellow); color: var(--ink); font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.tb-who { display: flex; flex-direction: column; line-height: 1.2; }
.tb-who span { color: var(--navy-ink2); font-size: 12px; }

#body { flex: 1; display: flex; min-height: 0; }

#rail {
  width: var(--rail); flex: 0 0 var(--rail);
  background: var(--navy); color: var(--navy-ink);
  display: flex; flex-direction: column; padding: 16px 12px;
  position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar));
}

#rail nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }

#rail nav button {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; height: 38px; padding: 0 10px;
  background: none; border: 0; border-radius: 8px;
  color: var(--navy-ink); text-align: left; cursor: pointer;
  font: 400 14px var(--body);
}
#rail nav button:hover { background: rgba(255,255,255,.07); color: #fff; }
#rail nav button[aria-current="true"] {
  background: var(--navy-lt); color: #fff; font-weight: 600;
}
#rail nav button .badge {
  font: 700 11px var(--body); letter-spacing: 0;
  background: var(--yellow); color: var(--ink);
  border-radius: 9px; padding: 1px 7px; min-width: 20px; text-align: center;
}
#rail nav button .badge.danger { background: #FF8D80; color: #3d0f0c; }

.rail-foot { display: flex; gap: 8px; padding-top: 12px; }
.rail-foot .btn {
  flex: 1; height: 36px; min-height: 36px; border-radius: 8px;
  background: var(--navy-lt); border: 0; color: #fff; font-size: 13px;
}
.rail-foot .btn:hover { background: #2d5075; }

#main { flex: 1; min-width: 0; padding: 24px 28px 60px; }

/* ---------- headings ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 16px;
}
h1 {
  font-family: var(--display); font-size: 30px; font-weight: 800;
  margin: 0; line-height: 1.1; letter-spacing: 0; text-transform: none;
}
.sub { color: var(--ink3); font-size: 13px; margin-top: 5px; }

h2 {
  font-family: var(--display); font-size: 16px; font-weight: 700;
  letter-spacing: 0; text-transform: none;
  margin: 0 0 10px; color: var(--ink);
}

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line2);
  border-radius: var(--rc); padding: 16px 18px; margin-bottom: 16px;
}
.card.tight { padding: 12px 14px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  cursor: pointer; font: 600 14px var(--body); color: var(--ink);
  text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--ink4); background: #F7F9F9; }
.btn.primary { background: var(--steel); border-color: var(--steel); color: #fff; }
.btn.primary:hover { background: var(--steel-lt); border-color: var(--steel-lt); }
.btn.go { background: var(--go); border-color: var(--go); color: #fff; }
.btn.go:hover { filter: brightness(1.15); }
.btn.warn { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber); }
/* The inspection verdicts use these three. They were never defined, so Monitor,
   Recommended and Urgent all rendered as the same plain white button — on the
   one screen where what you just tapped has to be unmistakable. */
.btn.steel { background: var(--steel); border-color: var(--steel); color: #fff; }
.btn.amber { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber); }
.btn.stop { background: var(--stop); border-color: var(--stop); color: #fff; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
/* Small buttons in a table cell used to sit on collapsed template whitespace,
   about 4px apart. Routine actions should not be a thumb's width from one that
   cannot be undone. */
td .btn.sm + .btn.sm { margin-left: 6px; }
/* A danger button was white — the same white as its neighbours, told apart only
   by a faint border. */
.btn.danger { background: var(--stop-bg); border-color: var(--stop-line); color: var(--stop); }
.btn.danger:hover { background: #f5ddda; }

/* Verdict buttons are pressed in a bay, on a tablet, with gloves on. Six
   single-character buttons 31px wide in one nowrap row is narrower than a
   gloved fingertip, so the words go in and the row wraps to a grid. */
.verdicts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.verdicts .vbtn { min-height: 54px; padding: 0 8px; font-size: 15px; font-weight: 600; }
.verdicts .vbtn.unset { color: var(--ink2); border-style: dashed; }
.verdicts .vbtn.aux { font-weight: 500; }
@media (max-width: 560px) { .verdicts { grid-template-columns: repeat(2, 1fr); } }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.linkish {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--link); text-decoration: none; font-weight: 600; font-size: inherit;
}
.linkish:hover { text-decoration: underline; }

/* ---------- forms ---------- */
label.f { display: block; margin-bottom: 12px; }
label.f > span {
  display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink3); margin-bottom: 5px; font-weight: 600;
}
input[type=text], input[type=number], input[type=date], input[type=time],
input[type=tel], input[type=email], input[type=search], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  font: 400 14px var(--body); color: var(--ink);
}
textarea { min-height: 74px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--steel-lt); outline-offset: 1px; border-color: var(--steel-lt);
}
input.mono, .mono { font-family: var(--mono); }
input.num { text-align: right; font-family: var(--mono); }
.hint { font-size: 12px; color: var(--ink3); margin-top: 4px; }
.hint.bad { color: var(--stop); }
.hint.ok { color: var(--go); }
/* Used where a choice is legitimate but is probably not what was meant — most of
   all "this vendor invoice is not going on a car". */
.hint.warn { color: var(--amber); background: var(--amber-bg); border: 1px solid var(--amber-line);
  border-radius: 6px; padding: 6px 8px; margin-top: 6px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
th {
  font: 600 11px var(--body);
  letter-spacing: .06em; text-transform: uppercase; color: var(--ink3);
  text-align: left; padding: 9px 8px; background: var(--tablehead);
  border-bottom: 1px solid var(--line2); white-space: nowrap;
}
td { padding: 11px 8px; border-top: 1px solid var(--rule); border-bottom: 0; vertical-align: middle; }
td.r, th.r { text-align: right; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #F7F9F9; }
.t-scroll { overflow-x: auto; }

/* ---------- pills ---------- */
.pill {
  display: inline-block; padding: 4px 9px; border-radius: 6px;
  font: 700 12px var(--body); letter-spacing: .04em; text-transform: none;
  border: 1px solid transparent;
}
.pill.grey  { background: var(--line2); border-color: transparent; color: var(--ink2); }
.pill.steel { background: #E3ECF8; border-color: transparent; color: var(--link); }
.pill.amber { background: var(--amber-bg); border-color: transparent; color: var(--amber); }
.pill.stop  { background: var(--stop-bg); border-color: transparent; color: var(--stop); }
.pill.go    { background: var(--go-bg); border-color: transparent; color: var(--go); }

/* ---------- SIGNATURE: estimate ceiling meter ---------- */
.meter-wrap {
  border: 1px solid var(--line); border-radius: var(--r);
  background: #fbfcfa; padding: 13px 15px 15px;
}
.meter-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; flex-wrap: wrap; margin-bottom: 11px;
}
.meter-head .lab {
  font-family: var(--display); font-size: 12px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink2);
}
.meter-head .verdict { font-family: var(--display); font-size: 15px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.verdict.ok { color: var(--go); }
.verdict.warn { color: var(--amber); }
.verdict.bad { color: var(--stop); }

.track {
  position: relative; height: 30px; background: #eceee9;
  border: 1px solid var(--line); border-radius: 2px; overflow: hidden;
}
.fill { position: absolute; inset: 0 auto 0 0; transition: width .18s ease; }
.fill.ok   { background: linear-gradient(180deg, #3d7c60, #1f5d45); }
.fill.warn { background: linear-gradient(180deg, #c99a2c, #9a6d09); }
.fill.bad  { background: linear-gradient(180deg, #bf4139, #9e2b25); }

/* the two notches are the whole point: authorized amount, and the legal ceiling */
.notch { position: absolute; top: -1px; bottom: -1px; width: 2px; }
.notch.est { background: var(--ink2); }
.notch.ceil { background: repeating-linear-gradient(180deg, var(--stop) 0 4px, transparent 4px 7px); width: 3px; }
/* These two figures used to float above the track, pinned to their notches.
   But while a job is under the ceiling the scale is fixed at ceiling/0.8, so
   the notches always land at 72.7% and 80% — permanently 7.3% apart, both
   centred on their notch and set to nowrap. On a laptop they touched; on a
   390px phone the gap between their centres is about 24px and each label is
   about 90px wide, so the second printed straight over the first and the only
   one left standing was the ceiling. That is precisely the number that must not
   be mistaken for what the customer agreed to.

   So they get a box each, side by side, and say what they mean in words. */
.ceil-pair { display: flex; gap: 10px; margin-top: 8px; }
.ceil-pair > div {
  flex: 1; min-width: 0; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--r); padding: 7px 9px;
}
.ceil-pair span {
  display: block; font-family: var(--display); font-size: 11px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink2);
}
.ceil-pair b { font-family: var(--mono); font-size: 17px; font-weight: 600; }
.ceil-pair .ceil { border-color: var(--stop-line); background: var(--stop-bg); }
.ceil-pair .ceil span, .ceil-pair .ceil b { color: var(--stop); }

.meter-nums {
  display: flex; gap: 20px; flex-wrap: wrap; margin-top: 11px;
  font-size: 12px; color: var(--ink2);
}
.meter-nums b { display: block; font-family: var(--mono); font-size: 16px; color: var(--ink); font-weight: 600; }
.meter-nums .bad b { color: var(--stop); }

.reauth-callout {
  margin-top: 11px; padding: 10px 12px;
  background: var(--stop-bg); border: 1px solid var(--stop-line); border-radius: var(--r);
  font-size: 13px; color: #6b1c18;
}
.reauth-callout.warn { background: var(--amber-bg); border-color: var(--amber-line); color: #5c410a; }
.reauth-callout b { display: block; font-family: var(--display); letter-spacing: .09em; text-transform: uppercase; margin-bottom: 3px; }

/* ---------- board ---------- */
.bays { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.bay {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  min-height: 110px; padding: 10px;
}
.bay > h3 {
  font-family: var(--display); font-size: 13px; letter-spacing: .12em;
  text-transform: uppercase; margin: 0 0 8px; color: var(--ink2);
  border-bottom: 1px solid var(--line2); padding-bottom: 6px;
}
.ro-chip {
  border: 1px solid var(--line); border-left: 4px solid var(--ink3);
  border-radius: var(--r); padding: 8px 10px; margin-bottom: 7px; cursor: pointer;
  background: #fbfcfa;
}
.ro-chip:hover { background: #f2f4f0; }
.ro-chip.ok { border-left-color: var(--go); }
.ro-chip.warn { border-left-color: var(--amber-line); }
.ro-chip.bad { border-left-color: var(--stop); }
.ro-chip .n { font-family: var(--mono); font-size: 12px; color: var(--ink3); }
.ro-chip .v { font-weight: 600; font-size: 14px; }
.ro-chip .c { font-size: 12px; color: var(--ink2); }

/* ---------- schedule ---------- */
.sched { display: grid; gap: 10px; }
.slot {
  display: grid; grid-template-columns: 88px 1fr; gap: 10px; align-items: start;
  border-top: 1px solid var(--line2); padding-top: 8px;
}
.slot .t { font-family: var(--mono); font-size: 13px; color: var(--ink2); padding-top: 9px; }
.appt {
  background: var(--steel-bg); border: 1px solid #b6cade; border-left: 4px solid var(--steel);
  border-radius: var(--r); padding: 8px 10px; margin-bottom: 6px; cursor: pointer;
}
.appt:hover { filter: brightness(.98); }
.appt.done { background: var(--go-bg); border-color: var(--go-line); border-left-color: var(--go); }
.appt.noshow { background: #f0f1ee; border-left-color: var(--ink3); opacity: .75; }

/* ---------- stat blocks ---------- */
.stat { background: var(--card); border: 1px solid var(--line2); border-radius: var(--rc); padding: 14px 16px; }
.stat .k { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink2); font-weight: 600; }
.stat .v { font-family: var(--mono); font-size: 26px; font-weight: 600; margin-top: 4px; line-height: 1.1; }
.stat .n { font-size: 12px; color: var(--ink3); margin-top: 2px; }
.stat.alert { background: var(--stop-bg); border-color: var(--stop-line); }
.stat.alert .v { color: var(--stop); }
.stat.caution { background: var(--amber-bg); border-color: var(--amber-line); }
.stat.caution .v { color: var(--amber); }

/* ---------- modal ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(20,23,26,.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 30px 16px; overflow-y: auto; z-index: 50;
}
.modal {
  background: var(--card); border-radius: var(--r); width: 100%; max-width: 620px;
  box-shadow: 0 14px 40px rgba(0,0,0,.3);
}
.modal.wide { max-width: 860px; }
.modal-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line2);
}
.modal-head h3 {
  margin: 0; font-family: var(--display); font-size: 18px;
  letter-spacing: .09em; text-transform: uppercase;
}
.modal-body { padding: 18px; }
.modal-foot {
  padding: 13px 18px; border-top: 1px solid var(--line2);
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
}
/* Delete used to be the leftmost of a tight right-aligned cluster, 8px from
   Cancel and — before the colour fix above — exactly the same white as it. At a
   counter with a customer waiting, that is a single mis-tap. Now it sits hard
   left with the whole footer between it and the safe pair. */
.modal-foot .btn.danger:first-child { margin-right: auto; }
.x { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--ink3); padding: 0 4px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: var(--r);
  font-size: 14px; z-index: 90; box-shadow: 0 6px 18px rgba(0,0,0,.3);
}
#toast.bad { background: var(--stop); }

.empty { text-align: center; padding: 34px 16px; color: var(--ink3); }
.empty p { margin: 0 0 12px; }

.row-flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--ink3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }

/* ---------- invoice (screen + print) ---------- */
#printarea { display: none; }

.doc { background: #fff; color: #000; padding: 30px; font-size: 13px; }
.doc h1 { font-size: 24px; letter-spacing: .05em; }
.doc .doc-head { display: flex; justify-content: space-between; gap: 24px; border-bottom: 2px solid #000; padding-bottom: 12px; margin-bottom: 14px; }
.doc .doc-meta { text-align: right; font-family: var(--mono); font-size: 12px; }
.doc table { margin-top: 8px; }
.doc th { border-bottom: 1px solid #000; }
.doc td { border-bottom: 1px solid #ddd; }
.doc .totals { margin-left: auto; width: 290px; margin-top: 12px; }
.doc .totals td { border: 0; padding: 3px 6px; font-family: var(--mono); }
.doc .totals tr.grand td { border-top: 2px solid #000; font-size: 16px; font-weight: 700; padding-top: 7px; }
.doc .legal { margin-top: 20px; padding-top: 10px; border-top: 1px solid #999; font-size: 10.5px; line-height: 1.5; }
.doc .sigline { margin-top: 22px; display: flex; gap: 30px; }
.doc .sigline div { flex: 1; border-top: 1px solid #000; padding-top: 4px; font-size: 10.5px; }

@media print {
  #shell, #toast, .modal-bg { display: none !important; }
  #printarea { display: block !important; }
  @page { margin: 12mm; }
  body { background: #fff; }

  /* Browsers drop background colours and images when printing unless told not
     to. A report of scan tool photos with the photos missing is useless. */
  #printarea img {
    max-width: 100%; page-break-inside: avoid; break-inside: avoid;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  #printarea h3 { page-break-after: avoid; break-after: avoid; }
  #printarea table { page-break-inside: auto; }
  #printarea tr { page-break-inside: avoid; break-inside: avoid; }
}

/* ---------- tablet / narrow ---------- */
@media (max-width: 900px) {
  /* The rail and the page sit inside #body, so turning #shell into a column
     stacked nothing: #body stayed a row, the full-width rail took the screen
     and the page was pushed off the right-hand edge. */
  #shell { flex-direction: column; }
  #body { flex-direction: column; }
  #rail {
    width: 100%; flex: none; height: auto; position: static;
  }
  /* The fade at each end is the only thing telling a thumb there is more menu
     off to the side. */
  #rail nav {
    /* The column direction set further up was never undone here, so on a
       tablet the menu has been stacking into a wall above every page instead
       of the single scrolling row the fade below is drawn for. */
    display: flex; flex-direction: row; flex-wrap: nowrap;
    overflow-x: auto; overflow-y: hidden; padding: 0;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    mask-image: linear-gradient(90deg, transparent 0, #000 14px,
      #000 calc(100% - 22px), transparent 100%);
  }
  #rail nav button { flex: none; width: auto; }
  #rail nav button {
    border-left: 0; border-bottom: 3px solid transparent;
    min-height: 50px; padding: 0 16px; white-space: nowrap;
  }
  #rail nav button[aria-current="true"] { border-left: 0; border-bottom-color: var(--amber-line); }
  .rail-foot { display: none; }
  #main { padding: 16px 14px 50px; }
  h1 { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- photos ---------- */
.photo-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.thumb {
  margin: 0; position: relative;
  border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; background: #f2f4f0; cursor: pointer;
}
.thumb img {
  display: block; width: 100%; height: 130px; object-fit: cover; background: #ddd;
}
.thumb figcaption {
  padding: 6px 8px; font-size: 12px; line-height: 1.35; color: var(--ink2);
}
.thumb figcaption span {
  display: block; font-size: 10.5px; color: var(--ink3); margin-top: 2px;
}
.thumb-x {
  position: absolute; top: 4px; right: 4px;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(20,23,26,.72); color: #fff;
  border: 0; font-size: 18px; line-height: 1; cursor: pointer;
}
.thumb-x:hover { background: var(--stop); }

.subhead {
  font-size: 12px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink2); margin: 0 0 6px; font-family: var(--display); font-weight: 700;
}

@media (max-width: 560px) {
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .thumb img { height: 105px; }
}

/* ---------- in-app notification banner ---------- */
.notif {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: 14px; z-index: 95;
  display: flex; align-items: center; gap: 10px;
  max-width: min(94vw, 520px);
  background: var(--ink); color: #fff;
  padding: 11px 12px 11px 16px; border-radius: 4px;
  box-shadow: 0 8px 26px rgba(0,0,0,.35);
  border-left: 4px solid var(--amber-line);
}
.notif-body { flex: 1; font-size: 14px; line-height: 1.35; }
.notif-go {
  background: var(--amber-line); color: #33240a; border: 0;
  border-radius: 3px; padding: 7px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.notif-x { background: none; border: 0; color: #aab3bb; font-size: 22px; cursor: pointer; padding: 0 4px; }

/* ---------- job card ---------- */
.doc.jobcard { font-size: 14px; }
.doc.jobcard th { background: #eee; }
.doc.jobcard td { padding: 7px 8px; }

/* ---------- urgent notification stays put ---------- */
.notif.urgent { border-left-color: var(--stop); background: #2a1513; }
.notif.urgent .notif-go { background: #e08a84; color: #3d0f0c; }
#nav .badge { margin-left: 4px; }

/* ---------- month calendar ---------- */
.cal-head {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  font-family: var(--display); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink2); text-align: center;
  padding-bottom: 6px; border-bottom: 1px solid var(--line2);
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 4px; }
.cal-cell {
  min-height: 96px; border: 1px solid var(--line2); border-radius: var(--r);
  padding: 4px; cursor: pointer; background: #fff; overflow: hidden;
}
.cal-cell:hover { background: #f5f7f4; border-color: var(--ink3); }
.cal-cell.empty { background: #f4f5f2; border-color: transparent; cursor: default; }
.cal-cell.today { border-color: var(--steel); border-width: 2px; }
.cal-num {
  font-family: var(--mono); font-size: 12px; color: var(--ink2);
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px;
}
.cal-count {
  background: var(--steel); color: #fff; border-radius: 9px;
  font-size: 10px; padding: 0 6px; min-width: 17px; text-align: center;
}
.cal-appt {
  font-size: 10.5px; line-height: 1.3; padding: 2px 4px; margin-bottom: 2px;
  border-radius: 2px; background: var(--steel-bg); border-left: 3px solid var(--steel);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-appt.done { background: var(--go-bg); border-left-color: var(--go); }
.cal-appt.noshow { background: #f0f1ee; border-left-color: var(--ink3); opacity: .7; }
.cal-appt.arrived { background: var(--amber-bg); border-left-color: var(--amber-line); }
.cal-more { font-size: 10px; color: var(--ink3); padding-left: 4px; }

@media (max-width: 700px) {
  .cal-cell { min-height: 62px; }
  .cal-appt { font-size: 9px; }
  .cal-head { font-size: 9px; }
}

/* ---------- overdue invoices ---------- */
/* Red down the left edge so a late invoice is obvious while scanning. */
.overdue-row { background: var(--stop-bg) !important; }
.overdue-row td:first-child { box-shadow: inset 3px 0 0 var(--stop); }
.overdue-row:hover { background: #f6dedb !important; }

/* ---------- work order: header, tabs, and the rest ---------- */

.wo-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.wo-back { font-size: 13px; font-weight: 600; color: var(--link); background: none; border: 0; padding: 0; cursor: pointer; }
.wo-titlerow { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.wo-titlerow h1 { font-size: 30px; }
.wo-titlerow h1 .num { font-family: var(--mono); font-weight: 500; }
.wo-sub { color: var(--ink3); font-size: 13px; margin-top: 4px; }
.wo-iconbtn {
  width: 32px; height: 32px; min-height: 32px; padding: 0;
  border-radius: 8px; border: 1px solid var(--line); background: #fff;
  color: var(--ink3); cursor: pointer; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}

/* the one strip of fields that stays put whichever tab you are on */
.wo-strip {
  background: var(--card); border: 1px solid var(--line2); border-radius: var(--rc);
  padding: 14px 18px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px; align-items: end; margin-bottom: 16px;
}
.wo-strip label.f { margin: 0; min-width: 0; }
.wo-ceil { grid-column: span 2; display: flex; flex-direction: column; gap: 6px; }
.wo-ceil-top { display: flex; justify-content: space-between; gap: 8px; }
.wo-ceil-lab { font-size: 11px; font-weight: 600; color: var(--ink3); letter-spacing: .06em; text-transform: uppercase; }
.wo-ceil-state { font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.wo-ceil-bar { height: 10px; border-radius: 5px; background: var(--floor); overflow: hidden; display: flex; }
.wo-ceil-bar span { background: var(--go); }
.wo-ceil-bar span.warn { background: #C99A2C; }
.wo-ceil-bar span.bad { background: var(--stop); }
.wo-ceil-note { font-size: 12px; color: var(--ink3); }
@media (max-width: 1100px) { .wo-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } .wo-ceil { grid-column: span 2; } }

/* tabs */
.wo-tabs {
  display: flex; align-items: flex-end; gap: 28px;
  border-bottom: 1px solid #D9DFE2; margin-bottom: 16px; flex-wrap: wrap;
}
.wo-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 0 12px; margin-bottom: -1px;
  border: 0; border-bottom: 3px solid transparent; background: transparent;
  cursor: pointer; font: 600 15px var(--body); color: var(--ink3); min-height: 0;
}
.wo-tab:hover { color: var(--ink); }
.wo-tab[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--yellow); }
.wo-tab .tb { font: 700 11px var(--body); padding: 2px 7px; border-radius: 9px; background: var(--floor); color: var(--ink3); }
.wo-tab .tb.amber { background: var(--amber-bg); color: var(--amber); }
.wo-tab .tb.stop { background: var(--stop-bg); color: var(--stop); }
.wo-tab.right { margin-left: auto; }

/* the two alerts, side by side under the tab content */
.wo-alerts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 16px; margin-top: 16px; }
.wo-alerts .card { margin: 0; }

/* parts and labour */
.lines-head { padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line2); }
.lines-head h2 { margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .t-scroll { margin: 0; }
.lines-foot { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; padding: 16px 18px; border-top: 1px solid var(--line2); align-items: start; }
@media (max-width: 900px) { .lines-foot { grid-template-columns: 1fr; } }
.tot { display: flex; flex-direction: column; font-size: 13px; }
.tot > div { display: flex; justify-content: space-between; padding: 7px 0; color: var(--ink2); }
.tot .qual { color: var(--ink4); font-size: 12px; }
.tot .sub { border-top: 1px solid var(--line2); font-weight: 700; color: var(--ink); margin-top: 0; }
.tot .grand { border-top: 2px solid var(--ink); margin-top: 4px; font-size: 16px; font-weight: 800; color: var(--ink); }
.tot .grand b { font-family: var(--mono); font-size: 17px; }
.tot .mono { font-family: var(--mono); }

/* the slim bar that links the invoice to the payment tab */
.paybar {
  background: var(--card); border: 1px solid var(--line2); border-radius: var(--rc);
  padding: 12px 18px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  cursor: pointer; width: 100%; text-align: left; color: var(--ink); min-height: 0;
}
.paybar .k { font-size: 11px; font-weight: 600; color: var(--ink3); letter-spacing: .06em; text-transform: uppercase; }
.paybar .go-link { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--link); }

/* More tab */
.more-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .more-grid { grid-template-columns: 1fr; } }
.more-list { background: var(--card); border: 1px solid var(--line2); border-radius: var(--rc); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.more-list button {
  height: 40px; padding: 0 12px; border: 0; border-radius: 8px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  cursor: pointer; text-align: left; font: 600 14px var(--body);
  background: transparent; color: var(--ink); min-height: 0; width: 100%;
}
.more-list button:hover { background: var(--floor); }
.more-list button[aria-current="true"] { background: #E3ECF8; color: var(--navy); }
.more-list button.danger-item { color: var(--stop); }
.more-list .n { font: 600 11px var(--body); padding: 1px 7px; border-radius: 9px; background: var(--floor); color: var(--ink3); }
.more-sep { height: 1px; background: var(--line2); margin: 6px 4px; }

/* the More actions menu in the header */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 268px;
  background: var(--card); border: 1px solid var(--line2); border-radius: var(--rc);
  box-shadow: 0 14px 40px rgba(19,33,44,.18); padding: 6px; display: flex; flex-direction: column;
}
.menu button {
  height: 42px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent;
  text-align: left; cursor: pointer; font: 500 14.5px var(--body); color: var(--ink);
  display: flex; align-items: center; min-height: 0; width: 100%;
}
.menu button:hover { background: var(--floor); }
.menu[hidden] { display: none; }

/* heading above a section inside the More pane */
.more-h { font: 600 13px var(--body); letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink2); margin: 0 0 8px; }
.card.flush { padding: 0; }
.card.flush > .lines-head, .card.flush > .lines-foot { padding: 16px 18px; }
.card.flush table { margin: 0; }

/* a sixth pill tone, so "in progress" and the part lines read apart from the
   amber estimate state */
.pill.work { background: #E8E2F6; border-color: transparent; color: #5B3BA8; }
/* the status beside the RO number is set in caps, as on the mockup */
.wo-titlerow .pill { text-transform: uppercase; letter-spacing: .06em; }

/* the totals block on the invoice tab: no line between the working rows,
   a hairline above the subtotal and a heavy one above the total */
table.tot { width: 392px; border-collapse: collapse; }
table.tot td { border: 0; padding: 7px 0; font-size: 14px; vertical-align: baseline; }
table.tot td.r { text-align: right; white-space: nowrap; }
table.tot .muted { font-size: 12.5px; color: var(--ink3); }
table.tot .linkish { font-size: 12.5px; margin-left: 8px; }
table.tot tr.rule td { border-top: 1px solid var(--line2); padding-top: 11px; }
table.tot tr.grand td { border-top: 2px solid var(--ink); padding-top: 12px; }
table.tot tr.grand b { font-family: var(--display); font-size: 20px; }
table.tot tr.grand td.r b { font-family: var(--mono); font-size: 21px; }

/* ---- the parts & labour table reads as a printed list until you touch it ---- */
.card.flush tbody td { padding: 6px 10px; border-bottom: 1px solid var(--rule); }
.card.flush tbody tr:last-child td { border-bottom: 0; }
.card.flush tbody input[type="text"],
.card.flush tbody input[type="number"] {
  border: 1px solid transparent; background: transparent; box-shadow: none;
  height: 34px; min-height: 34px; padding: 0 8px; border-radius: 7px;
  font: 400 14px var(--body); color: var(--ink); width: 100%;
}
.card.flush tbody input.num { font-family: var(--mono); text-align: right; }
.card.flush tbody input:hover { border-color: var(--line2); background: var(--card); }
.card.flush tbody input:focus {
  border-color: var(--navy); background: var(--card);
  box-shadow: 0 0 0 3px rgba(23,50,74,.12); outline: 0;
}
.card.flush tbody td[data-amt] { font-weight: 600; }

/* tax is a word you click, not a checkbox */
.taxtog {
  border: 0; background: transparent; cursor: pointer; min-height: 0;
  font: 500 13px var(--body); color: var(--ink3); padding: 4px 6px; border-radius: 6px;
}
.taxtog.on { color: var(--ink2); }
.taxtog:hover { background: var(--floor); color: var(--navy); }

/* the row's remove control */
.xdel {
  border: 0; background: transparent; cursor: pointer; min-height: 0;
  width: 26px; height: 26px; border-radius: 6px; padding: 0;
  font: 400 18px/1 var(--body); color: var(--faint);
}
.xdel:hover { background: var(--stop-bg); color: var(--stop); }

/* the two alerts at the foot of the page: text left, buttons right, one line */
.wo-alerts .row-flex { flex-wrap: nowrap; align-items: center; gap: 14px; }
.wo-alerts .row-flex > div:first-child { min-width: 0; }
.wo-alerts .btn { flex: none; }
.wo-alerts .small { font-size: 12.5px; }

/* no spinner arrows eating the right edge of the money columns */
.card.flush tbody input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.card.flush tbody input[type="number"]::-webkit-outer-spin-button,
.card.flush tbody input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* keep the shop-supplies line and its remove link on one row */
table.tot td:first-child { white-space: nowrap; }
table.tot .muted { font-size: 12px; }
table.tot .linkish { font-size: 12px; margin-left: 10px; }

/* the payment tab: the form on the left, what has been taken on the right */
.pay-grid { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1080px) { .pay-grid { grid-template-columns: 1fr; } }
.pay-grid .card { margin: 0; }
.pf-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* what is known about the car, under the vehicle picker */
.vehfacts {
  background: var(--steel-bg); border-radius: var(--r); padding: 12px 14px;
  font-size: 13px; color: var(--ink2); line-height: 1.7;
}
.vehfacts b { color: var(--ink3); font-weight: 600; margin-right: 4px; }
.vehfacts .linkish { font-size: 13px; }

/* three figures in one panel, divided by hairlines — the time box */
.tiles3 {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line2); border-radius: var(--rc); overflow: hidden;
}
.tiles3 > div { padding: 14px 18px; border-left: 1px solid var(--line2); }
.tiles3 > div:first-child { border-left: 0; }
.tiles3 .k { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--ink2); font-weight: 600; }
.tiles3 .v { font-family: var(--mono); font-size: 26px; font-weight: 600; margin-top: 4px; line-height: 1.1; }
.tiles3 .n { font-size: 12px; color: var(--ink3); margin-top: 2px; }

/* ---------- the left panel, grouped under umbrellas ---------- */
.nav-group { display: flex; flex-direction: column; }
#rail nav .nav-head {
  height: 30px; padding: 0 10px; margin-top: 10px;
  font: 600 11px var(--body); letter-spacing: .1em; text-transform: uppercase;
  color: var(--navy-ink2); justify-content: space-between;
}
#rail nav .nav-head:hover { background: rgba(255,255,255,.05); color: var(--navy-ink); }
.nav-head-right { display: flex; align-items: center; gap: 7px; }
#rail nav .nav-head .chev { font-size: 9px; opacity: .7; }
.nav-items { display: flex; flex-direction: column; gap: 2px; }
/* `display: flex` above beats the browser's own rule for [hidden], so a
   folded umbrella needs this or its entries stay on screen. */
.nav-items[hidden] { display: none; }
#rail nav .nav-items button { padding-left: 18px; }

/* On a phone the menu is one scrolling row, so the headings come out and the
   groups collapse into the strip rather than stacking it into a wall. */
@media (max-width: 900px) {
  #rail nav .nav-head { display: none; }
  .nav-group, .nav-items { display: contents; }
  .nav-items[hidden] { display: contents; }
  #rail nav .nav-items button { padding-left: 16px; }
}

/* ---------- putting the left panel away ---------- */
/* The hamburger in the top bar. */
#railToggle {
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  width: 36px; height: 36px; min-height: 36px; padding: 0 9px; margin-right: 2px;
  background: transparent; border: 0; border-radius: 8px; cursor: pointer; flex: none;
}
#railToggle span { display: block; height: 2px; background: var(--navy-ink); border-radius: 2px; }
#railToggle:hover { background: rgba(255,255,255,.09); }
#railToggle:hover span { background: #fff; }
#railToggle:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

#railEdge, #railPin { display: none; }

/* On a phone or tablet the menu is already a single scrolling row rather than
   a column, so there is nothing to put away — the button would do nothing. */
@media (max-width: 900px) { #railToggle { display: none; } }

/* On a phone the top bar has no room for a search field — it squeezes down to
   an empty sliver. Search has its own entry in the menu, so the box steps
   aside and the shop name and who is signed in keep their space. */
@media (max-width: 620px) { .tb-search { display: none; } }

@media (min-width: 901px) {
  /* With the menu put away the page uses the whole width, and the panel
     itself floats over the top when you reach for it rather than shoving
     the page sideways every time the pointer strays left. */
  #shell.rail-off #railEdge {
    display: block; position: fixed; left: 0; top: var(--topbar);
    width: 14px; height: calc(100vh - var(--topbar)); z-index: 39;
  }
  #shell.rail-off #rail {
    position: fixed; top: var(--topbar); left: calc(var(--rail) * -1);
    z-index: 40; transition: left .16s ease; box-shadow: 0 0 40px rgba(0,0,0,.35);
  }
  #shell.rail-off #railEdge:hover ~ #rail,
  #shell.rail-off #rail:hover,
  #shell.rail-off #rail:focus-within { left: 0; }

  #shell.rail-off #railPin {
    display: flex; align-items: center; gap: 6px; justify-content: center;
    width: 100%; height: 34px; min-height: 34px; margin-bottom: 10px;
    background: var(--navy-lt); border: 0; border-radius: 8px; cursor: pointer;
    color: #fff; font: 600 12.5px var(--body);
  }
  #shell.rail-off #railPin:hover { background: #2d5075; }
}

/* The heading of a folded umbrella lights up when the page you are on lives
   inside it, so putting one away never hides where you are. */
#rail nav .nav-head[aria-current="true"] {
  background: var(--navy-lt); color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  #shell.rail-off #rail { transition: none; }
}

/* Back in the top bar, named after the page it leads to. */
#topBack {
  display: flex; align-items: center; gap: 2px; flex: none;
  height: 32px; min-height: 32px; max-width: 220px; padding: 0 12px;
  border: 1px solid rgba(255,255,255,.18); border-radius: 8px;
  background: transparent; color: var(--navy-ink); cursor: pointer;
  font: 500 13px var(--body); white-space: nowrap; margin-right: 4px;
}
#topBack .lab { overflow: hidden; text-overflow: ellipsis; }
#topBack:hover { background: rgba(255,255,255,.09); color: #fff; border-color: rgba(255,255,255,.3); }
#topBack[hidden] { display: none; }
@media (max-width: 620px) { #topBack .lab { display: none; } #topBack { padding: 0 10px; } }

/* a plain two-column read-out of what a record held */
table.kv { width: 100%; border-collapse: collapse; }
table.kv th {
  text-align: left; vertical-align: top; width: 180px; padding: 7px 14px 7px 0;
  font: 600 12px var(--body); letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink2); border-bottom: 1px solid var(--line2); white-space: nowrap;
}
table.kv td { padding: 7px 0; border-bottom: 1px solid var(--line2); font-size: 14px; }
table.kv tr:last-child th, table.kv tr:last-child td { border-bottom: 0; }

/* the date window and sort, above the work order list */
.datebar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line2);
}
.datebar .f { margin: 0; min-width: 132px; }
.datebar .f > span { font-size: 10.5px; }
.datebar select, .datebar input { height: 36px; min-height: 36px; font-size: 13.5px; }
.datebar-quick { display: flex; gap: 7px; flex-wrap: wrap; padding-bottom: 1px; }
tr[aria-current="true"] td { background: var(--steel-bg); }

/* choosing which invoices a payment is for */
.pickbox {
  border: 1px solid var(--line2); border-radius: var(--rc);
  padding: 12px 14px; margin: 4px 0 12px; background: var(--card);
}
.pickrow {
  display: flex; align-items: center; gap: 10px; padding: 6px 0;
  border-bottom: 1px solid var(--rule); cursor: pointer; font-size: 13.5px; margin: 0;
}
.pickrow:last-of-type { border-bottom: 0; }
.pickrow input { width: 17px; height: 17px; min-height: 0; margin: 0; flex: none; }
.pickbox .linkish { font-size: 12.5px; margin-left: 10px; }

/* what a payment would do, invoice by invoice */
.paylines { border: 1px solid var(--line2); border-radius: var(--rc); overflow: hidden; }
.payline {
  display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,1.4fr) 110px 150px;
  gap: 10px; align-items: center; padding: 9px 14px;
  border-bottom: 1px solid var(--rule); font-size: 13.5px;
}
.payline:last-child { border-bottom: 0; }
.payline.head {
  background: var(--tablehead); font: 600 10.5px var(--body);
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink2);
}
.payline.done { background: var(--go-bg); }
.payline.rest { background: var(--floor); color: var(--ink3); }
.payline .r { text-align: right; }
.payline .pill { white-space: nowrap; }
@media (max-width: 700px) {
  .payline { grid-template-columns: 1fr auto; }
  .payline > :nth-child(2) { display: none; }
}

/* "a new version is ready" — only ever shown when someone is mid-edit */
#updBar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 90;
  display: flex; align-items: center; gap: 10px;
  background: var(--navy-dk); color: #fff; border-radius: 12px;
  padding: 10px 12px 10px 16px; box-shadow: 0 10px 34px rgba(0,0,0,.34);
  font: 500 14px var(--body); max-width: calc(100vw - 32px);
}
#updBar .btn { min-height: 32px; }
