/* Parts inventory - one stylesheet, built for a shop floor monitor. */

:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --ink: #16202c;
  --ink-2: #44526a;
  --muted: #74839a;
  --line: #d8e0ea;
  --brand: #17457e;
  --brand-2: #2563c9;
  --brand-dark: #12395f;
  --ok-bg: #e3f6e9; --ok-ink: #14663a; --ok-line: #a9dfbf;
  --warn-bg: #fdf1dd; --warn-ink: #8a5512; --warn-line: #f0cf9b;
  --bad-bg: #fdeaea; --bad-ink: #9c2420; --bad-line: #f0b6b3;
  --info-bg: #e6eefb; --info-ink: #1b4d94;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20,32,48,.06), 0 6px 18px rgba(20,32,48,.06);
  --mono: "Cascadia Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 "Segoe UI", -apple-system, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 10px; line-height: 1.25; }
h1 { font-size: 26px; letter-spacing: -.2px; }
h2 { font-size: 19px; }
h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-2); }
p { margin: 0 0 12px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: 12px; }

/* ---------------------------------------------------------- header / nav */

header.top {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 40;
}
.top-inner {
  max-width: 1360px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { font-size: 17px; font-weight: 650; letter-spacing: .2px; display: flex; align-items: center; gap: 10px; }
.brand-logo { height: 34px; width: auto; max-width: 160px; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px 4px; }
.brand span { display: block; font-size: 11.5px; font-weight: 400; opacity: .75;
              text-transform: uppercase; letter-spacing: 1px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px;
             font-size: 13px; }
.top-right a { color: #cfe0f7; }
.whoami { text-align: right; line-height: 1.3; }
.whoami b { display: block; font-size: 14px; color: #fff; }

nav.tabs {
  background: var(--brand-dark);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
nav.tabs .inner {
  max-width: 1360px; margin: 0 auto; padding: 0 12px;
  display: flex; gap: 2px; flex-wrap: wrap;
}
nav.tabs a {
  color: #c6d8ef; text-decoration: none; padding: 11px 12px;
  font-size: 14px; font-weight: 550; white-space: nowrap;
  border-bottom: 3px solid transparent;
}
nav.tabs a:hover { background: rgba(255,255,255,.07); color: #fff; }
nav.tabs a.on { color: #fff; border-bottom-color: #6fa8ff; background: rgba(255,255,255,.09); }
nav.tabs .badge {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px;
  background: #d97706; color: #fff; border-radius: 9px; font-size: 11px;
  text-align: center; font-weight: 700;
}
/* an explicit display would otherwise beat the browser default for [hidden] */
nav.tabs .badge[hidden] { display: none; }

main { max-width: 1360px; margin: 0 auto; padding: 22px 20px 60px; }

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

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 18px;
}
.card.pad0 { padding: 0; overflow: hidden; }
.card h2 { display: flex; align-items: baseline; gap: 10px; }
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 18px; }
.grid { display: grid; gap: 18px; }
.grid > * { min-width: 0; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.side { grid-template-columns: minmax(0,2fr) minmax(280px,1fr); }
@media (max-width: 960px) {
  .grid.two, .grid.three, .grid.side { grid-template-columns: 1fr; }
}

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

label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
        text-transform: uppercase; letter-spacing: .5px; margin-bottom: 5px; }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=tel],
input[type=date], input[type=search], select, textarea {
  width: 100%; max-width: 100%; padding: 9px 11px; font-size: 15px; font-family: inherit;
  color: var(--ink); background: #fff;
  border: 1px solid #c3cddb; border-radius: 8px; outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(37,99,201,.15);
}
textarea { min-height: 70px; resize: vertical; max-width: 100%; }
.field { margin-bottom: 14px; min-width: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
/* min-width:0 lets a flex child shrink past its content, which is what stops a
   long input or placeholder forcing the page wider than a phone screen. */
.row > * { min-width: 0; }
.row > .field { flex: 1 1 180px; margin-bottom: 0; }
.row.tight { gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; text-transform: none;
         font-size: 14px; letter-spacing: 0; font-weight: 500; color: var(--ink); }
.check input { width: auto; }

.scan-field input {
  font-family: var(--mono); font-size: 26px; font-weight: 700; padding: 16px 16px;
  letter-spacing: 1px; text-transform: uppercase; border-width: 2px;
  border-color: var(--brand-2); background: #fbfdff;
}
.scan-hint { font-size: 13px; color: var(--muted); margin-top: 6px; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 16px; font-size: 14.5px; font-weight: 600; font-family: inherit;
  color: #fff; background: var(--brand-2); border: 1px solid var(--brand-2);
  border-radius: 8px; cursor: pointer; text-decoration: none; line-height: 1.2;
}
button:hover, .btn:hover { background: #1c54ab; text-decoration: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost, button.ghost {
  background: #fff; color: var(--ink); border-color: #c3cddb;
}
.btn.ghost:hover, button.ghost:hover { background: var(--surface-2); }
.btn.danger, button.danger { background: #b91c1c; border-color: #b91c1c; }
.btn.danger:hover, button.danger:hover { background: #991b1b; }
.btn.ok, button.ok { background: #15803d; border-color: #15803d; }
.btn.ok:hover, button.ok:hover { background: #126c34; }
.btn.big, button.big { padding: 14px 22px; font-size: 17px; }
.btn.sm, button.sm { padding: 6px 11px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

.tile-links { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .tile-links { grid-template-columns: 1fr; } }
.tile {
  display: block; padding: 30px 26px; background: var(--surface);
  border: 2px solid var(--line); border-radius: 14px; text-decoration: none;
  color: var(--ink); box-shadow: var(--shadow); transition: .12s;
}
.tile:hover { border-color: var(--brand-2); transform: translateY(-2px); text-decoration: none; }
.tile b { display: block; font-size: 21px; margin-bottom: 6px; }
.tile span { color: var(--muted); font-size: 14px; }

/* ---------------------------------------------------------- tables */

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; padding: 9px 12px; background: var(--surface-2);
  border-bottom: 1px solid var(--line); font-size: 11.5px; letter-spacing: .5px;
  text-transform: uppercase; color: var(--ink-2); white-space: nowrap;
}
table.data td { padding: 9px 12px; border-bottom: 1px solid #edf1f6; vertical-align: top; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #f8fafd; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .pn { font-family: var(--mono); font-weight: 700; }
.table-wrap { overflow-x: auto; }

/* ---------------------------------------------------------- pills / flags */

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .3px; white-space: nowrap;
  border: 1px solid transparent;
}
.pill.ok   { background: var(--ok-bg);   color: var(--ok-ink);   border-color: var(--ok-line); }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.pill.bad  { background: var(--bad-bg);  color: var(--bad-ink);  border-color: var(--bad-line); }
.pill.info { background: var(--info-bg); color: var(--info-ink); border-color: #bcd2f2; }
.pill.grey { background: #eef1f5; color: var(--ink-2); border-color: var(--line); }
.pill.fleet { background: #e6f1f4; color: #0f5468; border-color: #b6d6df; font-weight: 700; letter-spacing: .03em; }

.note {
  padding: 12px 14px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface-2); font-size: 14px;
}
.note.ok   { background: var(--ok-bg);   border-color: var(--ok-line);   color: var(--ok-ink); }
.note.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.note.bad  { background: var(--bad-bg);  border-color: var(--bad-line);  color: var(--bad-ink); }
.note.info { background: var(--info-bg); border-color: #bcd2f2; color: var(--info-ink); }

.lockbar {
  background: var(--warn-bg); border-bottom: 2px solid var(--warn-line);
  color: var(--warn-ink); padding: 10px 20px; font-weight: 600; font-size: 14px;
  text-align: center;
}

.flashes { margin-bottom: 16px; }
.flashes .note { margin-bottom: 8px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.stat .n { font-size: 30px; font-weight: 700; line-height: 1.1; letter-spacing: -.5px; }
.stat .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px;
           color: var(--muted); margin-top: 4px; }
.stat.bad .n { color: var(--bad-ink); }
.stat.warn .n { color: var(--warn-ink); }
.stat.ok .n { color: var(--ok-ink); }

/* ---------------------------------------------------------- scan feed */

.feed { display: flex; flex-direction: column; gap: 10px; }
.feed-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-left-width: 4px; border-radius: 9px;
  background: #fff; animation: pop .18s ease-out;
}
.feed-item.ok   { border-left-color: #15803d; background: #f6fcf8; }
.feed-item.warn { border-left-color: #b45309; background: #fffaf2; }
.feed-item.bad  { border-left-color: #b91c1c; background: #fdf6f6; }
.feed-item.wait { border-left-color: #2563c9; background: #f7faff; }
.feed-item .body { flex: 1 1 auto; min-width: 0; }
.feed-item .pn { font-family: var(--mono); font-weight: 700; font-size: 16px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; } }

.pending-card {
  border: 2px solid var(--brand-2); border-radius: 10px; padding: 14px;
  background: #f7faff; margin-bottom: 12px;
}
.pending-card .ref { font-family: var(--mono); font-weight: 700; color: var(--brand-2); }

/* ---------------------------------------------------------- supersession */

.tree { font-size: 14.5px; }
.tree-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px;
            border-radius: 7px; }
.tree-row + .tree-row { margin-top: 2px; }
.tree-row.cur { background: var(--info-bg); border: 1px solid #bcd2f2; font-weight: 650; }
.tree-row .arm { color: var(--muted); font-family: var(--mono); white-space: pre; }
.tree-row .pn { font-family: var(--mono); font-weight: 700; }
.tree-row .desc { color: var(--ink-2); font-size: 13.5px; }
.tree-row .qty { margin-left: auto; font-size: 12.5px; color: var(--muted); }

/* ---------------------------------------------------------- bar chart */

.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.bar-row .lab { width: 78px; color: var(--ink-2); flex: none; }
.bar-row .track { flex: 1 1 auto; background: #e9eef5; border-radius: 4px; height: 16px;
                  overflow: hidden; }
.bar-row .fill { background: var(--brand-2); height: 100%; border-radius: 4px; min-width: 2px; }
.bar-row .val { width: 46px; text-align: right; font-variant-numeric: tabular-nums;
                color: var(--ink-2); flex: none; }

/* ---------------------------------------------------------- login */

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
             padding: 24px; background: linear-gradient(160deg, #17457e, #0d2340); }
.auth-card { width: 100%; max-width: 460px; background: #fff; border-radius: 14px;
             box-shadow: 0 18px 50px rgba(6,20,40,.35); padding: 30px; }
.auth-card h1 { font-size: 23px; }
.auth-card .sub { color: var(--muted); margin-bottom: 22px; font-size: 14px; }

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

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
           margin-bottom: 14px; }
.toolbar form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid #c3cddb; border-radius: 8px; overflow: hidden; }
.seg a { padding: 7px 13px; font-size: 13.5px; color: var(--ink-2); background: #fff;
         border-right: 1px solid #e3e9f1; }
.seg a:last-child { border-right: none; }
.seg a:hover { background: var(--surface-2); text-decoration: none; }
.seg a.on { background: var(--brand-2); color: #fff; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); font-size: 12.5px; text-transform: uppercase;
         letter-spacing: .4px; padding-top: 2px; }
.kv dd { margin: 0; }

.toast-wrap { position: fixed; right: 18px; bottom: 18px; z-index: 90;
              display: flex; flex-direction: column; gap: 8px; }
.toast { background: #16202c; color: #fff; padding: 11px 16px; border-radius: 9px;
         box-shadow: 0 8px 24px rgba(0,0,0,.25); font-size: 14px; max-width: 380px; }
.toast.ok { background: #15803d; }
.toast.bad { background: #b91c1c; }
.toast.warn { background: #b45309; }

details.more { margin-top: 10px; }
details.more summary { cursor: pointer; color: var(--brand-2); font-size: 13.5px; }

hr.sep { border: none; border-top: 1px solid var(--line); margin: 18px 0; }

.qrshot { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 6px; }

/* The settings page is long; keep Save reachable without hunting for it. */
.savebar {
  position: sticky; bottom: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  border-color: var(--brand-2);
  box-shadow: 0 -4px 18px rgba(20,32,48,.10);
}
.savebar.dirty { background: var(--warn-bg); border-color: var(--warn-line); }

@media (max-width: 560px) {
  main { padding: 16px 12px 48px; }
  h1 { font-size: 22px; }
  .card { padding: 14px; }
  .card-body, .card-head { padding: 12px 14px; }
  .scan-field input { font-size: 20px; padding: 13px 12px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 10px; }
  .stat { padding: 11px 12px; }
  .stat .n { font-size: 24px; }
  .toolbar form { width: 100%; }
  .toolbar input[type=search] { width: 100% !important; }
  .btn-row { width: 100%; }
}

@media print {
  header.top, nav.tabs, .no-print, .toast-wrap, .lockbar { display: none !important; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .card { box-shadow: none; border-color: #bbb; break-inside: avoid; }
  a { color: #000; }
}

/* ---------------------------------------------------------------- one-off tweaks
   The content-security policy blocks inline style attributes, so the few
   one-off tweaks a screen needs live here. */
.gap-below { margin-bottom: 14px; }
.full { width: 100%; }
.inline-form { display: inline; margin: 0; }
button.linkish {
  background: none; border: none; padding: 0; font: inherit; cursor: pointer;
  color: inherit; text-decoration: underline; text-underline-offset: 2px;
}
button.linkish:hover { background: none; opacity: .85; }
ul.plain { list-style: none; margin: 0 0 14px; padding: 0; }
ul.plain li { padding: 5px 0; border-bottom: 1px solid #edf1f6; }
ul.plain li:last-child { border-bottom: none; }
@media (max-width: 800px) { .grid.two { grid-template-columns: 1fr; } }
.card.narrow { max-width: 520px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.actions form { margin: 0; }
.temp-password {
  display: block; text-align: center; font-size: 34px; font-weight: 600; letter-spacing: 4px;
  padding: 16px; background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--radius);
}

/* ---------------------------------------------------------------- Phase 1b */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin: 0; display: flex; align-items: center; gap: 10px; }
.actions.start { justify-content: flex-start; }
.crumbs { margin: 0 0 4px; font-size: 13px; }
.gap-top { margin-top: 14px; }
.code-input { font-family: var(--mono); font-size: 24px; letter-spacing: 6px; text-align: center; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 14px; }
.qr { margin: 10px 0; }
.qr svg { width: 200px; height: 200px; border: 1px solid var(--line); border-radius: 8px; }
.setup-key { font-size: 17px; letter-spacing: 1px; word-break: break-all; }
.link-out { font-family: var(--mono); font-size: 13px; word-break: break-all; user-select: all; }
.history { margin-top: 12px; font-size: 14px; }
.narrow-field { flex: 0 0 110px !important; }
/* Compact edit rows (company page): fields share one line, button at the end. */
.row.tight { flex-wrap: nowrap; align-items: center; }
.row.tight > input, .row.tight > select { width: auto; flex: 1 1 120px; min-width: 0; }
.row.tight > button { flex: none; }
@media (max-width: 700px) { .row.tight { flex-wrap: wrap; } }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* Badge: credit-card size, printed at 100% */
.badge-sheet { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 40px 16px; }
.badge-card {
  width: 85.6mm; height: 54mm; box-sizing: border-box; padding: 3mm 4mm;
  border: 1px solid #b8c2cf; border-radius: 3mm; background: #fff; color: #111;
  display: grid; grid-template-columns: 30mm 1fr; grid-template-rows: auto 1fr auto auto;
  column-gap: 4mm; align-items: center;
}
.badge-company { grid-column: 1 / -1; font-weight: 700; font-size: 10pt; color: #17457e; }
.badge-qr { grid-row: 2 / span 3; }
.badge-qr svg { width: 30mm; height: 30mm; display: block; }
.badge-name { font-size: 13pt; font-weight: 700; line-height: 1.15; align-self: end; }
.badge-role { font-size: 9pt; color: #44526a; }
.badge-code { font-size: 8pt; color: #44526a; }
.badge-help { max-width: 420px; text-align: center; }
@media print {
  body { background: #fff; }
  .badge-sheet { padding: 0; }
  .badge-card { border-color: #999; }
}

/* ---------------------------------------------------------------- shop workflow */
:root {
  --stage-check_in: #64748b; --stage-inspection: #2563c9; --stage-working: #1f7a4f;
  --stage-idle: #b7791f; --stage-completed: #0f766e; --stage-ready_to_invoice: #6d4fc2;
  --stage-invoiced: #9a3412; --stage-closed: #94a3b8;
  /* Efficiency wheel: checked for colour-blind separation against the green. */
  --wheel-green: #1f7a4f; --wheel-orange: #f0943d; --wheel-yellow: #d4a90c;
  --wheel-gray: #9aa5b1; --wheel-gold: #c9a227; --wheel-track: #edf1f6;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.card.narrow-wide { max-width: 760px; }
.narrow-field-wide { flex: 0 0 150px !important; }
.search-row { max-width: 720px; }
.search-row input[type=search] { flex: 3 1 260px; }
fieldset.lines-fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 4px; margin: 0 0 14px; }
fieldset.lines-fieldset legend { padding: 0 6px; font-weight: 600; }
details > summary { cursor: pointer; color: var(--brand-2); font-weight: 600; margin: 4px 0; }

.stage-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  color: #fff; background: var(--stage-check_in); vertical-align: middle; white-space: nowrap; }
.stage-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--stage-check_in); flex: none; }
.stage-check_in { background: var(--stage-check_in); }
.stage-inspection { background: var(--stage-inspection); }
.stage-working { background: var(--stage-working); }
.stage-idle { background: var(--stage-idle); }
.stage-completed { background: var(--stage-completed); }
.stage-ready_to_invoice { background: var(--stage-ready_to_invoice); }
.stage-invoiced { background: var(--stage-invoiced); }
.stage-closed { background: var(--stage-closed); }

.board-count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 600; }
.stage-edge-check_in { border-left-color: var(--stage-check_in); }
.stage-edge-inspection { border-left-color: var(--stage-inspection); }
.stage-edge-working { border-left-color: var(--stage-working); }
.stage-edge-idle { border-left-color: var(--stage-idle); }
.stage-edge-completed { border-left-color: var(--stage-completed); }
.stage-edge-ready_to_invoice { border-left-color: var(--stage-ready_to_invoice); }
.stage-edge-invoiced { border-left-color: var(--stage-invoiced); }

.line-card h2 { font-size: 17px; margin: 0; }
.line-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.line-status { font-size: 13px; font-weight: 600; }
.status-done { color: var(--ok-ink); }
.status-working { color: var(--stage-working); }
.status-idle { color: var(--warn-ink); }
.status-inspection { color: var(--stage-inspection); }
.status-check_in { color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.timeline li { display: flex; gap: 10px; align-items: baseline; }

.invoice { max-width: 860px; margin: 0 auto; padding: 32px 20px; background: var(--surface); }
.invoice-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 16px; }
.invoice-company { font-size: 22px; font-weight: 700; }
.invoice-title { font-size: 20px; font-weight: 700; }
.invoice-parties { margin-bottom: 16px; }
.invoice-lines tfoot td { border-top: 2px solid var(--line); padding-top: 10px; }
.invoice-paid { margin-top: 16px; font-weight: 700; color: var(--ok-ink); }

.tech-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tech-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.tech-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--wheel-track); border: 2px solid var(--stage-check_in); flex: none; }
.tech-on .tech-dot { background: var(--stage-working); border-color: var(--stage-working); }
.tech-on { border-color: #9fd2b8; }
/* On shift but on no job: solid yellow, so it never reads as "not clocked in". */
.tech-idle .tech-dot { background: var(--wheel-yellow); border-color: var(--wheel-yellow); }
.tech-idle { border-color: #ecd98c; }
/* Not clocked in: a hollow gray ring. */
.tech-out .tech-dot { background: transparent; border-color: var(--wheel-gray); }
.dot-key { display: flex; gap: 16px; flex-wrap: wrap; margin: 0 0 12px; }
.dot-key span { display: inline-flex; align-items: center; gap: 6px; }
.dot-key .tech-dot { width: 12px; height: 12px; }
.tech-now { margin: 0 0 6px; }

.clock-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px;
  border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 16px; }
.clock-bar.on { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); font-weight: 600; }
.clock-bar form { margin: 0; }
.job-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.job-card.job-on { border-color: var(--ok-line); box-shadow: 0 0 0 2px var(--ok-bg); }
.job-complaint { font-size: 20px; margin: 4px 0; }

.month-nav { align-items: center; gap: 10px; }
.card.efficiency { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; margin-bottom: 18px; }
.wheel { width: 240px; height: 240px; flex: none; }
.wheel circle { fill: none; stroke-width: 26; }
.wheel-track { stroke: var(--wheel-track); }
.wheel-green { stroke: var(--wheel-green); }
.wheel-orange { stroke: var(--wheel-orange); }
.wheel-yellow { stroke: var(--wheel-yellow); }
.wheel-gray { stroke: var(--wheel-gray); }
.wheel-gold { stroke: var(--wheel-gold); }
.wheel-number { font-size: 38px; font-weight: 700; text-anchor: middle; fill: var(--ink); }
.wheel-caption { font-size: 14px; text-anchor: middle; fill: var(--muted); }
.efficiency-facts { flex: 1 1 260px; }
.efficiency-empty { padding: 20px 0; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }
.swatch-green { background: var(--wheel-green); }
.swatch-orange { background: var(--wheel-orange); }
.swatch-yellow { background: var(--wheel-yellow); }
.swatch-gray { background: var(--wheel-gray); }
.swatch-gold { background: var(--wheel-gold); }
.legend ul.plain li { border: none; padding: 3px 0; }
@media print { .invoice { padding: 0; } }

/* ---------------------------------------------------------------- corrections, round one */

/* Spacing: a page heading never sits on what follows it, and a row of fields
   never touches the next row or the button under it. */
.page-head { margin-bottom: 14px; }
.row:not(:last-child) { margin-bottom: 14px; }
fieldset.bare { border: none; margin: 0; padding: 0; min-width: 0; }
fieldset.bare[disabled] { opacity: .62; }
.block { display: block; }
.section-title { margin: 20px 0 10px; display: flex; align-items: center; gap: 10px; }
.list-pad { padding: 6px 18px 4px; }
/* A list of jobs or tickets, each one a link to open it. */
.job-rows { display: grid; }
.job-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 18px; color: var(--ink);
  border-top: 1px solid var(--line); text-decoration: none; }
.job-row:first-child { border-top: none; }
.job-row:hover { background: var(--surface-2); text-decoration: none; }
.job-row .stage-pill { flex: none; }
.pager-body { padding-top: 6px; padding-bottom: 10px; }
.check-field { margin: 22px 0 0; }
.btn.disabled { opacity: .45; pointer-events: none; }

.pager { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 18px; }
.pager-where { font-size: 13.5px; color: var(--ink-2); }

.support-bar { background: var(--info-bg); border-bottom-color: #bcd2f2; color: var(--info-ink); }
.lock-note { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.confirm-what { font-size: 18px; font-weight: 600; margin: 8px 0 14px; }

/* The technician's home: one big button per job they are on or have waiting. */
.job-buttons { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 16px; }
.job-button {
  display: grid; gap: 4px; padding: 16px 18px; background: var(--surface); color: var(--ink);
  border: 2px solid var(--line); border-left-width: 6px; border-radius: 12px; box-shadow: var(--shadow);
  text-decoration: none; transition: .12s;
}
.job-button:hover { text-decoration: none; border-color: var(--brand-2); transform: translateY(-1px); }
.job-button-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.job-button-what { font-size: 20px; font-weight: 700; line-height: 1.2; }
.job-inspection { border-left-color: var(--stage-inspection); }
.job-working { border-left-color: var(--stage-working); background: #f6fcf8; }
.job-idle { border-left-color: var(--stage-idle); }
.job-completed { border-left-color: var(--stage-completed); }
.job-parked { border-left-color: var(--stage-idle); margin-bottom: 18px; max-width: 560px; }
.parked-counts { display: flex; gap: 8px; flex-wrap: wrap; }
.job-actions .big { min-width: 140px; }

/* The managers' live board. */
.hud { margin-bottom: 18px; }
.hud-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.hud-head h2 { margin: 0; }
.hud-tiles { margin-bottom: 12px; }
.hud-tiles .stat { box-shadow: none; }
.stat .n .of { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.hud-shop + .hud-shop { margin-top: 14px; }
.hud-shop h3 { margin: 10px 0 6px; }
.hud-table td { vertical-align: middle; }
.hud-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 0; }
.hud-dot-under { background: var(--wheel-green); }
.hud-dot-over { background: var(--wheel-orange); }
.hud-dot-none { background: var(--stage-inspection); }
.hud-dot-idle { background: var(--wheel-yellow); }
.hud-out { margin: 8px 0 0; }
.location-link, .region-link { text-decoration: none; }
.location-link:hover .muted { color: var(--brand-2); }

.stat.gold .n { color: var(--wheel-gold); }
.stat.gray .n { color: var(--ink-2); }
.stat.yellow .n { color: #a07d00; }
.stat.orange .n { color: #c25e0c; }
.eff { display: inline-block; min-width: 46px; padding: 1px 8px; border-radius: 999px; font-weight: 700; text-align: center; }
.eff-gold { background: #f7eecd; color: #7a5f00; }
.eff-gray { background: #eef1f5; color: var(--ink-2); }
.eff-yellow { background: #fbf1c7; color: #7d6200; }
.eff-orange { background: #fde5cf; color: #9a4a08; }
.month-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.month-head h2 { margin: 0; }
.wheel-small { display: flex; justify-content: center; margin: 4px 0 10px; }
.wheel-small .wheel { width: 190px; height: 190px; }

.bars .fill { display: block; }
.bar-0 { width: 0; } .bar-5 { width: 5%; } .bar-10 { width: 10%; } .bar-15 { width: 15%; }
.bar-20 { width: 20%; } .bar-25 { width: 25%; } .bar-30 { width: 30%; } .bar-35 { width: 35%; }
.bar-40 { width: 40%; } .bar-45 { width: 45%; } .bar-50 { width: 50%; } .bar-55 { width: 55%; }
.bar-60 { width: 60%; } .bar-65 { width: 65%; } .bar-70 { width: 70%; } .bar-75 { width: 75%; }
.bar-80 { width: 80%; } .bar-85 { width: 85%; } .bar-90 { width: 90%; } .bar-95 { width: 95%; }
.bar-100 { width: 100%; }
.bar-row .lab { width: 120px; }
.bar-row .val { width: 76px; }

/* Technicians: each card opens that technician's record. */
a.tech-card { display: block; color: var(--ink); text-decoration: none; transition: .12s; }
a.tech-card:hover { text-decoration: none; border-color: var(--brand-2); }
.tech-status { margin: 4px 0; color: var(--ink-2); }

.vin-card { border-color: var(--warn-line); background: var(--warn-bg); }
.vin-card h2 { color: var(--warn-ink); }
table.data tr.group-row td {
  background: var(--surface-2); font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--ink-2); padding-top: 7px; padding-bottom: 7px;
}
table.data tr.has-open td:first-child { box-shadow: inset 4px 0 0 var(--stage-inspection); }

/* The IT console looks different from any company's screens on purpose. */
header.it-top { background: #23303f; }
nav.it-tabs { background: #1a2532; }
.feature-list li { padding: 10px 0; }
.feature-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.feature-row form { flex: none; }
.info-mini li { padding: 7px 0; }
.unit-number-field { flex: 0 1 220px !important; }

/* ---------------------------------------------------------------- notifications */
.top-right a.bell { white-space: nowrap; }
.bell-count { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 10px;
              background: #f0943d; color: #16202c; font-weight: 700; font-size: 12px; text-align: center; }
.notice-list { list-style: none; margin: 0; padding: 0; }
.notice-list li { display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px;
                  border-bottom: 1px solid var(--line); }
.notice-list li:last-child { border-bottom: none; }
.notice-list li.unread { background: var(--info-bg); }
.notice-list .notice-body { flex: 1 1 auto; min-width: 0; }
.notice-list .notice-body p { margin: 4px 0 0; }
.notice-list form { margin: 0; flex: none; }

/* ---------------------------------------------------------------- live board */
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
            background: #1f7a4f; margin-right: 2px; vertical-align: middle;
            animation: live-pulse 2s ease-in-out infinite; }
@keyframes live-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.invoice-total { text-align: right; font-size: 17px; margin: 14px 0 0; }
.price-form { justify-content: flex-end; }
.price-form input { max-width: 110px; }

/* ---------------------------------------------------------------- parts */
.parts-nav { display: inline-flex; }
.shop-picker { max-width: 420px; }
.form-card { max-width: 860px; }
.count-form { justify-content: flex-end; }
.count-form input { max-width: 80px; text-align: right; }
.seg-radio { display: flex; gap: 18px; flex-wrap: wrap; }
table.data tr.here td { background: var(--info-bg); }
.move { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
        background: #eef1f5; color: var(--ink-2); white-space: nowrap; }
.move-receive { background: var(--ok-bg); color: var(--ok-ink); }
.move-return { background: var(--info-bg); color: var(--info-ink); }
.move-checkout { background: #fff3e6; color: #8a4b0f; }
.move-adjust, .move-cycle_count { background: var(--warn-bg); color: var(--warn-ink); }
.tree-row.depth-1 { margin-left: 18px; } .tree-row.depth-2 { margin-left: 36px; }
.tree-row.depth-3 { margin-left: 54px; } .tree-row.depth-4 { margin-left: 72px; }
.tree-row.depth-5 { margin-left: 90px; } .tree-row.depth-6 { margin-left: 108px; }
ul.plain li.row.tight { justify-content: space-between; padding: 4px 0; }

/* Labels: one 2" x 1" label, or an Avery 5160 sheet (30 at 1" x 2-5/8"). */
.label-help { max-width: 640px; margin: 24px auto; padding: 0 16px; }
.part-label { display: flex; align-items: center; gap: 2mm; overflow: hidden; background: #fff; color: #000;
              box-sizing: border-box; }
.part-label-qr svg { width: 20mm; height: 20mm; display: block; }
.part-label-text { min-width: 0; line-height: 1.15; }
.part-label-title { font-family: var(--mono); font-weight: 700; font-size: 10pt; word-break: break-all; }
.part-label-detail { font-size: 7pt; max-height: 2.4em; overflow: hidden; }
.part-label-shelf { font-size: 7pt; font-weight: 600; }
.label-single { display: flex; justify-content: center; }
.label-single .part-label { width: 2in; height: 1in; padding: 1.5mm; border: 1px dashed #c3cddb; }
.label-sheet { width: 8.5in; margin: 0 auto; padding: 0.5in 0.1875in 0;
               display: grid; grid-template-columns: repeat(3, 2.625in); column-gap: 0.125in;
               grid-auto-rows: 1in; box-sizing: border-box; }
.label-sheet .part-label { padding: 0 2mm; outline: 1px dashed #d8e0ea; }
@media print {
  .label-single .part-label, .label-sheet .part-label { border: none; outline: none; }
  .label-sheet { padding-top: 0.5in; }
}

/* ---------------------------------------------------------- ticket chat */

.chat-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; max-height: 460px; overflow-y: auto; }
.chat-msg { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-right: 15%; }
.chat-msg.mine { background: var(--info-bg); border-color: #c4d6f3; margin: 0 0 0 15%; }
.chat-meta { margin-bottom: 2px; }
.chat-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-form { display: flex; gap: 10px; align-items: flex-end; }
.chat-form textarea { flex: 1; }
.chat-form button { flex: none; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------------------------------------------------------- activity */

.act { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.act-opened { background: var(--info-bg); color: var(--info-ink); border-color: #c4d6f3; }
.act-clock { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-line); }
.act-part { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.act-chat { background: #efe9fb; color: #5a3b99; border-color: #d6c8f2; }
.activity-table td { vertical-align: top; }
.screens-table select { min-width: 120px; }
.time-row { align-items: center; flex-wrap: wrap; }
.time-row input[type=datetime-local] { flex: 0 1 220px; }
.time-lasted { min-width: 90px; color: var(--ink-2); }
.card-head .btn { margin-left: auto; }

/* ---------------------------------------------------------- shop efficiency */

.eff-bar-cell { width: 40%; min-width: 160px; }
.eff-bar { display: block; width: 100%; height: 12px; border-radius: 6px; overflow: hidden; }
.eff-track { fill: var(--wheel-track); }
.eff-green { fill: var(--wheel-green); }
.eff-gray { fill: var(--wheel-gray); }
.eff-yellow { fill: var(--wheel-yellow); }
.eff-orange { fill: var(--wheel-orange); }
.eff-gold { fill: var(--wheel-gold); }
.eff-me td { background: var(--info-bg); }

/* ---------------------------------------------------------- cost trend */

.trend { display: block; width: 100%; height: 170px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.trend-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 4 4; }
.trend-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.trend-dot { stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.trend-line.trend-up { stroke: var(--wheel-orange); }
.trend-line.trend-down { stroke: var(--wheel-green); }
.trend-line.trend-flat { stroke: var(--brand-2); }
.trend-dot.trend-up { fill: var(--wheel-orange); }
.trend-dot.trend-down { fill: var(--wheel-green); }
.trend-dot.trend-flat { fill: var(--brand-2); }
.trend-up-ink { color: var(--warn-ink); }
.trend-down-ink { color: var(--ok-ink); }
.trend-axis { display: flex; justify-content: space-between; margin: 4px 2px 12px; }
.trend-stats .n { font-size: 18px; }
a.stat-link { color: inherit; text-decoration: none; }
a.stat-link:hover { border-color: var(--brand-2); text-decoration: none; }

.org-tree, .org-tree ul { list-style: none; margin: 0; padding-left: 18px; border-left: 2px solid var(--line); }
.org-tree { padding-left: 0; border-left: none; }
.org-tree li { margin: 6px 0; }

.clocks { display: flex; gap: 6px; align-items: center; }
.clock-chip { background: rgba(255,255,255,.12); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; white-space: nowrap; }
.clock-chip b { font-variant-numeric: tabular-nums; margin-left: 4px; }
.clock-chip.off { opacity: .7; }
.app-foot { max-width: 1360px; margin: 0 auto; padding: 8px 20px 24px; text-align: right; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.media-tile { margin: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.media-tile img, .media-tile video { display: block; width: 100%; height: 130px; object-fit: cover; background: #0b0f14; }
.media-tile figcaption { padding: 6px 8px; font-size: 13px; }
.media-tile form { margin: 2px 0 0; }
.note-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.note-list li { border-left: 3px solid var(--warn-line); background: var(--warn-bg); padding: 6px 10px; border-radius: 6px; }

.batch-box { font-size: 18px; line-height: 1.5; }
.pick-tick { width: 60px; }
.pick-box { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--ink); border-radius: 3px; }
.inline-price label { flex-basis: 100%; }
.inline-price input { max-width: 120px; }
.color-pair input[type=color] { width: 52px; flex: none; padding: 2px; height: 40px; }
.color-pair input[type=text] { max-width: 130px; }

.wheel-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.wheel-card { text-align: center; }
.wheel-empty { height: 160px; display: flex; align-items: center; justify-content: center; border: 2px dashed var(--line); border-radius: 50%; width: 160px; margin: 0 auto 10px; }

/* Period chooser over a page of figures: week to lifetime. */
.period-picker { display: inline-flex; flex-wrap: wrap; gap: 0; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.period-picker a { padding: 6px 12px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); border-right: 1px solid var(--line); white-space: nowrap; }
.period-picker a:last-child { border-right: none; }
.period-picker a:hover { background: var(--surface-2); text-decoration: none; }
.period-picker a.on { background: var(--brand-2); color: #fff; }

/* A customer's money: labor and parts round the outside, cost and profit inside. */
:root { --ring-labor: #2563c9; --ring-parts: #0f766e; --ring-cost: #9aa5b1; --ring-profit: #1f7a4f;
        --ring-outside: #8a5cf6; --ring-down: #f0943d; --ring-own: #4b5a6b; --ring-run: #c9a227; }
.money-wrap { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin-bottom: 10px; }
.money-ring { width: 200px; height: 200px; flex: none; }
.money-ring circle { fill: none; }
.money-ring .ring-outer { stroke-width: 20; }
.money-ring .ring-inner { stroke-width: 16; }
.ring-track { stroke: var(--wheel-track); }
.ring-arc.ring-labor { stroke: var(--ring-labor); }
.ring-arc.ring-parts { stroke: var(--ring-parts); }
.ring-arc.ring-cost { stroke: var(--ring-cost); }
.ring-arc.ring-profit { stroke: var(--ring-profit); }
.ring-arc.ring-outside { stroke: var(--ring-outside); }
.ring-arc.ring-down { stroke: var(--ring-down); }
.ring-arc.ring-own { stroke: var(--ring-own); }
.ring-arc.ring-run { stroke: var(--ring-run); }
.ring-number { font-size: 24px; font-weight: 700; text-anchor: middle; fill: var(--ink); }
.ring-caption { font-size: 12px; text-anchor: middle; fill: var(--muted); }
.money-table { flex: 1 1 220px; }
.swatch.ring-labor { background: var(--ring-labor); }
.swatch.ring-parts { background: var(--ring-parts); }
.swatch.ring-cost { background: var(--ring-cost); }
.swatch.ring-profit { background: var(--ring-profit); }
.swatch.ring-outside { background: var(--ring-outside); }
.swatch.ring-down { background: var(--ring-down); }
.swatch.ring-own { background: var(--ring-own); }
.swatch.ring-run { background: var(--ring-run); }

/* Alternative contacts: a button that opens the list. */
details.contacts > summary { display: inline-block; list-style: none; color: #fff; margin: 0; }
details.contacts > summary::-webkit-details-marker { display: none; }
details.contacts[open] > summary { margin-bottom: 12px; }
.contacts-body { border-top: 1px solid var(--line); padding-top: 12px; }
.contact-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.contact-item { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.contact-item form { margin: 0; flex: none; }

/* A unit's customer: locked until a badge or password re-check. */
.locked-field input[readonly] { background: var(--surface-2); color: var(--ink-2); cursor: not-allowed; }
.locked-field .lock { font-size: 12px; }
.locked-field .row.tight { flex-wrap: nowrap; }
.locked-field + form { margin-top: 14px; }

/* Ticket status by hand, and the hours on a ticket. */
.stage-moves { margin: 12px 0 8px; padding-left: 18px; }
.stage-moves li { margin: 2px 0; }
.stage-note { display: block; color: var(--warn-ink); }
.edit-row td { padding-top: 0; border-top: none; }
.edit-row details > summary { font-size: 13px; }

/* Dragging tickets between columns on the board. */
.move-dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; max-width: 460px; width: calc(100% - 32px); box-shadow: var(--shadow); }
.move-dialog::backdrop { background: rgba(16, 24, 36, .35); }
.move-dialog h2 { font-size: 18px; }

/* @mentions in ticket chat. */
.mention-wrap { position: relative; flex: 1; display: flex; }
.mention-wrap textarea { flex: 1; }
.mention-list { position: absolute; left: 0; bottom: 100%; margin: 0 0 4px; padding: 4px 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); min-width: 200px; max-height: 220px; overflow-y: auto; z-index: 20; }
.mention-list li { padding: 6px 12px; cursor: pointer; }
.mention-list li.on, .mention-list li:hover { background: var(--info-bg); }
.mention { color: var(--brand-2); font-weight: 700; }
.chat-msg.to-me { border-color: var(--brand-2); box-shadow: inset 3px 0 0 var(--brand-2); }

/* Pictures from a phone: the QR code on the computer, the page on the phone. */
.phone-qr-card { text-align: center; }
.phone-qr svg { width: 240px; height: 240px; max-width: 100%; }
.phone-address { overflow-wrap: anywhere; margin-top: 10px; }
.steps-list { padding-left: 20px; }
.steps-list li { margin: 6px 0; }
.phone-page { max-width: 520px; margin: 0 auto; padding: 18px 16px 40px; }
.phone-page .card { margin: 14px 0; }
.phone-page input[type=file] { font-size: 16px; padding: 10px 0; }

/* ---------------------------------------------------------- round five (8 October) */

/* Priority beside the status: emergency, priority, project. */
.prio { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  white-space: nowrap; border: 1px solid var(--line); vertical-align: middle; letter-spacing: .2px; }
.prio-emergency { background: var(--bad-bg); color: var(--bad-ink); border-color: var(--bad-line); }
.prio-priority { background: var(--info-bg); color: var(--info-ink); border-color: #c4d6f3; }
.prio-project { background: #eef1f5; color: var(--ink-2); border-color: var(--line); }
.prio-edge-emergency { border-left-color: var(--bad-ink) !important; }
.prio-pick { gap: 10px; }
.prio-choice { border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; background: var(--surface); }
.prio-choice-emergency b { color: var(--bad-ink); }

/* How the customer pays, at a glance. */
.pays { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  white-space: nowrap; vertical-align: middle; border: 1px solid; }
.pays-cash { background: var(--ok-bg); color: var(--ok-ink); border-color: var(--ok-line); }
.pays-po { background: #efe9fb; color: #5a3b99; border-color: #d6c8f2; }

/* The live board: anyone clocked in and not billable is the box to look at. */
.stat.alert { border: 2px solid var(--bad-ink); box-shadow: 0 0 0 2px var(--bad-bg); }
.stat.alert .n { color: var(--bad-ink); }
.hud.stale { opacity: .6; }
.hud.stale .hud-live { opacity: 1; color: var(--bad-ink); }
.hud.stale .live-dot { background: var(--bad-ink); animation: none; }

/* A technician's jobs in three columns: emergency, priority, project. */
.job-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; align-items: start; }
.job-column { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.job-column-emergency { border-color: var(--bad-line); background: #fff8f8; }
.job-column-head { margin: 0 0 2px; display: flex; align-items: center; gap: 8px; font-size: 15px; }
.job-column .job-button { margin-top: 10px; }
.job-column-empty { margin: 8px 0 0; }
.job-button-link { display: grid; gap: 4px; color: var(--ink); text-decoration: none; }
.job-button-link:hover { text-decoration: none; }
.job-button-actions { margin-top: 8px; }
@media (max-width: 900px) { .job-columns { grid-template-columns: 1fr; } }

/* The job a technician is on: one bordered sheet with everything about it. */
.job-sheet { background: var(--surface); border: 2px solid #b9c6d6; border-left-width: 8px; border-radius: 12px;
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; min-width: 0; }
.job-sheet.job-inspection { border-left-color: var(--stage-inspection); }
.job-sheet.job-working { border-left-color: var(--stage-working); background: #f6fcf8; }
.job-sheet.job-idle { border-left-color: var(--stage-idle); }
.job-sheet.job-completed { border-left-color: var(--stage-completed); }
.job-sheet.job-on { box-shadow: 0 0 0 3px var(--ok-bg), var(--shadow); }
.job-sheet-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.job-sheet-title { margin: 8px 0 2px; font-size: 26px; }
.job-sheet-ticket { margin: 0 0 12px; color: var(--ink-2); font-size: 16px; }

/* Each line on a ticket, bordered like the jobs on the technician's home. */
.line-card { border-width: 2px; border-left-width: 6px; }
.line-edge-check_in { border-left-color: var(--stage-check_in); }
.line-edge-inspection { border-left-color: var(--stage-inspection); }
.line-edge-working { border-left-color: var(--stage-working); }
.line-edge-idle { border-left-color: var(--stage-idle); }
.line-edge-done { border-left-color: var(--stage-completed); }

/* The new ticket's unit search. */
.unit-pick { position: relative; }
.unit-results { position: absolute; left: 0; right: 0; top: 64px; margin: 0; padding: 4px 0; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
  max-height: 320px; overflow-y: auto; z-index: 30; }
.unit-results li { padding: 8px 12px; cursor: pointer; border-top: 1px solid var(--surface-2); }
.unit-results li:first-child { border-top: none; }
.unit-results li.on, .unit-results li[role=option]:hover { background: var(--info-bg); }
.unit-results .unit-none { cursor: default; color: var(--muted); }
#unit_chosen:not(:empty) { color: var(--ok-ink); font-weight: 600; }

/* Ticket chat: who it goes to. */
.chat-form-to { display: block; }
.chat-compose { display: flex; gap: 10px; align-items: flex-end; }
.chat-compose button { flex: none; }
.chat-to { border: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 6px 16px; min-width: 0; }
.chat-to legend { padding: 0; margin-bottom: 4px; width: 100%; }
.chat-to-choice { font-size: 14px; }
.chat-to-line { margin-top: 4px; }
.chat-list-full { max-height: none; }

/* Other charges on a ticket. */
.act-misc { background: #eef1f5; color: var(--ink-2); }
.act-sublet { background: #efe9fb; color: #5a3b99; border-color: #d6c8f2; }

/* A customer's parts and labor history, to print. */
.range-links a { white-space: nowrap; }
.history-sheet .invoice-head { margin-bottom: 16px; }
.history-sums .stat .n { font-size: 22px; }
.history-ticket { break-inside: avoid; }
.history-ticket-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.history-ticket-head h2 { margin: 0; font-size: 17px; }
.history-ticket .data { margin-top: 8px; }
.history-ticket-total { text-align: right; margin: 10px 0 0; }
@media print {
  .history-sheet .card { box-shadow: none; border-color: #bbb; }
  .history-sums .stat { box-shadow: none; }
}

/* The tickets board: a column for each status side by side, each ticket a
   compact row in it (2.0.2.2). */
.board-cols { display: flex; gap: 8px; align-items: flex-start; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; }
.board-col { flex: 1 0 170px; min-width: 170px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; }
.board-col-head { display: flex; align-items: center; gap: 6px; margin: 0; padding: 8px 10px; font-size: 13.5px;
  background: var(--surface); border-bottom: 1px solid var(--line); cursor: default; }
.board-col-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-col-head .board-count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 600; }
.board-col-rows { display: grid; }
.board-item { display: grid; gap: 1px; padding: 6px 8px 7px; background: var(--surface); color: var(--ink);
  text-decoration: none; border-bottom: 1px solid var(--line); border-left: 3px solid var(--line);
  font-size: 12.5px; line-height: 1.3; min-width: 0; }
.board-item:hover { text-decoration: none; background: var(--info-bg); }
.board-item[draggable=true] { cursor: grab; }
.board-item.stage-edge-check_in { border-left-color: var(--stage-check_in); }
.board-item.stage-edge-inspection { border-left-color: var(--stage-inspection); }
.board-item.stage-edge-working { border-left-color: var(--stage-working); }
.board-item.stage-edge-idle { border-left-color: var(--stage-idle); }
.board-item.stage-edge-completed { border-left-color: var(--stage-completed); }
.board-item.stage-edge-ready_to_invoice { border-left-color: var(--stage-ready_to_invoice); }
.board-item.stage-edge-invoiced { border-left-color: var(--stage-invoiced); }
.board-item-top { display: flex; align-items: center; gap: 6px; }
.board-item-top b { color: var(--brand-2); }
.board-item-top .prio { font-size: 10.5px; padding: 0 6px; }
.board-item-age { margin-left: auto; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.board-item-customer { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-item-more { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-col-empty { margin: 0; padding: 8px 10px; font-size: 12px; color: var(--muted); }
body.dragging .board-col[data-drop] { outline: 2px dashed var(--line); outline-offset: -2px; }
.board-col.drop-over { outline: 2px dashed var(--brand-2) !important; background: var(--info-bg); }

/* Customer notes on a job: what was found and done, for the story. */
.job-notes { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; }
.job-notes h2 { font-size: 17px; margin: 0 0 2px; }
.job-notes textarea { width: 100%; }
.note-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.note-list li { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.line-notes { margin: 8px 0; }
.line-notes textarea { width: 100%; }
.tiny-head { font-size: 13px; margin: 6px 0 0; color: var(--ink-2); }

/* New company: the lists of shops and people */
.setup-table input, .setup-table select { width: 100%; min-width: 120px; }
.setup-table td { padding-top: 7px; padding-bottom: 7px; }
.setup-table td.setup-remove { width: 1%; white-space: nowrap; }

.stack-tight { display: flex; flex-direction: column; gap: 8px; }

/* The weekly profit report: the write-up as it was written. */
.report-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
