﻿/* IBK Shop - interface styles
   Dense, keyboard-driven, search-first. Built for a shop office screen. */

:root {
  --bg:        #f6f7f6;
  --surface:   #ffffff;
  --surface-2: #eef1ef;
  --border:    #d8ddda;
  --border-str:#bcc4c0;
  --ink:       #171b1d;
  --ink-mute:  #5d6a6f;
  --ink-faint: #8b979b;
  --accent:    #b4531d;
  --accent-ink:#ffffff;
  --accent-sf: #fbf0e9;
  --good:      #2c7a58;
  --good-sf:   #e7f3ed;
  --warn:      #9a6b12;
  --warn-sf:   #fbf2e0;
  --bad:       #a83f38;
  --bad-sf:    #f9eae9;
  /* Part paid needs a hue of its own - it is neither owing nor settled. */
  --info:      #2a6f9e;
  --info-sf:   #e8f1f8;
  --radius:    6px;
  --shadow:    0 1px 2px rgba(20,26,28,.06), 0 4px 12px rgba(20,26,28,.05);
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
  --sans: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#121618; --surface:#191f21; --surface-2:#212a2d; --border:#2b3538;
    --border-str:#3a4649; --ink:#e6ecea; --ink-mute:#9aa8ac; --ink-faint:#6d7b7f;
    --accent:#d97740; --accent-ink:#1a1010; --accent-sf:#2a1d15;
    --good:#4fae83; --good-sf:#16261f; --warn:#c99a3c; --warn-sf:#2a2213;
    --bad:#d2716a; --bad-sf:#2b1a19;
    --info:#6ba8d0; --info-sf:#152530;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  --bg:#121618; --surface:#191f21; --surface-2:#212a2d; --border:#2b3538;
  --border-str:#3a4649; --ink:#e6ecea; --ink-mute:#9aa8ac; --ink-faint:#6d7b7f;
  --accent:#d97740; --accent-ink:#1a1010; --accent-sf:#2a1d15;
  --good:#4fae83; --good-sf:#16261f; --warn:#c99a3c; --warn-sf:#2a2213;
  --bad:#d2716a; --bad-sf:#2b1a19;
  --info:#6ba8d0; --info-sf:#152530;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased;
}
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ---------------------------------------------------------------- shell */
.app { display: grid; grid-template-columns: 208px 1fr; min-height: 100vh; }

.side {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 2px; padding: 14px 10px;
  position: sticky; top: 0; height: 100vh;
}
.brand { padding: 6px 10px 16px; display: flex; flex-direction: column; gap: 2px; }
.brand b { font-size: 15px; letter-spacing: -.01em; }
.brand span { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .08em; }

.nav-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; border-radius: var(--radius); color: var(--ink-mute);
  text-decoration: none; font-weight: 500; border: 1px solid transparent; cursor: pointer;
  background: none; width: 100%; text-align: left; font-family: inherit; font-size: 14px;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.on { background: var(--accent-sf); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.nav-item .tally { font-size: 11px; color: var(--ink-faint); }
.side-foot { margin-top: auto; padding: 10px; font-size: 11px; color: var(--ink-faint); }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 16px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.spacer { flex: 1; }

.view { padding: 20px; display: none; }
.view.on { display: block; }

/* --------------------------------------------------------------- controls */
button, .btn {
  font: inherit; padding: 7px 13px; border-radius: var(--radius);
  border: 1px solid var(--border-str); background: var(--surface); color: var(--ink);
  cursor: pointer; font-weight: 550;
}
button:hover { background: var(--surface-2); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.07); background: var(--accent); }
.btn-ghost { border-color: transparent; background: none; color: var(--ink-mute); }
button:disabled { opacity: .45; cursor: not-allowed; }

input, select, textarea {
  font: inherit; padding: 6px 9px; border: 1px solid var(--border-str);
  border-radius: var(--radius); background: var(--surface); color: var(--ink); width: 100%;
}
input::placeholder { color: var(--ink-faint); }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em; color: var(--ink-mute); font-weight: 600; }
label.f > input, label.f > select { text-transform: none; letter-spacing: normal;
  font-size: 14px; font-weight: 400; color: var(--ink); }

.search-wrap { position: relative; flex: 1; max-width: 460px; }
.results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border-str); border-radius: var(--radius);
  box-shadow: var(--shadow); max-height: 340px; overflow-y: auto; display: none;
}
.results.on { display: block; }
.result {
  padding: 8px 11px; cursor: pointer; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 10px;
}
.result:last-child { border-bottom: 0; }
.result:hover, .result.sel { background: var(--accent-sf); }
.result small { color: var(--ink-faint); }

/* ----------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow); }
.card-h { padding: 11px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; }
.card-h h2 { margin: 0; font-size: 13px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-mute); }
.card-b { padding: 16px; }

.grid-2 { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
@media (max-width: 1080px) { .grid-2 { grid-template-columns: 1fr; } }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 13px 15px; }
.tile .k { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-mute); font-weight: 600; }
.tile .v { font-size: 21px; font-weight: 650; margin-top: 3px; letter-spacing: -.02em; }
.tile.is-bad .v { color: var(--bad); }
.tile.is-warn .v { color: var(--warn); }
.tile.is-good .v { color: var(--good); }

/* ---------------------------------------------------------------- tables */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-mute); font-weight: 650; padding: 8px 10px;
  border-bottom: 1px solid var(--border-str); white-space: nowrap; background: var(--surface);
}
td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: var(--surface-2); }
.r { text-align: right; }
td input, td select { border-color: transparent; background: transparent; padding: 4px 6px; }
td input:hover, td select:hover { border-color: var(--border); }
td input:focus { border-color: var(--accent); background: var(--surface); }
.row-del { color: var(--ink-faint); border: 0; background: none; padding: 2px 6px; cursor: pointer; }
.row-del:hover { color: var(--bad); background: none; }
td.row-tools { white-space: nowrap; text-align: right; padding-left: 0; padding-right: 2px; }
/* Grab here and drag the line where it belongs. */
.row-grip { display: inline-block; color: var(--ink-faint); cursor: grab; user-select: none;
            padding: 2px 3px; letter-spacing: -3px; font-size: 14px; line-height: 1; vertical-align: middle; }
.row-grip:hover { color: var(--ink); }
.row-grip:active { cursor: grabbing; }
tr.dragging td { opacity: .35; }
/* A line with no amount on it, pointed at when Ready is refused. */
tr.no-amount td { background: var(--warn-sf); }
tr.no-amount .l-rate, tr.no-amount .p-price { outline: 2px solid var(--bad); }

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px;
  font-weight: 650; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
  border: 1px solid;
}
/* Draft is work you have not finished. It is the one status that wants you
   to come back to it, so it is the loud one: solid fill, not a tint. */
