/* =========================================================================
   GQ Platform styles — reuses the look of the existing pricing map
   ========================================================================= */
:root {
  --navy: #15395b;
  --navy-deep: #0f2840;
  --teal: #2f9c91;
  --green: #2e9e5b;
  --orange: #e8920c;
  --red: #d23b32;
  --bg: #f4f6f8;
  --card: #ffffff;
  --line: #e2e7ec;
  --text: #1d2a36;
  --muted: #6b7884;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
/* The HTML "hidden" flag must always win, even over the display rules below,
   so that showing/hiding the login screen, app, and pages works reliably. */
[hidden] { display: none !important; }
body {
  font-family: "Saira", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- Login ---------- */
.login-view {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy), var(--navy-deep));
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 14px; padding: 32px;
  width: 100%; max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25); text-align: center;
}
.login-logo { height: 64px; margin-bottom: 18px; }
.login-card h1 {
  font-family: "Saira Semi Condensed", sans-serif;
  font-size: 22px; color: var(--navy); text-transform: uppercase; letter-spacing: 0.5px;
}
.login-card p { margin: 6px 0 20px; font-size: 13px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-card label, .field-grid label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12.5px; font-weight: 600; color: var(--navy);
}
.login-card input, .field-grid input, .add-type-row input {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-family: inherit; font-size: 14px; color: var(--text); outline: none;
}
.login-card input:focus, .field-grid input:focus,
.search-row input:focus, .add-type-row input:focus {
  border-color: var(--teal); box-shadow: 0 0 0 3px rgba(47,156,145,0.15);
}
.form-error {
  background: #fdecea; color: var(--red); border: 1px solid #f5c6c2;
  padding: 9px 12px; border-radius: 8px; font-size: 13px;
}

/* ---------- Buttons ---------- */
button { font-family: inherit; cursor: pointer; }
#loginBtn, .btn-primary {
  background: var(--navy); color: #fff; border: none; border-radius: 8px;
  padding: 11px 18px; font-weight: 700; font-size: 14px; transition: background .15s;
}
#loginBtn:hover, .btn-primary:hover { background: var(--navy-deep); }
.btn-ghost {
  background: transparent; border: 1px solid var(--line); color: var(--navy);
  border-radius: 8px; padding: 7px 14px; font-weight: 600; font-size: 13px;
}
.btn-ghost:hover { background: var(--bg); }
.btn-danger {
  background: transparent; border: 1px solid #f1b3ae; color: var(--red);
  border-radius: 6px; padding: 5px 10px; font-weight: 600; font-size: 12px;
}
.btn-danger:hover { background: #fdecea; }

/* ---------- App shell ---------- */
.app-view { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
header {
  background: #fff; padding: 10px 22px;
  display: flex; align-items: center; gap: 16px;
  border-bottom: 3px solid transparent;
  border-image: linear-gradient(90deg, var(--navy), var(--teal)) 1;
  box-shadow: 0 2px 10px rgba(21,57,91,0.06); z-index: 500;
}
header img { height: 46px; display: block; }
header .title h1 {
  font-family: "Saira Semi Condensed", sans-serif;
  font-weight: 800; letter-spacing: 1px;
  text-transform: uppercase; color: var(--navy);
  line-height: 1.05;
  display: flex; align-items: baseline; gap: 6px;
}
header .title h1 .brand-gq     { font-size: 24px; font-weight: 800; }
header .title h1 .brand-merlin { font-size: 24px; font-weight: 800; }
header .title .sub {
  font-size: 11px; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--teal); font-weight: 700;
  margin-top: 2px;
}
header .title .sub2 {
  font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
  margin-top: 2px;
}
.user-box { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-name { font-weight: 600; font-size: 13px; }
.role-tag {
  background: var(--teal); color: #fff; border-radius: 20px;
  padding: 3px 10px; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
}

.app-body { flex: 1; display: flex; min-height: 0; }
.nav {
  width: 210px; background: #fff; border-right: 1px solid var(--line);
  padding: 14px 10px; display: flex; flex-direction: column; gap: 0;
  overflow-y: auto;
}
.nav-section {
  display: flex; flex-direction: column; gap: 2px;
  padding-bottom: 12px; margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.nav-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 4px; }
.nav-section-title {
  font-family: "Saira Semi Condensed", sans-serif;
  font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); font-weight: 700;
  padding: 2px 14px 6px;
}
.nav-item {
  text-align: left; background: transparent; border: none; border-radius: 8px;
  padding: 10px 14px; font-size: 14px; font-weight: 600; color: var(--navy);
}
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--navy); color: #fff; }
.nav-soon { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.nav-soon-title {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); margin-bottom: 8px;
}
.nav-soon span {
  display: block; padding: 6px 14px; font-size: 13px; color: #aab4bd;
}

.content { flex: 1; overflow-y: auto; padding: 20px; }
.page-title {
  font-family: "Saira Semi Condensed", sans-serif;
  font-size: 20px; color: var(--navy); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 14px;
}

/* ---------- Cards / forms ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 16px 18px; margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(21,57,91,0.04);
}
.card h2 {
  font-family: "Saira Semi Condensed", sans-serif;
  font-size: 13px; letter-spacing: 1.1px; text-transform: uppercase;
  color: var(--navy); margin-bottom: 12px; font-weight: 700;
}
.field-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.field-grid input { width: 100%; }
.preview-row {
  margin-top: 14px; display: flex; gap: 14px; align-items: center;
  font-size: 14px; color: var(--muted); flex-wrap: wrap;
}
.preview-row b {
  color: var(--navy); background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 10px; font-family: "Saira Semi Condensed", sans-serif;
}
.save-banner {
  /* Float at top-centre so the confirmation is always visible, no matter
     how far down the page the Save button was when it was clicked. */
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 2000;
  background: #e8f6ee; border: 1px solid #b6e2c6; color: var(--green);
  padding: 10px 18px; border-radius: 8px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.save-banner.error { background: #fdecea; border-color: #f5c6c2; color: var(--red); }

.readout-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px;
}

/* Home page: consistent breathing room between the welcome card, the next-IDs
   readout grid, the Recalls widget and the Upcoming Jobs widget. */
#page-home > * { margin-bottom: 22px; }
#page-home > *:last-child { margin-bottom: 0; }

/* Invoice editor line rows — column-aligned grid (Description / Qty / Unit /
   VAT / Total / Remove). Header row uses the same template so columns line up. */
