/* Omni Service. Layout: office = 3-column board (form | status columns | map + job); technician = single mobile column with bottom nav. */
:root {
    --ink: #17232b;
    --ink-2: #4f5f69;
    --ink-3: #7d8b94;
    --bg: #f2f4f3;
    --surface: #ffffff;
    --line: #d9dfe2;
    --bar: #16323f;
    --bar-ink: #e8eef0;
    --accent: #0f6f8f;
    --accent-weak: #e2f0f5;
    --next: #c98a12;
    --good: #2f7d4f;
    --warn: #b7791f;
    --bad: #b3362d;
    --good-weak: #e5f3ea;
    --warn-weak: #fbf1df;
    --bad-weak: #f9e4e2;
    --sim: #6a4fb3;
    --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: 'IBM Plex Sans Condensed', 'Arial Narrow', var(--font);
    --font-mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
    --radius: 6px;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --ink: #e4eaed; --ink-2: #aab7be; --ink-3: #82919a; --bg: #0f171c; --surface: #172229; --line: #2a3a43;
        --bar: #0b1216; --bar-ink: #dce6ea; --accent: #49a9c8; --accent-weak: #15303a; --next: #e0a93b;
        --good: #5cb27e; --warn: #e0a93b; --bad: #e46a60; --good-weak: #173226; --warn-weak: #33280f; --bad-weak: #3a1d1b; --sim: #a38be6;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; text-wrap: balance; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.mono { font-family: var(--font-mono); font-size: .9em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; background: var(--bar); color: var(--bar-ink); padding: .6rem max(16px, env(safe-area-inset-right)) .6rem max(16px, env(safe-area-inset-left)); }
.topbar a { color: var(--bar-ink); text-decoration: none; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; color: inherit; text-decoration: none; }
.brand-mark { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 30% 50%, #9aa7ad 0 28%, transparent 30%), radial-gradient(circle at 72% 50%, #c9d1d5 0 28%, transparent 30%); }
.brand-lg { font-size: 1.6rem; color: var(--ink); }
.topnav { display: flex; gap: 1rem; flex-wrap: wrap; }
.topnav a { padding: .2rem 0; border-bottom: 2px solid transparent; opacity: .85; }
.topnav a[aria-current] { border-color: var(--next); opacity: 1; }
.who { margin-left: auto; font-size: .85rem; opacity: .8; }

.page { padding: 1.25rem max(16px, env(safe-area-inset-right)) 2rem max(16px, env(safe-area-inset-left)); max-width: 1100px; margin: 0 auto; }
.page-wide { max-width: none; }

/* Flash */
.flash { padding: .6rem .8rem; border-radius: var(--radius); margin: 0 0 .75rem; border: 1px solid var(--line); background: var(--surface); }
.flash-success { background: var(--good-weak); border-color: var(--good); }
.flash-warning { background: var(--warn-weak); border-color: var(--warn); }
.flash-error { background: var(--bad-weak); border-color: var(--bad); }
.flash-info { background: var(--accent-weak); border-color: var(--accent); }
.flash form.inline { display: inline; margin-left: .5rem; }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: 500 .9rem var(--font); padding: .5rem .9rem; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-small { padding: .3rem .6rem; font-size: .8rem; }
.btn-block { width: 100%; }
.btn-big { padding: .9rem 1rem; font-size: 1.05rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .75rem; min-width: 0; }
.field label, .field .label { font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .6rem; width: 100%; }
textarea { resize: vertical; }
.input-num { width: 6rem; text-align: right; }
.check { display: flex; gap: .5rem; align-items: center; margin: .35rem 0; font-size: .95rem; }
.check input { width: auto; }
.field-help { font-size: .8rem; color: var(--ink-3); margin: 0; }
.field-error { font-size: .8rem; color: var(--bad); margin: 0; }
.has-error input, .has-error textarea, .has-error select { border-color: var(--bad); }
.seg { display: flex; gap: .5rem; }
.seg label { display: flex; gap: .35rem; align-items: center; border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem .7rem; font-weight: 500; color: var(--ink); }
.seg input { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; margin: 0 0 1rem; background: var(--surface); }
legend { font-weight: 600; padding: 0 .3rem; font-size: .9rem; }

.chip { display: inline-block; font-size: .72rem; font-weight: 600; padding: .1rem .45rem; border-radius: 999px; background: var(--accent-weak); color: var(--accent); white-space: nowrap; vertical-align: middle; }
.chip-warn { background: var(--warn-weak); color: var(--warn); }
.chip-bad { background: var(--bad-weak); color: var(--bad); }
.chip-sim { background: color-mix(in srgb, var(--sim) 15%, transparent); color: var(--sim); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.empty-state, .empty { color: var(--ink-3); font-size: .9rem; }
.back { display: inline-block; margin-bottom: .5rem; text-decoration: none; font-size: .9rem; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: .25rem 0; }

/* Board */
.board-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.board-head p { margin: 0; }
.head-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.head-actions select { width: auto; }
.board-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr) 380px; gap: 1rem; align-items: start; }
@media (max-width: 1400px) { .board-layout { grid-template-columns: 300px minmax(0, 1fr); } .side { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; } }
@media (max-width: 860px) { .board-layout, .side { grid-template-columns: 1fr; } }
.log-call h2 { margin-bottom: .75rem; }
.rollover { margin: .25rem 0 1rem; font-size: .85rem; }
.rollover summary { cursor: pointer; color: var(--ink-2); margin-bottom: .5rem; }
.lookup { border: 1px dashed var(--line); border-radius: var(--radius); padding: .6rem .7rem; margin: -.25rem 0 .75rem; font-size: .85rem; background: var(--bg); }
.lookup .lk-name { font-weight: 600; }
.lookup .lk-row { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .25rem; }
.lookup.is-error { border-color: var(--bad); color: var(--bad); }

.board { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: .75rem; overflow-x: auto; padding-bottom: .25rem; }
@media (max-width: 1100px) { .board { grid-template-columns: repeat(5, minmax(180px, 1fr)); } }
.board-col { background: color-mix(in srgb, var(--line) 35%, transparent); border-radius: var(--radius); padding: .6rem; min-height: 200px; }
.board-col h3 { display: flex; justify-content: space-between; margin-bottom: .6rem; }
.count { font-family: var(--font-mono); color: var(--ink-3); }
.job-card { display: block; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--radius); padding: .55rem .6rem; margin-bottom: .5rem; color: var(--ink); text-decoration: none; font-size: .85rem; }
.job-card:hover { border-color: var(--accent); }
.job-card.is-selected { box-shadow: 0 0 0 2px var(--accent); }
.job-card.status-logged, .job-card.status-ready_to_schedule { border-left-color: var(--next); }
.job-card.status-dispatched, .job-card.status-en_route { border-left-color: var(--accent); }
.job-card.status-on_site, .job-card.status-in_progress { border-left-color: var(--good); }
.job-card.status-waiting_spares { border-left-color: var(--warn); }
.job-card.status-completed, .job-card.status-invoiced { opacity: .75; }
.job-card-top { display: flex; justify-content: space-between; align-items: center; }
.ref { font-family: var(--font-mono); font-size: .78rem; color: var(--ink-2); }
.pri { font-family: var(--font-mono); font-size: .72rem; font-weight: 600; color: var(--ink-3); }
.pri-1 { color: var(--bad); }
.pri-2 { color: var(--warn); }
.job-card-cust { font-weight: 600; margin-top: .15rem; }
.job-card-model { color: var(--ink-2); }
.job-card-meta { color: var(--ink-3); margin-top: .2rem; display: flex; gap: .3rem; flex-wrap: wrap; }
.age { margin-left: auto; font-family: var(--font-mono); }
.age-warn { color: var(--warn); }
.age-late { color: var(--bad); font-weight: 600; }
.job-card-error, .job-card-flag { margin-top: .3rem; font-size: .75rem; font-weight: 600; color: var(--bad); }
.job-card-flag { color: var(--warn); }