.pill.draft { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pill.ready { background: var(--warn-sf); color: var(--warn); border-color: var(--warn); }
.pill.sent  { background: var(--accent-sf); color: var(--accent); border-color: var(--accent); }
.pill.part-paid { background: var(--info-sf); color: var(--info); border-color: var(--info); }
.pill.paid  { background: var(--good-sf); color: var(--good); border-color: var(--good); }
.pill.void, .pill.overdue { background: var(--bad-sf); color: var(--bad); border-color: var(--bad); }
/* Carried in from the old system: owed like any other bill, but not part of the
   draft-to-paid flow. Dashed, so it does not read as a draft at a glance. */
.pill.legacy { background: transparent; color: var(--ink-mute);
  border-style: dashed; border-color: var(--border-str); }

/* ---------------------------------------------------------------- totals */
.totals { display: flex; flex-direction: column; gap: 1px; }
.totals .line { display: flex; justify-content: space-between; padding: 6px 0; }
.totals .line.sub { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; font-weight: 600; }
.totals .line.grand {
  border-top: 2px solid var(--ink); margin-top: 8px; padding-top: 11px;
  font-size: 19px; font-weight: 700; letter-spacing: -.02em;
}
.totals .line .lbl { color: var(--ink-mute); }
.totals .line.grand .lbl { color: var(--ink); }
.exempt { font-size: 11px; color: var(--ink-faint); font-style: italic; }

.empty { padding: 44px 20px; text-align: center; color: var(--ink-faint); }
.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--radius);
  box-shadow: var(--shadow); opacity: 0; transform: translateY(8px);
  transition: opacity .18s, transform .18s; pointer-events: none; max-width: 380px;
}
.toast.on { opacity: 1; transform: none; }
.toast.err { background: var(--bad); color: #fff; }
.hint { font-size: 12px; color: var(--ink-faint); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------------------------------------------------------------- dialogs */
dialog {
  border: 1px solid var(--border-str); border-radius: 10px; padding: 0;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
  max-width: 720px; width: calc(100% - 40px);
}
dialog::backdrop { background: rgba(10,14,16,.5); }
.dlg { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.dlg h3 { margin: 0; font-size: 16px; font-weight: 650; }
.dlg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 620px) { .dlg-grid { grid-template-columns: 1fr; }
  .dlg-grid label.f[style*="span 2"] { grid-column: auto !important; } }
.dlg-checks { display: flex; flex-wrap: wrap; gap: 16px; padding-top: 2px; }
.dlg-checks label { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-mute); }
.dlg-checks input { width: auto; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px;
  border-top: 1px solid var(--border); padding-top: 14px; }
.dlg .hint:empty { display: none; }
.dlg .hint { color: var(--bad); font-weight: 550; }
tbody tr[data-cust] { cursor: pointer; }

/* -------------------------------------------------------- unit expander */
.unit-panel > td { background: var(--surface-2); padding: 12px 14px; }
.unit-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.unit-bar .k { font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-mute); font-weight: 650; margin-right: 4px; }
.unit-chip {
  display: inline-flex; align-items: baseline; gap: 7px;
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border-str);
  background: var(--surface); font-size: 13px; cursor: pointer;
}
.unit-chip:hover { border-color: var(--accent); background: var(--accent-sf); }
.unit-chip span { color: var(--ink-mute); }
.unit-chip small { color: var(--ink-faint); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------- customer picker */
.pick-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--border);
  border-radius: var(--radius); }
.pick-list:empty { display: none; }
.pick-row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding: 9px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.pick-row:last-child { border-bottom: 0; }
.pick-row:hover, .pick-row.sel { background: var(--accent-sf); }
.pick-row small { color: var(--ink-faint); white-space: nowrap; }
.pick-row .who b { font-weight: 600; }
.pick-row .who span { color: var(--ink-mute); }
#dlg-pick { max-width: 560px; }

/* -------------------------------------------- invoice-shaped job editor */
.doc-bar {
  display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end;
  padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border);
}
.doc-bar .f { gap: 3px; }
.doc-bar .f > b { font-size: 14px; font-weight: 600; color: var(--ink);
  text-transform: none; letter-spacing: normal; }
.doc-bar label.f > input { max-width: 170px; }

.inv-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .inv-panels { grid-template-columns: 1fr; } }

.inv-panel { border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.inv-panel > header {
  background: var(--surface-2); padding: 7px 12px; font-size: 11px; font-weight: 700;
  letter-spacing: .07em; color: var(--ink-mute); display: flex; align-items: center;
  justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--border);
}
.inv-panel > header button { padding: 2px 8px; font-size: 11px; }

.kv { margin: 0; padding: 10px 12px; display: grid;
  grid-template-columns: auto 1fr auto 1fr; gap: 4px 10px; align-items: baseline; }
.kv dt { font-size: 11px; color: var(--ink-mute); white-space: nowrap; text-align: right; }
.kv dd { margin: 0; font-size: 13px; font-weight: 550; color: var(--ink);
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kv dd.blank { color: var(--ink-faint); font-weight: 400; font-style: italic; }
.kv .full { grid-column: 2 / -1; }
.kv .addr { grid-column: 1 / -1; text-align: left; font-size: 13px; font-weight: 550;
  color: var(--ink); margin-bottom: 2px; }
.kv .addr b { display: block; font-size: 14px; font-weight: 650; }
.kv .addr span { color: var(--ink-mute); font-weight: 400; }

.veh-pick { display: flex; gap: 6px; padding: 10px 12px 0; }
.veh-pick select { flex: 1; }
.veh-pick button { padding: 6px 11px; }
.veh-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 10px 12px; }
@media (max-width: 620px) { .veh-grid { grid-template-columns: 1fr 1fr; } }

.totals .line.mute { color: var(--ink-mute); }
.totals .line.acct { border-top: 1px dashed var(--border); margin-top: 8px; padding-top: 9px;
  font-size: 12px; color: var(--ink-mute); }

/* ------------------------------------------------------------ send dialog */
#dlg-send { max-width: 640px; }
#dlg-send .dlg > div > label.f { margin-bottom: 10px; }
.send-channels { display: flex; gap: 20px; flex-wrap: wrap;
  padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius); }
.send-channels label { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.send-channels input { width: auto; }
.send-channels .hint { font-size: 11px; }
#send-body { font-family: var(--mono); font-size: 11px; line-height: 1.4; }
#send-sms { font-size: 13px; }
#send-blocked:not(:empty) { background: var(--warn-sf); color: var(--warn);
  padding: 8px 11px; border-radius: var(--radius); font-weight: 600; }
.send-result { padding: 9px 12px; border-radius: var(--radius); margin-top: 8px; font-size: 13px; }
.send-result.ok { background: var(--good-sf); color: var(--good); }
.send-result.bad { background: var(--bad-sf); color: var(--bad); }

/* The email body is edited as plain text, so show it as prose not code. */
#send-body { font-family: var(--sans); font-size: 13px; line-height: 1.5; white-space: pre-wrap; }

/* ----------------------------------------------------------- payments */
#dlg-pay { max-width: 760px; }
.pay-alloc-head { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 13px; }
.pay-alloc-head button { padding: 3px 9px; font-size: 12px; }
#tbl-alloc td, #tbl-alloc th { padding: 5px 8px; font-size: 13px; }
#tbl-alloc input { text-align: right; padding: 3px 6px; }
.pay-summary { display: flex; gap: 18px; flex-wrap: wrap; padding: 10px 12px; margin-top: 10px;
  background: var(--surface-2); border-radius: var(--radius); font-size: 13px; }
.pay-summary span { display: flex; gap: 7px; align-items: baseline; }
.pay-summary b { font-variant-numeric: tabular-nums; }
.pay-summary .over { color: var(--bad); font-weight: 700; }
.pay-summary .left { color: var(--warn); font-weight: 700; }
.pay-summary .done { color: var(--good); font-weight: 700; }
.row-undo { color: var(--ink-faint); border: 0; background: none; cursor: pointer; padding: 2px 8px; font-size: 12px; }
.row-undo:hover { color: var(--bad); background: none; }