.inv-lines-head,
.inv-line-row {
  display: grid;
  grid-template-columns: 1fr 70px 100px 80px 100px 36px;
  gap: 8px; align-items: center;
  padding: 8px 0;
}
.inv-lines-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); font-weight: 700; padding: 0 0 6px 0;
  border-bottom: 1px solid var(--line);
}
.inv-line-row { border-bottom: 1px solid #f0f3f6; padding: 10px 0; }
.inv-line-row.inv-line-readonly { grid-template-columns: 1fr 70px 100px 80px 100px; }
.inv-line-row input {
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; font-size: 13px; background: #fff; outline: none; width: 100%;
}
.inv-line-row input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(47,156,145,0.15); }
.inv-line-row .il-qty,
.inv-line-row .il-price,
.inv-line-row .il-vat { text-align: right; }
.inv-line-row .il-remove {
  background: #fff; border: 1px solid var(--red); color: var(--red);
  border-radius: 6px; cursor: pointer; padding: 6px 0; font-weight: 700;
}
.readout {
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px;
}
/* Clickable variant — used by the Home page tiles to deep-link into list pages */
button.readout.readout-clickable {
  font-family: inherit; text-align: left; cursor: pointer;
  display: block; width: 100%;
  transition: box-shadow 140ms ease, transform 80ms ease, border-color 140ms ease;
}
button.readout.readout-clickable:hover {
  border-color: var(--teal);
  box-shadow: 0 4px 12px rgba(21,57,91,0.08);
}
button.readout.readout-clickable:active { transform: translateY(1px); }
.readout-hint {
  margin-top: 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.4px;
  text-transform: uppercase; color: var(--teal);
  opacity: 0; transition: opacity 140ms ease;
}
button.readout.readout-clickable:hover .readout-hint { opacity: 1; }
button.readout.readout-clickable:focus-visible {
  outline: none; border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(47,156,145,0.18);
}
button.readout.readout-clickable:focus-visible .readout-hint { opacity: 1; }
.readout-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.readout-val {
  font-family: "Saira Semi Condensed", sans-serif; font-size: 26px;
  font-weight: 800; color: var(--navy); margin-top: 6px;
}

/* ---------- Equipment types table ---------- */
.types-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.types-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line);
}
.types-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.types-table td:first-child input { width: 100%; border: 1px solid transparent; background: transparent; padding: 6px 8px; border-radius: 6px; font: inherit; }
.types-table td:first-child input:hover, .types-table td:first-child input:focus {
  border-color: var(--line); background: #fff; outline: none;
}
.types-table input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--teal); cursor: pointer; }
.add-type-row { display: flex; gap: 8px; margin-top: 14px; }
.add-type-row input { flex: 1; }