.side { display: flex; flex-direction: column; gap: 1rem; }
.map { height: 320px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); }
.tech-list { list-style: none; padding: 0; margin: .75rem 0 0; font-size: .85rem; }
.tech-list li { padding: .15rem 0; }

/* Trips: a technician's day (timeline beside the map). */
.tech-links { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; font-size: .85rem; color: var(--ink-2); margin: 0 0 1rem; }
.tech-links .chip { text-decoration: none; font-size: .8rem; }
.day-summary { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 .75rem; }
.day-summary .chip { font-size: .8rem; }
.chip-live { background: var(--good-weak); color: var(--good); }
.day-grid { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 1rem; align-items: start; }
.map-tall { height: min(70vh, 640px); }
.timeline { list-style: none; margin: 0; padding: 0; max-height: min(70vh, 640px); overflow-y: auto; }
.timeline li { display: grid; grid-template-columns: 3rem 1fr; gap: .5rem; padding: .45rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.timeline time { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.timeline .tl-drive { color: var(--ink-2); }
.timeline .swatch { display: inline-block; width: .8rem; height: .3rem; border-radius: 2px; margin-right: .4rem; vertical-align: middle; }
.timeline .stop-no { display: inline-grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 50%; background: var(--ink-2); color: var(--surface); font-size: .72rem; font-weight: 700; margin-right: .35rem; }
.timeline .tl-start strong, .timeline .tl-end strong { color: var(--good); }
@media (max-width: 800px) { .day-grid { grid-template-columns: 1fr; } .map-tall { height: 55vh; } .timeline { max-height: none; } }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--good); margin-right: .4rem; }
.dot-off { background: var(--bad); }
.tech-marker { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--accent); }
.tech-marker.off { background: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.job-marker { width: 12px; height: 12px; transform: rotate(45deg); background: var(--next); border: 2px solid #fff; }

.job-panel-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.status-chip.status-waiting_spares { background: var(--warn-weak); color: var(--warn); }
.status-chip.status-completed, .status-chip.status-invoiced, .status-chip.status-on_site, .status-chip.status-in_progress { background: var(--good-weak); color: var(--good); }
.facts { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .3rem .75rem; margin: .5rem 0 1rem; font-size: .9rem; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.dispatch { margin: 1rem 0; }
.ranking { list-style: none; padding: 0; margin: 0 0 .75rem; }
.ranking label { display: grid; grid-template-columns: auto 1fr; gap: .1rem .5rem; padding: .45rem .5rem; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .35rem; cursor: pointer; }
.ranking input { width: auto; grid-row: span 2; align-self: center; }
.ranking label:has(input:checked) { border-color: var(--accent); background: var(--accent-weak); }
.rank-name { font-weight: 600; }
.rank-meta { font-size: .8rem; color: var(--ink-2); display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; }
.visits { padding-left: 1.1rem; font-size: .9rem; }
.visits li { margin-bottom: .5rem; }
.timeline { display: flex; flex-wrap: wrap; gap: .2rem .8rem; font-size: .8rem; color: var(--ink-2); }
.sim-tools { display: flex; flex-direction: column; gap: .4rem; margin: .75rem 0; padding: .6rem; border: 1px dashed var(--sim); border-radius: var(--radius); }
.sim-tools .btn { border-color: var(--sim); color: var(--sim); }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: .55rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); background: color-mix(in srgb, var(--line) 25%, transparent); white-space: nowrap; }
.table .num { text-align: right; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.bar-cell { position: relative; min-width: 7rem; }
.bar { position: absolute; left: .7rem; right: .7rem; top: 50%; height: 6px; transform: translateY(-50%); }
.bar::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--accent-weak); border-radius: 3px; }
.bar-val { position: relative; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin: 1rem 0; }
.stats > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; }
.stat-val { display: block; font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; }
.stat-label { color: var(--ink-3); font-size: .8rem; }
.model-row { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.model-actions { display: flex; gap: .5rem; align-items: center; min-width: 0; flex: 1 1 320px; max-width: 520px; }

/* Fincon log */
.log-row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .4rem; }
.log-row summary { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; padding: .5rem .7rem; cursor: pointer; font-size: .88rem; }
.log-error { border-color: var(--bad); }
.method { font-family: var(--font-mono); font-size: .72rem; font-weight: 600; padding: .05rem .35rem; border-radius: 3px; background: var(--accent-weak); color: var(--accent); }
.method-post { background: var(--warn-weak); color: var(--warn); }
.log-body { padding: 0 .7rem .7rem; }
.log-body h4 { margin: .6rem 0 .2rem; font-size: .75rem; text-transform: uppercase; color: var(--ink-2); }
pre { margin: 0; padding: .6rem; background: var(--bg); border-radius: var(--radius); overflow-x: auto; font: .8rem/1.4 var(--font-mono); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem max(16px, env(safe-area-inset-right)) 1rem max(16px, env(safe-area-inset-left)); }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }

/* Technician app */
body.tech { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
.tech-bar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; background: var(--bar); color: var(--bar-ink); padding: calc(.6rem + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) .6rem max(16px, env(safe-area-inset-left)); }
.loc-pill { font-size: .75rem; font-weight: 600; padding: .2rem .6rem; border-radius: 999px; background: color-mix(in srgb, var(--good) 30%, transparent); color: #d8f3e3; }
.loc-pill[data-off="1"] { background: var(--bad); color: #fff; }
.loc-warning { background: var(--bad-weak); border-bottom: 2px solid var(--bad); padding: .75rem max(16px, env(safe-area-inset-right)) .75rem max(16px, env(safe-area-inset-left)); font-size: .9rem; }
.loc-on { display: flex; gap: .5rem; align-items: end; flex-wrap: wrap; margin-top: .5rem; }
.loc-on label { width: 100%; font-size: .8rem; font-weight: 600; }
.loc-on select { flex: 1; }
.tech-main { padding: 1rem max(16px, env(safe-area-inset-right)) 1rem max(16px, env(safe-area-inset-left)); max-width: 640px; margin: 0 auto; }
.tech-h1 { font-size: 1.4rem; }
.tech-h2 { font-size: 1rem; margin-top: 1.5rem; }
.tech-job { display: block; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: .8rem; margin-bottom: .75rem; color: var(--ink); text-decoration: none; }
.tech-job.status-on_site, .tech-job.status-in_progress { border-left-color: var(--good); }
.tech-job.status-ready_to_schedule { border-left-color: var(--next); }
.tech-job-top { display: flex; justify-content: space-between; align-items: center; }
.tech-job-cust { font-weight: 600; font-size: 1.05rem; margin-top: .2rem; }
.tech-job-fault { margin-top: .35rem; font-size: .9rem; }
.steps { list-style: none; padding: 0; margin: 1rem 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; }
.steps li { display: flex; flex-direction: column; gap: .1rem; padding: .45rem; border-radius: var(--radius); border: 1px solid var(--line); font-size: .78rem; text-align: center; background: var(--surface); }
.steps li.done { background: var(--good-weak); border-color: var(--good); }
.steps li.next { border-color: var(--next); box-shadow: inset 0 -3px 0 var(--next); font-weight: 600; }
.gps-note { text-align: center; margin-top: .4rem; }
.part-line { display: grid; grid-template-columns: 7rem minmax(0, 1fr) 3.5rem; gap: .4rem; margin-bottom: .4rem; }
.signature { width: 100%; height: 180px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; touch-action: none; }
.sig-actions { display: flex; justify-content: flex-end; margin: .35rem 0 .75rem; }
.tech-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tech-nav a { text-align: center; padding: .9rem .5rem; text-decoration: none; color: var(--ink-2); font-weight: 500; }
.tech-nav a[aria-current] { color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.done-list li, .time-list li { border-bottom: 1px solid var(--line); }

@media (max-width: 420px) { .field-pair { grid-template-columns: 1fr; } .facts { grid-template-columns: 1fr; } .facts dt { margin-top: .4rem; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* PWA: install / notification buttons */
.app-tools { display: inline-flex; gap: .4rem; margin-right: .6rem; vertical-align: middle; }
.app-tools:not(:has(.app-tool:not([hidden]))) { display: none; }
.topbar .app-tool { background: transparent; color: var(--bar-ink); border-color: color-mix(in srgb, var(--bar-ink) 35%, transparent); }
.app-tool[data-state="on"] { border-color: var(--good); }
.app-tool[data-state="blocked"] { opacity: .7; }
.tech-tools { padding: .5rem max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
.tech-tools .app-tools { margin: 0; }
.tech-tools:not(:has(.app-tool:not([hidden]), .ios-hint:not([hidden]))) { display: none; }
.ios-hint { font-size: .8rem; color: var(--ink-3); margin: .4rem 0 0; }
.topbar .ios-hint { display: none; }

/* Report photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .5rem; margin: .5rem 0; }
.photo-grid:empty { display: none; }
.photo-thumb { position: relative; margin: 0; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del { position: absolute; top: 2px; right: 2px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.photo-add { position: relative; overflow: hidden; }
.photo-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.report-links { margin-top: .25rem; }
.report-email-missing { color: var(--warn); }
.photo-flags { margin: .25rem 0; padding-left: 1.1rem; color: var(--warn); }
.email-again { display: flex; gap: .4rem; margin-top: .3rem; }
.email-again input { flex: 1; min-width: 0; font-size: .8rem; padding: .25rem .4rem; }

/* Spares and van stock */
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs a { padding: .45rem .8rem; text-decoration: none; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current] { color: var(--ink); border-color: var(--accent); font-weight: 600; }
.tabs-small a { font-size: .85rem; padding: .3rem .6rem; }
.panel + .panel, .two-col + .panel, .panel + .two-col { margin-top: 1rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.panel-head h2 { margin: 0; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; margin-top: 1rem; }
.two-col-wide { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.row-line { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.row-line:last-child { border-bottom: 0; }
.inline-form { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.inline-form input:not(.input-num) { flex: 1; min-width: 12rem; }
.issue-form { display: grid; grid-template-columns: 9rem minmax(0, 1fr) 5rem minmax(0, 1fr) auto; gap: .5rem; align-items: end; }
.issue-form .field { margin: 0; }
.table td.actions { display: flex; gap: .3rem; flex-wrap: wrap; }
.table tr.row-warn td { background: var(--warn-weak); }
.table tr.row-bad td { background: var(--bad-weak); }
.table td.warn, .warn { color: var(--warn); font-weight: 600; }
.ok { color: var(--good); font-weight: 600; }
.part-line:has(.from-van) { grid-template-columns: 6.5rem minmax(0, 1fr) 3.2rem auto; }
.from-van { display: flex; align-items: center; gap: .25rem; font-size: .8rem; white-space: nowrap; }
.from-van input { width: auto; }
.van-list li { display: flex; gap: .5rem; align-items: baseline; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.van-list li span:nth-child(2) { flex: 1; }
.van-qty { font-family: var(--font-mono); }
.van-low .van-qty { color: var(--warn); }
.van-out .van-qty { color: var(--bad); }
@media (max-width: 800px) { .two-col-wide, .issue-form { grid-template-columns: 1fr; } }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.chip-branch { background: color-mix(in srgb, var(--next) 18%, transparent); color: var(--ink); }
.branch-tabs { border-bottom: 0; margin: .4rem 0 0; }
.timeline .tl-gap { background: var(--warn-weak); }
.timeline .tl-gap strong { color: var(--warn); }

/* Routes: a technician's stops for the rest of the day. */
.route-stops { list-style: none; margin: 0; padding: 0; }
.route-stops li { display: grid; grid-template-columns: 1.6rem 1fr auto; gap: .5rem; align-items: start; padding: .55rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.route-stops .stop-no { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: #c2410c; color: #fff; font-size: .75rem; font-weight: 700; }
.route-stops .is-under-way .stop-no { background: #7c3aed; }
.route-stops .is-late .stop-no { background: var(--bad); }
.route-stop a { text-decoration: none; }
.route-leg { margin-bottom: .1rem; }
.route-move { display: flex; flex-direction: column; gap: .25rem; }
.route-move .btn { padding: .15rem .5rem; }
.suggest { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
/* Invoicing: completed calls waiting for their Fincon invoice. */
.invoicing-bar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; }
.tab { font: inherit; font-size: .85rem; padding: .35rem .7rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); cursor: pointer; }
.tab.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab .count { font-weight: 700; margin-left: .2rem; }
.inv-card { border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: .75rem; background: var(--surface); }
.inv-card.is-ready { border-left-color: var(--good); }
.inv-card.is-problem { border-left-color: var(--bad); }
.inv-head, .inv-foot { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; }
.inv-card p { margin: .35rem 0; }
.inv-foot { margin-top: .5rem; }
.table-compact th, .table-compact td { padding: .25rem .5rem; font-size: .85rem; }
.inv-recent { margin-top: 1.5rem; }
.inv-recent-head { font-weight: 600; cursor: pointer; margin-bottom: .5rem; }
/* A button that looks like a link. */
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }

/* Cancelled calls. */
.job-card.status-cancelled { opacity: .6; }
.job-card.status-cancelled .ref { text-decoration: line-through; }
.status-chip.status-cancelled { background: var(--bad-weak); color: var(--bad); }
.cancel-call { margin: 1rem 0; }
.cancel-call summary { cursor: pointer; color: var(--bad); font-size: .9rem; }
.cancel-call form { display: grid; gap: .5rem; margin-top: .5rem; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
/* Dashboard. Series colours validated (dataviz validate_palette) against this app's surfaces. */
.viz-root { --series-1: #2a78d6; --series-2: #eb6834; --viz-grid: var(--line); --viz-muted: var(--ink-3); --viz-text: var(--ink-2); }
@media (prefers-color-scheme: dark) { :root .viz-root { --series-1: #3987e5; --series-2: #d95926; } }
.dashboard { display: flex; flex-direction: column; gap: 1rem; }
.filter-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.filter-row select { width: auto; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .9rem; }
.kpi-label { font-size: .8rem; color: var(--ink-2); }
.kpi-value { font-size: 1.75rem; font-weight: 600; line-height: 1.2; margin: .15rem 0; }
.kpi-sub { font-size: .78rem; color: var(--ink-3); }
.kpi-delta { font-size: .78rem; }
.kpi-delta.tone-good { color: var(--good); }
.kpi-delta.tone-bad { color: var(--bad); }
.kpi-delta.tone-flat { color: var(--ink-3); }
.chart-card h2, .dashboard .panel h2 { font-size: 1rem; margin: 0 0 .5rem; }
.chart-box { position: relative; height: 280px; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.age-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.age-bars li { display: grid; grid-template-columns: 6.5rem 1fr 2.5rem; gap: .6rem; align-items: center; font-size: .85rem; }
.age-track { height: 12px; }
.age-fill { display: block; height: 12px; min-width: 0; background: var(--series-1); border-radius: 0 4px 4px 0; }
.age-n { text-align: right; font-variant-numeric: tabular-nums; }
.oldest li { padding: .3rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.dashboard .table td.num, .dashboard .table th.num { font-variant-numeric: tabular-nums; }