/* ------------------------------------------------------ delete / void */
.btn-danger { border-color: var(--bad); color: var(--bad); background: var(--surface); }
.btn-danger:hover { background: var(--bad-sf); }
#dlg-delete { max-width: 540px; }
#dlg-delete p { margin: 0; line-height: 1.5; }
.del-choice { display: flex; flex-direction: column; gap: 10px; }
.del-choice label { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px;
  border: 1px solid var(--border-str); border-radius: var(--radius); cursor: pointer; }
.del-choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-sf); }
.del-choice input { width: auto; margin-top: 3px; }
.del-choice small { color: var(--ink-mute); line-height: 1.45; }

/* ------------------------------------------- why an invoice is held back */
/* A class-level display beats the [hidden] attribute, so hiding must be explicit. */
.review-note[hidden] { display: none; }
.review-note {
  display: flex; gap: 9px; align-items: flex-start;
  background: var(--warn-sf); border: 1px solid var(--warn); color: var(--warn);
  border-radius: var(--radius); padding: 10px 13px; margin-bottom: 14px;
  font-size: 13px; line-height: 1.5; font-weight: 550;
}
.review-note b { display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: .07em; margin-bottom: 2px; }
.review-note ul { margin: 4px 0 0; padding-left: 18px; font-weight: 400; }

/* A service history needs more room than the other dialogs. */
dialog.wide { max-width: min(1000px, 94vw); width: min(1000px, 94vw); }
.hist-body { max-height: 62vh; overflow-y: auto; }

/* -------------------------------------------------------- vehicles */
.veh-row { cursor: pointer; }
.veh-row:hover, .veh-row.open { background: var(--surface-2); }
.veh-detail > td { background: var(--bg); padding: 14px 16px; }

/* The per-customer add. Always visible - a control that appears only on
   hover is a control people never find - but quiet enough that 51 of them
   do not compete with the fleet list they sit beside. */
.row-act { width: 104px; text-align: right; padding-right: 12px; }
.add-veh {
  font: inherit; font-size: 12px; font-weight: 600; line-height: 1;
  padding: 5px 11px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  color: var(--ink-faint); background: transparent;
  border: 1px solid var(--border);
  transition: color .12s, border-color .12s, background .12s;
}
.veh-row:hover .add-veh { color: var(--ink-mute); border-color: var(--border-str); }
.add-veh:hover, .add-veh:focus-visible {
  color: var(--accent); border-color: var(--accent); background: var(--accent-sf);
}

.veh-spec { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 10px; }
.veh-spec .kv b { color: var(--ink-mute); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em; margin-right: 5px; }
.veh-sub { font-size: 13px; color: var(--ink-mute); margin-bottom: 8px; }
.veh-jobs { width: 100%; }
/* Hold the narrow columns open. Left to itself the table gives every spare
   pixel to the description, which then starts under the wrong heading. */
.veh-jobs th:first-child, .veh-jobs td:first-child { width: 72px; }
.veh-jobs .odo, .veh-jobs th:nth-child(3) { width: 110px; white-space: nowrap; }
.veh-jobs th:nth-child(2), .veh-jobs td:nth-child(2) { width: 92px; white-space: nowrap; }
.veh-jobs tbody tr:hover { background: var(--surface-2); }

/* A decal number that can be traced back to the invoice it was issued on.
   Looks like the text beside it until you go near it. */
.link-cell {
  font: inherit; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--accent); text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: 2px;
}
.link-cell:hover, .link-cell:focus-visible { text-decoration-color: var(--accent); }

/* Payments, grouped the same way as the fleet list. */
.pay-row { cursor: pointer; }
.pay-row:hover, .pay-row.open { background: var(--surface-2); }
.pay-detail > td { background: var(--bg); padding: 12px 16px; }

/* The running total of ticked invoices. Sits with the count, but has to
   carry more weight than it - it is a figure, not a caption. */
.sel-total[hidden] { display: none; }
.sel-total {
  font-size: 12.5px; padding: 4px 11px; border-radius: 999px;
  background: var(--accent-sf); color: var(--accent);
  border: 1px solid var(--accent); white-space: nowrap;
}

/* ------------------------------------------------------- reminders */
/* A reminder that cannot be delivered - a text with no Twilio set up.
   Shown greyed rather than hidden, so it is clear what is being missed. */
.rem-dead td { opacity: .55; }
.rem-dead .pick-cell input { cursor: not-allowed; }
#tbl-reminders .pick-cell { width: 30px; }

.pay-summary[hidden] { display: none; }
.send-channels[hidden] { display: none; }
.unit-bar[hidden] { display: none; }
.doc-bar[hidden] { display: none; }
.inv-panels[hidden] { display: none; }
.del-choice[hidden] { display: none; }
.kv[hidden] { display: none; }
.veh-grid[hidden] { display: none; }
.dlg-grid[hidden] { display: none; }
.tiles[hidden] { display: none; }
.totals[hidden] { display: none; }

/* ------------------------------------------------ payment allocation rows */
#tbl-alloc tbody tr { cursor: pointer; }
#tbl-alloc tbody tr:hover { background: var(--surface-2); }
#tbl-alloc tbody tr.picked { background: var(--good-sf); }
#tbl-alloc tbody tr.picked td { border-bottom-color: var(--good); }
#tbl-alloc input[type="checkbox"] { width: auto; cursor: pointer; }
/* The amount stays editable, but must look editable. */
#tbl-alloc input.alloc {
  border: 1px solid var(--border-str); background: var(--surface);
  text-align: right; padding: 3px 7px; width: 100%;
}
#tbl-alloc input.alloc:focus { border-color: var(--accent); }
#tbl-alloc tr.picked input.alloc { border-color: var(--good); font-weight: 600; }

/* ------------------------------------------------ MVI records on a unit */
.mvi-history:empty { display: none; }
.mvi-history { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 5px; }
.mvi-history .k { font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-mute); font-weight: 650; }
.mvi-row { display: flex; align-items: center; gap: 9px; font-size: 13px;
  padding: 5px 9px; border: 1px solid var(--border); border-radius: var(--radius); }
.mvi-row .decal { font-weight: 650; font-variant-numeric: tabular-nums; }
.mvi-row .exp { color: var(--ink-mute); font-variant-numeric: tabular-nums; }
.mvi-row .tag { font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent); background: var(--accent-sf); border-radius: 3px; padding: 1px 6px; }
.mvi-row button { margin-left: auto; padding: 2px 9px; font-size: 12px;
  color: var(--bad); border-color: transparent; background: none; }
.mvi-row button:hover { background: var(--bad-sf); border-color: var(--bad); }

/* An inspection done on this job prints on it; the others do not. */
.mvi-row.on-this-job { border-color: var(--good); background: var(--good-sf); }
.mvi-row .tag.other { color: var(--ink-faint); background: var(--surface-2); }

