* { box-sizing: border-box; margin: 0; }
:root {
  --bar: #1b2a41;
  --bar-text: #e8eef7;
  --accent: #e0a100;
  --line: #d8dde4;
  --muted: #6b7686;
  --bg: #f4f6f8;
  --waiting: #f5a623;
  --dispatched: #2b5bd7;
  --enroute: #1fa88a;
  --onscene: #1d7a34;
  --towing: #47a8e5;
  --completed: #8a94a3;
  --cancelled: #c0392b;
}
html, body { height: 100%; }
body {
  font: 14px/1.4 "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: #22293a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- top bar ---------- */
#topbar {
  background: var(--bar);
  color: var(--bar-text);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  flex: 0 0 auto;
}
#brand { font-weight: 700; letter-spacing: 1px; }
#brand span { color: var(--accent); }
#btn-new-call {
  background: var(--accent);
  border: 0;
  color: #1b2a41;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 4px;
  cursor: pointer;
}
#btn-new-call:hover { filter: brightness(1.08); }
#search {
  flex: 1;
  max-width: 420px;
  padding: 7px 10px;
  border-radius: 4px;
  border: 0;
}
#company { margin-left: auto; font-size: 12px; opacity: .85; }

/* ---------- layout ---------- */
#layout { flex: 1; display: flex; min-height: 0; }
#rail {
  flex: 0 0 170px;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 10px 0;
}
.rail-title { font-size: 11px; color: var(--muted); padding: 0 14px 6px; letter-spacing: .5px; }
.rail-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  color: #33405a;
}
.rail-item:hover { background: #eef2f7; }
.rail-item.active { background: #e3ebf5; font-weight: 600; }
.rail-item .count { color: var(--muted); font-size: 12px; }

#board { flex: 1; overflow-y: auto; }
#call-list { padding: 6px; }
.empty { color: var(--muted); text-align: center; padding: 40px; }

/* ---------- call rows ---------- */
.call {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 6px solid var(--completed);
  border-radius: 4px;
  margin-bottom: 6px;
  padding: 8px 12px;
  cursor: pointer;
}
.call:hover { border-color: #b9c2cf; border-left-color: inherit; }
.call.st-waiting { border-left-color: var(--waiting); }
.call.st-dispatched { border-left-color: var(--dispatched); }
.call.st-enroute { border-left-color: var(--enroute); }
.call.st-onscene { border-left-color: var(--onscene); }
.call.st-towing { border-left-color: var(--towing); }
.call.st-completed { border-left-color: var(--completed); }
.call.st-cancelled { border-left-color: var(--cancelled); }

.call-grid {
  display: grid;
  grid-template-columns: 70px 1.4fr 1.4fr 1fr 1.2fr 110px;
  gap: 4px 12px;
  align-items: start;
}
.call-num { color: var(--muted); font-size: 13px; padding-top: 2px; }
.call-vehicle { font-weight: 600; color: #1d4f91; }
.call-sub { color: var(--muted); font-size: 12px; }
.card-form { border: 1px solid var(--line); border-radius: 4px; padding: 10px; margin-top: 8px; display: grid; gap: 8px; max-width: 480px; }
.card-form[hidden] { display: none; }
.card-form input[type="text"] { padding: 5px 6px; border: 1px solid var(--line); border-radius: 4px; font: inherit; }
.card-agree { font-size: 13px; display: flex; gap: 6px; align-items: center; }
.call-po { color: var(--text); font-weight: 700; font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }
.kv { font-size: 13px; }
.kv b { color: var(--muted); font-weight: 600; font-size: 11px; display: inline-block; min-width: 62px; }
.call-balance { text-align: right; font-weight: 600; }
.call-balance .paid { color: var(--onscene); }
.late {
  display: inline-block;
  background: #fff3b0;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  margin-top: 2px;
}

.call-notes { font-size: 12px; color: var(--muted); padding: 4px 0 0 82px; white-space: pre-line;   /* lines up with the vehicle column */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.call-notes b { font-weight: 600; }
.call-actions {
  display: none;
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding-top: 8px;
  gap: 8px;
  flex-wrap: wrap;
}
.call.open .call-actions { display: flex; }
.call-actions button {
  border: 1px solid var(--line);
  background: #f7f9fb;
  border-radius: 4px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 13px;
}
.call-actions button:hover { background: #e8eef5; }
.call-actions button.adv { border-color: var(--dispatched); color: var(--dispatched); font-weight: 600; }
.call-actions button.done { border-color: var(--onscene); color: var(--onscene); font-weight: 600; }
.call-actions button.warn { border-color: var(--cancelled); color: var(--cancelled); }

/* ---------- legend ---------- */
#legend {
  flex: 0 0 auto;
  display: flex;
  gap: 16px;
  padding: 6px 14px;
  background: #fff;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: #444;
}
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; }
.s-waiting { background: var(--waiting); }
.s-dispatched { background: var(--dispatched); }
.s-enroute { background: var(--enroute); }
.s-onscene { background: var(--onscene); }
.s-towing { background: var(--towing); }
.s-completed { background: var(--completed); }
.s-cancelled { background: var(--cancelled); }

/* ---------- editor ---------- */
#editor-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 28, 45, .35);
}
#editor {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 720px;
  max-width: 95vw;
  background: #fff;
  box-shadow: -4px 0 18px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
}
#editor-head {
  background: var(--bar);
  color: var(--bar-text);
  padding: 10px 14px;
  display: flex;
  align-items: center;
}
#editor-title { font-weight: 600; flex: 1; }
#editor-close {
  background: none; border: 0; color: var(--bar-text);
  font-size: 22px; cursor: pointer; line-height: 1;
}
#editor-body { flex: 1; overflow-y: auto; padding: 12px 16px; }
#editor-body section { border-bottom: 1px solid var(--line); padding: 10px 0; }
.section-title { font-weight: 600; font-size: 13px; color: #33405a; margin-bottom: 8px; }
.row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.row label { flex: 0 0 90px; font-size: 12px; color: var(--muted); text-align: right; }
.row label.inline { flex: 0 0 auto; }
/* With the pricer on, the labels of what the price is worked out from stand out. */
body.pricing #editor-body .pr-need { color: var(--cancelled); }
.eta-picker { display: flex; flex: 1; gap: 6px; flex-wrap: wrap; align-items: center; }
.eta-picker .eta-day { flex: 0 0 150px; }
.eta-picker .eta-time { display: flex; gap: 6px; }
.eta-picker .eta-time select { flex: 0 0 auto; }
.eta-picker .eta-type { display: flex; gap: 6px; flex: 1; min-width: 280px; }
.eta-picker .eta-text { flex: 1; min-width: 200px; }
.eta-picker .eta-clear { flex: none; border: 1px solid var(--line); background: #f7f9fb; border-radius: 4px;
  padding: 5px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.row input, .row select, .row textarea {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  flex: 1;
  min-width: 60px;
}
.row textarea { resize: vertical; }
.row .wide { flex: 1 1 100%; }
.grow-right { margin-left: auto; font-weight: 700; }

.vehicle-block {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px;
  margin-bottom: 8px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.vehicle-block input, .vehicle-block select {
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  width: 100%;
}
.vehicle-block .span2 { grid-column: span 2; }
.vehicle-block .vin-note { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.vehicle-block .veh-curb { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }   /* the curb weight range */
.vehicle-block .from-vin { background: #fdeaea; border-color: #d98b8b; color: #8a1c1c; }   /* a VIN filled it: red until changed by hand */
.vehicle-block .plate-lookup { padding: 5px 6px; border: 1px solid var(--line); border-radius: 4px; font: inherit; background: #fff; cursor: pointer; }
.vehicle-block .veh-remove {
  grid-column: 6;
  justify-self: end;
  border: 0; background: none; color: var(--cancelled); cursor: pointer; font-size: 12px;
}

.item-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.item-row input.desc { flex: 1; }
.item-row input.qty { flex: 0 0 60px; text-align: right; }
.item-row input.rate { flex: 0 0 90px; text-align: right; }
.item-row .line-total { flex: 0 0 80px; text-align: right; font-weight: 600; }
.item-row .item-remove { border: 0; background: none; color: var(--cancelled); cursor: pointer; }
.item-row .item-fee { flex: 0 0 auto; border: 1px solid var(--line); background: #f7f9fb; border-radius: 4px;
  padding: 3px 8px; font: inherit; font-size: 12px; cursor: pointer; }
.mini {
  border: 1px dashed var(--line);
  background: #f7f9fb;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.totals-row { margin-top: 8px; }
.totals-row input { flex: 0 0 90px; }
.totals-row select { flex: 0 0 60px; }

/* ---------- Reports ---------- */
.rep-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rep-controls select, .rep-controls input {
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; font: inherit; font-size: 13px;
}
.rep-summary { display: flex; gap: 12px; margin-bottom: 10px; }
.rep-card { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 10px 16px; min-width: 150px; }
.rep-card b { display: block; font-size: 20px; }
.rep-card span { color: var(--muted); font-size: 12px; }
.rep-wrap { background: #fff; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 12px; overflow-x: auto; }
.rep-wrap h4 { margin: 0; padding: 10px 14px 4px; font-size: 13px; color: #33405a; }
table.rep { width: 100%; border-collapse: collapse; font-size: 13px; }
.rep th { text-align: right; font-size: 11px; letter-spacing: .4px; text-transform: uppercase; color: var(--muted);
  padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rep td { text-align: right; padding: 6px 12px; border-bottom: 1px solid #edf0f3; white-space: nowrap; }
.rep th:first-child, .rep td:first-child { text-align: left; }
.rep tr.sum td { font-weight: 700; border-top: 2px solid var(--line); background: #f7f9fb; }
.rep td.zero { color: #c3c9d2; }
.rep-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
/* the Call Explorer */
.ex-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 8px; }
.ex-bar input[type=search] { flex: 1 1 240px; min-width: 180px; font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; }
.ex-bar select, .ex-bar button, details.ex-pop summary { font: inherit; font-size: 12px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; background: #fff; cursor: pointer; color: inherit; }
.ex-filters { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 10px; }
.ex-filters label { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); font-weight: 600; }
.ex-filters select, .ex-filters input { font: inherit; font-size: 12px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 4px; background: #fff; min-width: 110px; max-width: 220px; }
.ex-filters select.set { border-color: #1b2a41; background: #eef3ff; }
details.ex-pop { position: relative; }
details.ex-pop summary { list-style: none; }
details.ex-pop summary::-webkit-details-marker { display: none; }
details.ex-pop[open] summary { background: #eef3ff; }
.ex-pop-body { position: absolute; z-index: 30; top: 100%; left: 0; margin-top: 4px; background: #fff; border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 10px; box-shadow: 0 8px 24px rgba(0,0,0,.15); max-height: 60vh; overflow: auto; min-width: 240px; }
.ex-pop-body.cols { column-count: 3; min-width: 520px; }
.ex-pop-body label { display: block; font-weight: 400; font-size: 12px; margin: 2px 0; break-inside: avoid; white-space: nowrap; }
.ex-pop-body input[type=checkbox] { width: auto; margin: 0 6px 0 0; vertical-align: middle; }
.ex-view { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; padding: 3px 0; column-span: all; }
.ex-view button { font: inherit; font-size: 11px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 4px; background: #f7f9fb; cursor: pointer; }
table.rep th.sortable { cursor: pointer; user-select: none; }
table.rep th.sorted { color: #1b2a41; }
table.ex-table td.left { text-align: left; }
table.ex-table td.wrap { white-space: normal; max-width: 340px; text-align: left; }
.ex-link { color: var(--dispatched); text-decoration: underline; cursor: pointer; }
.ex-more { margin: 8px 12px; font: inherit; font-size: 12px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 4px; background: #f7f9fb; cursor: pointer; }
.rep-wrap h4 .ex-link { font-weight: 400; }
.rep-card small { font-size: 12px; color: var(--muted); font-weight: 400; }

/* ---------- Impounds ---------- */
#impound-backdrop { position: fixed; inset: 0; background: rgba(20, 28, 45, .35); z-index: 20; }
#impound-box {
  position: fixed; z-index: 21; top: 60px; left: 50%; transform: translateX(-50%);
  width: 520px; max-width: 94vw; background: #fff; border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
#impound-head {
  background: var(--bar); color: var(--bar-text); padding: 10px 14px;
  font-weight: 600; display: flex; align-items: center; justify-content: space-between;
}
#impound-close { background: none; border: 0; color: var(--bar-text); font-size: 22px; cursor: pointer; }
.impound-body { padding: 12px 16px; max-height: calc(100vh - 120px); overflow-y: auto; }
#i-vehicle { font-weight: 600; margin-bottom: 10px; }
.imp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.imp-grid label, .imp-notes { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.imp-grid .span2 { grid-column: span 2; }
.imp-notes { margin-top: 8px; }
.impound-body input, .impound-body select, .impound-body textarea {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; font: inherit; color: #222;
}
.imp-grid label.imp-check { flex-direction: row; align-items: center; gap: 6px; padding-top: 18px; color: #222; font-size: 13px; }
#i-storage { margin: 10px 0; padding: 8px 10px; background: #f4f6f8; border-radius: 4px; font-size: 13px; }
.imp-actions { display: flex; gap: 8px; margin-bottom: 6px; }
.impound-body button {
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 4px; background: #fff; cursor: pointer; font: inherit;
}
.impound-body button.primary { background: var(--bar); color: #fff; border-color: var(--bar); }
.impound-body button.go { background: var(--onscene); color: #fff; border-color: var(--onscene); margin-top: 8px; }
.impound-body button.warn { border-color: var(--cancelled); color: var(--cancelled); margin-left: auto; }
#i-released-text { font-size: 13px; margin-bottom: 8px; }
#i-status { font-size: 13px; min-height: 1em; margin: 8px 0 0; }
#i-status.err { color: var(--cancelled); }
#i-status.ok { color: #1a7f4b; }
.imp-tabs { display: flex; gap: 6px; }
.imp-tabs button {
  padding: 5px 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; font: inherit; font-size: 12px;
}
.imp-tabs button.on { background: var(--bar); color: #fff; border-color: var(--bar); }
.imp-row {
  display: grid; grid-template-columns: 70px 1.6fr 1.2fr 1fr 110px auto; gap: 12px; align-items: center;
  background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--towing);
  border-radius: 6px; padding: 10px 14px; margin-bottom: 8px;
}
.imp-row.st-auction { border-left-color: var(--waiting); }
.imp-row.st-released { border-left-color: var(--completed); }
.imp-stock { font-weight: 700; }
.imp-money { text-align: right; }
.imp-money b { display: block; }
.imp-row .hold { color: var(--cancelled); font-weight: 700; font-size: 11px; }
.imp-row button {
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 4px; background: #fff; cursor: pointer; font: inherit; font-size: 12px;
}
.item-row.auto input { background: #f4f6f8; color: #555; }
.item-row .auto-tag { flex: 0 0 auto; font-size: 11px; color: var(--muted); padding: 0 4px; }

/* ---------- Square pay link ---------- */
#paylink-backdrop { position: fixed; inset: 0; background: rgba(20, 28, 45, .35); z-index: 20; }
#paylink-box {
  position: fixed; z-index: 21; top: 70px; left: 50%; transform: translateX(-50%);
  width: 480px; max-width: 92vw; background: #fff; border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
#paylink-head {
  background: var(--bar); color: var(--bar-text); padding: 10px 14px;
  font-weight: 600; display: flex; align-items: center; justify-content: space-between;
}
#paylink-close { background: none; border: 0; color: var(--bar-text); font-size: 22px; cursor: pointer; }
.paylink-body { padding: 14px 16px; max-height: calc(100vh - 140px); overflow-y: auto; }
.paylink-body label { display: block; font-weight: 600; font-size: 13px; margin: 10px 0 4px; }
#pl-amount { font-size: 20px; font-weight: 700; }
.pl-row { display: flex; gap: 8px; }
.pl-row input { flex: 1; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; font: inherit; }
.pl-row button, .pl-link button {
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 4px; background: #fff;
  cursor: pointer; font: inherit; white-space: nowrap;
}
.pl-row button.primary { background: var(--bar); color: #fff; border-color: var(--bar); }
.pl-row button:disabled { opacity: .6; cursor: wait; }
#pl-result { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; text-align: center; }
.pl-link { display: flex; gap: 8px; align-items: center; text-align: left; }
#pl-url { flex: 1; font-size: 12px; word-break: break-all; color: var(--dispatched); }
#pl-qr { width: 200px; height: 200px; margin: 10px auto 0; display: block; }
#pl-result .hint { color: var(--muted); font-size: 12px; }
#pl-status { font-size: 13px; margin: 10px 0 0; min-height: 1em; }
#pl-status.ok { color: #1a7f4b; }
#pl-status.err { color: var(--cancelled); }

/* ---------- Square payments to match ---------- */
.sq-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; margin-bottom: 10px;
}
.sq-row {
  display: grid; grid-template-columns: 130px 90px 1fr auto; gap: 12px; align-items: center;
  background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--waiting);
  border-radius: 6px; padding: 10px 14px; margin-bottom: 8px;
}
.sq-amt { font-weight: 700; font-size: 15px; }
.sq-act { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.sq-act input { width: 80px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 4px; font: inherit; }
.sq-head button, .sq-act button {
  padding: 5px 10px; border: 1px solid var(--line); border-radius: 4px; background: #fff;
  cursor: pointer; font: inherit; font-size: 12px;
}
.sq-act button.go { border-color: var(--onscene); color: var(--onscene); font-weight: 600; }
.sq-act button.warn { border-color: var(--cancelled); color: var(--cancelled); }
.sq-suggest { font-size: 12px; color: var(--muted); width: 100%; text-align: right; }

/* ---------- payments ---------- */
.pay-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}
.pay-row .pay-date { flex: 0 0 72px; color: var(--muted); }
.pay-row .pay-method { flex: 0 0 64px; font-weight: 600; }
.pay-row .pay-ref { flex: 1; color: var(--muted); }
.pay-row .pay-amt { flex: 0 0 80px; text-align: right; font-weight: 600; }
.pay-row .item-remove { border: 0; background: none; color: var(--cancelled); cursor: pointer; }
.pay-unsaved { color: var(--waiting); font-style: normal; font-size: 11px; margin-left: 6px; }
.pay-none { color: var(--muted); font-size: 12px; padding: 4px 0; }
.pay-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.pay-form input, .pay-form select {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
}
.pay-form #p-amount { flex: 0 0 90px; text-align: right; }
.pay-form #p-ref { flex: 1; min-width: 140px; }
.pay-btn { border: 0; border-radius: 4px; padding: 6px 12px; cursor: pointer; background: #e6e9ee; color: #333; }
.pay-btn.primary { background: var(--bar); color: #fff; }
.pay-note { color: var(--muted); font-size: 12px; margin-top: 6px; }
.pay-summary { text-align: right; margin-top: 8px; font-size: 13px; }

/* ---------- address autocomplete ---------- */
#ac-box, #names-box {
  position: fixed;
  z-index: 50;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
  max-height: 220px;
  overflow-y: auto;
  font-size: 13px;
}
.ac-item { padding: 6px 10px; cursor: pointer; }
.ac-item:hover, .ac-item.sel { background: #e3ebf5; }

#editor-foot {
  border-top: 1px solid var(--line);
  padding: 10px 14px;
  display: flex;
  gap: 10px;
}
#editor-foot button {
  padding: 8px 18px;
  border-radius: 4px;
  border: 0;
  font-weight: 600;
  cursor: pointer;
}
#editor-foot .primary { background: var(--bar); color: #fff; }
#editor-foot .go { background: var(--onscene); color: #fff; }
#editor-foot .plain { background: #e6e9ee; color: #333; }
#editor-foot .danger { background: none; color: var(--cancelled); margin-left: auto; }
#editor-foot button:hover { filter: brightness(1.1); }

#btn-settings {
  background: none; border: 0; color: var(--bar-text);
  font-size: 18px; cursor: pointer; margin-left: 8px;
}
#settings-backdrop { position: fixed; inset: 0; background: rgba(20, 28, 45, .35); z-index: 20; }
#settings-box {
  position: fixed; z-index: 21; top: 90px; left: 50%; transform: translateX(-50%);
  width: 460px; max-width: 92vw; background: #fff; border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
#settings-head {
  background: var(--bar); color: var(--bar-text); padding: 10px 14px;
  font-weight: 600; display: flex; align-items: center; justify-content: space-between;
}
#settings-close { background: none; border: 0; color: var(--bar-text); font-size: 22px; cursor: pointer; }
.settings-body { padding: 14px 16px; max-height: calc(100vh - 160px); overflow-y: auto; }
.settings-body label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.settings-body input, .settings-body textarea {
  width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; font: inherit;
}
.settings-body textarea { resize: vertical; margin-bottom: 8px; }
.settings-body select {
  width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; font: inherit;
  margin-bottom: 8px;
}
.settings-section {
  font-weight: 700; font-size: 12px; letter-spacing: .4px; text-transform: uppercase;
  color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; margin: 4px 0 10px;
}
#f-co-name { margin-bottom: 8px; }
.settings-body label.check-line { display: flex; align-items: center; gap: 8px; font-weight: 400; margin-bottom: 8px; }
.settings-body label.check-line input { width: auto; }
.settings-pair { display: flex; gap: 10px; margin-bottom: 8px; }
.settings-pair > div { flex: 1; }
.settings-body .hint { color: #5b636d; font-size: 12px; margin: 6px 0 12px; }
.settings-actions { display: flex; align-items: center; gap: 10px; }
#settings-saved { color: #1a7f4b; font-size: 13px; }
/* Settings drawn from the registry (shared/settings-ui.js) */
.st-section h2 { font-weight: 700; font-size: 12px; letter-spacing: .4px; text-transform: uppercase; color: var(--muted);
  border-top: 1px solid var(--line); padding-top: 12px; margin: 4px 0 10px; }
.st-help { color: #5b636d; font-size: 12px; margin: 4px 0 10px; }
.st-log { margin: 4px 0 10px 18px; padding: 0; font-size: 12px; color: #5b636d; }
/* the Drivers panel under the call lists: who is free, who is out, who is off duty */
#drivers-panel { padding: 0 12px 12px; font-size: 12px; }
#drivers-panel .drv-row { padding: 4px 0; border-bottom: 1px solid var(--line); }
#drivers-panel .drv-free { color: #1a7f4b; font-weight: 600; }
#drivers-panel .drv-off { color: #8a1c1c; }
.st-nav { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 12px; }
.st-image img { display: block; max-width: 300px; max-height: 80px; margin: 4px 0; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 14px 14px; border: 1px solid var(--line); border-radius: 4px; }
.st-image-buttons { display: flex; gap: 6px; margin: 4px 0; }
.st-image-buttons .st-image-pick, .st-image-buttons button { font: inherit; font-size: 12px; font-weight: 400; padding: 4px 10px; border: 1px solid var(--line); border-radius: 4px; background: #f7f9fb; cursor: pointer; margin: 0; }
.st-nav .st-search { flex: 1 1 180px; min-width: 140px; margin: 0; }
.st-nav .st-menu { display: contents; }
.st-menu-item { border: 1px solid var(--line); background: #f7f9fb; border-radius: 999px; padding: 5px 11px; cursor: pointer; font: inherit; font-size: 12px; color: inherit; }
.st-menu-item small { display: none; }
.st-menu-item.on { background: #1b2a41; border-color: #1b2a41; color: #fff; }
.st-back { display: none; }
.st-sub { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin: 12px 0 6px; padding-top: 8px; border-top: 1px dashed var(--line); }
.settings-body .st-check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin-bottom: 8px; }
.settings-body .st-check input { width: auto; }
.st-group { border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 4px; }
.st-group-head { font-weight: 700; margin-bottom: 4px; }
.st-group-head small { color: var(--muted); font-weight: 400; }
.st-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.st-row .st-name { flex: 2; }
.st-row .st-extra, .st-row select { flex: 1; }
.st-row .st-pct { flex: 0 0 64px; }
.st-row .st-unload { flex: 0 0 72px; }
.st-row .st-s { flex: 0 0 52px; }
.st-row.hidden-row .st-name { color: var(--muted); text-decoration: line-through; }
.st-move { flex: none; width: 26px; padding: 4px 0; border: 1px solid var(--line); border-radius: 4px; background: #f7f9fb; cursor: pointer; font-size: 10px; }
.st-move:disabled { opacity: .3; cursor: default; }
.settings-body .st-hide { flex: none; display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); font-weight: 400; margin: 0; }
.settings-body .st-hide input { width: auto; }
.st-add { display: flex; gap: 6px; margin-top: 6px; }
.st-add-btn { flex: none; padding: 5px 12px; border: 1px solid var(--line); border-radius: 4px; background: #f7f9fb; cursor: pointer; font: inherit; }
.st-list-error { color: var(--cancelled); font-size: 12px; min-height: 1em; margin: 4px 0 0; }
.settings-inline { display: flex; gap: 8px; }
.settings-inline input { flex: 1; min-width: 0; }
#phone-access { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
#phone-qr { width: 140px; height: 140px; flex: 0 0 auto; border: 1px solid var(--line); }
#phone-url { font-weight: 600; word-break: break-all; }
.settings-inline button {
  background: #e6e9ee; border: 1px solid var(--line); border-radius: 4px; padding: 6px 10px;
  font: inherit; cursor: pointer; white-space: nowrap;
}

/* ---------- signatures ---------- */
.sig-item { display: flex; gap: 12px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--line); }
.sig-item img { width: 180px; height: 70px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 4px; }
.sig-item .sig-text { font-size: 12px; color: var(--muted); margin-top: 2px; }
#sig-wording label { margin-top: 6px; }
.hold-line { font-size: 13px; padding: 6px 0; color: #5b4200; }
.card-buttons { display: flex; gap: 8px; }
.file-btn { cursor: pointer; display: inline-block; }
.sig-wait { font-size: 13px; padding: 5px 0; display: flex; gap: 8px; align-items: center; color: #7a4b00; }
#sig-backdrop { position: fixed; inset: 0; background: rgba(20, 28, 45, .35); z-index: 30; }
#sig-box { position: fixed; z-index: 31; top: 120px; left: 50%; transform: translateX(-50%); width: 480px; max-width: 92vw;
  background: #fff; border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.3); padding: 16px 18px; }
#sig-title { font-weight: 700; font-size: 16px; margin-bottom: 8px; }
#sig-box label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
#sig-kind { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; font: inherit; margin-bottom: 8px; }
#sig-note { color: #4a5566; font-size: 13px; margin-bottom: 10px; }
#sig-status { font-size: 13px; margin-top: 8px; color: #1a7f4b; }
#sig-box .ask-buttons { flex-wrap: wrap; }
#ask-backdrop { position: fixed; inset: 0; background: rgba(20, 28, 45, .35); z-index: 30; }
#ask-box { position: fixed; z-index: 31; top: 140px; left: 50%; transform: translateX(-50%); width: 420px; max-width: 92vw;
  background: #fff; border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.3); padding: 16px 18px; }
#ask-title { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
#ask-text { color: #4a5566; font-size: 13px; margin-bottom: 10px; }
#ask-box label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
#ask-amount { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; font: inherit; }
#ask-error { color: var(--cancelled); font-size: 13px; min-height: 1.3em; margin: 6px 0; }
.ask-buttons { display: flex; gap: 8px; }
.ask-buttons button { padding: 7px 16px; border-radius: 4px; border: 0; font-weight: 600; cursor: pointer; background: #e6e9ee; }
.ask-buttons .primary { background: var(--bar); color: #fff; }
#sig-wording textarea { min-height: 64px; }

/* ---------- photos ---------- */
#photos { display: flex; flex-wrap: wrap; gap: 8px; }
#photos img { width: 96px; height: 96px; object-fit: cover; border-radius: 4px; cursor: pointer;
  background: #e6e9ee; border: 1px solid var(--line); }
#photo-view { position: fixed; inset: 0; z-index: 40; background: rgba(10, 14, 22, .92);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 20px; }
#photo-view-img { max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain; }
#photo-view-bar { display: flex; gap: 8px; align-items: center; color: #e8eef7; }
#photo-view-bar button { padding: 7px 14px; border-radius: 4px; border: 0; font: inherit; font-weight: 600; cursor: pointer; }
#photo-view-bar .danger { background: #fff; color: var(--cancelled); }
#photo-view-title { margin-right: 10px; }

/* The hidden attribute must win over layout rules like #editor's display:flex,
   otherwise closing the editor leaves it on screen. */
[hidden] { display: none !important; }

/* Browser edition vs the laptop app: each hides what only the other has. */
.web .electron-only { display: none; }
html:not(.web) .web-only { display: none; }
/* Status and times (the editor) */
.status-times .st-status { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.status-times .st-status select { width: auto; }
.status-times .st-times { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; }
.status-times .st-times label { display: flex; align-items: center; gap: 8px; }
.status-times .st-times label span { width: 80px; color: var(--muted); font-size: 12px; }
.status-times .st-times input { flex: 1; }
.status-times .st-hint { color: var(--muted); font-size: 12px; margin: 6px 0 0; min-height: 14px; }
/* People (browser edition) */
#people .person { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
#people .person-who { flex: 1; min-width: 160px; line-height: 1.3; }
#people .person-email { color: var(--muted); font-size: 12px; }
#people .person.off .person-who { opacity: .55; }
#people .person select { width: auto; }
#people .person-active { display: flex; align-items: center; gap: 4px; font-size: 13px; white-space: nowrap; }
.person-form { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; width: 100%; }
.person-form input, .person-form select { width: 100%; box-sizing: border-box; }
#btn-person-add { margin-top: 8px; }
.web-only .settings-inline { flex-wrap: wrap; }
#web-signin { position: fixed; inset: 0; z-index: 50; background: var(--bg, #eef1f4); display: flex; align-items: center; justify-content: center; }
#web-signin form { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 22px 26px; width: 340px; max-width: 92vw;
  box-shadow: 0 10px 30px rgba(0,0,0,.15); }
#web-signin h1 { font-size: 20px; margin: 0 0 14px; }
#web-signin .signin-link { font-size: 13px; color: var(--muted); margin: 14px 0 0; text-align: center; }
#plan-banner { position: fixed; left: 0; right: 0; top: 0; z-index: 60; background: #b3261e; color: #fff; padding: 10px 16px; font-size: 14px; display: flex; gap: 12px; align-items: center; justify-content: center; }
#plan-banner.warn { background: #8a5a00; top: auto; bottom: 0; }   /* a charge failed, still inside the grace days: at the bottom, the top bar stays usable */
/* Paused (the subscription lapsed): Settings shows only Your plan. */
#settings-box.plan-only .settings-body > *:not(.web-only) { display: none !important; }
#settings-box.plan-only .web-only > *:not(.plan-wrap) { display: none !important; }
#plan-banner button { font: inherit; font-weight: 600; padding: 4px 10px; border: 1px solid #fff; border-radius: 4px; background: transparent; color: #fff; cursor: pointer; }
#plan-box p { margin: 4px 0; } #plan-card-el { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 8px; margin: 6px 0; max-width: 420px; }
#web-signin label { display: block; font-weight: 600; font-size: 13px; margin: 8px 0 4px; }
#web-signin input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; font: inherit; }
#web-signin button { margin-top: 14px; width: 100%; padding: 9px; font: inherit; font-weight: 600; border-radius: 4px; border: 0;
  background: var(--bar); color: var(--bar-text); cursor: pointer; }
#web-signin .error { color: var(--cancelled); min-height: 1.3em; margin: 8px 0 0; font-size: 13px; }
/* the pricer: the price kept in view above the editor's buttons, how it was worked out, the driver's place */
#price-bar { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line);
  background: #f3f6fa; padding: 8px 14px; font: inherit; cursor: pointer; }
#price-bar:hover { background: #e9eef5; }
#price-bar b { font-size: 20px; color: var(--onscene); white-space: nowrap; }
#price-bar .pr-eta { font-style: normal; font-weight: 700; font-size: 14px; white-space: nowrap; }
#price-bar span { font-size: 12px; color: #4a5566; }
#price-bar.quiet span { font-size: 13px; }
#price-detail { border-top: 1px solid var(--line); padding: 10px 14px; max-height: 46vh; overflow-y: auto; font-size: 13px; }
.pr-detail p { margin: 0 0 6px; }
.pr-table { border-collapse: collapse; margin-bottom: 8px; }
.pr-table td { padding: 3px 10px 3px 0; vertical-align: top; }
.pr-table td:nth-child(2) { font-weight: 700; text-align: right; white-space: nowrap; }
.pr-table td:nth-child(3) { color: var(--muted); }
.pr-table .pr-at { display: block; color: var(--muted); font-size: 12px; }
.pr-total { font-size: 16px; }
.pr-note { color: var(--muted); }
.pr-hand { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.pr-hand-title { font-weight: 600; font-size: 12px; color: #33405a; margin-bottom: 6px; }
.pr-hand-row { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 6px; }
.pr-hand-row label { font-size: 12px; color: var(--muted); }
.pr-hand-row input { display: block; width: 110px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; font: inherit; }
.pr-hand-row .btn { padding: 6px 12px; border: 1px solid var(--line); border-radius: 4px; background: #f7f9fb; font: inherit; font-size: 12px; cursor: pointer; }
.row .driver-here { flex: 1; text-align: left; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; background: #fff; font: inherit; cursor: pointer; }
.driver-here small { margin-left: 8px; color: var(--muted); font-size: 11px; }
.st-row .st-kind { flex: 0 0 130px; }
