/* Daytona Glass quote tool. Palette and Exo come from the daytonaglass.ca theme. */
:root {
  --ink: #1f2426;          /* charcoal: sidebar, headings */
  --ink-2: #30383b;
  --text: #2f3639;
  --muted: #5f6a6d;
  --faint: #8a9497;
  --line: #e3e6e7;
  --line-2: #d3d9db;
  --page: #f4f5f5;
  --paper: #ffffff;
  --green: #1e6b35;        /* actions that matter: save, paid, sent */
  --green-dark: #17552a;
  --green-soft: #e5efe8;
  --amber: #9a5600;        /* edited / unsaved */
  --amber-soft: #fbf1e1;
  --red: #b42318;
  --red-soft: #fbeae8;
  --focus: #1e6b35;
  --r: 4px;
  --r-lg: 6px;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --display: "Exo", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --sidebar: 232px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { background: var(--page); }
body { margin: 0; background: var(--page); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, .doctype, .stat-value, .biz-name { font-family: var(--display); color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 1.55rem; font-weight: 700; margin: 0; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 .75rem; }
h3 { font-size: .75rem; font-weight: 600; margin: 1.1rem 0 .4rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
a { color: var(--green); }
code { font: .85em var(--mono); background: var(--page); padding: .1em .35em; border-radius: 3px; word-break: break-all; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); letter-spacing: .01em; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.good { color: var(--green); font-weight: 600; }
.bad { color: var(--red); font-weight: 600; }
.empty { padding: 1.25rem 0; margin: 0; }
.eyebrow { margin: 0 0 .15rem; font-size: .8rem; color: var(--muted); }

.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* ---------- sidebar ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--ink); color: #c9d0d2; display: flex; flex-direction: column; z-index: 30; }
.brand { display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1rem 1.25rem; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-mark { position: relative; width: 36px; height: 36px; overflow: hidden; flex: none; }
.brand-mark img { position: absolute; width: 200%; height: 200%; left: -50%; top: -50%; max-width: none; }
.brand-text { display: grid; line-height: 1.2; }
.brand-text b { font-family: var(--display); font-weight: 700; font-size: 1.02rem; letter-spacing: .01em; }
.brand-text small { color: #98a3a6; font-size: .76rem; }
.sidebar nav { display: grid; gap: 2px; padding: .75rem .6rem; }
.sidebar nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: var(--r); color: #c9d0d2; text-decoration: none; font-weight: 500; font-size: .93rem; border-left: 3px solid transparent; }
.sidebar nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar nav a.active { background: rgba(255,255,255,.08); color: #fff; border-left-color: #6fbf87; }
.sidebar nav a .i { opacity: .85; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #56606360; margin-left: auto; }
.dot.on { background: #6fbf87; }

main { margin-left: var(--sidebar); padding: 1.5rem 2rem 5rem; container: main / inline-size; }
/* On wide screens, content is centred and capped instead of hugging the left. */
.tab > :not(.editor-bar) { max-width: 1480px; margin-inline: auto; }
#settings-root { max-width: 1100px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.page-head p { margin: 0; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- controls ---------- */
label { display: block; font-size: .8rem; font-weight: 500; color: var(--muted); margin-bottom: .65rem; min-width: 0; }
label.bare { margin: 0; }
label.check { display: flex; align-items: center; gap: .5rem; color: var(--text); font-size: .92rem; font-weight: 400; }
input, select, textarea { display: block; width: 100%; margin-top: .25rem; padding: .5rem .6rem; font: inherit; font-size: .93rem; color: var(--text); background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r); transition: border-color .12s, box-shadow .12s; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: #b9c2c5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(30,107,53,.15); }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--green); }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.row.three { grid-template-columns: .8fr 1.1fr 1.1fr; }

.btn, button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font: inherit; font-size: .9rem; font-weight: 600; padding: .5rem .9rem; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--paper); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover, button:hover { border-color: #aab4b7; background: #fafbfb; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--page); color: var(--ink); }
.btn.icon-only { padding: .35rem; }
.btn.small-btn { padding: .35rem .65rem; font-size: .85rem; }
.btn:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button.linkish { background: none; border: 0; padding: 0; color: var(--green); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
button:disabled { opacity: .55; cursor: wait; }

/* ---------- panels (lists, settings) ---------- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.1rem 1.25rem; margin: 0 0 1rem; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .5rem 1rem; } /* the actions drop below the title when there's no room */
details summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.table-wrap { overflow-x: auto; }

/* ledger tables: printed-style rows */
table { width: 100%; border-collapse: collapse; }
.ledger th { text-align: left; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: .5rem .5rem; border-bottom: 1.5px solid var(--ink); }
.ledger td { padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.ledger tbody tr:last-child td { border-bottom: 0; }
.n { text-align: right; }
.ledger th.n { text-align: right; } /* number columns: the heading sits over the numbers */
.docs td, .docs-mini td { vertical-align: middle; }
.docs a.open, .docs-mini a.open { font-weight: 500; text-decoration: none; }
.docs a.open:hover, .docs-mini a.open:hover { text-decoration: underline; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; }
.filters input, .filters select { margin: 0; width: auto; }
.filters input { min-width: 260px; }
.page-head .filters { flex: 1 1 32rem; justify-content: flex-end; }
.page-head .filters input { flex: 1 1 18rem; min-width: min(100%, 18rem); max-width: 26rem; } /* room for the whole placeholder */

.status, .status-select { font-size: .75rem; font-weight: 600; text-transform: capitalize; border-radius: 3px; padding: .15rem .45rem; background: var(--page); color: var(--muted); border: 1px solid var(--line); }
.status-select { width: auto; margin: 0; padding: .2rem .4rem; cursor: pointer; }
.s-sent { background: #eef3f8; color: #2b5476; border-color: #d6e2ec; }
.s-accepted, .s-paid { background: var(--green-soft); color: var(--green); border-color: #cfe1d5; }
.s-declined, .s-void { background: var(--red-soft); color: var(--red); border-color: #f2d3cf; }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 .3rem; border: 1px solid var(--line-2); border-radius: 3px; }

/* ---------- home ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 1.25rem; }
.stat { background: var(--paper); padding: 1rem 1.2rem; }
.stat-label { font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 1.65rem; font-weight: 600; margin: .2rem 0 .1rem; font-family: var(--display); }
.stat.attention .stat-value { color: var(--amber); }
a.stat { display: block; color: inherit; text-decoration: none; transition: background .12s; }
a.stat:hover { background: #fafbfb; }
a.stat:hover .stat-label { color: var(--green); }
a.stat:focus-visible { outline-offset: -3px; }

/* ---------- editor ---------- */
.editor-bar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin: -1.5rem -2rem 1.25rem; padding: .8rem max(2rem, calc((100% - 1334px) / 2 + 2rem)); /* lines up with the 370 + 24 + 940px editor */ background: rgba(244,245,245,.94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.bar-title { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; margin-right: auto; }
.bar-title h1 { font-size: 1.3rem; }
.dirty { color: var(--amber); font-weight: 600; }
.dirty::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); margin-right: .35rem; vertical-align: 1px; }
.bar-actions { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.more-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.sync-status { flex-basis: 100%; color: var(--muted); }
.sync-status:empty { display: none; }
.mobile-only { display: none !important; }

/* Stacked by default; side by side once main has room (see container queries below). */
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; align-items: start; }

/* left rail: the job controls */
.rail { container: rail / inline-size; min-width: 0; }
.rail-section { padding: 0 0 1.1rem; margin-bottom: 1.1rem; border-bottom: 1px solid var(--line-2); }
.rail-section:last-child { border-bottom: 0; }
.rail-section h2 { display: flex; align-items: center; gap: .5rem; font-size: .98rem; }
.rail-section h2 .i { color: var(--muted); }
.rail-note { margin: 0 0 1rem; padding: .75rem .9rem; background: var(--paper); border: 1px dashed var(--line-2); border-radius: var(--r); color: var(--muted); font-size: .88rem; }
.vin-row { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: end; }
.vin-row .btn { margin-bottom: .65rem; }
#v-vin { font-size: 1rem; letter-spacing: .08em; text-transform: uppercase; }
#vin-note { min-height: 1.25em; margin: -.35rem 0 .45rem; }
.account-row { padding-bottom: .5rem; margin-bottom: .6rem; }
.account-row label { margin-bottom: .35rem; }
#account-diff { color: var(--muted); }
#account-diff .badge { display: inline-block; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--green); margin-right: .25rem; }
.service-row { position: relative; padding: .65rem 2.6rem .2rem .7rem; margin-bottom: .6rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); }
.service-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 .5rem; align-items: end; }
.service-fields .f-service { grid-column: 1 / -1; }
.service-fields .s-remove { position: absolute; top: .4rem; right: .35rem; }
@container rail (min-width: 620px) {
  .service-fields { grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); }
  .service-fields .f-service { grid-column: auto; }
}
.s-suggest { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin: -.2rem 0 .55rem; }
.s-suggest:empty { display: none; }
.s-suggest > span { flex-basis: 100%; }
.chip { max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: left; font-weight: 400; font-size: .8rem; padding: .2rem .5rem; border-radius: 3px; background: var(--green-soft); color: var(--ink); border: 1px solid #cfe1d5; font-family: var(--mono); }
.chip:hover { border-color: var(--green); background: #dbe9df; }
.checks { display: grid; gap: .15rem; }
.extras { align-items: end; margin-top: .6rem; }

/* the document */
.paper { background: var(--paper); border: 1px solid var(--line); border-radius: 2px; box-shadow: 0 1px 2px rgba(31,36,38,.06), 0 12px 32px rgba(31,36,38,.07); padding: 2.25rem 2.5rem 2rem; min-width: 0; container: paper / inline-size; }
.paper-head { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; padding-bottom: 1.25rem; border-bottom: 2px solid var(--ink); }
.paper-from { display: flex; gap: .9rem; align-items: flex-start; font-size: .86rem; color: var(--muted); }
.paper-logo { width: 54px; height: 54px; object-fit: cover; transform: scale(1.9); filter: brightness(.18); margin: 0 1.6rem 0 1.5rem; flex: none; } /* margins cover the 1.9x overflow */
.biz-name { font-size: 1.15rem; font-weight: 700; margin-bottom: .1rem; }
.paper-doc { text-align: right; }
.doctype { font-size: 1.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; line-height: 1.1; }
#paper-number { font-weight: 500; margin-top: .2rem; }
.paper-parties { display: grid; grid-template-columns: 1.3fr 1fr; gap: 2rem; padding: 1.25rem 0 1rem; }
.paper-parties h3 { margin-top: 0; }
.vehicle-block { font-size: .93rem; }

/* inputs on the paper look like printed text until you touch them */
.inline-input { text-overflow: ellipsis; margin: 0; padding: .2rem .35rem; border-color: transparent; background: transparent; border-radius: 3px; }
.inline-input:hover { border-color: var(--line-2); background: #fbfcfc; }
.inline-input:focus { background: var(--paper); }
.bill-to .inline-input { margin-left: -.35rem; width: calc(100% + .35rem); font-size: .93rem; }
.customer-search { position: relative; }
.customer-search .search-i { position: absolute; left: -1.5rem; top: .55rem; color: var(--faint); width: 16px; height: 16px; }
.name-input { resize: none; overflow: hidden; field-sizing: content; line-height: 1.35; font-family: var(--display); font-size: 1.1rem !important; font-weight: 600; color: var(--ink); }
#c-hint { min-height: 1.1em; margin: 0 0 .1rem; font-size: .78rem; }
#c-results { position: absolute; z-index: 15; left: -.35rem; right: 0; top: 100%; margin: .2rem 0 0; padding: .25rem; list-style: none; background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: 0 10px 28px rgba(31,36,38,.16); max-height: 280px; overflow-y: auto; }
#c-results li { padding: .45rem .6rem; border-radius: 3px; cursor: pointer; display: grid; grid-template-columns: auto 1fr; gap: 0 .5rem; align-items: center; }
#c-results li .r-sub { grid-column: 1 / -1; }
#c-results li .badge { justify-self: start; font-size: .7rem; font-weight: 600; color: var(--green); background: var(--green-soft); padding: 0 .35rem; border-radius: 3px; }
#c-results li:hover, #c-results li.active { background: var(--page); }
.stamp { display: inline-block; margin-top: .5rem; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--green); border: 1.5px solid var(--green); padding: .1rem .45rem; border-radius: 2px; cursor: help; }

.lines { margin-top: .25rem; table-layout: fixed; }
.lines th:nth-child(1) { width: 3.75rem; }
.lines th:nth-child(3) { width: 7.5rem; }
.lines th:nth-child(4) { width: 4rem; }
.lines .l-desc { width: 100%; resize: none; overflow: hidden; field-sizing: content; min-height: 0; line-height: 1.45; }
.lines .l-qty { width: 100%; text-align: left; }
.lines .l-amount { width: 100%; text-align: right; }
.lines td:not(:nth-child(2)) { padding-left: .2rem; padding-right: .2rem; }
.lines tr.edited td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.lines tr.edited .l-amount, .lines tr.edited .l-qty { color: var(--amber); font-weight: 500; }
.lines .empty { color: var(--muted); padding: 1.5rem .5rem; text-align: center; }
.l-meta { margin: .1rem 0 0 .35rem; color: var(--faint); font-size: .76rem; }
.l-meta .tag { border: 0; padding: 0; font-size: .72rem; }
.l-meta .tag.rule { color: var(--faint); }
.l-meta .tag.edited { color: var(--amber); }
.row-actions { white-space: nowrap; text-align: right; width: 1%; }
.row-actions .btn { opacity: .45; }
tr:hover .row-actions .btn, .row-actions .btn:focus-visible { opacity: 1; }
.lines-foot { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; padding: .4rem 0; border-top: 1px solid var(--line); }

.paper-totals { display: grid; grid-template-columns: 1fr auto; gap: .3rem 0; width: min(320px, 100%); margin: 1rem 0 1.5rem auto; }
.paper-totals dt { color: var(--muted); font-size: .9rem; }
.paper-totals dd { margin: 0; padding-left: 2rem; text-align: right; } /* padding, not a gap, so the line above the total runs unbroken */
.paper-totals .grand { font-family: var(--display); font-weight: 700; color: var(--ink); font-size: 1.15rem; padding-top: .45rem; border-top: 2px solid var(--ink); }
.paper-totals dd.grand { font-family: var(--mono); }
.paper-notes { color: var(--muted); }
.paper-notes span { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.paper-notes textarea { border-style: dashed; resize: vertical; }
.paper-terms { margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }

/* ---------- settings ---------- */
.settings-table { margin-bottom: .5rem; }
.settings-table th { text-align: left; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: .4rem .4rem; border-bottom: 1.5px solid var(--ink); }
.settings-table td { padding: .4rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.settings-table input[type=number] { max-width: 9rem; font-family: var(--mono); }
.settings-table td:first-child { min-width: 290px; }
.services-table th:first-child { width: 55%; } /* long service names ("Re:Re install … (glass supplied)") fit; the number boxes stay narrow */
.services-table th:nth-child(3), .services-table th:nth-child(4) { width: 8rem; }
.settings-table .applies { display: flex; flex-wrap: wrap; gap: .1rem .9rem; }
.settings-table .applies label { margin: 0; }
.account-card { border: 1px solid var(--line); border-radius: 8px; margin-bottom: .5rem; background: var(--paper); }
.account-head { display: flex; gap: .75rem; align-items: end; }
.account-head label { flex: 1; }
.account-head .btn { margin-bottom: .65rem; }
.grid-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 .75rem; margin-top: .6rem; }
.save-bar { position: sticky; bottom: 1rem; display: none; gap: .6rem; align-items: center; justify-content: flex-end; flex-wrap: wrap; padding: .7rem 1rem; background: var(--ink); color: #fff; border-radius: var(--r-lg); box-shadow: 0 10px 28px rgba(31,36,38,.25); }
.save-bar.show { display: flex; }
.save-bar .btn.ghost { color: #c9d0d2; }
.save-bar .btn.ghost:hover { background: rgba(255,255,255,.08); color: #fff; }
.save-msg { margin-right: auto; font-weight: 600; color: #f3c27a; }
.save-msg.bad { color: #ffb4a9; }

#toast { position: fixed; left: calc(50% + var(--sidebar) / 2); bottom: 1.5rem; transform: translate(-50%, 200%); background: var(--ink); color: #fff; padding: .65rem 1rem; border-radius: var(--r); max-width: min(560px, calc(100vw - 32px)); transition: transform .2s; z-index: 40; font-size: .92rem; box-shadow: 0 8px 24px rgba(31,36,38,.25); }
#toast.show { transform: translate(-50%, 0); }
#toast.error { background: var(--red); }

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

/* Editor: side by side once main is wide enough, centred and capped on widescreens. */
@container main (min-width: 880px) {
  .editor-layout { grid-template-columns: 330px minmax(0, 1fr); }
  .rail { position: sticky; top: 4.75rem; max-height: calc(100vh - 5.5rem); overflow-y: auto; padding-right: .25rem; }
}
@container main (min-width: 1300px) {
  .editor-layout { grid-template-columns: 370px minmax(0, 940px); justify-content: center; }
}
@container main (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .paper { padding: 1.75rem 1.75rem 1.5rem; }
}
@container main (max-width: 600px) {
  .paper { padding: 1.25rem 1rem; }
  .row, .row.three { grid-template-columns: 1fr; }
  .filters, .filters input, .filters select { width: 100%; min-width: 0; }
  .account-head { flex-direction: column; align-items: stretch; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }

  /* lists become cards */
  .docs, .docs tbody { display: block; }
  .docs thead { display: none; }
  /* Phone cards: number | total; customer · vehicle across the card; date · QuickBooks | status, print */
  /* Each line sizes on its own (flex lines, not grid columns), so a long status can't squeeze the number. */
  .docs tr { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
  .ledger.docs .doc-num { order: 1; flex: 1 1 auto; }
  .ledger.docs td.n { order: 2; margin-left: auto; }
  .ledger.docs .doc-who { order: 3; flex: 1 0 100%; }
  .ledger.docs .doc-date { order: 4; flex: 1 1 auto; }
  .ledger.docs .doc-status { order: 5; }
  .ledger.docs .doc-print { order: 6; }
  .ledger.docs .doc-status .due-note { max-width: 7.5rem; margin-left: auto; line-height: 1.25; } /* wraps rather than widening the column */
  .docs td, .ledger.docs tbody td { display: block; border: 0; padding: 0; } /* the card's cells sit close together */
  .ledger.docs .doc-num { white-space: normal; min-width: 0; } /* the CUSTOM tag drops below the number rather than into the total */
  .ledger.docs .doc-who { min-width: 0; overflow-wrap: anywhere; }
  .docs td:nth-child(1) { grid-area: num; }
  .docs td:nth-child(2) { grid-area: date; color: var(--muted); }
  .docs td:nth-child(3) { grid-area: cust; }
  .docs td:nth-child(4) { grid-area: total; font-weight: 600; }
  .docs td:nth-child(5) { grid-area: status; justify-self: end; text-align: right; }
  .ledger.docs td:nth-child(6) { display: none; } /* shown after the date instead */
  .ledger.docs .card-only { display: inline; }
  .ledger.docs .doc-who .doc-customer, .ledger.docs .doc-who .doc-vehicle { display: inline; }
  .ledger.docs .doc-who .doc-vehicle::before { content: " · "; }
  .ledger.docs .doc-status .status-select { min-height: 34px; padding: .15rem .5rem; font-size: .8rem; }
  .ledger.docs .doc-status .due-note { margin-top: .1rem; }
  .ledger.docs .doc-print a { min-width: 34px; min-height: 34px; justify-content: center; }
  .docs td:nth-child(7) { grid-area: print; justify-self: end; }
  .docs-mini td:nth-child(3) { display: none; }

  /* settings tables stack, each cell labelled */
  .settings-table, .settings-table tbody { display: block; }
  .settings-table thead { display: none; }
  .settings-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
  .settings-table td { border: 0; padding: 0; min-width: 0 !important; }
  .settings-table td:first-child { flex-basis: calc(100% - 3rem); }
  .settings-table td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; font-weight: 600; color: var(--muted); }
  .settings-table td:last-child { margin-left: auto; }
  .settings-table .applies { flex-basis: 100%; }
}

/* The document arranges itself by its own width. */
@container paper (max-width: 640px) {
  .paper-parties { grid-template-columns: 1fr; gap: 1rem; }
  .customer-search .search-i { display: none; }
}
@container paper (max-width: 520px) {
  .paper-head { flex-direction: column; gap: .75rem; }
  .paper-doc { text-align: left; }
  /* each line stacks: description on top, qty × price = amount underneath */
  .lines, .lines tbody { display: block; }
  .lines thead { display: none; }
  .lines tr { display: grid; grid-template-columns: 4rem minmax(0, 1fr) auto; grid-template-areas: "desc desc act" "qty amt amt"; gap: .2rem .5rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--line); }
  .lines td { display: block; border: 0; padding: 0 !important; }
  .lines td:nth-child(1) { grid-area: qty; }
  .lines td:nth-child(2) { grid-area: desc; }
  .lines td:nth-child(3) { grid-area: amt; }
  .lines td:nth-child(4) { grid-area: act; align-self: start; }
  .lines td.empty { grid-column: 1 / -1; }
  .lines tr.edited td:first-child { box-shadow: none; }
  .lines tr.edited { box-shadow: inset 3px 0 0 var(--amber); padding-left: .5rem; }
  .lines .l-amount { display: block; margin-left: auto; max-width: 9rem; font-weight: 600; }
  .row-actions .btn { opacity: .7; }
}

/* Tablets and small laptops: icon-only sidebar to give the work more room. */
@media (min-width: 861px) and (max-width: 1279px) {
  :root { --sidebar: 68px; }
  .brand { justify-content: center; padding: 1rem 0; }
  .brand-text { display: none; }
  .sidebar nav { padding: .6rem .5rem; }
  .sidebar nav a { position: relative; justify-content: center; padding: .7rem 0; border-left: 0; }
  .sidebar nav a.active { box-shadow: inset 3px 0 0 #6fbf87; }
  .sidebar nav a span:not(.dot) { display: none; }
  .sidebar nav a .dot { position: absolute; top: .55rem; right: .7rem; margin: 0; }
  .sidebar nav a .i { width: 20px; height: 20px; }
}

/* Phones and small tablets: top bar, and the editor's actions move to a bottom bar. */
@media (max-width: 860px) {
  :root { --sidebar: 0px; }
  .sidebar { position: sticky; inset: 0 auto auto; /* stays at the top while the page scrolls */ width: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .brand { border: 0; padding: .5rem .75rem; }
  .brand-text small { display: none; }
  .sidebar nav { display: flex; padding: .35rem; gap: 0; margin-left: auto; }
  .sidebar nav a { position: relative; border-left: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: .7rem .7rem; }
  .sidebar nav a.active { border-bottom-color: #6fbf87; background: transparent; }
  .sidebar nav a span:not(.dot) { display: none; }
  .sidebar nav a .dot { position: absolute; top: .5rem; right: .4rem; margin: 0; }
  .brand-text b { white-space: nowrap; }
  main { padding: 1rem 1rem 6.5rem; }
  .editor-bar { position: fixed; top: auto; bottom: 0; left: 0; right: 0; margin: 0; padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom)); background: var(--paper); box-shadow: 0 -6px 20px rgba(31,36,38,.12); border-top: 1px solid var(--line); border-bottom: 0; }
  .editor-bar:not(.open) .collapsible, .editor-bar:not(.open) .bar-title { display: none !important; }
  .editor-bar.open .more-actions { flex-basis: 100%; order: 3; }
  .editor-bar.open .more-actions .btn { flex: 1 1 45%; }
  .mobile-only { display: inline-flex !important; }
  .bar-total { margin-right: auto; align-items: baseline; gap: .4rem; }
  .bar-total strong { font-size: 1.15rem; color: var(--ink); }
  #toast { left: 50%; bottom: 5.5rem; }
}

/* Touch screens: comfortable tap targets. */
@media (pointer: coarse), (max-width: 860px) {
  .btn, button:not(.linkish), select, input:not([type=checkbox]) { min-height: 42px; }
  .inline-input, .lines .l-desc { min-height: 38px; }
  .btn.icon-only { min-width: 42px; }
  .chip { min-height: 36px; padding: .3rem .7rem; }
  input[type=checkbox] { width: 20px; height: 20px; }
  label.check { min-height: 36px; }
  .row-actions .btn { opacity: .8; }
  .status-select { min-height: 36px; }
}

/* Small phones: logo mark only, so all six sections fit across the top. */
@media (max-width: 520px) {
  .brand { padding: .5rem .25rem .5rem .6rem; }
  .brand-text { display: none; }
  .sidebar nav a { padding: .7rem .55rem; }
}

/* ---------- email dialog, payments, backups ---------- */
dialog { border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 1.4rem 1.5rem 1.2rem; width: min(460px, calc(100vw - 32px)); color: var(--text); box-shadow: 0 24px 60px rgba(31,36,38,.3); }
dialog::backdrop { background: rgba(31,36,38,.45); }
dialog h2 { margin-bottom: .4rem; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; /* the buttons go onto two lines on a narrow phone */ gap: .5rem; margin-top: .4rem; }
.warn { color: var(--amber); font-weight: 600; }
.s-partial { background: var(--amber-soft); color: var(--amber); border-color: #f0dcbc; }
#backup-panel { max-width: 1100px; }
.backups .panel-head h2 { display: flex; align-items: center; gap: .5rem; margin: 0; }
.backup-list td { vertical-align: middle; }
.backup-list a { text-decoration: none; font-weight: 500; }
.docs .i { width: 15px; height: 15px; color: var(--muted); }
#numbering-panel { max-width: 1100px; }
.numbering-row { grid-template-columns: 1fr 1fr auto; align-items: end; }
.numbering-row .btn { margin-bottom: .65rem; }
@container main (max-width: 600px) { .numbering-row { grid-template-columns: 1fr; } }
#sync-status .btn { margin-left: .5rem; }

/* ---------- toast: completely out of the way until it has something to say ---------- */
#toast { opacity: 0; visibility: hidden; transition: transform .2s, opacity .2s, visibility .2s; }
#toast.show { opacity: 1; visibility: visible; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.editor-bar { -webkit-backdrop-filter: blur(6px); }
.docs a.open, .docs-mini a.open { white-space: nowrap; }
.phone-head, .see-paper { display: none; }

/* ---------- phones (matches the daytonaglass.ca mobile patterns) ---------- */
@media (max-width: 860px) {
  /* Safari on iPhone zooms the page into any field with text under 16px. */
  input, select, textarea, .inline-input, .bill-to .inline-input { font-size: 16px !important; }
  .name-input { font-size: 1.15rem !important; }

  .sidebar { height: 52px; padding-top: env(safe-area-inset-top); box-sizing: content-box; }
  .sidebar nav a { padding: .6rem .6rem; }

  /* which document, plus the Job details / Quote switch */
  .phone-head { display: block; position: sticky; top: calc(52px + env(safe-area-inset-top)); z-index: 15; margin: -1rem -1rem 1rem; padding: .7rem 1rem .75rem; background: rgba(244,245,245,.97); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
  .phone-title-row { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; margin-bottom: .55rem; }
  .phone-title-row h1 { font-size: 1.2rem; }
  .segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; background: #e4e8e9; border-radius: 12px; }
  .segmented button { min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; gap: .4rem; }
  .segmented button[aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(31,36,38,.15); }
  .segmented .num { font-size: .85rem; color: var(--green); }
  .editor-layout[data-view="paper"] .rail, .editor-layout[data-view="job"] .paper { display: none; }
  .see-paper { display: flex; width: 100%; min-height: 50px; margin: .25rem 0 1rem; border-radius: 12px; font-size: 1rem; }

  /* short vehicle fields stay side by side */
  .rail .row.three { grid-template-columns: .75fr 1fr 1fr; }
  .rail .row { grid-template-columns: 1fr 1fr; }
  label { margin-bottom: .55rem; }

  /* the document runs edge to edge, like a sheet */
  .paper { margin: 0 -1rem; border-left: 0; border-right: 0; border-radius: 0; box-shadow: none; padding: 1.25rem 1rem 1.5rem; }

  /* bottom bar in the website's style: charcoal, big rounded buttons, clear of the home indicator */
  .editor-bar { background: rgba(31,36,38,.97); color: #fff; border-top: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px rgba(0,0,0,.25); gap: 10px; }
  .bar-total .muted { color: #b8c0c2; }
  .bar-total strong { color: #fff; }
  .editor-bar #save { min-height: 48px; padding: 0 1.15rem; border-radius: 12px; background: #fff; border-color: #fff; color: var(--ink); }
  .editor-bar #sum-toggle { min-height: 48px; min-width: 48px; border: 2px solid rgba(255,255,255,.75); border-radius: 12px; color: #fff; }
  .editor-bar.open .bar-actions { flex-basis: 100%; }
  .editor-bar.open #save { flex: 1; }
  .editor-bar.open .more-actions { order: 3; flex-basis: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .editor-bar .more-actions .btn { min-height: 48px; border-radius: 12px; background: transparent; border: 2px solid rgba(255,255,255,.55); color: #fff; }
  .editor-bar .more-actions .btn.ghost { border-color: transparent; color: #c9d0d2; }
  .editor-bar .sync-status { color: #c9d0d2; }
  .editor-bar .good { color: #8fd3a5; }
  .editor-bar .bad, .editor-bar .warn { color: #ffcf99; }
  .editor-bar #sync-status .btn { background: #fff; color: var(--ink); }

  /* home: recent work as compact cards */
  .docs-mini, .docs-mini tbody { display: block; }
  .docs-mini tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "num total" "cust status"; gap: .15rem .75rem; padding: .65rem 0; border-bottom: 1px solid var(--line); }
  .docs-mini td { display: block; border: 0; padding: 0; }
  .docs-mini td:nth-child(1) { grid-area: num; }
  .docs-mini td:nth-child(2) { grid-area: cust; font-weight: 600; }
  .docs-mini td:nth-child(3) { display: none; }
  .docs-mini td:nth-child(4) { grid-area: status; justify-self: end; }
  .docs-mini td:nth-child(5) { grid-area: total; font-weight: 600; }
  .stat { padding: .85rem 1rem; }
  .stat-value { font-size: 1.4rem; }
}
@media (max-width: 359px) {
  .rail .row.three, .rail .row { grid-template-columns: 1fr; }
}

/* lines on a narrow document read as "1 × $360.00" */
@container paper (max-width: 520px) {
  .lines td:nth-child(3) { display: flex; align-items: center; gap: .3rem; }
  .lines td:nth-child(3)::before { content: "× $"; color: var(--muted); font-family: var(--mono); white-space: nowrap; }
  .lines .l-qty { text-align: center; }
}
#v-vin::placeholder { text-transform: none; letter-spacing: normal; font-family: var(--font); }
@media (max-width: 860px) { .editor-bar .bar-title { display: none !important; } }
@media (pointer: coarse), (max-width: 860px) { .lines th:nth-child(5) { width: 6rem; } .row-actions { width: 4.75rem; } .row-actions .btn + .btn { margin-left: 2px; } }

/* ---------- log out, restore ---------- */
.logout { margin: auto .6rem 1rem; display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border: 0; border-radius: var(--r); background: transparent; color: #98a3a6; font-weight: 500; font-size: .9rem; justify-content: flex-start; }
.logout:hover { background: rgba(255,255,255,.05); color: #fff; border: 0; }
.restore-btn { margin: 0; color: var(--ink); font-size: .9rem; cursor: pointer; }
@media (min-width: 861px) and (max-width: 1279px) {
  .logout { justify-content: center; margin: auto .5rem 1rem; padding: .7rem 0; }
  .logout span { display: none; }
}
@media (max-width: 860px) {
  .logout { margin: 0 .25rem 0 0; padding: .6rem; min-height: 42px; }
  .logout span { display: none; }
}

/* ---------- customer's printout: each price / total only ---------- */
.customer-sees { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; margin: .25rem 0 .75rem; padding: .5rem .65rem; background: var(--page); border-radius: var(--r); }
.seg-small { display: inline-flex; padding: 2px; gap: 2px; background: #e4e8e9; border-radius: 6px; }
.seg-small label { margin: 0; display: inline-flex; align-items: center; padding: .3rem .7rem; border-radius: 4px; font-size: .85rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg-small input { position: absolute; opacity: 0; pointer-events: none; }
.seg-small label:has(input:checked) { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(31,36,38,.15); }
.seg-small label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
@media (pointer: coarse), (max-width: 860px) { .seg-small label { min-height: 38px; padding: .3rem .9rem; } }
.email-warning { margin: 0 0 .75rem; padding: .6rem .7rem; background: var(--amber-soft); color: #6d3f00; border-radius: var(--r); }

/* ---------- supplier glass picker (Vanfax) ---------- */
.s-glass-pick:empty { display: none; }
.gp-card { margin: .1rem 0 .6rem; border: 1px solid var(--line); border-radius: var(--r); background: #fbfcfc; }
.gp-head { padding: .45rem .6rem; border-bottom: 1px solid var(--line); color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.gp-head b { color: var(--ink); }
.gp-style { width: auto; display: inline-block; margin: 0; padding: .15rem .35rem; font-size: .82rem; }
.gp-part { padding: .5rem .6rem; border-bottom: 1px solid var(--line); display: grid; gap: .3rem; }
.gp-part:last-child { border-bottom: 0; }
.gp-part.chosen { background: var(--green-soft); box-shadow: inset 3px 0 0 var(--green); }
.gp-desc { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; font-size: .85rem; }
.gp-desc .mono { font-weight: 500; margin-right: .2rem; }
.gp-tag { font-size: .72rem; padding: .05rem .4rem; border-radius: 3px; background: var(--page); border: 1px solid var(--line); color: var(--text); }
.gp-offer { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; }
.gp-offer .gp-use { margin-left: auto; }
.gp-choose { display: block; padding: .5rem .6rem; margin: 0; }
.gp-loading, .gp-error { padding: .4rem 0 .6rem; }
.gp-error { color: var(--red); }

/* ---------- scheduling ---------- */
.loc-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; vertical-align: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
.paper-schedule { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; width: 100%; margin: .9rem 0 0; padding: .55rem .7rem; text-align: left; font: inherit; font-size: .88rem; font-weight: 400; color: var(--text); background: var(--page); border: 1px dashed var(--line-2); border-radius: var(--r); cursor: pointer; }
.paper-schedule:hover { border-color: var(--green); background: var(--green-soft); }
.loc-pick { border: 0; padding: 0; margin: 0 0 .65rem; }
.loc-pick legend { color: var(--muted); font-weight: 500; padding: 0; margin-bottom: .3rem; }
#sch-locations { display: flex; flex-wrap: wrap; gap: .4rem; }
.loc-option { display: inline-flex; align-items: center; gap: .4rem; margin: 0; padding: .45rem .7rem; border: 1px solid var(--line-2); border-radius: var(--r); color: var(--text); font-size: .9rem; cursor: pointer; }
.loc-option input { width: auto; margin: 0; accent-color: var(--green); }
.loc-option:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.dialog-actions .spacer { flex: 1; }
.btn.danger { color: var(--red); }
#schedule-dialog { width: min(560px, calc(100vw - 32px)); }
.job-row { display: flex; align-items: center; gap: .7rem; padding: .6rem 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.job-row:last-child { border-bottom: 0; }
.job-row:hover .job-main b { color: var(--green); }
.job-main { flex: 1; min-width: 0; }
.location-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1.4fr) auto; gap: .5rem .75rem; align-items: end; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.location-row label { margin-bottom: .2rem; }
.location-row .check { margin-bottom: .55rem; }
.loc-color input[type=color] { width: 44px; height: 38px; padding: 2px; cursor: pointer; }
#zoho-panel { max-width: 1100px; }
#zoho-panel h2 { display: flex; align-items: center; gap: .5rem; }
@container main (max-width: 600px) {
  .location-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .location-row > :nth-child(3), .location-row > :nth-child(4) { grid-column: 1 / -1; }
}

/* =====================================================================
   Polish pass: clearer sections, readable fields, obvious focus.
   Patterns from professional admin tools (Shopify admin, Stripe dashboard,
   estimate builders): content in white cards on a grey page, dark labels,
   firm field borders, a visible focus ring, and the active card highlighted.
   ===================================================================== */
:root {
  --field-border: #b9c3c6;
  --label: #3a4447;
  --card-shadow: 0 1px 2px rgba(31,36,38,.06), 0 1px 1px rgba(31,36,38,.04);
  --ring: 0 0 0 3px rgba(30,107,53,.18);
}

/* fields */
label { color: var(--label); font-weight: 600; font-size: .78rem; letter-spacing: .01em; }
label.check { font-weight: 500; }
input, select, textarea { border-color: var(--field-border); background-color: #fff; }
input::placeholder, textarea::placeholder { color: #98a2a5; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: var(--ring); background-color: #fff; }
select { appearance: none; -webkit-appearance: none; padding-right: 2rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235f6a6d' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .65rem center; }
.inline-input:focus { box-shadow: var(--ring); border-color: var(--green); }

/* job panel: every section is a card; the one you're working in lights up */
.rail { overflow-x: hidden; }
.rail-section { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--card-shadow); padding: .9rem 1rem .4rem; margin-bottom: .9rem; transition: border-color .15s, box-shadow .15s; }
.rail-section:last-of-type { border-bottom: 1px solid var(--line); }
.rail-section:focus-within { border-color: #9cc5a8; box-shadow: var(--card-shadow), 0 0 0 3px rgba(30,107,53,.08); }
.rail-section h2 { margin: -.15rem 0 .8rem; padding-bottom: .6rem; border-bottom: 1px solid var(--line); font-size: .95rem; }
.rail-section h2 .i { width: 28px; height: 28px; padding: 5px; border-radius: 7px; background: var(--green-soft); color: var(--green); }
.rail-section:focus-within h2 { color: var(--green); }
.rail-note { background: var(--paper); border-style: solid; box-shadow: var(--card-shadow); border-radius: 10px; }
#vin-note .good { font-weight: 600; }

/* service rows: a tinted block with an accent while you're filling it in */
.service-row { background: #f6f8f8; border: 1px solid var(--line); border-radius: 8px; transition: border-color .15s, background .15s; }
.service-row:focus-within { background: #fff; border-color: #9cc5a8; box-shadow: inset 3px 0 0 var(--green); }

/* add-ons as tick-able tiles */
.checks { gap: .4rem; }
.checks label.check { margin: 0; padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 7px; background: #fff; cursor: pointer; transition: background .12s, border-color .12s; }
.checks label.check:hover { border-color: var(--field-border); }
.checks label.check:has(input:checked) { background: var(--green-soft); border-color: #9cc5a8; }
.checks label.check .muted { margin-left: auto; font-family: var(--mono); font-size: .85rem; }
#mobile-wrap { padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 7px; }
#mobile-wrap:has(input:checked) { background: var(--green-soft); border-color: #9cc5a8; }
.see-paper { box-shadow: var(--card-shadow); }

/* remembered parts */
.s-suggest > span { font-weight: 600; color: var(--label); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; }
.chip { background: #fff; border: 1px solid var(--field-border); color: var(--ink); }
.chip:hover { background: var(--green-soft); border-color: var(--green); }

/* ---------- supplier results (Vanfax): a distinct card with clear prices and stock ---------- */
.gp-card { margin: .25rem 0 .7rem; border: 1px solid #c7d0d3; border-radius: 9px; background: #fff; overflow: hidden; box-shadow: var(--card-shadow); }
.gp-head { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .55rem; padding: .55rem .7rem; background: var(--ink); color: #dfe5e6; border: 0; font-size: .82rem; }
.gp-badge { font-family: var(--display); font-weight: 700; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); background: #e8f3ec; padding: .12rem .45rem; border-radius: 4px; }
.gp-vehicle { font-weight: 600; color: #fff; }
.gp-head .gp-style { margin: 0 0 0 auto; width: auto; max-width: 100%; min-height: 0; padding: .2rem 1.8rem .2rem .5rem; font-size: .78rem; color: var(--ink); border-color: transparent; border-radius: 5px; }
.gp-part { position: relative; display: grid; gap: .4rem; padding: .65rem .75rem; border-bottom: 1px solid var(--line); transition: background .12s; }
.gp-part:hover { background: #fafbfb; }
.gp-part.chosen { background: var(--green-soft); box-shadow: inset 4px 0 0 var(--green); }
.gp-part.unpriced { opacity: .7; }
.gp-desc { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.gp-nags { font-family: var(--mono); font-weight: 600; font-size: .85rem; color: var(--ink); margin-right: .25rem; }
.gp-tag { font-size: .72rem; font-weight: 500; padding: .1rem .45rem; border-radius: 999px; background: #eef2f3; border: 1px solid #dde3e5; color: #364043; }
.gp-offer { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: .3rem .6rem; }
.gp-price { font-size: 1.15rem; font-weight: 600; color: var(--ink); }
.gp-stock { font-size: .72rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; white-space: nowrap; }
.gp-stock.in { background: #dcefe2; color: #14532d; }
.gp-stock.out { background: var(--amber-soft); color: #7a4300; }
.gp-pn { font-size: .76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-use { min-width: 5.5rem; border-color: var(--green); color: var(--green); font-weight: 700; }
.gp-use:hover { background: var(--green); color: #fff; border-color: var(--green); }
.gp-part.chosen .gp-use { background: var(--green); color: #fff; }
.gp-none { font-size: .82rem; color: var(--muted); }
.gp-pad { padding: .7rem .75rem; }
.gp-choose { padding: .7rem .75rem; margin: 0; }
.gp-error { margin: .25rem 0 .7rem; padding: .6rem .75rem; border-radius: 8px; background: var(--red-soft); border: 1px solid #f2d3cf; color: #7f1d1d; font-weight: 500; }
@container rail (max-width: 340px) {
  .gp-offer { grid-template-columns: auto auto 1fr; }
  .gp-pn { grid-column: 1 / -1; grid-row: 2; }
  .gp-use { grid-column: 3; grid-row: 1; justify-self: end; }
}
/* loading placeholder rows */
.sk { display: block; height: .7rem; border-radius: 4px; background: linear-gradient(90deg, #eceff0 0%, #f6f7f8 50%, #eceff0 100%); background-size: 200% 100%; animation: sk 1.2s ease-in-out infinite; }
.sk-line { width: 85%; }
.sk-short { width: 45%; height: 1rem; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* ---------- consistent cards, lists and settings across pages ---------- */
.panel { border-radius: 10px; box-shadow: var(--card-shadow); }
.panel > h2, #settings-root .panel > h2 { padding-bottom: .65rem; margin-bottom: .9rem; border-bottom: 1px solid var(--line); }
.panel h3 { color: var(--label); }
.page-head h1 { font-size: 1.6rem; }

/* tables: tinted header, row hover, comfortable rows */
.ledger.docs thead th, .settings-table thead th { background: #f6f8f8; border-bottom: 1px solid var(--line-2); padding-top: .6rem; padding-bottom: .6rem; }
.ledger.docs tbody tr { transition: background .1s; }
.ledger.docs tbody tr:hover, .docs-mini tbody tr:hover { background: #f6f8f8; }
.ledger.docs td { padding-top: .7rem; padding-bottom: .7rem; }
.settings-table tbody tr:hover { background: #fafbfb; }
.filters input, .filters select { min-height: 40px; }

/* stat tiles and upcoming jobs */
.stats { border-radius: 10px; box-shadow: var(--card-shadow); }
.stat-label { color: var(--label); }
.job-row { padding: .7rem .5rem; margin: 0 -.5rem; border-radius: 6px; }
.job-row:hover { background: #f6f8f8; }
.loc-dot { width: 12px; height: 12px; }

/* dialogs */
dialog { border-radius: 12px; padding: 0; }
dialog form { padding: 1.3rem 1.4rem 1.1rem; }
dialog h2 { font-size: 1.2rem; padding-bottom: .6rem; margin-bottom: .6rem; border-bottom: 1px solid var(--line); }

/* the paper's on-screen helpers */
.customer-sees { border: 1px solid var(--line); background: #f6f8f8; }
.paper-schedule { border-style: solid; background: #f6f8f8; }

/* sidebar: slightly stronger active item */
.sidebar nav a.active { background: rgba(255,255,255,.1); }

/* ---------- fixes from the visual check ---------- */
/* the hidden radio buttons in the "Customer's printout shows" switch sat far off to the right
   and gave the whole page a sideways scrollbar */
.seg-small label { position: relative; }
.seg-small input { left: 0; top: 0; width: 1px; height: 1px; margin: 0; }

/* a roomier job panel beside the document */
@container main (min-width: 880px) { .editor-layout { grid-template-columns: 360px minmax(0, 1fr); } }
@container main (min-width: 1300px) { .editor-layout { grid-template-columns: 390px minmax(0, 940px); } }
#v-vin { letter-spacing: .03em; font-size: .95rem; }

/* service rows: only the service picker needs room for the delete button */
.service-row { padding-right: .7rem; }
.service-fields .f-service { padding-right: 2.1rem; }

/* supplier results lay themselves out by their own width */
.s-glass-pick { container: gp / inline-size; }
@container gp (max-width: 380px) {
  .gp-offer { grid-template-columns: auto minmax(0, 1fr) auto; }
  .gp-price { grid-column: 1; grid-row: 1; }
  .gp-stock { grid-column: 2; grid-row: 1; justify-self: start; }
  .gp-use { grid-column: 3; grid-row: 1; min-width: 0; }
  .gp-pn { grid-column: 1 / -1; grid-row: 2; }
  .gp-head .gp-style { margin-left: 0; flex-basis: 100%; }
}

/* =====================================================================
   Colour with meaning. Surfaces stay white and charcoal; small accents
   carry meaning, the same everywhere:
   green = done / chosen / brand action, blue = information and progress,
   amber = needs attention, red = problems, violet = scheduling.
   ===================================================================== */
:root {
  --blue: #1f5fae;   --blue-soft: #e8f0fb;   --blue-line: #b9d0ef;
  --violet: #6a47c2; --violet-soft: #f0ebfb; --violet-line: #d3c6f2;
  --green-line: #9cc5a8; --amber-line: #f0d29a; --red-line: #f2c4bd;
}

/* section colours in the job panel */
.tone-blue h2 .i { background: var(--blue-soft); color: var(--blue); }
.tone-blue:focus-within { border-color: var(--blue-line); box-shadow: var(--card-shadow), 0 0 0 3px rgba(31,95,174,.08); }
.tone-blue:focus-within h2 { color: var(--blue); }
.tone-blue input:focus, .tone-blue select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,95,174,.18); }
.tone-blue #vin-note .good { color: var(--blue); }
.tone-green h2 .i { background: var(--green-soft); color: var(--green); }

/* statuses: one colour per meaning, everywhere */
.status, .status-select { border-color: var(--line); }
.s-draft { background: #f1f3f4; color: #4b5558; border-color: #dfe3e5; }
.s-sent { background: var(--blue-soft); color: var(--blue); border-color: var(--blue-line); }
.s-accepted, .s-paid { background: var(--green-soft); color: var(--green); border-color: var(--green-line); }
.s-partial { background: var(--amber-soft); color: #7a4300; border-color: var(--amber-line); }
.s-declined, .s-void { background: var(--red-soft); color: var(--red); border-color: var(--red-line); }

/* lists: document numbers are links (blue), rows hover in a soft blue */
.docs a.open, .docs-mini a.open, .job-row .open { color: var(--blue); }
.ledger.docs tbody tr:hover, .docs-mini tbody tr:hover { background: #f5f8fd; }
.tag { border-color: var(--violet-line); color: var(--violet); background: var(--violet-soft); }

/* dashboard tiles: a coloured top edge per kind of number */
.stat { border-top: 3px solid transparent; }
.stats > :nth-child(1) { border-top-color: var(--blue); }
.stats > :nth-child(2) { border-top-color: #d08a14; }
.stats > :nth-child(3) { border-top-color: var(--green); }
.stats > :nth-child(4) { border-top-color: var(--violet); }
.stats > :nth-child(1) .stat-label { color: var(--blue); }
.stats > :nth-child(2) .stat-label { color: #9a5600; }
.stats > :nth-child(3) .stat-label { color: var(--green); }
.stats > :nth-child(4) .stat-label { color: var(--violet); }
a.stat:hover { background: #fafcff; }
a.stat:hover .stat-label { text-decoration: underline; }

/* scheduling is violet */
#upcoming-panel h2 { display: flex; align-items: center; gap: .5rem; margin: 0; }
#upcoming-panel h2 .i, #zoho-panel h2 .i { width: 28px; height: 28px; padding: 5px; border-radius: 7px; background: var(--violet-soft); color: var(--violet); }
.job-row:hover { background: var(--violet-soft); }
.job-row:hover .job-main b { color: var(--violet); }
.paper-schedule { background: var(--violet-soft); border-color: var(--violet-line); }
.paper-schedule:hover { background: #e7defa; border-color: var(--violet); }
#schedule .i { color: var(--violet); }
.loc-option:has(input:checked) { border-color: var(--violet); background: var(--violet-soft); }

/* backups and numbering are housekeeping: blue */
.backups .panel-head h2 .i { width: 28px; height: 28px; padding: 5px; border-radius: 7px; background: var(--blue-soft); color: var(--blue); }
.backup-list a { color: var(--blue); }

/* QuickBooks / information */
#sync-status .good { color: var(--green); }
.customer-sees .seg-small label:has(input:checked) { color: var(--blue); }
.l-meta .tag.rule { color: var(--blue); background: none; border: 0; }

/* sidebar: each area has its own marker colour */
.sidebar nav a[data-tab="home"].active, .sidebar nav a[data-tab="new"].active, .sidebar nav a[data-tab="quickbooks"].active { border-left-color: #6fbf87; }
.sidebar nav a[data-tab="custom"].active, .sidebar nav a[data-tab="documents"].active { border-left-color: #7fb3ee; }
.sidebar nav a[data-tab="settings"].active { border-left-color: #b39cf0; }
.sidebar nav a.active .i { opacity: 1; }
.sidebar nav a[data-tab="home"].active .i, .sidebar nav a[data-tab="new"].active .i, .sidebar nav a[data-tab="quickbooks"].active .i { color: #8fd3a5; }
.sidebar nav a[data-tab="custom"].active .i, .sidebar nav a[data-tab="documents"].active .i { color: #9cc4f2; }
.sidebar nav a[data-tab="settings"].active .i { color: #c7b6f5; }
@media (min-width: 861px) and (max-width: 1279px) {
  .sidebar nav a[data-tab="custom"].active, .sidebar nav a[data-tab="documents"].active { box-shadow: inset 3px 0 0 #7fb3ee; }
  .sidebar nav a[data-tab="settings"].active { box-shadow: inset 3px 0 0 #b39cf0; }
}
@media (max-width: 860px) {
  .sidebar nav a[data-tab="custom"].active, .sidebar nav a[data-tab="documents"].active { border-bottom-color: #7fb3ee; }
  .sidebar nav a[data-tab="settings"].active { border-bottom-color: #b39cf0; }
}

/* attention states stay amber, problems red */
.dirty { color: #9a5600; }
.email-warning { border: 1px solid var(--amber-line); }
#upcoming-panel .panel-head { align-items: center; margin-bottom: .4rem; }
.paper-schedule { justify-content: flex-start; }

/* =====================================================================
   Responsive touch-ups
   ===================================================================== */
/* Locations: colour, name, "at the customer's address", remove on one line; the address gets its own
   full-width line underneath so a real street address is never cut off. */
.location-row { grid-template-columns: auto minmax(0, 1fr) auto auto; }
.location-row > :nth-child(4) { grid-row: 2; grid-column: 2 / 4; }
.location-row > span:nth-child(4) { display: none; }
@container main (max-width: 600px) {
  .location-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .location-row > :nth-child(3) { grid-row: 2; grid-column: 1 / -1; }
  .location-row > :nth-child(4) { grid-row: 3; grid-column: 1 / -1; }
}
/* On tablets and phones the document runs edge to edge, so the search icon would sit outside it. */
@media (max-width: 860px) {
  .customer-search .search-i { display: none; }
}
/* Phone home tiles: keep labels on one line and the tiles compact. */
@media (max-width: 480px) {
  .stat { padding: .7rem .85rem; }
  .stat-label { font-size: .72rem; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stat-value { font-size: 1.35rem; }
}

/* =====================================================================
   Inventory and texting
   ===================================================================== */
.glass-badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: .05rem .4rem; border-radius: 3px; border: 1px solid; vertical-align: 1px; white-space: nowrap; }
.glass-badge.needed { background: var(--amber-soft); color: var(--amber); border-color: #f0dcbc; }
.glass-badge.ordered { background: var(--blue-soft); color: var(--blue); border-color: var(--blue-line); }
.glass-badge.received, .glass-badge.done { background: var(--green-soft); color: var(--green); border-color: #cfe1d5; }

/* Glass for jobs */
.order-group { padding: .25rem 0 .75rem; }
.order-group + .order-group { border-top: 1px solid var(--line); padding-top: .75rem; }
.order-group h3 { display: flex; align-items: center; gap: .5rem; margin: 0 0 .4rem; font-size: .95rem; }
.order-group .count { font-size: .75rem; font-weight: 600; min-width: 1.4rem; text-align: center; padding: 0 .35rem; border-radius: 99px; background: var(--line); color: var(--muted); }
.g-needed .count:not(:empty) { background: var(--amber-soft); color: var(--amber); }
.g-ordered .count { background: var(--blue-soft); color: var(--blue); }
.g-received .count { background: var(--green-soft); color: var(--green); }
.order-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: .5rem 1rem; align-items: center; padding: .6rem .5rem; border-radius: var(--r); }
.order-row + .order-row { border-top: 1px solid var(--line); }
.g-needed .order-row { box-shadow: inset 3px 0 0 #e3b467; }
.g-ordered .order-row { box-shadow: inset 3px 0 0 var(--blue-line); }
.g-received .order-row { box-shadow: inset 3px 0 0 #9fcaad; }
.order-controls { display: flex; gap: .4rem; align-items: center; }
.order-controls select { width: auto; }
.order-controls .o-po { width: 8.5rem; }
.o-eta-wrap { display: flex; align-items: center; gap: .3rem; margin: 0; }
.o-eta-wrap input { width: auto; }
.g-needed .o-eta-wrap, .g-received .o-po, .g-received .o-eta-wrap { display: none; }

/* Shop stock */
.stock-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .5rem 1rem; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.stock-row.low .stock-count b { color: var(--amber); }
.stock-count { font-size: 1.2rem; text-align: right; min-width: 5rem; }
.stock-controls { display: flex; gap: .35rem; align-items: center; }
.stock-controls .st-qty { width: 4.5rem; }
.stock-edit { grid-column: 1 / -1; background: var(--bg, #f4f6f6); border-radius: var(--r); padding: .75rem; }
.stock-edit .per-service { grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); }
.stock-add { margin-top: 1rem; align-items: end; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)) auto; }

/* Texts */
#texts-panel h2 .i { width: 28px; height: 28px; padding: 5px; border-radius: 7px; background: var(--blue-soft); color: var(--blue); }
#texts-panel h2 { display: flex; align-items: center; gap: .5rem; }
.text-due { display: flex; gap: 1rem; align-items: flex-start; padding: .7rem 0; border-top: 1px solid var(--line); }
.text-due-main { flex: 1; min-width: 0; }
.text-due-actions { display: flex; gap: .35rem; flex-shrink: 0; }
.text-preview { margin: .35rem 0 0; padding: .45rem .6rem; background: var(--blue-soft); border-radius: 10px 10px 10px 2px; color: var(--ink); }
.text-preview span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.text-kinds { border: 0; padding: 0; margin: 0 0 .75rem; }
#text-kinds { display: flex; flex-wrap: wrap; gap: .4rem; }
.text-kind { display: flex; align-items: center; gap: .35rem; margin: 0; padding: .35rem .6rem; border: 1px solid var(--line-2); border-radius: var(--r); cursor: pointer; font-size: .9rem; }
.text-kind input { width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; accent-color: var(--blue); flex-shrink: 0; }
.text-kind:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
#text-send.disabled { opacity: .45; pointer-events: none; }
#texting-panel h2 { display: flex; align-items: center; gap: .5rem; }
.text-enabled { border: 0; padding: 0; margin: .5rem 0; display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.sidebar nav a[data-tab="inventory"].active { border-left-color: #e3b467; }
.sidebar nav a[data-tab="inventory"].active .i { color: #f0c98a; }

@container main (max-width: 760px) {
  .order-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .order-controls { grid-column: 1 / -1; flex-wrap: wrap; }
  .order-controls .o-po { flex: 1; min-width: 7rem; }
  .stock-add { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stock-add label:first-child, .stock-add button { grid-column: 1 / -1; }
}
@container main (max-width: 520px) {
  .order-row { grid-template-columns: minmax(0, 1fr); }
  .stock-row { grid-template-columns: minmax(0, 1fr) auto; }
  .stock-controls { grid-column: 1 / -1; }
  .stock-controls .st-qty { flex: 1; }
  .text-due { flex-direction: column; gap: .5rem; }
  #texts-panel .panel-head .muted { display: none; }
  .text-due-actions { width: 100%; }
  .text-due-actions .btn { flex: 1; justify-content: center; }
}

/* Netlify's free plan pins a "Powered by Netlify" badge to the bottom-right corner (about 60px tall).
   It can't be turned off on that plan, so leave room for it instead of letting it cover buttons. */
:root { --nf-badge: 0px; }
html.nf-badge { --nf-badge: 64px; }
main { padding-bottom: calc(5rem + var(--nf-badge)); }
#toast { bottom: calc(1.5rem + var(--nf-badge)); }
@media (max-width: 860px) {
  main { padding-bottom: calc(6.5rem + var(--nf-badge)); }
  .editor-bar { padding-bottom: calc(10px + env(safe-area-inset-bottom) + var(--nf-badge)); }
}

/* Narrow phones (under 400px): tighter top menu so all seven sections fit without scrolling sideways. */
@media (max-width: 400px) {
  .sidebar nav { padding: .35rem .2rem; }
  .sidebar nav a { padding: .6rem clamp(.3rem, 1.9vw, .55rem); }
  .brand { padding-right: 0; }
}

/* =====================================================================
   PO / work order numbers, and customer signatures
   ===================================================================== */
.ref-field { display: flex; align-items: baseline; justify-content: flex-end; gap: .4rem; margin: .15rem 0 0; font-size: .8rem; color: var(--muted); }
.ref-field span { white-space: nowrap; }
.ref-field .inline-input { width: 9.5rem; text-align: right; font-size: .85rem; padding: .1rem .3rem; }
@container paper (max-width: 520px) {
  .ref-field { justify-content: flex-start; }
  .ref-field .inline-input { text-align: left; }
}

.paper-signature { margin-top: 1.25rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.paper-signature h3 { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .35rem; }
.paper-signature img { display: block; max-width: 240px; max-height: 80px; border-bottom: 1px solid var(--line-2); padding-bottom: .2rem; }
.paper-signature .sig-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; margin-top: .35rem; }
.paper-signature .sig-line .linkish { margin-left: auto; }
.paper-signature p { margin: .3rem 0 0; }

/* The signing screen: nearly full screen on tablets and phones, so there's room to sign. */
dialog.sign-dialog { width: min(860px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
.sign-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); margin-bottom: .6rem; }
.sign-head h2 { border: 0; margin: 0; padding-bottom: .6rem; }
.sign-total strong { font-size: 1.25rem; }
.sign-statement { margin: 0 0 .75rem; font-size: .95rem; color: var(--text); }
.sign-pad-wrap { position: relative; height: clamp(180px, 38dvh, 320px); border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); background: #fff; margin-bottom: .8rem; }
.sign-pad-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; border-radius: inherit; }
.sign-hint { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); font-size: 1.05rem; pointer-events: none; }
.sign-x { position: absolute; left: 1rem; bottom: 22%; font-size: 1.6rem; color: var(--faint); pointer-events: none; }
.sign-pad-wrap::after { content: ""; position: absolute; left: 2.6rem; right: 1.2rem; bottom: 24%; border-bottom: 1px solid var(--line-2); pointer-events: none; }
.sign-name input { font-size: 1.05rem; }

/* Payment terms on invoices, with the due date under them */
.ref-field select.terms-select { width: 9.5rem; font-size: .85rem; padding: .1rem .3rem; text-align: right; text-align-last: right; }
.due-line { font-size: .8rem; }
.due-line b { color: var(--ink); font-weight: 600; }
@container paper (max-width: 520px) {
  .ref-field select.terms-select { text-align: left; text-align-last: left; }
}
/* Overdue invoices in lists */
.overdue { color: var(--red); font-weight: 600; }
.due-note { display: block; font-size: .75rem; margin-top: .15rem; }

/* The signing screen, invoice version: warranty, then the declaration and insurance parts.
   The middle scrolls; the title and the buttons stay put. */
#sign-form { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); }
.sign-body { overflow-y: auto; overscroll-behavior: contain; margin: 0 -1.4rem; padding: 0 1.4rem; flex: 1 1 auto; min-height: 0; }
.sign-warranty { background: #f6f8f8; border: 1px solid var(--line); border-radius: var(--r); padding: .6rem .75rem; margin-bottom: .9rem; }
.sign-warranty h3 { margin: 0 0 .25rem; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sign-warranty p { margin: 0; font-size: .78rem; line-height: 1.4; max-height: 7.5rem; overflow-y: auto; }
.sign-part { padding: .2rem 0 .6rem; }
.sign-part + .sign-part { border-top: 1px solid var(--line); padding-top: .9rem; }
.sign-tick { display: flex; gap: .65rem; align-items: flex-start; font-size: .86rem; font-weight: 400; color: var(--text); line-height: 1.45; margin-bottom: .7rem; cursor: pointer; }
.sign-tick input { flex: 0 0 auto; width: 24px; height: 24px; min-height: 0; margin: .05rem 0 0; accent-color: var(--green); }
.sign-pad-wrap .sign-clear { position: absolute; top: .4rem; right: .4rem; min-height: 0; }
#sign-insurance-fields .row { margin-bottom: .6rem; }
dialog.sign-dialog .sign-pad-wrap { height: clamp(150px, 28dvh, 260px); }
@media (max-width: 520px) {
  .sign-body { margin: 0 -1rem; padding: 0 1rem; }
  #sign-insurance-fields .row { grid-template-columns: 1fr; }
}

/* The signed acknowledgement as shown in the editor */
.ack-parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; }
.ack-part { border: 1px solid var(--line); border-radius: var(--r); padding: .6rem .7rem; }
.ack-part p { margin: 0 0 .35rem; }
.ack-part img { display: block; max-width: 100%; max-height: 64px; border-bottom: 1px solid var(--line-2); }
.ack-title { font-weight: 600; color: var(--ink); }
.ack-tick { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 3px; background: var(--green-soft); color: var(--green); font-size: .8rem; }
.ack-none { display: grid; place-items: center; }

/* Plates are stored in capitals; show them that way while typing */
#v-plate { text-transform: uppercase; }

/* The vehicle on the document preview: the name, then plate, kms and VIN on labelled rows */
.vehicle-name { color: var(--ink); font-weight: 600; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .1rem .8rem; margin: .35rem 0 0; align-items: baseline; }
.facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; color: var(--text); font-size: .9rem; overflow-wrap: anywhere; }
.facts dd.mono { font-size: .84rem; letter-spacing: .02em; }

/* Damage & condition (public/condition.js): amber, like other "take note" things */
.tone-amber h2 .i { background: var(--amber-soft); color: var(--amber); }
.cond-intro { margin: -.2rem 0 .6rem; }
/* the checklist as chips that size to their text and wrap, so it stays short in the narrow job panel */
.cond-items { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .75rem; }
.cond-items label.check { font-size: .85rem; line-height: 1.3; padding: .35rem .65rem .35rem .5rem; border-radius: 999px; min-height: 0; gap: .4rem; }
.cond-items label.check input { margin: 0; flex: 0 0 auto; }
.cond-items label.check:has(input:checked) { background: var(--amber-soft); border-color: var(--amber-line); }
.photo-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .25rem 0 .6rem; }
.photo-add { cursor: pointer; }
.photo-add:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.photo-list { list-style: none; margin: 0 0 .6rem; padding: 0; display: grid; gap: .5rem; }
.photo-list:empty { display: none; }
.photo { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: .6rem; align-items: center; padding: .4rem; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.photo-thumb img { display: block; width: 76px; height: 57px; object-fit: cover; border-radius: 4px; background: var(--line); }
.photo.tag-before .photo-thumb img { box-shadow: 0 0 0 2px var(--amber-line); }
.photo.tag-after .photo-thumb img { box-shadow: 0 0 0 2px var(--green-line); }
.photo-meta { display: grid; gap: .35rem; min-width: 0; }
.photo-tag { display: inline-flex; justify-self: start; padding: 2px; gap: 2px; background: #e4e8e9; border-radius: 6px; }
.photo-tag button { font: inherit; font-size: .8rem; font-weight: 600; padding: .2rem .6rem; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; min-height: 0; }
.photo-tag button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(31,36,38,.15); }
.photo-note { width: 100%; font-size: .88rem; padding: .3rem .5rem; min-height: 0; }
#cond-show-wrap { margin-top: .25rem; }

/* …and the same paragraph on the document preview */
.paper-condition { margin-top: 1rem; }
.paper-condition p { margin: 0; font-size: .86rem; color: var(--text); white-space: pre-wrap; }
.paper-condition b { color: var(--ink); text-transform: uppercase; letter-spacing: .04em; font-size: .9em; }

/* History (public/history.js): earlier jobs on the vehicle and for the customer */
.tone-violet h2 .i { background: var(--violet-soft); color: var(--violet); }
.history-head { margin: .4rem 0 .35rem; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.history-list { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; gap: .35rem; }
.history-job { display: grid; justify-content: stretch; justify-items: stretch; gap: .1rem; width: 100%; text-align: left; font: inherit; padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 7px; background: #fff; cursor: pointer; color: var(--text); min-height: 0; }
.history-job:hover { border-color: var(--violet-line); background: var(--violet-soft); }
.history-top { display: flex; align-items: baseline; gap: .6rem; }
.history-top .num { margin-left: auto; color: var(--ink); }
.history-top b { color: var(--violet); }
.history-work { font-size: .9rem; color: var(--ink); }

/* ADAS calibration (public/adas.js) */
.adas-hint { margin: -.2rem 0 .6rem; padding: .45rem .6rem; border-radius: 6px; background: var(--amber-soft); color: #7a4300; }
.report-list { list-style: none; margin: 0 0 .5rem; padding: 0; display: grid; gap: .35rem; }
.report-list:empty { display: none; }
.report-list li { display: flex; align-items: center; gap: .6rem; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.report-list a { display: inline-flex; align-items: center; gap: .35rem; color: var(--blue); font-weight: 600; }
.report-list .report-remove { margin-left: auto; }
.report-add { cursor: pointer; }
.report-add:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.adas-preview { margin: .25rem 0 0; padding: .5rem .6rem; border-radius: 6px; background: var(--blue-soft); color: var(--ink); }

/* Reports (public/reports.js) */
.report-range { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.report-range select, .report-range input { width: auto; }
.report-custom { display: inline-flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.report-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); gap: 0 1rem; }
.report-dl { display: grid; grid-template-columns: 1fr auto; gap: .45rem 1rem; margin: 0; }
.report-dl dt { color: var(--muted); }
.report-dl dd { margin: 0; text-align: right; color: var(--ink); }
.report-note { max-width: 70ch; }
.table-scroll { overflow-x: auto; }
.report-table { min-width: 34rem; }
.report-sub { display: block; }
.chart-table { margin-top: .75rem; }
.chart-table summary { cursor: pointer; color: var(--muted); font-size: .88rem; }

/* monthly sales columns: one colour, hairline grid, 4px rounded tops, a 2px gap between columns */
.month-chart { --plot: 190px; position: relative; padding: 1.4rem 0 0 3rem; }
.mc-grid { position: absolute; left: 3rem; right: 0; top: 1.4rem; height: var(--plot); pointer-events: none; }
.mc-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.mc-line span { position: absolute; right: calc(100% + .5rem); top: -.55em; font-size: .72rem; color: var(--muted); white-space: nowrap; font-family: var(--mono); }
.mc-cols { position: relative; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 2px; height: var(--plot); }
.mc-col { position: relative; display: flex; align-items: flex-end; justify-content: center; height: 100%; padding: 0; border: 0; background: transparent; cursor: default; min-height: 0; }
.mc-bar { position: relative; width: min(24px, 70%); background: var(--green); border-radius: 4px 4px 0 0; min-height: 1px; }
.mc-col:hover .mc-bar, .mc-col:focus-visible .mc-bar { background: #175528; }
.mc-col:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.mc-cap { position: absolute; bottom: calc(100% + 3px); left: 50%; transform: translateX(-50%); font-size: .72rem; font-family: var(--mono); color: var(--ink); white-space: nowrap; }
.mc-tip { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: 5; display: none; gap: .1rem; min-width: 11rem; padding: .5rem .65rem; border-radius: 6px; background: var(--ink); color: #fff; font-size: .8rem; text-align: left; box-shadow: 0 6px 18px rgba(0,0,0,.18); pointer-events: none; }
.mc-tip span { display: flex; justify-content: space-between; gap: 1rem; color: #d7dcdd; }
.mc-tip b { color: #fff; font-weight: 600; }
.mc-col:hover .mc-tip, .mc-col:focus-visible .mc-tip { display: grid; }
.mc-col:first-child .mc-tip, .mc-col:nth-child(2) .mc-tip { left: 0; transform: none; }
.mc-col:last-child .mc-tip, .mc-col:nth-last-child(2) .mc-tip { left: auto; right: 0; transform: none; }
.mc-labels { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 2px; margin-top: .35rem; font-size: .72rem; color: var(--muted); text-align: center; }
@media (max-width: 520px) { .mc-labels span:nth-child(even) { visibility: hidden; } .month-chart { padding-left: 2.6rem; } .mc-grid { left: 2.6rem; } }

/* Quotes & invoices list: customer and vehicle share a column; the short columns don't wrap */
.docs .doc-num, .docs .doc-date, .docs .doc-qbo, .docs .doc-print, .docs td.n { white-space: nowrap; }
.docs .doc-num .tag { margin-left: .3rem; vertical-align: 1px; }
.docs .doc-who { min-width: 10rem; }
/* Every column gets the same breathing room; Customer & vehicle takes the spare width, so the other
   columns stay snug to their content, and the right-aligned Total gets a clear gap before Status. */
@container main (min-width: 601px) { /* as a table; on phones it's cards */
  .ledger.docs th, .ledger.docs td { padding-left: .85rem; padding-right: .85rem; }
  .ledger.docs th:first-child, .ledger.docs td:first-child { padding-left: .75rem; }
  .ledger.docs th.n, .ledger.docs td.n { padding-right: 2rem; } /* a clear gap between Total and Status */
  .ledger.docs .doc-status { min-width: 7.5rem; }
  .ledger.docs .due-note { white-space: nowrap; } /* "Overdue since Oct 27" on one line */
}
/* Tablets (iPad mini, iPad in portrait): five columns. The date sits under the number and the
   QuickBooks status under the total, instead of in columns of their own. */
.docs .compact-only, .docs .card-only { display: none; }
@container main (min-width: 601px) and (max-width: 1000px) {
  .ledger.docs th:nth-child(2), .ledger.docs td:nth-child(2), .ledger.docs th:nth-child(6), .ledger.docs td:nth-child(6) { display: none; }
  .ledger.docs .compact-only { display: block; margin-top: .15rem; font-family: var(--font); font-weight: 400; }
  .ledger.docs th.n, .ledger.docs td.n { padding-right: 1.5rem; }
}
.doc-customer { display: block; color: var(--ink); font-weight: 500; }
.doc-vehicle { display: block; }
.docs .doc-print a { display: inline-flex; align-items: center; gap: .3rem; }
.docs .doc-print .i { color: currentColor; }
.docs .status-select { min-width: 0; }
@container main (max-width: 1000px) { .docs .doc-print span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }

.nowrap { white-space: nowrap; }

/* Finger-sized targets on touch screens: the photo Before/After toggle, Remove under a signature,
   and the tick boxes in the dealer-account price table */
@media (pointer: coarse), (max-width: 860px) {
  .photo-tag button { min-height: 34px; padding: .3rem .75rem; }
  #sig-remove { padding: .45rem .3rem; margin: -.45rem 0; }
  td > input[type="checkbox"] { width: 24px; height: 24px; }
  label:has(> input[type="checkbox"]):not(.check) { padding-block: .35rem; } /* a taller target for plain tick-box labels */
  summary:not(.account-summary) { padding-block: .55rem; } /* "Show as a table", "Offered with …" and other expandable lines */
}

/* Settings › Backups list: each value on one line; on a phone the type column goes and Download is an icon */
.backup-list td { white-space: nowrap; }
@container main (max-width: 600px) {
  .backup-list td:nth-child(2) { display: none; }
  .backup-list .dl-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .backup-list td a { display: inline-flex; min-width: 36px; min-height: 36px; align-items: center; justify-content: center; }
}

/* Settings › Dealer accounts: the travel / rounding switches and the "not offered" list */
.account-flags { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; margin: .25rem 0 .5rem; }
.not-offered { grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); margin-bottom: .5rem; }
.not-offered label.check { font-size: .88rem; }

/* Glass picker: questions about the options that tell the listed parts apart, and parts
   installed before on a car with the same VIN pattern */
.gp-questions { padding: .55rem .6rem; border-bottom: 1px solid var(--line); background: var(--amber-soft); }
.gp-questions p { margin: 0 0 .35rem; }
.gp-q { display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: center; padding: .35rem 0; border-top: 1px solid rgba(154,86,0,.15); }
.gp-q-name { flex: 1 1 9rem; } /* the answers drop below when there isn't room beside it */
.gp-q-help { flex: 1 0 100%; line-height: 1.35; }
.gp-q-name { font-weight: 600; color: var(--ink); }
.gp-q-ans { display: inline-flex; padding: 2px; gap: 2px; background: #e4e8e9; border-radius: 6px; }
.gp-q-ans button { font: inherit; font-size: .8rem; font-weight: 600; padding: .2rem .55rem; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; min-height: 0; }
.gp-q-ans button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(31,36,38,.15); }
.gp-q-count { margin: .3rem 0 0; color: #7a4300; font-weight: 600; }
.gp-part.installed-before { box-shadow: inset 3px 0 0 var(--green); }
.gp-tag.gp-before { background: var(--green-soft); color: var(--green); border-color: var(--green-line); font-weight: 600; }
.chip.chip-confirmed { border-color: var(--green-line); background: var(--green-soft); }
.chip-check { color: var(--green); font-weight: 600; font-family: var(--font); }
@media (pointer: coarse), (max-width: 860px) { .gp-q-ans button { min-height: 34px; padding: .3rem .7rem; } }

/* ---------- Settings: section links, dealer accounts as collapsible cards, add-on lists ---------- */
.settings-nav { position: sticky; top: 0; z-index: 12; display: flex; gap: .35rem; overflow-x: auto; scrollbar-width: none; margin: -.25rem 0 1rem; padding: .5rem 0; background: var(--page); }
.settings-nav::-webkit-scrollbar { display: none; }
.settings-nav a { flex: none; padding: .35rem .75rem; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--text); font-size: .85rem; font-weight: 500; text-decoration: none; white-space: nowrap; }
.settings-nav a:hover { border-color: var(--green-line); color: var(--green); }
#tab-settings .panel { scroll-margin-top: 4.5rem; }
@media (max-width: 860px) {
  .settings-nav { top: calc(52px + env(safe-area-inset-top)); margin-inline: -1rem; padding-inline: 1rem; }
  #tab-settings .panel { scroll-margin-top: 7.5rem; }
}
@media (pointer: coarse), (max-width: 860px) { .settings-nav a { padding: .55rem .9rem; } }

.accounts-head { align-items: center; }
.accounts-head h2 { display: flex; align-items: center; gap: .5rem; margin: 0; }
.count-pill { font-size: .78rem; font-weight: 600; padding: .05rem .5rem; border-radius: 999px; background: var(--page); color: var(--muted); border: 1px solid var(--line); }
.accounts-tools { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.accounts-tools input { width: 14rem; margin: 0; }
.account-list { margin: .5rem 0 .75rem; }
.account-card[open] { border-color: var(--green-line); box-shadow: 0 2px 10px rgba(31,36,38,.06); }
.account-summary { display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem; cursor: pointer; list-style: none; min-height: 48px; }
.account-summary::-webkit-details-marker { display: none; }
.account-summary::after { content: ""; flex: none; width: .5rem; height: .5rem; margin-left: auto; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.account-card[open] > .account-summary::after { transform: rotate(-135deg); }
.account-summary:hover .acct-name { color: var(--green); }
.acct-badge { flex: none; display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; font-size: .78rem; font-weight: 700; letter-spacing: .02em; }
.av-0 { background: var(--blue-soft); color: var(--blue); } .av-1 { background: var(--green-soft); color: var(--green); }
.av-2 { background: var(--violet-soft); color: var(--violet); } .av-3 { background: var(--amber-soft); color: #7a4300; }
.av-4 { background: var(--red-soft); color: var(--red); } .av-5 { background: #e6f4f4; color: #0f6b6b; }
.acct-name { font-weight: 600; color: var(--ink); min-width: 0; }
.acct-tags { display: flex; flex-wrap: wrap; gap: .25rem; min-width: 0; }
.acct-tag { font-size: .74rem; padding: .05rem .45rem; border-radius: 999px; background: var(--page); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.acct-tag.tag-good { background: var(--green-soft); border-color: var(--green-line); color: var(--green); }
.acct-tag.tag-terms { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue); }
.acct-tag.tag-off { background: var(--amber-soft); border-color: var(--amber-line); color: #7a4300; }
.account-body { padding: .25rem .9rem .9rem; border-top: 1px solid var(--line); }
.account-body h4 { margin: .9rem 0 .25rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; }
@container main (max-width: 600px) {
  .accounts-tools { width: 100%; }
  .accounts-tools input { flex: 1 1 100%; width: auto; }
  .account-summary { flex-wrap: wrap; row-gap: .3rem; }
  .account-summary::after { order: 2; }
  .acct-name { flex: 1 1 0; order: 1; }
  .acct-tags { order: 3; flex: 1 0 100%; padding-left: 2.8rem; }
}

.applies-pick > summary { cursor: pointer; color: var(--text); font-size: .88rem; padding: .3rem 0; }
.applies-pick[open] > summary { margin-bottom: .35rem; }
.applies-pick .applies { display: flex; flex-wrap: wrap; gap: .1rem .9rem; }

.docs-count { margin: -.5rem 0 .5rem; min-height: 1em; }
.docs-count:empty { display: none; }

/* ---------- technicians on the way (public/trips.js) ---------- */
.pulse { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; background: #22a04b; box-shadow: 0 0 0 0 rgba(34,160,75,.5); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(34,160,75,0); } 100% { box-shadow: 0 0 0 0 rgba(34,160,75,0); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* while this phone shares its location: a bar at the top of every page back to that screen */
.trip-banner { position: sticky; top: 0; z-index: 25; display: flex; align-items: center; gap: .6rem; width: calc(100% + 4rem); margin: -1.5rem -2rem 1rem; padding: .7rem 2rem; border: 0; background: var(--green); color: #fff; font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.trip-banner .pulse { background: #b9f5cb; }
.trip-banner > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-banner-open { padding: .2rem .7rem; border-radius: 999px; background: rgba(255,255,255,.2); font-size: .85rem; }

/* the "On my way" screen: a sheet from the bottom on phones */
dialog.trip-dialog { width: min(480px, calc(100vw - 32px)); }
.trip-sheet { padding: 1.3rem 1.4rem 1.1rem; }
.trip-address { display: flex; gap: .4rem; align-items: flex-start; margin: 0 0 .9rem; color: var(--text); }
.trip-address .i { flex: none; margin-top: .2rem; color: var(--green); }
.trip-consent { margin: .8rem 0; padding: .7rem .8rem; border-radius: 8px; background: var(--green-soft); color: var(--ink); font-size: .9rem; }
.trip-eta { display: grid; justify-items: center; gap: .1rem; padding: 1rem; border-radius: 10px; background: var(--green-soft); text-align: center; }
.trip-eta strong { font-family: var(--display); font-size: 2.6rem; line-height: 1.1; color: var(--green-dark); font-variant-numeric: tabular-nums; }
.trip-status { display: flex; align-items: center; gap: .5rem; margin: .7rem 0; font-size: .9rem; color: var(--muted); }
.trip-status.warn { padding: .55rem .7rem; border-radius: 8px; background: var(--amber-soft); color: var(--amber); }
.trip-note { margin: 0 0 .7rem; padding: .55rem .7rem; border-radius: 8px; background: var(--amber-soft); color: var(--amber); }
.trip-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.trip-actions #trip-text { grid-column: 1 / -1; }
.trip-actions .btn { justify-content: center; }
.btn.trip-arrived { width: 100%; justify-content: center; margin-top: .75rem; padding-block: .85rem; font-size: 1.05rem; font-weight: 700; background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.trip-arrived:hover { background: var(--ink-2); }
.trip-tip { margin: .75rem 0 .4rem; }

/* Home: who's on the road */
.road-panel .panel-head h2 { display: flex; align-items: center; gap: .55rem; margin: 0; }
.road-map { position: relative; z-index: 0; height: 260px; margin: .75rem 0 .5rem; border-radius: 8px; overflow: hidden; background: #dde3e4; }
.road-list { list-style: none; margin: 0; padding: 0; }
.road-row { display: flex; align-items: center; gap: .7rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.road-row:last-child { border-bottom: 0; }
.road-main { flex: 1; min-width: 0; }
.road-badge, .map-tech { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--green); color: #fff; font-size: .75rem; font-weight: 700; }
.map-tech { width: 28px; height: 28px; border: 2px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.35); }
.road-eta, .live-pill { display: inline-flex; align-items: center; gap: .4rem; flex: none; padding: .2rem .65rem; border-radius: 999px; background: var(--green-soft); color: var(--green-dark); font-weight: 600; font-size: .85rem; white-space: nowrap; }
.road-eta.none { background: #eef0f1; color: var(--muted); }

/* Upcoming jobs: technician, "On my way", route for the day */
.job-tech { color: var(--ink); font-weight: 600; }
.onway-btn { flex: none; }
.onway-btn .i, #onway .i { color: var(--green); }
.head-btn { margin-left: auto; }
.route-from { margin: .2rem 0 .5rem; }
.route-stops { margin: 0 0 .8rem; padding-left: 1.4rem; }
.route-stops li { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.route-stops .mono, .road-main .mono { white-space: nowrap; }
.route-tip { display: grid; gap: .35rem; justify-items: start; margin-bottom: .6rem; padding: .7rem .8rem; border-radius: 8px; background: var(--amber-soft); color: var(--ink); }

/* Settings: technicians and how sharing works */
.tech-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: .5rem .75rem; align-items: end; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.tech-row label { margin-bottom: .2rem; }
.privacy-note { margin-top: .9rem; }
.privacy-note summary { cursor: pointer; font-weight: 600; color: var(--green); }
.privacy-note ul { margin: .5rem 0 0; padding-left: 1.2rem; color: var(--text); }
.privacy-note li { margin: .25rem 0; }

@container main (max-width: 600px) {
  .tech-row { grid-template-columns: minmax(0, 1fr) auto; }
  .tech-row > :nth-child(2) { grid-row: 2; grid-column: 1 / -1; }
  .job-row { flex-wrap: wrap; }
  .job-row .job-main { flex-basis: calc(100% - 2rem); }
  .job-row .onway-btn, .job-row .live-pill { margin-left: 1.3rem; }
  .road-row { flex-wrap: wrap; }
  .road-row .road-main { flex-basis: calc(100% - 3rem); }
  .road-row .road-eta { margin-left: 2.45rem; }
  .road-map { height: 220px; }
}
@media (max-width: 860px) {
  .trip-banner { top: calc(52px + env(safe-area-inset-top)); width: calc(100% + 2rem); margin: -1rem -1rem 1rem; padding: .7rem 1rem; }
  /* the "On my way" screen fills the bottom of the phone, easy to reach with a thumb */
  dialog.trip-dialog { width: 100vw; max-width: 100vw; max-height: 100dvh; margin: auto 0 0; border-radius: 16px 16px 0 0; border: 0; }
  .trip-sheet { padding: 1.2rem 1rem max(1rem, env(safe-area-inset-bottom)); }
  .head-btn { margin-left: 0; }
}

/* ---------- a technician's own screen (public/tech.html) ---------- */
.tech-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .7rem; height: 52px; padding: 0 max(1rem, calc((100% - 960px) / 2 + 2rem)); padding-top: env(safe-area-inset-top); box-sizing: content-box; background: var(--ink); color: #fff; }
.tech-top-text { display: grid; flex: 1; min-width: 0; line-height: 1.2; }
.tech-top-text b { font-family: var(--display); font-weight: 700; }
.tech-top-text small { color: #b9c2c4; font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.tech-logout { color: #e4e8e9; border-color: rgba(255,255,255,.25); }
.btn.tech-logout:hover { background: rgba(255,255,255,.08); color: #fff; }
.tech-app main.tech-main { margin: 0 auto; max-width: 960px; container: main / inline-size; }
.tech-app .trip-banner { top: calc(52px + env(safe-area-inset-top)); }
.tech-section { margin-bottom: 1.5rem; }
.tech-section h2, .tech-done summary h2 { display: flex; align-items: center; gap: .5rem; margin: 0 0 .6rem; font-size: 1.1rem; }
.tech-done summary { list-style: none; cursor: pointer; }
.tech-done summary::-webkit-details-marker { display: none; }
.tech-done summary h2::after { content: "Show"; margin-left: auto; font: 600 .85rem var(--font); color: var(--green); }
.tech-done[open] summary h2::after { content: "Hide"; }
.tech-jobs { display: grid; gap: .75rem; }
.tech-job { display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem; padding: .9rem 1rem; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--card-shadow); }
.tech-job.is-done { opacity: .8; }
.tj-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem .75rem; font-size: .9rem; }
.tj-when { display: inline-flex; align-items: center; gap: .45rem; }
.tj-main { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: stretch; justify-items: start; white-space: normal; gap: .15rem; width: 100%; min-width: 0; min-height: 0; margin: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.tj-main > span { max-width: 100%; overflow-wrap: anywhere; }
.tj-name { line-height: 1.25; font-family: var(--display); font-size: 1.2rem; font-weight: 700; color: var(--ink); }
.tj-line { color: var(--text); }
.tj-addr { display: flex; align-items: flex-start; gap: .35rem; }
.tj-addr .i, .jd-addr .i { flex: none; margin-top: .2rem; color: var(--green); }
.tj-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.tj-pill { padding: .15rem .6rem; border-radius: 999px; font-size: .82rem; font-weight: 600; background: #eef0f1; color: var(--muted); }
.tj-pill.done { background: var(--green-soft); color: var(--green-dark); }
.tj-pill.signed { background: #eaf0fb; color: #1d4ed8; }

/* one job */
dialog.job-dialog { width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); }
.job-sheet { max-height: calc(100dvh - 32px); overflow-y: auto; padding: 1.2rem 1.4rem 0; }
.job-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; padding-bottom: .6rem; border-bottom: 1px solid var(--line); }
.job-head h2 { margin: .1rem 0 0; padding: 0; border: 0; font-size: 1.35rem; }
.jd-sec { padding: .9rem 0; border-bottom: 1px solid var(--line); }
.jd-sec h3 { display: flex; align-items: center; gap: .5rem; margin: 0 0 .5rem; font-size: .95rem; }
.jd-addr { display: flex; gap: .4rem; margin: 0 0 .6rem; font-size: 1.05rem; color: var(--ink); }
.jd-buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.jd-big { margin: 0; font-size: 1.05rem; font-weight: 600; color: var(--ink); }
.jd-facts { display: grid; grid-template-columns: auto 1fr; gap: .15rem .9rem; margin: .4rem 0 0; }
.jd-facts dt { color: var(--muted); font-size: .85rem; }
.jd-facts dd { margin: 0; overflow-wrap: anywhere; }
.jd-list { margin: 0; padding-left: 1.2rem; }
.jd-list li { margin: .15rem 0; }
.jd-label { margin: .7rem 0 .25rem; font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.jd-note { margin: 0 0 .3rem; padding: .5rem .65rem; border-radius: 6px; background: var(--amber-soft); color: var(--ink); white-space: pre-wrap; }
.cond-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.cond-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .7rem; border: 1px solid var(--line-2); border-radius: 999px; font-size: .88rem; font-weight: 500; color: var(--text); cursor: pointer; }
.cond-chip:has(input:checked) { border-color: var(--amber); background: var(--amber-soft); color: var(--ink); }
.cond-chip input { margin: 0; }
.jd-field { display: grid; gap: .25rem; margin-bottom: .6rem; }
.jd-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .5rem; margin-bottom: .7rem; }
.jd-photos figure { margin: 0; }
.jd-photos img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: #eef0f1; }
.jd-photos figcaption { display: flex; align-items: center; justify-content: space-between; font-size: .8rem; color: var(--muted); }
.jd-photo-del { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; }
.jd-photo-del:hover { color: var(--red); }
label.btn { cursor: pointer; }
label.btn.busy { opacity: .6; pointer-events: none; }
.jd-signed, .jd-done { margin: 0; padding: .55rem .7rem; border-radius: 6px; background: var(--green-soft); color: var(--green-dark); }
.jd-footer { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; margin: 0 -1.4rem; padding: .8rem 1.4rem max(.9rem, env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); border-top: 1px solid var(--line); }

/* Settings › Technicians: each one's login */
.tech-access { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; }
.tech-access-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-left: auto; }
.tech-login { padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: #eef0f1; color: var(--muted); }
.tech-login.on { background: var(--green-soft); color: var(--green-dark); }
.tp-field { display: flex; gap: .5rem; margin-top: .25rem; }
.tp-field input { flex: 1; min-width: 0; }

@container main (max-width: 600px) {
  .tj-actions .btn { flex: 1 1 auto; justify-content: center; }
  .tech-access-actions { margin-left: 0; }
}
@media (max-width: 860px) {
  .tech-app main.tech-main { padding: 1rem 1rem 6rem; }
  .tech-logout span { display: none; }
  /* the job opens as a full-height sheet, easy to scroll with a thumb */
  dialog.job-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .job-sheet { max-height: 100dvh; height: 100%; padding: max(1rem, env(safe-area-inset-top)) 1rem 0; }
  .jd-footer { margin: 0 -1rem; padding-inline: 1rem; }
  .jd-footer .btn { flex: 1 1 auto; justify-content: center; }
}
.trip-visible { margin: -.2rem 0 .7rem; padding: .5rem .7rem; border-radius: 8px; background: #eef0f1; color: var(--text); }
.trip-visible.on { background: var(--green-soft); color: var(--green-dark); font-weight: 600; }

/* Insurance claims directory (public/insurance.js): the dealer accounts' cards (Settings) */
.ins-phone { font-size: .8rem; color: var(--text); white-space: nowrap; margin-right: .15rem; }
.ins-body > p { margin: .6rem 0 0; overflow-wrap: anywhere; }
.ins-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.ins-actions .ins-call { font-variant-numeric: tabular-nums; }
.ins-note { font-size: .88rem; color: var(--text); }
.ins-steps { margin: .6rem 0 0; padding-left: 1.2rem; font-size: .88rem; line-height: 1.45; }
.ins-steps li + li { margin-top: .2rem; }
.ins-missing b { display: inline-block; margin-left: .25rem; padding: 0 .45rem; border-radius: 99px; background: var(--amber-soft); color: #7a4300; font-size: .75rem; }
.ins-foot { display: flex; justify-content: flex-end; margin-top: .5rem; }
.ins-claim { margin: .2rem 0 0; }
.ins-claim a { font-weight: 600; }
#ins-count { margin-top: -.75rem; }
#insurer-dialog { width: min(560px, calc(100vw - 32px)); }
#insurer-dialog textarea { resize: vertical; }
#tab-insurance .filters { flex-wrap: nowrap; }
#tab-insurance .filters input { min-width: 0; }
@container main (max-width: 600px) {
  .ins-actions .btn { flex: 1 1 auto; }
  .ins-actions .ins-call { flex-basis: 100%; } /* the number is the main thing to tap */
  .ins-foot .btn { flex: 1; }
}
@media (max-width: 520px) {
  #insurer-dialog .row { grid-template-columns: 1fr; }
}

/* Back to top (any long page) */
.to-top { position: fixed; right: max(1rem, env(safe-area-inset-right)); bottom: calc(1.25rem + env(safe-area-inset-bottom) + var(--nf-badge)); z-index: 35; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 1px solid var(--line-2); background: var(--paper); color: var(--ink); box-shadow: 0 6px 18px rgba(31,36,38,.18); }
.to-top:hover { border-color: var(--green); color: var(--green); background: var(--paper); }
.to-top[hidden] { display: none; }
@media print { .to-top { display: none !important; } }

/* Tech job sheet: "On my way" at the top, or when it will be available */
.jd-onway { display: grid; gap: .4rem; margin-bottom: .8rem; }
.jd-onway .btn { width: 100%; min-height: 48px; font-size: 1rem; }
.jd-onway p { margin: 0; }
.jd-onway.is-live p { color: var(--green-dark); }
.jd-onway .pulse { width: 9px; height: 9px; border-radius: 50%; background: #9fe0b2; box-shadow: 0 0 0 0 rgba(159,224,178,.6); animation: pulse 2s infinite; }
.jd-onway-later { display: flex; gap: .5rem; align-items: flex-start; margin: 0 0 .8rem; padding: .6rem .7rem; border-radius: 8px; background: var(--page); color: var(--text); }
.jd-onway-later .i { flex: none; margin-top: .1rem; color: var(--muted); }