/* ------------------------------------------------------------ batch send */
#dlg-batch { max-width: 720px; }
.batch-groups { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.batch-group { border: 1px solid var(--border); border-radius: 7px; padding: 11px 13px; }
.batch-group.cannot { border-color: var(--bad); background: var(--bad-sf); }
.batch-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.batch-head b { font-size: 14px; }
.batch-head .to { margin-left: auto; font-size: 12px; color: var(--ink-mute); }
.batch-docs { margin-top: 6px; font-size: 12px; color: var(--ink-mute);
  font-variant-numeric: tabular-nums; }
.batch-group textarea { margin-top: 8px; font-family: var(--sans); font-size: 12px;
  line-height: 1.45; min-height: 74px; }
.batch-group summary { cursor: pointer; font-size: 12px; color: var(--ink-mute); margin-top: 6px; }
#tbl-invoices tbody tr.chosen { background: var(--accent-sf); }
#inv-all, .inv-pick { width: auto; cursor: pointer; }

/* --------------------------------------------- per-line PST on exempt jobs */
/* The column only means anything when the customer holds an exemption. */
.pst-col { text-align: center; }
#tbl-parts td.pst-cell { text-align: center; }
#tbl-parts td.pst-cell input { width: auto; cursor: pointer; }
body:not(.pst-exempt) .pst-col,
body:not(.pst-exempt) #tbl-parts td.pst-cell { display: none; }
/* Only meaningful on an exempt invoice. When PST is charged on everything,
   highlighting some lines and not others says nothing and reads as a mistake. */
body.pst-exempt #tbl-parts tr.pst-on td { background: var(--warn-sf); }
.pst-note { font-size: 11px; color: var(--warn); margin-top: 6px; font-weight: 600; }
.pst-note:empty { display: none; }

/* ------------------------------------------- receivables by customer */
#tbl-ar-cust tbody tr.cust-row { cursor: pointer; }
#tbl-ar-cust tbody tr.cust-row:hover { background: var(--surface-2); }
#tbl-ar-cust tbody tr.cust-row.open { background: var(--accent-sf); }
.ar-detail > td { background: var(--surface-2); padding: 0; }
.ar-detail table { width: 100%; }
.ar-detail th { background: transparent; font-size: 10px; }
.ar-detail td, .ar-detail th { padding: 5px 10px; }
.ar-actions { display: flex; gap: 6px; justify-content: flex-end; }
.ar-actions button { padding: 3px 10px; font-size: 12px; }
.reach-none { color: var(--bad); font-weight: 600; }
.reach-ok { color: var(--good); font-weight: 600; }


/* ------------------------------------------------------ tax report */

button.quiet { color: var(--ink-mute); font-weight: 500; }

/* The report is a document that gets filed, so it is headed like one. */
.rep-doc-h {
  display: flex; align-items: flex-end; gap: 12px;
  padding-bottom: 12px; margin-bottom: 16px;
  border-bottom: 2px solid var(--ink);
}
.rep-doc-h h1 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.rep-sub { font-size: 12.5px; color: var(--ink-mute); margin-top: 3px; }

/* Shown only when a figure is wrong. An empty report is a balanced one. */
.alert {
  border: 1px solid var(--bad); border-left-width: 3px; border-radius: 6px;
  background: var(--bad-sf, transparent); color: var(--bad);
  padding: 9px 13px; margin-bottom: 16px; font-size: 13px; font-weight: 600;
}
.alert[hidden] { display: none; }
.bad-num { color: var(--bad); font-weight: 600; }

/* Totals on every table in the report. */
#rep-tax tfoot td {
  border-top: 2px solid var(--border-str); background: var(--surface-2);
  padding-top: 7px; padding-bottom: 7px;
}
/* Collected and unpaid sit under the total as working lines, not totals. */
#rep-tax tfoot tr.sub td {
  border-top: 0; padding-top: 3px; padding-bottom: 3px;
  color: var(--ink-mute); font-weight: 500;
}

.pill.exempt-pill {
  background: var(--warn-sf); color: var(--warn); border: 1px solid transparent;
}

/* ------------------------------------------------------------- printing */
/* A report is a document somebody files, so printing has to give a clean
   sheet: no sidebar, no buttons, just the figures under a heading that says
   whose they are and what period they cover. The report draws that heading
   itself, so paper and screen say the same thing. */
@media print {
  .side, .topbar, #rep-tax-csv, #rep-tax-print,
  .card-h button, .empty, .nav-item { display: none !important; }
  .app { display: block; }
  .main { margin: 0; padding: 0; }
  .view { display: none; }
  .view.on { display: block; }

  body { background: #fff; color: #000; font-size: 10.5pt; }
  .card, .tile {
    border: 1px solid #999; border-radius: 0; background: #fff;
    box-shadow: none; break-inside: avoid;
  }
  .card { margin-bottom: 10pt; }
  .tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6pt; }
  .card-h h2 { font-size: 11pt; }
  .rep-doc-h { border-bottom: 2px solid #000; }
  .rep-doc-h h1 { font-size: 15pt; }

  table { width: 100%; border-collapse: collapse; }
  th, td { border-bottom: 1px solid #ccc; padding: 3pt 5pt; }
  thead th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  thead { display: table-header-group; }
  tfoot { display: table-row-group; }
  #rep-tax tfoot td { background: #f4f4f4 !important; border-top: 1.5pt solid #000;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  tr { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
  .tbl-wrap { overflow: visible; max-height: none; }

  /* The period selector is not part of the document, but which period was
     chosen is - and the report heading already carries it. */
  #view-reports > .card:first-child { display: none; }
}
/* The Units button ends every customer row, so it has to read as the control
   it is rather than fading into the row it sits on. */
.js-units {
  border-color: var(--border-str); background: var(--surface);
  color: var(--ink); font-weight: 650; letter-spacing: .01em;
}
.js-units:hover {
  border-color: var(--accent); background: var(--accent-sf); color: var(--accent);
}

/* A chip opens that vehicle's service record, so it reads as a link into
   something rather than a label. */
.unit-chip { font-weight: 600; color: var(--ink); }


/* -------------------------------------------------------------- sign-in */
dialog.signin { max-width: 420px; }
dialog.signin::backdrop { background: var(--bg); }        /* nothing to see behind it */
.si-names { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 14px; }
.si-name {
  font-size: 18px; font-weight: 700; padding: 22px 10px; border-radius: 10px;
  border: 2px solid var(--border-str); background: var(--surface); color: var(--ink);
}
.si-name:hover { border-color: var(--accent); }
.si-name.on { border-color: var(--accent); background: var(--accent-sf); color: var(--accent); }
.si-pinrow { display: flex; gap: 8px; align-items: center; }
.si-pinrow input { font-size: 20px; letter-spacing: .3em; text-align: center; max-width: 160px; }
.si-pinrow[hidden], #si-setup[hidden], #si-pick[hidden] { display: none; }
.err { color: var(--bad); font-weight: 600; font-size: 12.5px; min-height: 16px; margin-top: 8px; }
.who {
  border-color: var(--border-str); background: var(--surface); font-weight: 650; color: var(--ink);
}
.who:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-sf); }