/* ---------- Map page (ported from existing map) ---------- */
.map-layout { display: flex; height: calc(100vh - 130px); min-height: 360px; }
#map { flex: 1; background: #cfe3ea; border-radius: 10px; }
.sidebar {
  width: 330px; background: var(--bg); padding-left: 16px; overflow-y: auto;
}
.search-row { display: flex; gap: 8px; }
.search-row input {
  flex: 1; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-family: inherit; font-size: 14px; color: var(--text); outline: none;
}
.search-row button {
  background: var(--navy); color: #fff; border: none; border-radius: 8px;
  padding: 0 16px; font-weight: 600; font-size: 14px; transition: background .15s;
}
.search-row button:hover { background: var(--navy-deep); }
.search-hint { font-size: 11px; color: var(--muted); margin-top: 7px; }
.search-result {
  margin-top: 12px; padding: 12px; border-radius: 8px; display: none;
  border: 1px solid var(--line); background: #fff;
}
.search-result.show { display: block; }
.search-result .place { font-weight: 700; font-size: 14px; margin-bottom: 2px; }
.search-result .dist { font-size: 20px; font-weight: 800; }
.zone-tag {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; color: #fff; margin-top: 6px;
}
.zone-tag.green { background: var(--green); }
.zone-tag.orange { background: var(--orange); }
.zone-tag.red { background: var(--red); }
.search-result .action { font-size: 12.5px; color: var(--muted); margin-top: 7px; }
.radius-readout {
  font-family: "Saira Semi Condensed", sans-serif;
  font-size: 34px; font-weight: 800; color: var(--navy);
  text-align: center; margin: 2px 0;
}
.radius-readout small { font-size: 14px; color: var(--muted); font-weight: 500; }
.radius-control input { width: 100%; accent-color: var(--teal); cursor: pointer; margin-top: 6px; }
.ticks { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.zone-stat { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.zone-stat:last-child { border-bottom: none; }
.zone-stat .swatch { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; }
.zone-stat .label { flex: 1; font-size: 13px; }
.zone-stat .label small { color: var(--muted); display: block; font-size: 11px; }
.zone-stat .count { font-weight: 800; font-size: 16px; font-family: "Saira Semi Condensed", sans-serif; }
.town-list { font-size: 13px; max-height: 260px; overflow-y: auto; }
.town { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.town:last-child { border-bottom: none; }
.town .name { display: flex; align-items: center; gap: 8px; }
.town .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.town .mi { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.note { font-size: 11px; color: var(--muted); line-height: 1.55; margin-top: 10px; }
.leaflet-popup-content { font-family: "Saira", sans-serif; }

@media (max-width: 820px) {
  .nav { width: 64px; }
  .nav-item { font-size: 0; padding: 12px; text-align: center; }
  .nav-section-title { display: none; }
  .nav-section { padding-bottom: 6px; margin-bottom: 6px; }
  .nav-soon { display: none; }
  .map-layout { flex-direction: column; height: auto; }
  .sidebar { width: 100%; padding-left: 0; padding-top: 14px; }
  #map { height: 50vh; }
  .contact-head { display: none; }
  .contact-row { grid-template-columns: 1fr 1fr; }
}

/* ---------- Phase 1: Practices ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.page-head .page-title { margin-bottom: 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.list-controls { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.list-controls input { flex: 1; min-width: 200px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px; outline: none; }
.list-controls select { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px; background: #fff; }
.list-controls input:focus, .list-controls select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(47,156,145,0.15); }

.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.data-table td { padding: 10px; border-bottom: 1px solid var(--line); }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: var(--bg); }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.badge.active { background: #e8f6ee; color: var(--green); border-color: #b6e2c6; }
.badge.lapsed { background: #f2f4f6; color: var(--muted); }
.badge.prospect { background: #e9f4f3; color: var(--teal); border-color: #bfe3df; }
.badge.primary { background: var(--teal); color: #fff; border-color: var(--teal); }

.link-back { background: transparent; border: none; color: var(--teal); font-weight: 600; font-size: 13px; padding: 0; margin-bottom: 12px; }
.link-back:hover { text-decoration: underline; }

.detail-head { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 6px; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; align-items: start; }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { color: var(--text); }

.mini-map { height: 220px; border-radius: 8px; background: #cfe3ea; overflow: hidden; }
.placeholder-card { background: #fbfcfd; border-style: dashed; }

.contact-head, .contact-row { display: grid; grid-template-columns: 1.4fr 1.1fr 1fr 1.4fr auto auto; gap: 8px; align-items: center; }
.contact-head { font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin-bottom: 6px; padding: 0 2px; }
.contact-row { margin-bottom: 8px; }
.contact-row input, .contact-row select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 13px; outline: none; width: 100%; }
.contact-row input:focus, .contact-row select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(47,156,145,0.15); }
.c-primary { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--navy); white-space: nowrap; }
.c-primary input { width: 16px; height: 16px; accent-color: var(--teal); }
.contact-row .c-remove { padding: 6px 10px; }

.contact-row-view { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.contact-row-view:last-child { border-bottom: none; }

.form-buttons { margin: 4px 0 28px; }

.field-grid select, .field-grid textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px; color: var(--text); background: #fff; outline: none; }
.field-grid select:focus, .field-grid textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(47,156,145,0.15); }
label.full { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--navy); margin-top: 12px; }
label.full textarea,
label.full input[type="text"],
label.full input[type="date"],
label.full input[type="number"],
label.full select { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px; color: var(--text); outline: none; background: #fff; }
label.full textarea { resize: vertical; }
label.full textarea:focus,
label.full input:focus,
label.full select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(47,156,145,0.15); }

/* Financials page — consistent spacing between cards (mirrors home spacing). */
#page-financials > * { margin-bottom: 22px; }
#page-financials > *:last-child { margin-bottom: 0; }

/* Reporting page — same spacing rhythm so the filter bar + panels feel laid
   out, not crammed. */
#page-reporting > * { margin-bottom: 22px; }
#page-reporting > *:last-child { margin-bottom: 0; }
.reporting-panel-body { margin-top: 6px; }

/* Money-in bar chart on the Financials page. Simple HTML/CSS bars; no chart
   library. Each bar = one month; tallest bar = 120px, others scaled. */
.fin-bars {
  display: grid; gap: 6px;
  align-items: end; margin-top: 8px; min-height: 180px;
}
#finMoneyInRange { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; font-size: 13px; }
.fin-bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.fin-bar-val { font-size: 10px; color: var(--navy); font-weight: 700; min-height: 14px; }
.fin-bar-fill { width: 100%; border-radius: 4px 4px 0 0; transition: height 200ms ease-out; }
.fin-bar-lbl { font-size: 10px; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.4px; }

/* Dispatch dashboard — week grid with engineers as rows, days as columns. */
.disp-grid {
  display: grid;
  grid-template-columns: 180px repeat(7, minmax(120px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.disp-cell-head, .disp-cell, .disp-cell-eng {
  background: #fff; padding: 8px 10px; min-height: 38px;
}
.disp-cell-head {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  background: var(--bg);
}
.disp-cell-head.disp-today { color: var(--teal); background: #eef9f7; }
.disp-cell-eng-head { background: var(--bg); }
.disp-cell-eng { font-size: 13px; color: var(--text); }
.disp-eng-unassigned { background: #fdf5ee; color: #b46e0c; font-weight: 600; }
.disp-cell { min-height: 92px; display: flex; flex-direction: column; gap: 6px; padding: 6px; cursor: pointer; transition: background 120ms ease; }
.disp-cell:hover { background: #fafbfc; }
.disp-cell:hover::after { content: '+ Add job'; color: var(--muted); font-size: 11px; align-self: center; margin-top: auto; pointer-events: none; }
.disp-drop-target { background: rgba(47,156,145,0.12); outline: 2px dashed var(--teal); outline-offset: -2px; }
.disp-chip {
  background: #f4f6f8; border: 1px solid var(--line); border-left: 3px solid var(--navy);
  border-radius: 6px; padding: 6px 8px; font-size: 12px; line-height: 1.3;
  cursor: pointer; user-select: none;
}
.disp-chip:hover { background: #fff; border-color: var(--teal); }
.disp-chip.disp-dragging { opacity: 0.4; }
.disp-chip.disp-chip-extra { border-left-color: #6b7884; border-left-width: 2px; background: #fbfbfc; opacity: 0.95; cursor: pointer; }
.disp-chip-time { font-weight: 700; color: var(--navy); font-size: 11px; }
.disp-chip-pract { color: var(--text); font-size: 12px; margin-top: 1px; }
.disp-chip-type { font-size: 11px; }
.disp-chip-badge { font-size: 10px; margin-top: 4px; display: inline-block; }

/* Numbered route pins on the day's map. */
.disp-route-pin .disp-route-pin-inner {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  border: 2px solid #fff; box-shadow: 0 2px 4px rgba(0,0,0,.18);
}

/* Pool Inventory cards — one per pool unit, with current + scheduled loans
   stacked underneath. Once a loan is Returned/Cancelled it drops off the
   card (still visible via History). */
.pool-grid { display: flex; flex-direction: column; gap: 12px; }
.pool-card { border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.pool-card-head {
  display: flex; gap: 14px; padding: 12px 16px;
  background: #f9fafc; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.pool-unit-info { flex: 1 1 240px; min-width: 0; }
.pool-unit-status, .pool-unit-actions { align-self: center; }
.pool-unit-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pool-loans { padding: 0; }
.pool-loan-row {
  display: flex; gap: 14px; padding: 10px 16px;
  align-items: flex-start; flex-wrap: wrap;
  border-bottom: 1px solid #f0f3f6;
  border-left: 3px solid transparent;
}
.pool-loan-row:last-child { border-bottom: 0; }
.pool-loan-row .pool-loan-info { flex: 1 1 260px; min-width: 0; }
.pool-loan-row .pool-loan-actions { display: flex; gap: 6px; flex-wrap: wrap; align-self: center; }
.pool-loan-active { border-left-color: var(--green); background: #f4fbf6; }
.pool-loan-scheduled { border-left-color: var(--navy); }
.pool-empty-hint { padding: 10px 16px; color: var(--muted); font-size: 13px; font-style: italic; }

/* Equipment GQ Lease / GQ Loan badge — clickable, deep-links to Leases page. */
.eq-lease-link {
  background: #15395b; color: #fff; border: none; cursor: pointer;
  font-family: inherit; font-size: inherit; padding: 4px 8px;
  border-radius: 12px; font-weight: 600;
}
.eq-lease-link:hover { background: #2f9c91; }

/* Search-as-you-type results panel (used by the New invoice modal). */
.search-results {
  margin-top: 6px; max-height: 220px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
.search-results .search-row {
  padding: 8px 12px; cursor: pointer; border-top: 1px solid #f0f3f6;
  font-size: 13px;
}
.search-results .search-row:first-child { border-top: 0; }
.search-results .search-row:hover { background: #f4f6f8; }
.search-results .search-row b { color: var(--navy); }
.search-results .search-empty { padding: 10px 12px; color: var(--muted); font-size: 13px; }

/* KV detail rows — when a value cell is editable (Due date / PO number on the
   invoice editor) the input should match the rest of the form inputs. */
.kv dd input[type="text"],
.kv dd input[type="date"],
.kv dd input[type="number"],
.kv dd select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px; color: var(--text); outline: none; background: #fff; }
.kv dd input:focus,
.kv dd select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(47,156,145,0.15); }

/* Map sidebar — practice controls */
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 10px; }
.check-row input { width: 17px; height: 17px; accent-color: var(--teal); }
.select-row { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--navy); }
.select-row select, #radiusPracticeSelect { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 13px; background: #fff; margin-top: 4px; }
.soft-divider { height: 1px; background: var(--line); margin: 12px 0; }
#practiceRadiusMiles { max-width: 90px; }

/* ---------- Phase 2: Equipment ---------- */
.eq-list { display: grid; gap: 12px; }
.eq-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; }
.eq-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.eq-actions { display: flex; gap: 8px; flex-shrink: 0; }
.eq-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.eq-dates { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.eq-chip { font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; color: var(--muted); }
.eq-chip b { color: var(--text); font-variant-numeric: tabular-nums; }
.eq-subhead { font-family: "Saira Semi Condensed", sans-serif; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--navy); margin: 16px 0 10px; }
.badge.status-pill { background: #eef1f4; color: var(--navy); border-color: var(--line); }
.badge.priority { background: #fff3e0; color: var(--orange); border-color: #f3d39c; }

/* Modal dialog (equipment add/edit) */
.modal { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: flex-start; justify-content: center; background: rgba(15,40,64,0.55); padding: 30px 16px; overflow-y: auto; }
.modal-card { background: #fff; border-radius: 14px; padding: 22px 24px; width: 100%; max-width: 760px; box-shadow: 0 24px 60px rgba(0,0,0,0.35); position: relative; }
.modal-close { position: absolute; top: 12px; right: 14px; background: transparent; border: none; font-size: 18px; color: var(--muted); line-height: 1; }
.modal-close:hover { color: var(--navy); }
.modal-card .field-grid { margin-bottom: 6px; }

/* ---------- Phase 3: Users & Roles ---------- */
.data-table input[type="text"], .data-table select { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 13px; background: #fff; outline: none; }
.data-table input[type="text"]:focus, .data-table select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(47,156,145,0.15); }
.data-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--teal); cursor: pointer; }
.help-steps { margin: 8px 0 0 18px; font-size: 13.5px; line-height: 1.7; color: var(--text); }

/* ---------- Phase 10: Parent Groups ---------- */
.group-link { color: var(--teal); font-weight: 600; text-decoration: none; }
.group-link:hover { text-decoration: underline; }
.group-add-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; margin-bottom: 12px; }
.group-add-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.group-add-row:hover { background: var(--bg); }
.group-add-row input { width: 16px; height: 16px; accent-color: var(--teal); flex-shrink: 0; }

/* ---------- Phase 4: Bookings ---------- */
.bookings-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-label { font-family: "Saira Semi Condensed", sans-serif; font-weight: 800; font-size: 16px; color: var(--navy); min-width: 150px; text-align: center; }
.view-tabs { display: flex; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.view-tab { background: transparent; border: none; border-radius: 6px; padding: 6px 14px; font-weight: 600; font-size: 13px; color: var(--navy); }
.view-tab.active { background: var(--navy); color: #fff; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); text-align: center; padding: 4px 0; font-weight: 700; }
.cal-cell { min-height: 92px; max-height: 200px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: #fff; cursor: pointer; overflow-y: auto; }
.cal-cell:hover { border-color: var(--teal); }
.cal-empty { background: transparent; border: none; cursor: default; }
.cal-today { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.cal-daynum { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.cal-chip { font-size: 10.5px; line-height: 1.3; background: var(--bg); border-left: 3px solid var(--navy); border-radius: 4px; padding: 3px 5px; margin-bottom: 3px; cursor: pointer; overflow: hidden; }
.cal-chip:hover { background: #eef1f4; }
.cal-chip-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip-head { font-weight: 600; color: var(--navy); }
.cal-chip-muted { color: var(--muted); font-size: 10px; }
.cal-chip-time { font-weight: 700; color: var(--navy); }

.bookings-map { height: calc(100vh - 320px); min-height: 360px; border-radius: 10px; background: #cfe3ea; }

.bk-newpractice { border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; margin: 6px 0 4px; background: #fbfcfd; }
.bk-subsection { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 10px; }

/* Booking line-items / quote */
.lines-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 8px; }
.job-line { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; background: #fff; }
.job-line-top { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.job-line-top .jl-eq { flex: 1.4; }
.job-line-top .jl-svc { flex: 1; }
.job-line-top select { padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 13px; background: #fff; }
.jl-remove { padding: 6px 10px; flex-shrink: 0; }
.job-line-bottom { display: flex; gap: 8px; align-items: center; }
.job-line-bottom .jl-desc { flex: 1; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 13px; }
.jl-money { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; }
.jl-money .jl-price { width: 90px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 13px; }
.jl-disc { padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 13px; background: #fff; }
.jl-total { min-width: 74px; text-align: right; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.quote-totals { display: flex; gap: 18px; justify-content: flex-end; align-items: center; padding: 10px 4px 2px; border-top: 1px solid var(--line); margin-top: 6px; flex-wrap: wrap; font-size: 13px; }
.quote-totals b { color: var(--navy); font-family: "Saira Semi Condensed", sans-serif; font-size: 16px; margin-left: 4px; }

/* ---------- Phase 5: Parts & Stock ---------- */
.row-low { background: #fff8ec; }
.row-low:hover { background: #fff3dc !important; }
.stock-low { color: var(--orange); font-weight: 700; }
.bom-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.bom-row .bom-comp { flex: 1; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 13px; background: #fff; }
.bom-row .bom-qty { width: 90px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 13px; }
.bom-row .bom-remove { padding: 6px 10px; }

/* ---------- Phase 6 Stage A: engineer execution ---------- */
.eq-list-item { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.eq-list-item:last-child { border-bottom: none; }
.up-comp-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.up-comp-row:hover { background: var(--bg); }
.up-comp-row input { width: 16px; height: 16px; accent-color: var(--teal); }
.badge.booked { background: #eef1f4; color: var(--navy); border-color: var(--line); }
.badge.confirmed { background: #e9f4f3; color: var(--teal); border-color: #bfe3df; }
.badge.in-progress { background: #fff3e0; color: var(--orange); border-color: #f3d39c; }
.badge.completed { background: #e8f6ee; color: var(--green); border-color: #b6e2c6; }
.badge.cancelled { background: #f2f4f6; color: var(--muted); }
.badge.no-access { background: #fdecea; color: var(--red); border-color: #f5c6c2; }
.eq-history-group { border-left: 3px solid var(--line); padding: 6px 0 6px 10px; margin-bottom: 14px; }
.eq-history-head { font-size: 13.5px; color: var(--navy); margin-bottom: 6px; }
.past-job { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.past-job:last-child { border-bottom: none; }
.past-job details { margin-top: 4px; }

/* Engineer forms (Phase 6 Stage C) */
.form-tasks-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.form-tasks-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--line); }
.form-tasks-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.form-tasks-table select, .form-tasks-table input[type="text"], .form-tasks-table input[type="number"] {
  width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 13px; background: #fff;
}
.form-multi { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 4px; }
.bk-equipment-list { max-height: 180px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.bk-eq-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.bk-eq-row:hover { background: var(--bg); }
.bk-eq-row input { width: 16px; height: 16px; accent-color: var(--teal); flex-shrink: 0; }

@media (max-width: 820px) {
  .cal-cell { min-height: 64px; }
  .cal-chip { font-size: 10px; }
}

/* ---------- Engineer job uploads (validation reports + photos) ---------- */
.attachment-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0; border-top: 1px solid #f0f3f6;
}
.attachment-row:first-child { border-top: none; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.photo-tile {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  border-radius: 8px; overflow: hidden; background: var(--bg);
  border: 1px solid var(--line);
}
.photo-tile img {
  width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block;
}
.photo-tile-missing {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; color: var(--muted); font-size: 24px;
}
.photo-tile-x {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,0.92); color: var(--red);
  border: 1px solid #f1b3ae; line-height: 1;
  font-size: 14px; font-weight: 700; cursor: pointer; padding: 0;
}
.photo-tile-x:hover { background: #fdecea; }
/* Admin photo-remove on practice/group Filed Documents (different parent
   container so we re-use the same look without coupling to .photo-tile-x). */
.photo-remove {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,0.92); color: var(--red);
  border: 1px solid #f1b3ae; line-height: 1;
  font-size: 14px; font-weight: 700; cursor: pointer; padding: 0;
}
.photo-remove:hover { background: #fdecea; }

/* ---------- Filed Documents: grouped-by-job ---------- */
details.filed-job {
  border: 1px solid var(--line); border-radius: 10px;
  margin-top: 10px; background: #fff;
}
details.filed-job > summary {
  list-style: none; cursor: pointer;
  padding: 10px 14px; border-radius: 10px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  user-select: none;
}
details.filed-job > summary::-webkit-details-marker { display: none; }
details.filed-job > summary::before {
  content: "▸"; display: inline-block; color: var(--navy);
  width: 14px; transition: transform 120ms ease;
}
details.filed-job[open] > summary::before { transform: rotate(90deg); }
details.filed-job[open] > summary { border-bottom: 1px solid var(--line); }
.filed-job-body { padding: 6px 14px 14px 28px; }
.filed-block { margin-top: 10px; }
.filed-block:first-child { margin-top: 4px; }
.filed-block-head {
  font-size: 12px; letter-spacing: 0.4px; text-transform: uppercase;
  font-weight: 700; color: var(--navy); margin-bottom: 4px;
}

/* ---------- Reporting panels ---------- */
.rep-stat-row {
  display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 12px;
}
.rep-stat { min-width: 140px; }
.rep-stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; }
.rep-stat-value { font-size: 22px; font-weight: 700; color: var(--navy); margin-top: 2px; }

/* Aging pill on the Outstanding panel table */
.aging-pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0.3px;
}
.rep-table-wrap { max-height: 480px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.rep-table-wrap table { margin: 0; border: 0; }
.rep-table-wrap thead th { position: sticky; top: 0; background: #fff; z-index: 1; }

/* Invoice status board panel */
.rep-status-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-top: 6px;
}
.rep-status-card {
  text-align: left; padding: 12px 14px;
  background: #fff; border: 1px solid var(--line); border-left: 4px solid #ccd2d8;
  border-radius: 8px; cursor: pointer; font-family: inherit;
  transition: box-shadow 120ms ease, transform 80ms ease;
}
.rep-status-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.rep-status-card:active { transform: translateY(1px); }
.rep-stack {
  display: flex; height: 18px; border-radius: 999px; overflow: hidden;
  background: var(--bg); border: 1px solid var(--line);
}
.rep-stack-seg { height: 100%; }

/* Conversion funnel panel */
.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel-row { display: flex; flex-direction: column; gap: 4px; }
.funnel-label { font-size: 13px; }
.funnel-track {
  height: 28px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; overflow: hidden;
}
.funnel-fill {
  height: 100%; border-radius: 6px;
  display: flex; align-items: center; padding: 0 10px;
  transition: width 240ms ease-out;
  min-width: 40px;
}
.funnel-fill-label { color: #fff; font-weight: 700; font-size: 12px; white-space: nowrap; }

/* Recall summary panel — service-type breakdown bars */
.recall-svc-row {
  display: grid; grid-template-columns: 110px 1fr 60px;
  gap: 10px; align-items: center; padding: 4px 0;
}
.recall-svc-label { font-size: 13px; font-weight: 600; color: var(--navy); }
.recall-svc-track {
  height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden;
  border: 1px solid var(--line);
}
.recall-svc-fill { height: 100%; background: #15395b; transition: width 220ms ease-out; }
.recall-svc-count { text-align: right; font-size: 13px; font-weight: 700; color: var(--navy); }

/* Lease progress rows on the Reporting "Lease income" panel */
.lease-progress { display: flex; flex-direction: column; gap: 8px; }
.lease-row { display: grid; grid-template-rows: auto auto auto; gap: 3px; padding: 6px 0; border-top: 1px solid #f0f3f6; }
.lease-row:first-child { border-top: none; }
.lease-row-title { font-size: 13px; }
.lease-row-bar { height: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.lease-row-bar-fill { height: 100%; transition: width 220ms ease-out; }
.lease-row-meta { font-size: 11px; color: var(--muted); }

/* Payment health panel — stacked bar with scheduled background + collected fill */
.ph-bar-track {
  width: 100%; background: #ccd2d8; border-radius: 4px 4px 0 0;
  display: flex; align-items: flex-end; overflow: hidden;
  transition: height 200ms ease-out;
}
.ph-bar-fill {
  width: 100%; border-radius: 4px 4px 0 0;
  transition: height 200ms ease-out;
}
.ph-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ph-swatch {
  display: inline-block; width: 12px; height: 12px; border-radius: 3px;
  vertical-align: middle; margin-right: 4px;
}

/* ---------- Collapsible reporting panels ---------- */
details.reporting-panel { padding: 0; }
details.reporting-panel > .rep-panel-summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 12px 16px; border-radius: 10px;
}
details.reporting-panel > .rep-panel-summary::-webkit-details-marker { display: none; }
details.reporting-panel[open] > .rep-panel-summary {
  border-bottom: 1px solid var(--line);
  border-radius: 10px 10px 0 0;
}
.rep-panel-head { display: flex; align-items: center; gap: 10px; }
.rep-panel-titlewrap { flex: 1; min-width: 0; }
.rep-panel-chev {
  display: inline-block; width: 14px; color: var(--navy);
  transition: transform 140ms ease;
}
details.reporting-panel[open] > summary .rep-panel-chev { transform: rotate(90deg); }
.rep-panel-actions { margin-left: auto; }

/* Body padding for the open state */
details.reporting-panel[open] .reporting-panel-body,
details.reporting-panel[open] > *:not(summary) {
  padding-left: 16px; padding-right: 16px;
}
details.reporting-panel[open] > *:last-child { padding-bottom: 14px; }

/* Pool utilisation panel — per-unit timeline */
.pool-util-list { display: flex; flex-direction: column; gap: 8px; }
.pool-util-row {
  display: grid; grid-template-rows: auto auto auto; gap: 3px;
  padding: 6px 0; border-top: 1px solid #f0f3f6;
}
.pool-util-row:first-child { border-top: none; }
.pool-util-title { font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pool-util-meta { font-size: 11px; color: var(--muted); }
.pool-timeline {
  position: relative; height: 18px; background: #f5f7fa;
  border: 1px solid var(--line); border-radius: 4px; overflow: hidden;
}
.pool-timeline-seg {
  position: absolute; top: 0; bottom: 0;
  border-radius: 2px; opacity: 0.85; cursor: help;
}
.pool-timeline-seg:hover { opacity: 1; }

/* Engineer productivity panel — completed-jobs bar list */
.ep-bars { display: flex; flex-direction: column; gap: 6px; }
.ep-bar-row {
  display: grid; grid-template-columns: 160px 1fr 50px;
  gap: 10px; align-items: center;
}
.ep-bar-name { font-size: 13px; font-weight: 600; color: var(--navy); }
.ep-bar-track {
  height: 14px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 999px; overflow: hidden;
}
.ep-bar-fill { height: 100%; background: #15395b; transition: width 220ms ease-out; }
.ep-bar-count { text-align: right; font-size: 13px; font-weight: 700; color: var(--navy); }

/* Forms filed panel — stacked monthly bars */
.form-stack {
  width: 100%;
  display: flex; flex-direction: column-reverse;
  border-radius: 4px 4px 0 0; overflow: hidden;
  background: var(--bg); border-bottom: 0;
}
.form-stack-seg {
  width: 100%;
  transition: height 200ms ease-out;
}
.form-stack-seg + .form-stack-seg { border-top: 1px solid rgba(255,255,255,0.4); }

/* Per-panel date override picker (lives inside the summary actions area) */
.rep-date-picker {
  display: flex; align-items: center; gap: 6px;
}
.rep-date-picker select,
.rep-date-picker input[type=date] {
  font-size: 12px; padding: 4px 8px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
.rep-override-pill {
  display: inline-block; vertical-align: middle;
  margin-left: 8px; padding: 2px 8px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.3px;
  background: #fff2c2; color: #8a6500; border: 1px solid #f0d97a;
  border-radius: 999px; text-transform: uppercase;
}

/* Per-panel "Export…" dropdown (sibling of the date picker) */
.rep-export-select {
  font-size: 12px; padding: 4px 8px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
}

/* ---------- Network status pill (Phase 6D Step 2) ---------- */
.net-status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
  user-select: none;
}
.net-dot {
  width: 8px; height: 8px; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.6);
}
/* Online — subtle green dot, label hidden so it doesn't shout */
.net-status.net-online {
  color: var(--green); background: transparent;
  border: 1px solid transparent;
}
.net-status.net-online .net-label { display: none; }
/* Offline — clear amber pill so the engineer can't miss it */
.net-status.net-offline {
  color: #8a4b00; background: #fff4d6;
  border: 1px solid #f0c265;
  animation: gqNetPulse 1.6s ease-in-out infinite;
}
.net-status.net-offline .net-dot { background: #d97706; }
@keyframes gqNetPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217,119,6, 0.35); }
  50%      { box-shadow: 0 0 0 6px rgba(217,119,6, 0); }
}

/* ---------- Offline cache banner (Phase 6D Step 3) ---------- */
.cache-banner {
  background: #fff4d6; border: 1px solid #f0c265; color: #8a4b00;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 14px;
  font-size: 13px; line-height: 1.45;
}
.cache-banner b { font-weight: 800; }
/* Photo tiles inside a cached job — signed URLs expire, so we mute the
   tile and tell the user we'll show the photo when they're back online. */
.photo-tile.photo-tile-offline {
  background: #f0f3f6; border-style: dashed;
}
.photo-tile-offline .photo-tile-missing { color: var(--muted); font-size: 11px; padding: 6px; text-align: center; }

/* ---------- Pending-mutations queue badge (Phase 6D Step 4) ---------- */
.queue-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fdecea; color: #8a1d18;
  border: 1px solid #f1b3ae; border-radius: 999px;
  padding: 3px 10px 3px 9px;
  font: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; user-select: none;
}
.queue-badge:hover { background: #ffd9d2; }
.queue-badge-dot {
  width: 8px; height: 8px; border-radius: 50%; background: currentColor;
  animation: gqQueuePulse 1.6s ease-in-out infinite;
}
.queue-badge-action { color: var(--navy); text-decoration: underline; font-weight: 700; }
@keyframes gqQueuePulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

/* ---------- Pending-upload indicators (Phase 6D Step 5) ---------- */
.attachment-pending {
  background: #fff4d6; color: #8a4b00; border: 1px solid #f0c265;
  font-size: 10px; letter-spacing: 0.4px; margin-left: 6px;
}
.photo-tile-pending {
  outline: 2px dashed #d97706;
  outline-offset: -2px;
}
.photo-tile-pending img { opacity: 0.85; }
.photo-tile-pending-tag {
  position: absolute; bottom: 4px; left: 4px;
  background: #d97706; color: #fff;
  padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.4px;
}

/* ---------- "Send this email" overlay (Email invoice / receipt) ---------- */
.email-overlay-row {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 10px; align-items: start;
  margin-top: 12px;
}
.email-overlay-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.4px; color: var(--muted); padding-top: 8px;
}
.email-overlay-field {
  padding: 8px 10px; font: inherit; font-size: 13px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
  width: 100%; outline: none;
}
.email-overlay-field:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(47,156,145,0.15); }
textarea.email-overlay-field { resize: vertical; line-height: 1.45; min-height: 140px; }
.email-overlay-copy { white-space: nowrap; }

/* ---------- Sync queue admin modal ---------- */
.sq-section-title {
  font-family: "Saira Semi Condensed", sans-serif;
  font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--navy); margin: 0 0 8px 0; font-weight: 700;
}
.sq-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 320px; overflow-y: auto;
  padding: 4px;
}
.sq-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
}
.sq-row-main  { flex: 1; min-width: 0; }
.sq-row-title { font-weight: 600; color: var(--text); font-size: 13.5px; margin-bottom: 2px; }
.sq-row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.sq-empty { padding: 8px 4px; }
.sq-error {
  margin-top: 4px;
  padding: 6px 10px; border-radius: 6px;
  background: #fdecea; color: #8a1d18; border: 1px solid #f1b3ae;
  font-size: 12px;
}
.sq-error code {
  background: rgba(0,0,0,0.05); padding: 1px 4px; border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px;
}

/* ---------- Sync state admin page (Phase 6G) ---------- */
.ss-device {
  border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 14px; margin-top: 10px; background: #fff;
}
.ss-device-stale  { opacity: 0.7; }
.ss-device-stuck  { border-color: #f1b3ae; background: #fff8f7; }
.ss-device-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.ss-device-hint {
  font-weight: 700; color: var(--navy); font-size: 13px;
  padding: 2px 8px; border-radius: 999px; background: var(--bg);
}
.ss-stuck-badge {
  background: #fdecea; color: #8a1d18; border: 1px solid #f1b3ae;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.4px; text-transform: uppercase;
}
.ss-ok-badge {
  background: #e8f6ee; color: var(--green); border: 1px solid #b6e2c6;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.4px; text-transform: uppercase;
}
.ss-stuck-list { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.ss-stuck-row {
  background: #fff; border: 1px solid #f1b3ae; border-radius: 6px;
  padding: 8px 12px;
}
.ss-stuck-title { font-weight: 600; color: var(--text); font-size: 13.5px; }

/* ---------- User Guide (Phase 6H) ---------- */
.ug-search {
  padding: 8px 12px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  min-width: 260px;
}
.ug-search:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(47,156,145,0.15); }

.ug-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.ug-card {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px; text-align: left; cursor: pointer;
  font: inherit; color: var(--text);
  display: flex; flex-direction: column; gap: 10px;
  transition: box-shadow 140ms ease, border-color 140ms ease, transform 60ms ease;
}
.ug-card:hover  { border-color: var(--teal); box-shadow: 0 4px 14px rgba(21,57,91,0.08); }
.ug-card:active { transform: translateY(1px); }
.ug-card-head   { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ug-card-title  {
  font-family: "Saira Semi Condensed", sans-serif;
  font-size: 16px; font-weight: 700; color: var(--navy);
  text-transform: uppercase; letter-spacing: 0.4px;
}
.ug-card-summary { font-size: 13px; color: var(--text); line-height: 1.45; }
.ug-card-foot {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--muted); margin-top: auto;
}
.ug-card-arrow { font-size: 18px; color: var(--navy); }

.ug-role {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
}
.ug-role-admin    { background: #e0eaf4; color: var(--navy); }
.ug-role-engineer { background: #ddefea; color: var(--teal); }
.ug-role-both     { background: #f0eada; color: #8a6500; }

.ug-pending {
  color: #8a6500; background: #fff4d6; border: 1px solid #f0d97a;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.3px;
}

/* ---- Section detail layout ---- */
.ug-section-layout {
  display: grid; grid-template-columns: 220px 1fr; gap: 24px;
  align-items: start;
}
.ug-toc {
  position: sticky; top: 18px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; font-size: 13px;
}
.ug-toc-head {
  font-family: "Saira Semi Condensed", sans-serif;
  font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin-bottom: 8px;
}
.ug-toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ug-toc a { color: var(--navy); text-decoration: none; padding: 4px 6px; border-radius: 4px; display: block; }
.ug-toc a:hover { background: var(--bg); }

.ug-content { display: flex; flex-direction: column; gap: 18px; }
.ug-sop {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 22px;
}
.ug-sop-title {
  font-family: "Saira Semi Condensed", sans-serif;
  font-size: 17px; font-weight: 800; color: var(--navy);
  text-transform: uppercase; letter-spacing: 0.4px;
  margin: 0 0 12px 0;
}
.ug-subhead {
  font-family: "Saira Semi Condensed", sans-serif;
  font-size: 13px; font-weight: 700; color: var(--teal);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin: 16px 0 6px 0;
}
.ug-sub-intro { font-size: 13px; color: var(--text); margin-bottom: 6px; }
.ug-steps { margin: 6px 0 0 20px; padding: 0; line-height: 1.6; font-size: 14px; }
.ug-steps li { margin-bottom: 4px; }
.ug-aside {
  margin-top: 16px; padding: 12px 16px;
  border-radius: 8px; border: 1px solid;
}
.ug-aside h5 {
  font-family: "Saira Semi Condensed", sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
  margin: 0 0 6px 0;
}
.ug-aside ul { margin: 0 0 0 18px; padding: 0; font-size: 13px; line-height: 1.55; }
.ug-aside-variations { background: #f4f9fc; border-color: #cfdce6; color: var(--navy); }
.ug-aside-variations h5 { color: var(--navy); }
.ug-aside-watch { background: #fff7e8; border-color: #f0d97a; color: #8a6500; }
.ug-aside-watch h5 { color: #8a6500; }

/* Tighter layout on narrow viewports */
@media (max-width: 760px) {
  .ug-section-layout { grid-template-columns: 1fr; }
  .ug-toc { position: static; }
}

/* Print: kill chrome, show only the content */
@media print {
  header, .nav, .page-actions, .save-banner, .queue-badge, .net-status { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
  .ug-sop { page-break-inside: avoid; border: none; padding: 0; margin-bottom: 24px; }
  .ug-section-layout { grid-template-columns: 1fr; }
  .ug-toc { display: none; }
  .ug-card { display: none; }
}

/* ---------- User Guide: last-reviewed stamp ---------- */
.ug-sop-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 8px;
}
.ug-sop-head .ug-sop-title { margin: 0; }
.ug-sop-reviewed { font-style: italic; }

/* ---------- What's new page ---------- */
.wn-card { padding: 22px 28px; max-width: 900px; }
.wn-card .wn-h1 { font-family: "Saira Semi Condensed", sans-serif; font-size: 22px; color: var(--navy); text-transform: uppercase; letter-spacing: 0.4px; margin: 0 0 14px 0; }
.wn-card .wn-h2 {
  font-family: "Saira Semi Condensed", sans-serif;
  font-size: 16px; color: var(--navy); margin: 28px 0 8px 0;
  border-top: 1px solid var(--line); padding-top: 16px;
  font-weight: 800; letter-spacing: 0.3px;
}
.wn-card .wn-h2:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.wn-card .wn-h3 { font-size: 14px; font-weight: 700; color: var(--navy); margin: 14px 0 4px 0; }
.wn-card p { margin: 6px 0; line-height: 1.55; }
.wn-card .wn-list { margin: 6px 0 12px 22px; line-height: 1.55; }
.wn-card .wn-list li { margin: 4px 0; }
.wn-card hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.wn-card code {
  background: rgba(0,0,0,0.06); padding: 1px 6px; border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
}
.wn-card strong { color: var(--navy); }

/* ---------- Technical Library (Phase 6I) ---------- */
.tech-grid {
  display: grid; gap: 14px; margin-top: 4px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.tech-card {
  --tech-accent: var(--navy);
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--tech-accent);
  border-radius: 10px; padding: 18px 20px; text-align: left;
  cursor: pointer; font: inherit; color: var(--text);
  display: flex; flex-direction: column; gap: 10px; min-height: 130px;
  transition: box-shadow 140ms ease, border-color 140ms ease, transform 60ms ease;
}
.tech-card:hover  { box-shadow: 0 4px 14px rgba(21,57,91,0.10); }
.tech-card:active { transform: translateY(1px); }
.tech-card-title {
  font-family: "Saira Semi Condensed", sans-serif;
  font-size: 19px; font-weight: 800; color: var(--tech-accent);
  text-transform: uppercase; letter-spacing: 0.4px;
}
.tech-card-blurb { font-size: 13px; line-height: 1.45; color: var(--text); }
.tech-card-meta  { font-size: 12px; color: var(--muted); margin-top: auto; font-weight: 600; }

.tech-tile {
  --tech-accent: var(--navy);
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 16px; text-align: left; cursor: pointer; font: inherit; color: var(--text);
  display: flex; flex-direction: column; gap: 6px;
  transition: box-shadow 140ms ease, border-color 140ms ease, transform 60ms ease;
}
.tech-tile:hover  { border-color: var(--tech-accent); box-shadow: 0 2px 10px rgba(21,57,91,0.07); }
.tech-tile:active { transform: translateY(1px); }
.tech-tile-name   { font-weight: 700; color: var(--navy); font-size: 15px; }
.tech-tile-sub    { font-size: 12px; color: var(--muted); }
.tech-tile-meta   { font-size: 12px; color: var(--muted); margin-top: 4px; }

#techBreadcrumb { padding: 10px 14px; font-size: 13px; }
#techBreadcrumb a { color: var(--navy); text-decoration: none; }
#techBreadcrumb a:hover { text-decoration: underline; }

#page-tech #techBody { margin-top: 6px; }

/* Tiles grid (used for sections / brands / products lists). */
.tech-grid--tiles {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* Per-file upload progress (Tech Library bulk upload). */
.tech-up-progress {
  margin-top: 12px; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 0; max-height: 320px; overflow: auto; background: #fafbfc;
}
.tech-up-row {
  display: grid; grid-template-columns: 1fr auto auto;
  gap: 10px; align-items: center;
  padding: 6px 12px; border-top: 1px solid #f0f3f6;
}
.tech-up-row:first-child { border-top: 0; }
.tech-up-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tech-up-size { font-variant-numeric: tabular-nums; }
.tech-up-stat { font-size: 12px; font-weight: 600; }
.tech-up-stat.is-active { color: var(--navy); }
.tech-up-stat.is-ok     { color: #2f7c4f; }
.tech-up-stat.is-err    { color: #a30000; max-width: 200px; white-space: normal; }