/* -------------------------------------------------------------- history */
.job-history { margin-top: 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.job-history > summary {
  cursor: pointer; padding: 9px 14px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .07em; font-weight: 650; color: var(--ink-mute); list-style: none;
}
.job-history > summary::-webkit-details-marker { display: none; }
.job-history > summary::before { content: "▸"; display: inline-block; width: 14px; }
.job-history[open] > summary::before { content: "▾"; }
.job-history table { width: 100%; border-collapse: collapse; }
.job-history td { padding: 6px 14px; border-top: 1px solid var(--border); font-size: 12.5px; vertical-align: top; }
.job-history td:first-child { white-space: nowrap; width: 128px; }
.job-history td:nth-child(2) { white-space: nowrap; width: 90px; }
.job-history td:nth-child(3) { white-space: nowrap; width: 150px; color: var(--ink-mute); }

/* Spelling marks: a dotted line under a word we do not know, laid over the box. */
.ac-layer { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; z-index: 55; }
.ac-mark { position: absolute; height: 5px; border-bottom: 2px dotted var(--bad); pointer-events: auto; cursor: pointer; }
.ac-mark:hover { border-bottom-style: solid; }
.ac-mirror { position: absolute; left: -99999px; top: 0; visibility: hidden; box-sizing: border-box; border: 0; margin: 0;
             pointer-events: none; }
.ac-mirror span { display: inline; }
/* The fill-in: what Tab would add, shown faintly ahead of the caret. */
.ac-ghost { position: absolute; z-index: 54; pointer-events: none; color: var(--ink-faint); white-space: pre;
            overflow: hidden; text-overflow: ellipsis; }
.ac-ghost::after { content: "Tab"; margin-left: 8px; font: 600 9px/1 var(--sans); letter-spacing: .04em; color: var(--ink-faint);
                   border: 1px solid var(--border-str); border-radius: 3px; padding: 1px 3px; vertical-align: middle; }
.ac-menu { position: absolute; z-index: 65; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; max-width: 360px;
           padding: 6px; background: var(--surface); border: 1px solid var(--border-str); border-radius: var(--radius);
           box-shadow: var(--shadow); }
.ac-menu button { padding: 4px 10px; font-size: 13px; }
.ac-menu .ac-pick { font-weight: 600; }
.ac-menu .ac-keep { background: none; border-color: transparent; color: var(--ink-mute); }
.ac-menu .ac-keep b { color: var(--ink); }
.ac-menu .ac-none { font-size: 12px; color: var(--ink-mute); padding: 2px 4px; width: 100%; }

/* Parts bought: supplier invoices and the review screen. */
.pill.new { background: var(--accent-sf); color: var(--accent); border-color: var(--accent); }
.pill.assigned { background: var(--info-sf); color: var(--info); border-color: var(--info); }
.pill.billed { background: var(--good-sf); color: var(--good); border-color: var(--good); }
.pill.unparsed { background: var(--warn-sf); color: var(--warn); border-color: var(--warn); }
.pill.stock, .pill.ignored { background: var(--surface-2); color: var(--ink-mute); border-color: var(--border-str); }
#tbl-parts-inv tbody tr { cursor: pointer; }
.pd-note { margin: 12px 16px 0; padding: 8px 12px; background: var(--warn-sf); color: var(--warn); border-radius: var(--radius); font-size: 12.5px; }
.pd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px 12px; padding: 14px 16px; }
.pd-grid .f { margin: 0; }
.pd-job { padding: 4px 16px 12px; display: grid; gap: 8px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.pd-job .k, .sugg .k { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-mute); font-weight: 600; margin-top: 8px; }
.pd-job-pick { font-size: 14px; margin-right: 8px; }
.sugg { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sugg .k { width: 100%; margin: 0; }
.sugg-job { text-align: left; }
.sugg-job .hint { display: block; font-weight: 400; }
.pd-alt { display: flex; gap: 8px; margin-top: 4px; }
.pd-foot { display: flex; gap: 12px; align-items: flex-end; padding: 10px 16px 12px; }
#tbl-pd-lines tr.is-billed td, #tbl-bought tr.is-billed td { color: var(--ink-mute); }
#tbl-pd-lines td.pst-cell { text-align: center; } #tbl-pd-lines td.pst-cell input { width: auto; }

/* Parts bought: attach offers in the editor, the purchases report, app keys. */
.bought-cands { display: grid; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--accent-sf); }
.bought-cands .cand { display: flex; gap: 12px; align-items: center; justify-content: space-between; font-size: 13px; }
.bought-cands .cand .hint { display: block; }
.rep-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .rep-two { grid-template-columns: 1fr; } }
.key-make { display: flex; gap: 8px; } .key-make input { flex: 1; }
.key-new { padding: 12px; background: var(--good-sf); border: 1px solid var(--good); border-radius: var(--radius); display: grid; gap: 8px; }
.key-new .k { font-size: 12.5px; color: var(--ink-mute); }
.key-value { display: flex; gap: 8px; align-items: center; } .key-value code { flex: 1; font: 13px var(--mono); word-break: break-all; user-select: all; }
#key-help code { font: 12px var(--mono); background: var(--surface-2); padding: 1px 4px; border-radius: 3px; }

/* Bought for this job: one header row per supplier invoice, actions per line. */
#tbl-bought tr.bought-inv td { background: var(--surface-2); font-size: 12.5px; padding-top: 6px; padding-bottom: 6px; }
#tbl-bought tr.bought-inv .js-inv-unassign { float: right; font-size: 12px; padding: 2px 8px; }
#tbl-bought .b-act { white-space: nowrap; } #tbl-bought .b-act button { padding: 4px 8px; font-size: 12px; margin-right: 3px; }
#tbl-bought .b-qty, #tbl-bought .b-sell { padding: 4px 6px; }
#tbl-bought .b-move { display: grid; gap: 6px; white-space: normal; min-width: 260px; }
#tbl-bought .b-move .sugg-job { font-size: 12px; }

.pill.applied { background: var(--surface-2); color: var(--ink-mute); border-color: var(--border-str); }
.pl-where { white-space: normal; font-size: 12.5px; } .pl-acts button { padding: 3px 8px; font-size: 12px; margin-right: 4px; }
.pl-on .pl-unplace { padding: 0 4px; font-size: 14px; line-height: 1; }

/* Labour descriptions show in full and grow as they are typed. */
textarea.l-desc { resize: none; overflow: hidden; min-height: 32px; line-height: 1.35; white-space: pre-wrap; word-break: break-word; display: block; }
#tbl-labour td { vertical-align: top; }

/* Money a customer has paid ahead, shown on their invoices. */
.credit-badge { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--good); background: var(--good-sf); border: 1px solid var(--good); border-radius: 999px; padding: 2px 10px; }
.credit-badge .js-apply-credit { color: var(--good); font-weight: 600; padding: 0 4px; font-size: 12px; }
#credit-what p { margin: 0 0 8px; }

.pay-acts { white-space: nowrap; }
.row-edit { color: var(--ink-mute); border: 0; background: none; padding: 2px 6px; cursor: pointer; font-size: 12px; }
.row-edit:hover { color: var(--accent); background: none; }

/* Payment row actions: small matching buttons, undo warns in red. */
.pay-acts { white-space: nowrap; text-align: right; }
.pay-acts .act { font-size: 12px; padding: 3px 10px; margin-left: 4px; border-radius: 999px; border: 1px solid var(--border-str); background: var(--surface); color: var(--ink-mute); font-weight: 600; }
.pay-acts .act:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-sf); }
.pay-acts .act-undo:hover { color: var(--bad); border-color: var(--bad); background: var(--bad-sf); }

/* To send: invoices done and waiting. Late ones are marked. */
#tbl-tosend .pay-acts .act[disabled] { opacity: .45; cursor: not-allowed; }
#tosend-fleet { margin: 0 16px 14px; } #tosend-fleet summary { cursor: pointer; font-size: 13px; font-weight: 600; padding: 8px 0; }
.credit-badge[hidden] { display: none; }

/* Chasing money: due rows stand out, quiet rows fade. */
#tbl-chase tr.is-due td:first-child b { color: var(--bad); }
#tbl-chase tr.is-quiet td { color: var(--ink-mute); }
#tbl-chase .chase-note { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#tbl-chase .cn-text { flex: 1; min-width: 160px; padding: 4px 8px; font-size: 12.5px; }
#tbl-chase .cn-until-l { display: inline-flex; gap: 4px; align-items: center; margin: 0; white-space: nowrap; } #tbl-chase .cn-until { width: 130px; padding: 3px 6px; font-size: 12px; }
#tbl-chase .act-due { color: var(--bad); border-color: var(--bad); }

/* The decal book. */
.decal-chip { display: inline-flex; align-items: center; gap: 2px; font-family: var(--mono); font-size: 12.5px; background: var(--surface); border: 1px solid var(--border-str); border-radius: 999px; padding: 1px 4px 1px 9px; margin: 2px 0; }
.decal-chip .js-decal-void { padding: 0 6px; font-size: 11px; }
#decal-card .review-note { margin: 12px 16px 0; }

#decal-void-list .act { padding: 1px 8px; font-size: 11px; margin-left: 2px; }

/* Picker: bought, not charged yet */
.bought-top { display: flex; gap: 10px; align-items: center; } .bought-top input[type=search] { flex: 0 1 380px; }
#tbl-bought-all tr.bought-inv td { background: var(--surface-2); font-size: 12.5px; padding-top: 6px; padding-bottom: 6px; white-space: normal; }
#tbl-bought-all tr.bought-inv button { font-size: 12px; padding: 2px 8px; margin-left: 4px; }
#tbl-bought-all .bp-qty, #tbl-bought-all .bp-stock { padding: 4px 6px; width: 64px; } #tbl-bought-all .bp-sell { padding: 4px 6px; width: 86px; }
#tbl-bought-all .bp-bills { white-space: normal; } #tbl-bought-all .bp-bills .pill { margin: 1px 2px 1px 0; }
#tbl-bought-all .js-bp-add { padding: 4px 10px; font-size: 12px; }
#tbl-bought-all tr.is-billed td { color: var(--ink-mute); }
#dlg-bought .tbl-wrap { overflow-x: auto; } #tbl-bought-all { min-width: 940px; }
/* While a dialog is up the page behind it stays put; a list inside scrolls on its own. */
body:has(dialog[open]) { overflow: hidden; }
.hist-body, dialog .tbl-wrap { overscroll-behavior: contain; }

/* Parts page: shop stock and supplier bills side by side */
.parts-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.parts-tabs .ptab { border-radius: 999px; padding: 6px 14px; }
.parts-tabs .ptab.is-on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.parts-tabs .badge:empty { display: none; }
#stock-tiles { padding: 12px 16px 0; }
#tbl-stock .st-low { color: var(--warn); font-weight: 600; }
#tbl-stock .st-zero { color: var(--ink-mute); }
#tbl-stock tr.st-hist td { background: var(--surface-2); font-size: 12.5px; white-space: normal; }
#tbl-stock .st-hist ul { margin: 4px 0; padding-left: 18px; } #tbl-stock .st-hist li { margin: 2px 0; }
#tbl-stock .st-edit { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#tbl-stock .st-edit input { padding: 3px 6px; font-size: 12.5px; }
#tbl-stock .st-count { width: 70px; } #tbl-stock .st-why { width: 150px; } #tbl-stock .st-loc { width: 110px; } #tbl-stock .st-min { width: 60px; }
#tbl-bought-all tr.bought-stock td { background: var(--good-sf); }
.parts-tabs .badge { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.parts-tabs .ptab.is-on .badge { background: var(--surface); color: var(--ink); }
#stock-card .card-h label.hint { white-space: nowrap; }

/* Supplier bills: one header row per invoice, its parts under it */
#tbl-parts-inv tr.inv-head td { background: var(--surface-2); padding-top: 9px; padding-bottom: 9px; white-space: normal; border-top: 2px solid var(--border-str); }
#tbl-parts-inv tr.inv-head .inv-title { font-size: 13.5px; }
#tbl-parts-inv tr.inv-head .inv-meta { color: var(--ink-mute); font-size: 12.5px; margin-left: 6px; }
#tbl-parts-inv tr.inv-head .inv-for { display: inline-flex; gap: 6px; align-items: center; margin-left: 12px; flex-wrap: wrap; }
#tbl-parts-inv tr.inv-head .inv-acts { float: right; display: flex; gap: 4px; align-items: center; }
#tbl-parts-inv tr.inv-head .inv-acts .act, #tbl-parts-inv .pl-acts .act, #tbl-parts-inv .inv-for .act { padding: 2px 9px; font-size: 12px; }
#tbl-parts-inv .pl-where { white-space: normal; font-size: 12.5px; }
#tbl-parts-inv .pl-where .pill { margin-right: 4px; }
#tbl-parts-inv .b-move { display: grid; gap: 6px; white-space: normal; min-width: 260px; } #tbl-parts-inv .b-move .sugg-job { font-size: 12px; }
#tbl-parts-inv tr.is-dealt td { color: var(--ink-mute); }
#tbl-parts-inv tr.inv-nolines td { color: var(--ink-mute); font-style: italic; }

.pl-acts { display: inline-flex; gap: 4px; align-items: center; } .pl-acts .pl-qty { width: 58px; padding: 2px 6px; font-size: 12.5px; }

/* Where a part row came from: the supplier bill (click opens it) or the shelf */
.p-src { display: inline-block; margin-top: 3px; font-size: 10.5px; line-height: 14px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--ink-mute); text-decoration: none; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
a.p-src:hover { background: var(--accent-sf); color: var(--accent); }

#tbl-parts-inv .inv-po { display: inline-block; margin-left: 10px; padding: 1px 9px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 700; font-size: 12.5px; letter-spacing: .01em; }
#tbl-parts-inv .inv-po-none { background: transparent; color: var(--ink-mute); font-weight: 500; border: 1px dashed var(--border-str); }

/* A supplier bill page: the bill itself, its parts beside it, whose parts at the top */
.pd-who { display: flex; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.pd-who .k { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-mute); font-weight: 600; }
.pd-who #pd-who-now { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pd-who .b-move { display: inline-grid; gap: 6px; min-width: 260px; }
.pd-view { display: grid; grid-template-columns: minmax(380px, 1fr) minmax(360px, 1fr); gap: 0; }
.pd-view .pd-pdf { width: 100%; height: 76vh; border: 0; border-right: 1px solid var(--border); background: var(--surface-2); }
.pd-view .pd-lines { padding: 10px 12px; overflow: auto; max-height: 76vh; }
.pd-view .pd-lines .k { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-mute); font-weight: 600; margin: 4px 0 8px; }
#tbl-pd-view td, #tbl-pd-view th { padding: 6px 8px; font-size: 12.5px; } #tbl-pd-view tr.is-dealt td { color: var(--ink-mute); }
@media (max-width: 1100px) { .pd-view { grid-template-columns: 1fr; } .pd-view .pd-pdf { height: 60vh; border-right: 0; border-bottom: 1px solid var(--border); } }
#btn-add-bought .badge { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; line-height: 18px; text-align: center; } #btn-add-bought .badge[hidden] { display: none; }
.card-h .inv-po { display: inline-block; padding: 1px 9px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 700; font-size: 12.5px; } .card-h .inv-po-none { background: transparent; color: var(--ink-mute); font-weight: 500; border: 1px dashed var(--border-str); }

/* The Where column: pills, then a fixed row of quantity box and buttons, lined up on every row */
.pl-where { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pl-where .pl-acts { display: inline-flex; gap: 4px; align-items: center; margin-left: auto; white-space: nowrap; }
.pl-where .pl-acts .pl-qty { width: 56px; padding: 2px 6px; font-size: 12.5px; border: 1px solid var(--border-str); border-radius: 6px; text-align: right; }
.pl-where .pl-acts .act { padding: 2px 9px; font-size: 12px; }
.pl-where .pl-acts .act-undo { padding: 2px 7px; }
#tbl-pd-view .pl-where, #tbl-parts-inv .pl-where { min-width: 300px; }
.inv-po { white-space: nowrap; }
.pd-view { grid-template-columns: minmax(320px, 44%) 1fr; }
#tbl-pd-view .pl-where { min-width: 260px; }
#tbl-pd-view td.pl-where { white-space: normal; }

/* Bills list: one row per bill, click to open */
#tbl-parts-inv tr.inv-head { cursor: pointer; } #tbl-parts-inv tr.inv-head td { background: transparent; border-top: 0; padding-top: 10px; padding-bottom: 10px; }
#tbl-parts-inv tr.inv-head:hover td { background: var(--surface-2); }
.pd-totals { display: flex; gap: 18px; justify-content: flex-end; padding: 10px 8px 4px; font-size: 13px; color: var(--ink-mute); border-top: 1px solid var(--border); margin-top: 6px; }
.pd-totals b { color: var(--ink); } .pd-totals .pd-total b { font-size: 14.5px; }
.pl-where a.pill { text-decoration: none; cursor: pointer; } .pl-where a.pill:hover { filter: brightness(.95); }

/* Bill page parts: quiet rows; where each piece went in words; buttons only when the row is under the mouse */
#tbl-pd-view td, #tbl-pd-view th { padding: 7px 8px; font-size: 13px; vertical-align: middle; }
#tbl-pd-view tr.is-dealt td { color: var(--ink-mute); }
#tbl-pd-view td.pl-where { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 30px; min-width: 240px; white-space: normal; }
#tbl-pd-view .pl-sent { color: var(--ink); font-size: 12.5px; text-decoration: none; white-space: nowrap; }
#tbl-pd-view a.pl-sent:hover { text-decoration: underline; }
#tbl-pd-view .pl-sent-wait { color: var(--ink-mute); } #tbl-pd-view .pl-sent-wait .act { margin-left: 3px; padding: 0 5px; font-size: 11px; line-height: 16px; }
#tbl-pd-view .pl-sep { color: var(--border-str); }
#tbl-pd-view .pl-left { color: var(--ink-mute); font-size: 12.5px; }
#tbl-pd-view .pl-acts { display: none; margin-left: auto; }
#tbl-pd-view tr:hover .pl-acts, #tbl-pd-view tr:focus-within .pl-acts { display: inline-flex; }
#tbl-pd-view .pl-acts .pl-qty[hidden] { display: none; }
.pd-fees { margin: 10px 8px 0; font-size: 12.5px; color: var(--ink-mute); } .pd-fees summary { cursor: pointer; }
#tbl-pd-fees td { padding: 4px 8px; font-size: 12.5px; color: var(--ink-mute); } #tbl-pd-fees .act { padding: 1px 8px; font-size: 11.5px; }

/* Bill page: two boxes per part */
#tbl-pd-view .pa-bill, #tbl-pd-view .pa-stock { width: 72px; padding: 4px 6px; text-align: right; }
#tbl-pd-view .pa-bill:disabled { background: var(--surface-2); color: var(--ink-mute); }
#tbl-pd-view tr.is-dealt .pa-bill, #tbl-pd-view tr.is-dealt .pa-stock { border-color: transparent; background: transparent; }
#tbl-pd-view td .hint { font-size: 11.5px; }

/* Bill page: whose part, typed as a unit number or a name */
#tbl-pd-view .pa-for { white-space: normal; }
#tbl-pd-view .pa-pick { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; position: relative; }
#tbl-pd-view .pa-for-q { width: 150px; padding: 4px 6px; font-size: 12.5px; } #tbl-pd-view .pa-for-qty { width: 48px; padding: 4px 6px; text-align: right; }
#tbl-pd-view .pa-for-res { flex-basis: 100%; } #tbl-pd-view .pa-for-res .sugg-job { font-size: 12px; padding: 3px 8px; }
#tbl-pd-view .pa-who { display: inline-flex; gap: 6px; align-items: center; } #tbl-pd-view .pa-who .act { padding: 0 6px; font-size: 11px; line-height: 16px; }

/* Bill page: the customer is the row */
#tbl-pd-view td.pa-for { white-space: normal; min-width: 260px; }
#tbl-pd-view .pa-pick { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#tbl-pd-view .pa-for-q { flex: 1 1 200px; min-width: 200px; height: 36px; padding: 6px 12px; font-size: 14px; font-weight: 600; border: 2px solid var(--accent); border-radius: 8px; background: var(--surface); color: var(--ink); }
#tbl-pd-view .pa-for-q::placeholder { font-weight: 500; color: var(--accent); opacity: .85; }
#tbl-pd-view .pa-for-q:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-sf); }
#tbl-pd-view .pa-for-n { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--ink-mute); white-space: nowrap; }
#tbl-pd-view .pa-for-qty { width: 52px; height: 30px; padding: 3px 6px; text-align: right; border: 1px solid var(--border-str); border-radius: 6px; }
#tbl-pd-view .pa-for-res { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; } #tbl-pd-view .pa-for-res .sugg-job { font-size: 13px; padding: 5px 10px; }
#tbl-pd-view .pa-who { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; } #tbl-pd-view .pa-who .act { padding: 1px 8px; font-size: 11.5px; }
#tbl-pd-view .pa-stock { width: 60px; height: 32px; padding: 4px 6px; text-align: right; border: 1px solid var(--border-str); border-radius: 6px; }
#tbl-pd-view tr.is-dealt .pa-stock { border-color: transparent; background: transparent; }

/* Bill page: removing a part with a reason */
#tbl-pd-view td.pa-rm-cell { white-space: normal; min-width: 420px; }
#tbl-pd-view .pa-rm-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; } #tbl-pd-view .pa-rm-form label { display: inline-flex; gap: 4px; align-items: center; font-size: 12.5px; }
#tbl-pd-view .pa-rm-qty { width: 52px; padding: 3px 6px; text-align: right; } #tbl-pd-view .pa-rm-why { flex: 1 1 200px; min-width: 200px; padding: 5px 8px; }
#tbl-pd-view .pa-removed { display: inline-flex; gap: 4px; align-items: center; color: var(--bad); font-size: 11.5px; margin-right: 6px; } #tbl-pd-view .pa-removed .act { padding: 0 5px; font-size: 11px; line-height: 15px; }
/* Bill page: the parts list scrolls with the page; the PDF stays alongside */
.pd-view { align-items: start; }
.pd-view .pd-lines { max-height: none; overflow: visible; }
.pd-view .pd-pdf { position: sticky; top: 8px; height: calc(100vh - 32px); }
@media (max-width: 1100px) { .pd-view .pd-pdf { position: static; height: 60vh; } }

/* Bill page: pieces spoken for sit under the part; the assign box is quantity then name */
#tbl-pd-view .pa-piece { font-size: 13px; padding: 2px 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#tbl-pd-view .pa-piece .act { padding: 0 6px; font-size: 11px; line-height: 16px; }
#tbl-pd-view .pa-pick { margin-top: 4px; }
#tbl-pd-view .pa-for-n { font-size: 13px; color: var(--ink); } #tbl-pd-view .pa-for-qty { width: 56px; height: 34px; font-size: 14px; font-weight: 600; border: 2px solid var(--border-str); border-radius: 8px; }
#tbl-pd-view .pa-instock b { font-size: 14px; }

/* Credit slips: information, not work */
#tbl-parts-inv .inv-credit { color: var(--good); font-weight: 600; }
.card-h .inv-credit-tag { background: var(--good); }
.pill.credit { background: var(--good-sf); color: var(--good); border-color: var(--good); }
#tbl-pd-credit td, #tbl-pd-credit th { padding: 6px 8px; font-size: 13px; }

/* Parts pages: short words, capitals */
#tbl-parts-inv .inv-credit, #tbl-parts-inv .inv-po, .pd-who, .pa-piece, .pd-lines .k, .inv-credit-tag { text-transform: uppercase; }
.pd-who .act, .pa-piece .act { text-transform: none; }

/* Bill page: the PO box */
.pd-po-box { display: inline-flex; gap: 6px; align-items: center; margin-left: 8px; }
.pd-po-box #pd-po-in { width: 200px; height: 34px; padding: 4px 10px; font-size: 14px; font-weight: 600; text-transform: uppercase; border: 2px solid var(--accent); border-radius: 8px; }
.pd-po-box #pd-po-in::placeholder { color: var(--accent); opacity: .8; }

/* Reports: pick the report, tick the months */
.rep-pick { flex-wrap: wrap; gap: 10px; }
.rep-kinds { display: flex; gap: 6px; } .rep-kinds .ptab { border-radius: 999px; padding: 6px 14px; } .rep-kinds .ptab.is-on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.rep-year { display: inline-flex; gap: 8px; align-items: center; font-size: 15px; } .rep-year .act { padding: 2px 10px; font-size: 15px; }
.rep-months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; padding: 4px 16px 10px; }
.rep-month { padding: 10px 0; border: 1px solid var(--border-str); border-radius: 8px; background: var(--surface); font-weight: 600; font-size: 13px; cursor: pointer; }
.rep-month:hover { background: var(--surface-2); } .rep-month.is-on { background: var(--accent); color: #fff; border-color: var(--accent); }
.rep-month.is-future { color: var(--ink-mute); } .rep-month.is-future.is-on { color: #fff; }
.rep-range { padding: 0 16px 12px; font-size: 13px; }
@media (max-width: 900px) { .rep-months { grid-template-columns: repeat(6, 1fr); } }

.mvi-expiry { display: inline-block; padding: 7px 10px; font-weight: 600; letter-spacing: .02em; background: var(--surface-2); border-radius: 6px; min-width: 120px; }
.mvi-expiry.is-recorded { background: var(--good-sf); color: var(--good); }

/* Invoices: the report month grid, smaller, in one row */
.inv-months-bar { display: flex; gap: 10px; align-items: center; padding: 6px 16px 10px; border-bottom: 1px solid var(--border); }
.rep-year-sm { font-size: 13px; } .rep-year-sm .act { padding: 1px 8px; font-size: 13px; }
.rep-months-sm { display: grid; grid-template-columns: repeat(12, minmax(44px, 1fr)); gap: 4px; padding: 0; flex: 1; max-width: 720px; }
.rep-months-sm .rep-month { padding: 5px 0; font-size: 12px; border-radius: 6px; }
@media (max-width: 900px) { .inv-months-bar { flex-wrap: wrap; } .rep-months-sm { grid-template-columns: repeat(6, 1fr); } }

/* Tax report: PST habit per customer and the odd ones out */
.pill.pst-ok { background: var(--good-sf); color: var(--good); border-color: var(--good); }
.pill.pst-bad { background: var(--bad-sf, #fdecec); color: var(--bad); border-color: var(--bad); font-weight: 700; }
#tbl-rep-pst tr.pst-row-bad td { background: var(--bad-sf, #fdecec); }
.rep-pst-card .card-h .hint { text-transform: uppercase; font-weight: 600; color: var(--bad); }

/* Settings page: cards of labelled boxes, one Save for the lot */
.set-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; align-items: start; }
.set-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; padding: 14px 16px; }
.set-form .set-wide { grid-column: span 2; }
.set-form textarea { font-family: inherit; font-size: 12px; line-height: 1.4; resize: vertical; }
.set-logo { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
#set-logo-img { max-width: 260px; max-height: 120px; border: 1px solid var(--border); border-radius: 6px; padding: 6px; background: #fff; }
.set-logo-acts { display: flex; gap: 8px; }
.brand #brand-tagline[hidden] { display: none; }
@media (max-width: 900px) { .set-grid { grid-template-columns: 1fr; } }

/* Sign-in steps, first-run wizard, people on the Settings page */
#dlg-signin .si-step[hidden] { display: none; }
.si-links { display: flex; gap: 14px; margin-top: 12px; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font-size: 12px; cursor: pointer; font-family: inherit; text-decoration: underline; text-underline-offset: 2px; }
.linkish:hover { color: var(--ink); }
#dlg-signin label.f { margin-bottom: 10px; }
.su-steps { display: flex; gap: 6px; margin-bottom: 12px; }
.su-step { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-faint); }
.su-step.is-on { background: var(--accent-sf); color: var(--accent); }
.people-tbl td, .people-tbl th { padding: 7px 8px; font-size: 13px; }
.people-tbl tr.is-off td { color: var(--ink-faint); }
.people-tbl .pay-acts { white-space: nowrap; text-align: right; }
.people-invite { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; border-top: 1px solid var(--border); }
.people-invite-row { display: grid; grid-template-columns: 1fr 1.4fr auto auto; gap: 8px; }
.people-pending-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; padding: 4px 0; }
@media (max-width: 700px) { .people-invite-row { grid-template-columns: 1fr 1fr; } }

/* More than one shop on a computer; the Shops page */
.si-shop { grid-column: span 2; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); margin: 6px 0 -4px; }
.shops-invite-row { grid-template-columns: 1fr 1.4fr auto; }
#tbl-shops tr.is-off td { color: var(--ink-faint); }

/* Suppliers dialog: who is checked for bills */
#dlg-suppliers { max-width: 860px; }
#tbl-suppliers input, #tbl-suppliers select { font-size: 12px; padding: 5px 7px; width: 100%; box-sizing: border-box; }
#tbl-suppliers tr.is-off td { color: var(--ink-faint); }
#tbl-suppliers .pay-acts { white-space: nowrap; }
.sup-add { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.sup-add-row { display: grid; grid-template-columns: 1fr 1.6fr auto auto; gap: 8px; }
@media (max-width: 700px) { .sup-add-row { grid-template-columns: 1fr; } }

/* A bill the reader was not sure of: it waits for a person */
.pill.check { background: var(--bad-sf, #fdecec); color: var(--bad); border-color: var(--bad); font-weight: 700; }
.inv-check { color: var(--bad); font-weight: 700; letter-spacing: .02em; }
.pd-check { margin: 10px 16px 0; padding: 12px 14px; border: 1px solid var(--bad); background: var(--bad-sf, #fdecec); border-radius: var(--radius); display: flex; flex-direction: column; gap: 6px; }
.pd-check b { color: var(--bad); letter-spacing: .03em; }
.pd-check-acts { display: flex; gap: 8px; margin-top: 4px; }
