/* Nexus Generator Hire Booking Board - styles.css
Light "Jemena" theme. Two display modes via <body data-mode>: "desktop" (staff) and "tv" (office screen). */
:root {
   --bg: #fafafa; --panel: #ffffff; --panel-2: #f4f6f8; --line: #e2e6ea;
   --text: #222222; --muted: #666666; --accent: #0b57d0; --accent-2: #0d47a1;
   --outage: #fb8c00; --emergency: #b71c1c; --general: #0b57d0;
   --confirmed: #2e7d32; --duration: #b26a00; --equipment: #6a1b9a;
   --review: #b71c1c; --completed: #9aa0a6; --cancelled: #c4c8cc;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; display: flex; flex-direction: column; }

.app-header { display: flex; align-items: center; gap: 24px; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand-mark { font-weight: 800; letter-spacing: 2px; color: var(--accent); font-size: 20px; }
.brand-sub { font-size: 12px; color: var(--muted); }
.view-tabs { display: flex; gap: 4px; flex: 1; }
.tab { background: transparent; border: 1px solid transparent; color: var(--muted); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.tab:hover { color: var(--text); background: var(--panel-2); }
.tab.active { color: #fff; background: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.updated { font-size: 12px; color: var(--muted); }
.btn { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.btn:hover { border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn-tv { border-color: var(--accent); color: var(--accent); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 20px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.nav-group { display: flex; align-items: center; gap: 8px; }
.period-label { font-size: 16px; font-weight: 600; margin-left: 8px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters input, .filters select { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; }
.filters input[type="search"] { min-width: 240px; }
.calendar-root { flex: 1; overflow: auto; padding: 16px 20px; }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.month-dow { text-align: center; color: var(--muted); font-size: 12px; padding: 4px 0; text-transform: uppercase; letter-spacing: 1px; }
.month-cell { min-height: 110px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px; overflow: hidden; }
.month-cell.other-month { opacity: 0.45; }
.month-cell.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.mc-num { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.month-cell.today .mc-num { color: var(--accent); font-weight: 700; }
.mc-more { font-size: 11px; color: var(--muted); margin-top: 2px; }
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.week-col { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px; min-height: 200px; }
.week-col.today { border-color: var(--accent); }
.wc-head { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--muted); }
.day-wrap, .list-wrap { max-width: 900px; margin: 0 auto; }
.day-title { font-size: 22px; margin: 0 0 16px; }
.subtle { color: var(--muted); margin-top: -8px; }
.empty { color: var(--muted); font-style: italic; }
.booking-card { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--general); border-radius: 6px; padding: 8px 10px; margin-bottom: 6px; cursor: pointer; }
.booking-card:hover { border-color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.booking-card.compact { padding: 3px 6px; margin-bottom: 3px; font-size: 11px; }
.booking-card.jt-outage { border-left-color: var(--outage); }
.booking-card.jt-emergency { border-left-color: var(--emergency); background: #fdecea; }
.booking-card.jt-general { border-left-color: var(--general); }
.booking-card.st-review, .booking-card.st-duration, .booking-card.st-equipment { box-shadow: inset 0 0 0 1px var(--duration); }
.booking-card.st-completed { opacity: 0.55; }
.bc-top { display: flex; justify-content: space-between; gap: 8px; }
.bc-cust { font-weight: 700; }
.bc-status { font-size: 11px; color: var(--muted); white-space: nowrap; }
.bc-site { font-size: 13px; color: var(--muted); }
.bc-meta { display: flex; gap: 10px; font-size: 12px; margin-top: 4px; }
.bc-dates { font-size: 12px; margin-top: 4px; color: var(--text); }
.bc-owner { font-size: 12px; color: var(--muted); margin-top: 2px; }
.bc-flag { margin-top: 6px; font-size: 12px; color: var(--duration); font-weight: 600; }
.st-confirmed .bc-status { color: var(--confirmed); }
.st-duration .bc-status { color: var(--duration); }
.st-equipment .bc-status { color: var(--equipment); }
.st-review .bc-status { color: var(--review); }
.st-completed .bc-status { color: var(--completed); }
.conflict-banner { background: #fdecea; color: var(--emergency); border-top: 1px solid var(--emergency); padding: 10px 20px; font-size: 14px; font-weight: 600; }
.sync-table { width: 100%; border-collapse: collapse; }
.sync-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.sync-table .sk { color: var(--muted); width: 240px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-backdrop[hidden] { display: none !important; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; width: min(540px, 92vw); max-height: 88vh; overflow: auto; padding: 24px; position: relative; box-shadow: 0 12px 40px rgba(0,0,0,0.2); }
.modal h2 { margin: 0 0 12px; }
.modal-close { position: absolute; top: 12px; right: 16px; background: none; border: none; color: var(--muted); font-size: 26px; cursor: pointer; }
.modal-badges { display: flex; gap: 8px; margin-bottom: 16px; }
.badge { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); }
.badge.jt-outage { color: #fff; background: var(--outage); border-color: var(--outage); }
.badge.jt-emergency { color: #fff; background: var(--emergency); border-color: var(--emergency); }
.badge.jt-general { color: #fff; background: var(--general); border-color: var(--general); }
.badge.st-confirmed { color: #fff; background: var(--confirmed); border-color: var(--confirmed); }
.detail-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.detail-row .dk { color: var(--muted); }
.detail-row .dv { text-align: right; }
.pipedrive-link { display: inline-block; margin-top: 18px; border-color: var(--accent); color: var(--accent); text-decoration: none; }
.app-footer { padding: 8px 20px; font-size: 12px; color: var(--muted); background: var(--panel); border-top: 1px solid var(--line); }
body[data-mode="tv"] { font-size: 20px; }
body[data-mode="tv"] .toolbar .filters { display: none; }
body[data-mode="tv"] .brand-mark { font-size: 32px; }
body[data-mode="tv"] .tab { font-size: 18px; padding: 10px 18px; }
body[data-mode="tv"] .period-label { font-size: 26px; }
body[data-mode="tv"] .month-cell { min-height: 150px; }
body[data-mode="tv"] .month-dow { font-size: 18px; }
body[data-mode="tv"] .mc-num { font-size: 18px; }
body[data-mode="tv"] .booking-card.compact { font-size: 15px; padding: 5px 8px; }
body[data-mode="tv"] .updated { font-size: 18px; color: var(--text); }
body[data-mode="tv"] .month-cell.today { box-shadow: inset 0 0 0 3px var(--accent); }
@media (max-width: 720px) {
   .filters input[type="search"] { min-width: 140px; }
   .month-cell { min-height: 80px; }
}

/* ---------- LIST VIEW (Jemena-style data table) ---------- */
.list-table-wrap { max-width: 100%; }
.list-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.list-title { font-size: 18px; margin: 0; color: var(--text); }
.list-count { font-size: 13px; color: var(--muted); }
.data-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.data-table thead th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel); }
.data-table tbody td { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--text); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-row { cursor: pointer; }
.data-row:hover { background: var(--panel-2); }
.cell-strong { font-weight: 600; }
.cell-nowrap { white-space: nowrap; }
.cell-actions { text-align: right; }
.row-link { color: var(--accent); text-decoration: none; font-weight: 500; }
.row-link:hover { text-decoration: underline; }
.pill { display: inline-block; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 10px; color: #fff; white-space: nowrap; }
.pill.st-confirmed { background: var(--confirmed); }
.pill.st-duration { background: var(--duration); }
.pill.st-equipment { background: var(--equipment); }
.pill.st-review { background: var(--review); }
.pill.st-completed { background: var(--completed); }
.pill.st-cancelled { background: var(--cancelled); color: #444; }
.chip { display: inline-block; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 10px; background: #e3f2fd; color: #0d47a1; white-space: nowrap; }
.chip.jt-outage { background: #fff3e0; color: #b26a00; }
.chip.jt-emergency { background: #fdecea; color: var(--emergency); }
.chip.jt-general { background: #e3f2fd; color: #0d47a1; }
@media (max-width: 980px) {
  .data-table { display: block; overflow-x: auto; }
}

/* ---------- Header logo (top right) ---------- */
.brand-logo { height: 40px; width: auto; max-width: 280px; object-fit: contain; margin-left: 8px; flex-shrink: 0; }
body[data-mode="tv"] .brand-logo { height: 60px; max-width: 380px; }

/* ---------- 2-WEEK (FORTNIGHT) VIEW: fixed, even day rows that fill the screen ---------- */
.fortnight-grid { height: 100%; min-height: 0; grid-template-rows: auto 1fr 1fr; gap: 6px; }
.fortnight-cell { min-height: 0; height: 100%; display: flex; flex-direction: column; overflow-y: auto; }
.fortnight-cell .mc-num { flex: 0 0 auto; }
body[data-mode="tv"] .fortnight-cell { min-height: 0; }
@media (max-width: 720px) {
.fortnight-cell { min-height: 80px; height: auto; }
.fortnight-grid { height: auto; grid-template-rows: none; }
}


/* ============================================================
   DISPATCH JOBSHEET (added feature/dispatch-jobsheet)
   Wide modal + dedicated /jobsheet route + A4 print styling.
   ============================================================ */
.modal.jobsheet-modal { width: min(960px, 96vw); max-height: 92vh; padding: 0; }
.jobsheet { color: #1a1a1a; background: #fff; }
.js-toolbar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 24px; background: #f4f6f8; border-bottom: 1px solid var(--line); }
.js-toolbar .js-title-min { margin-right: auto; font-weight: 700; font-size: 14px; color: var(--muted); }
.js-btn { display: inline-flex; align-items: center; gap: 6px; background: #fff; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px 14px; font-size: 13px; cursor: pointer; text-decoration: none; min-height: 40px; }
.js-btn:hover { border-color: var(--accent); }
.js-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.js-btn.pd { color: var(--accent); border-color: var(--accent); }
.js-btn.ready[data-ready="1"] { background: var(--confirmed); color: #fff; border-color: var(--confirmed); }
.js-body { padding: 24px 28px 36px; }
.js-sheet-head { display: flex; justify-content: space-between; gap: 24px; border-bottom: 3px solid #111; padding-bottom: 14px; margin-bottom: 18px; }
.js-brand h1 { margin: 0; font-size: 20px; letter-spacing: 0.5px; }
.js-brand .js-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.js-headmeta { text-align: right; font-size: 13px; line-height: 1.5; }
.js-headmeta .job-no { font-size: 22px; font-weight: 800; }
.js-statusline { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.js-tag { font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); }
.js-tag.jt-outage { background: #fff3e0; color: #b26a00; border-color: #f0c890; }
.js-tag.jt-emergency { background: #fdecea; color: var(--emergency); border-color: #f1b0a8; }
.js-tag.jt-general { background: #e3f2fd; color: #0d47a1; border-color: #b3d4f5; }
.js-warning { background: #fff8e1; border: 1px solid #f0c36d; border-left: 5px solid #f0a020; border-radius: 8px; padding: 12px 16px; margin-bottom: 20px; font-size: 13.5px; color: #7a4f00; }
.js-warning strong { color: #8a3b00; }
.js-section { margin-bottom: 24px; break-inside: avoid; }
.js-section > h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: #fff; background: #111; padding: 7px 12px; border-radius: 5px 5px 0 0; margin: 0; }
.js-section-body { border: 1px solid var(--line); border-top: none; border-radius: 0 0 6px 6px; padding: 14px 16px; }
.js-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 28px; }
.js-field { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.js-field .k { color: var(--muted); flex-shrink: 0; }
.js-field .v { text-align: right; font-weight: 500; }
.js-field .v.missing { color: var(--emergency); font-style: italic; font-weight: 600; }
.js-field.full { grid-column: 1 / -1; }
.js-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.js-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); border-bottom: 2px solid var(--line); padding: 8px 8px; }
.js-table td { border-bottom: 1px solid var(--line); padding: 9px 8px; vertical-align: middle; }
.js-table td.num, .js-table th.num { text-align: center; width: 78px; }
.js-table td.chk, .js-table th.chk { text-align: center; width: 64px; }
.js-table input[type="text"], .js-table input[type="number"] { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 8px; font-size: 13px; min-height: 38px; }
.js-table input.qty { width: 64px; text-align: center; }
.js-chk { width: 26px; height: 26px; cursor: pointer; accent-color: var(--accent); }
.js-blank { display: inline-block; min-width: 90px; border-bottom: 1px solid #999; height: 18px; }
.js-note-line { display: block; border-bottom: 1px solid #ccc; height: 22px; margin-top: 6px; }
.js-checks { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 6px; }
.js-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; padding: 6px 4px; }
.js-cardlist { display: none; }
.js-footer-sign { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 28px; margin-top: 10px; }
.js-sign { font-size: 13px; }
.js-sign .lbl { color: var(--muted); display: block; margin-bottom: 18px; }
.js-sign .rule { border-bottom: 1px solid #999; }
.local-note { font-size: 12px; color: var(--muted); font-style: italic; margin-top: 4px; }

@media (max-width: 860px) {
  .js-grid { grid-template-columns: 1fr; }
  .js-sheet-head { flex-direction: column; gap: 10px; }
  .js-headmeta { text-align: left; }
}
@media (max-width: 640px) {
  .js-body { padding: 16px 14px 28px; }
  .js-table.stackable thead { display: none; }
  .js-table.stackable, .js-table.stackable tbody, .js-table.stackable tr, .js-table.stackable td { display: block; width: 100%; }
  .js-table.stackable tr { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 12px; }
  .js-table.stackable td { border: none; border-bottom: 1px dashed var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 4px; }
  .js-table.stackable td:last-child { border-bottom: none; }
  .js-table.stackable td::before { content: attr(data-label); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); font-weight: 600; }
  .js-table.stackable td.chk { justify-content: flex-start; }
  .js-table input.qty { width: 80px; }
  .js-chk { width: 30px; height: 30px; }
}

/* ---------- A4 PRINT: warehouse/dispatch document ---------- */
@media print {
  @page { size: A4 portrait; margin: 12mm 12mm 14mm; }
  html, body { background: #fff !important; }
  body * { visibility: hidden !important; }
  .modal-backdrop, .modal-backdrop * { visibility: visible !important; }
  .modal-backdrop { position: static !important; background: none !important; display: block !important; }
  .modal.jobsheet-modal { visibility: visible !important; position: static !important; box-shadow: none !important; border: none !important; width: 100% !important; max-width: 100% !important; max-height: none !important; overflow: visible !important; }
  .jobsheet, .jobsheet * { visibility: visible !important; }
  .js-toolbar, .modal-close, .local-note, .js-btn { display: none !important; }
  .app-header, .toolbar, .app-footer, .conflict-banner, .calendar-root { display: none !important; }
  .js-body { padding: 0 !important; }
  .js-section { page-break-inside: avoid; break-inside: avoid; }
  .js-section > h3 { -webkit-print-color-adjust: exact; print-color-adjust: exact; background: #111 !important; color: #fff !important; }
  .js-table th, .js-table td { font-size: 11pt; }
  .js-chk { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border: 1.5px solid #333; border-radius: 3px; }
  .js-tag { -webkit-print-color-adjust: exact; print-color-adjust: exact; border: 1px solid #999 !important; }
  .js-warning { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a[href]:after { content: ""; }
}

/* ============================================================
   FLEET RESOURCING (feature/fleet-resourcing)
   Rental stock dashboard, status pills, resourcing section,
   import/service modals. Reuses the app's CSS variables.
   ============================================================ */

/* ---- fleet page ---- */
.fleet-page { padding: 16px 20px 40px; }
.fleet-loading, .fleet-empty { color: var(--muted); padding: 16px 0; }
.fleet-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.fleet-head h2 { margin: 0; font-size: 22px; }
.fleet-head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fleet-subhead { margin: 22px 0 8px; font-size: 15px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.fleet-write-ok { color: #2e7d32; font-size: 12px; font-weight: 600; }
.fleet-write-off { color: #b71c1c; font-size: 12px; font-weight: 600; }
.fleet-write-off.sm { font-size: 11px; }

/* ---- status cards ---- */
.fleet-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.fleet-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.fleet-stat .fs-num { font-size: 28px; font-weight: 800; line-height: 1; }
.fleet-stat .fs-lbl { font-size: 12px; color: var(--muted); margin-top: 6px; }
.fleet-stat.ok { border-color: #2e7d32; }
.fleet-stat.warn { border-color: #fb8c00; }
.fleet-stat.warn .fs-num { color: #fb8c00; }
.fleet-stat.crit { border-color: #b71c1c; }
.fleet-stat.crit .fs-num { color: #b71c1c; }

/* ---- filters ---- */
.fleet-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.fleet-filters input[type="search"], .fleet-filters select {
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; }
.fleet-filters input[type="search"] { min-width: 220px; }
.fleet-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }

/* ---- tables ---- */
.fleet-table-wrap { overflow-x: auto; }
.fleet-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.fleet-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.fleet-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; }
.fleet-table tr:last-child td { border-bottom: none; }
.fleet-table .cell-strong { font-weight: 700; }
.fleet-row:hover { background: var(--panel-2); }
.fleet-actions { white-space: nowrap; }

/* ---- status pills ---- */
.fleet-pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #fff; }
.fp-available { background: #2e7d32; }
.fp-allocated { background: #1565c0; }
.fp-on_hire { background: #0277bd; }
.fp-service_due { background: #fb8c00; }
.fp-overdue { background: #b71c1c; }
.fp-in_service { background: #6a1b9a; }
.fp-unavailable { background: #757575; }
.fp-retired { background: #424242; }

/* ---- buttons ---- */
.fleet-btn { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer; }
.fleet-btn:hover { border-color: var(--accent); }
.fleet-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.fleet-btn.ghost { background: transparent; }
.fleet-btn.warn { background: #fb8c00; color: #fff; border-color: #fb8c00; }
.fleet-btn.sm { padding: 4px 9px; font-size: 12px; }
.fleet-btn.danger { background: #fff; color: #c62828; border-color: #e9a8a2; }
.fleet-btn.danger:hover { background: #fdecea; border-color: #c62828; }

/* ---- db-not-configured panel ---- */
.fleet-warning-panel { background: var(--panel); border: 1px solid #fb8c00; border-left: 4px solid #fb8c00; border-radius: 10px; padding: 18px 20px; margin: 16px 20px; }
.fleet-warning-panel h3 { margin: 0 0 8px; color: #fb8c00; }
.fleet-warning-panel code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.fleet-warning-panel .subtle { color: var(--muted); font-size: 13px; }

/* ---- modals (import / service / allocate) ---- */
.fleet-modal-back { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 1000; overflow-y: auto; }
.fleet-modal { background: var(--panel); color: var(--text); border-radius: 12px; width: 100%; max-width: 680px; box-shadow: 0 12px 40px rgba(0,0,0,0.4); }
.fm-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.fm-head h3 { margin: 0; font-size: 17px; }
.fm-close { background: none; border: none; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; }
.fm-body { padding: 16px 18px; }
.fm-body .subtle { color: var(--muted); font-size: 12.5px; }
.fm-actions { display: flex; gap: 10px; margin-top: 14px; }
.fm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fm-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.fm-grid label.full { grid-column: 1 / -1; }
.fm-grid input, .fm-grid textarea, .fleet-textarea {
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13.5px; font-family: inherit; }
.fleet-textarea { width: 100%; min-height: 160px; resize: vertical; }
.fleet-import-result { margin-top: 12px; }
.fleet-mini { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 12.5px; }
.fleet-mini th, .fleet-mini td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); }
.fleet-ok { color: #2e7d32; }
.fleet-err { color: #b71c1c; }
.alloc-opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
.alloc-opt.conf { opacity: 0.8; border-color: #b71c1c; }
.alloc-opt.xhire { margin-top: 12px; border-style: dashed; }
.alloc-conf { margin-top: 12px; }

/* ---- resourcing section inside the jobsheet ---- */
.js-resourcing { font-size: 13.5px; }
.rs-loading, .rs-note { color: var(--muted); padding: 6px 0; }
.rs-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.rs-line { margin: 6px 0; }
.alloc-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #fff; background: #757575; }
.ab-ok { background: #2e7d32; }
.ab-prop { background: #1565c0; }
.ab-conflict { background: #b71c1c; }
.ab-xhire { background: #fb8c00; }
.ab-rel { background: #9e9e9e; }
.rs-alert { border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-weight: 600; }
.rs-alert.warn { background: rgba(251,140,0,0.14); color: #e65100; border: 1px solid #fb8c00; }
.rs-alert.crit { background: rgba(183,28,28,0.14); color: #b71c1c; border: 1px solid #b71c1c; }
.rs-hours { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 10px; }
.rs-hcell { display: flex; flex-direction: column; gap: 4px; }
.rs-hcell label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.rs-hcell input, .rs-hcell output { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 14px; min-width: 90px; }
.rs-hcell output { display: inline-block; font-weight: 700; }
.rs-stock { margin-top: 12px; }

/* ---- Fuel section: dedicated full-width row below engine hours ---- */
.rs-fuel {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  margin-top: 14px; padding: 14px 16px; border-top: 2px solid var(--line);
  background: var(--bg); border-radius: 8px;
  border: 1px solid var(--line);
}
.rs-fuel-label {
  display: block; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); margin-bottom: 6px;
}
.rs-fuel-unit { font-weight: 400; font-size: 10px; }
.rs-fuel-cell input[type="number"] {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 10px; font-size: 15px; font-weight: 600; box-sizing: border-box;
}
.rs-fuel-cell input[type="number"]:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(66,133,244,0.18); }
.rs-fuel-toggle-cell { display: flex; flex-direction: column; }

/* CSS toggle switch */
.rs-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.rs-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.rs-toggle-track {
  position: relative; width: 44px; height: 24px; border-radius: 12px;
  background: #d1d5db; transition: background .2s; flex-shrink: 0;
}
.rs-toggle input:checked ~ .rs-toggle-track { background: var(--danger, #e53935); }
.rs-toggle-thumb {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: left .18s;
}
.rs-toggle input:checked ~ .rs-toggle-track .rs-toggle-thumb { left: 23px; }
.rs-toggle-text { font-size: 13px; font-weight: 600; color: var(--text); }
.rs-toggle input:checked ~ .rs-toggle-text { color: var(--danger, #e53935); }

/* ---- calendar booking indicators ---- */
.booking-card.bc-alloc::after { content: ""; }
.bc-flag-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 4px; vertical-align: middle; }
.bc-dot-conflict { background: #b71c1c; }
.bc-dot-xhire { background: #fb8c00; }
.bc-dot-service { background: #fb8c00; }
.bc-dot-allocated { background: #2e7d32; }
.bc-dot-missing { background: #9e9e9e; }


/* ====================================================================
   STAFF RESOURCING & UTILISATION PAGE
   ==================================================================== */

/* ── nav icon for staff tab ───────────────────────────────────────── */
.tab[data-icon="staff"] .rail-ico::before { content: "👥"; font-style: normal; }

/* ── tab bar ─────────────────────────────────────────────────────── */
.su-tab-bar {
  display: flex; gap: 4px; padding: 16px 20px 0;
  border-bottom: 2px solid var(--line); margin-bottom: 20px;
}
.su-tab {
  padding: 8px 20px; border-radius: 8px 8px 0 0; font-size: 13.5px; font-weight: 600;
  background: none; border: 1px solid transparent; border-bottom: none;
  color: var(--muted); cursor: pointer; transition: background .12s, color .12s;
}
.su-tab:hover { background: var(--bg); color: var(--text); }
.su-tab.active { background: var(--panel); border-color: var(--line); color: var(--accent); }

/* ── filters row ─────────────────────────────────────────────────── */
.su-filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px;
  padding: 0 20px 16px; border-bottom: 1px solid var(--line); margin-bottom: 16px;
}
.su-filter-lbl {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted);
}
.su-select, .su-input-date {
  background: var(--bg); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 10px; font-size: 13px; min-width: 110px;
}
.su-nav-btn { align-self: flex-end; }

/* ── period label ────────────────────────────────────────────────── */
.su-period-row { padding: 0 20px 12px; }
.su-period-label { font-size: 14px; font-weight: 700; color: var(--text); }

/* ── summary cards ───────────────────────────────────────────────── */
.su-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px; padding: 0 20px 20px;
}
.su-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 4px;
}
.su-card-val {
  font-size: 22px; font-weight: 700; line-height: 1; color: var(--text);
}
.su-card-val.util-over { color: var(--danger, #d32f2f); }
.su-card-val.util-near { color: #e65100; }
.su-card-val.util-good { color: #2e7d32; }
.su-card-val.util-low  { color: var(--muted); }
.su-card-lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* ── insights panel ──────────────────────────────────────────────── */
.su-insights {
  margin: 0 20px 16px; padding: 14px 16px;
  background: rgba(66,133,244,0.06); border: 1px solid rgba(66,133,244,0.2);
  border-radius: 10px; display: flex; flex-direction: column; gap: 8px;
}
.su-insights:empty { display: none; }
.su-insights-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.su-insight-row { display: flex; gap: 8px; font-size: 13px; color: var(--text); }
.su-insight-ico { flex-shrink: 0; }

/* ── utilisation table ───────────────────────────────────────────── */
.su-table-wrap { padding: 0 20px 32px; overflow-x: auto; }
.su-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.su-table th {
  text-align: left; padding: 8px 10px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
  border-bottom: 2px solid var(--line); white-space: nowrap;
}
.su-table td {
  padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle;
}
.su-table tr:last-child td { border-bottom: none; }
.su-table tr:hover td { background: var(--bg); }
.su-name { font-weight: 600; color: var(--text); }
.su-num  { text-align: right; font-variant-numeric: tabular-nums; }

/* ── utilisation colour classes ──────────────────────────────────── */
.util-over { color: var(--danger, #d32f2f) !important; font-weight: 700; }
.util-near { color: #e65100 !important; font-weight: 700; }
.util-good { color: #2e7d32 !important; }
.util-low  { color: var(--muted) !important; }
.util-na   { color: var(--muted) !important; }

/* ── utilisation bar ─────────────────────────────────────────────── */
.su-bar-wrap { display: flex; align-items: center; gap: 8px; min-width: 140px; }
.su-bar-track {
  flex: 1; height: 10px; background: var(--line); border-radius: 99px; overflow: hidden;
}
.su-bar-fill {
  height: 100%; border-radius: 99px; position: relative;
  background: #9e9e9e; transition: width .3s;
}
.su-bar-fill.util-over { background: var(--danger, #d32f2f); }
.su-bar-fill.util-near { background: #ef6c00; }
.su-bar-fill.util-good { background: #43a047; }
.su-bar-fill.util-low  { background: #9e9e9e; }
.su-bar-bill {
  position: absolute; top: 0; left: 0; height: 100%;
  background: rgba(255,255,255,0.35); border-radius: 99px;
}
.su-bar-pct { font-size: 12px; font-weight: 700; min-width: 38px; text-align: right; }
.su-bar-na  { font-size: 12px; color: var(--muted); }

/* ── status pills ────────────────────────────────────────────────── */
.staff-status-pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
  border: 1px solid transparent;
}
.sp-over    { background: rgba(211,47,47,.12); color: #b71c1c; border-color: #ef9a9a; }
.sp-near    { background: rgba(239,108,0,.1);  color: #e65100; border-color: #ffcc80; }
.sp-good    { background: rgba(67,160,71,.12); color: #2e7d32; border-color: #a5d6a7; }
.sp-low     { background: var(--bg);           color: var(--muted); border-color: var(--line); }
.sp-none    { background: var(--bg);           color: var(--muted); border-color: var(--line); }
.sp-missing { background: var(--bg);           color: var(--muted); border-color: var(--line); font-style: italic; }

/* ── staff type badges ───────────────────────────────────────────── */
.staff-type-badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; text-transform: capitalize;
}
.st-employee   { background: rgba(66,133,244,.12); color: #1565c0; border: 1px solid #90caf9; }
.st-contractor { background: rgba(156,39,176,.1);  color: #6a1b9a; border: 1px solid #ce93d8; }

/* ── team roster ─────────────────────────────────────────────────── */
.sr-wrap { padding: 0 20px; }
.sr-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 14px; padding-top: 4px; }
.sr-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 6px;
}
.sr-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sr-name  { font-weight: 700; font-size: 14px; color: var(--text); }
.sr-role  { font-size: 12px; color: var(--muted); }
.sr-email { font-size: 12px; color: var(--accent); }

/* ── loading / error states ──────────────────────────────────────── */
.su-loading-text { padding: 24px; color: var(--muted); font-size: 13px; }
.su-error { padding: 16px; color: var(--danger, #d32f2f); font-size: 13px;
  background: rgba(211,47,47,.06); border-radius: 8px; margin: 8px 0; }

/* ── responsive ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .su-filters { padding: 0 12px 12px; }
  .su-cards   { grid-template-columns: repeat(2, 1fr); padding: 0 12px 16px; }
  .su-table-wrap { padding: 0 4px 24px; }
  .su-table th:nth-child(n+4):nth-child(-n+6) { display: none; }
  .su-table td:nth-child(n+4):nth-child(-n+6) { display: none; }
}

/* ── print: hide staff utilisation ──────────────────────────────── */
@media print {
  .su-tab-bar, .su-filters, .su-insights, .su-nav-btn { display: none !important; }
}

/* ---- phone: tables become cards ---- */
@media (max-width: 640px) {
  .fleet-page { padding: 12px; }
  .fleet-table.stackable thead { display: none; }
  .fleet-table.stackable, .fleet-table.stackable tbody, .fleet-table.stackable tr, .fleet-table.stackable td { display: block; width: 100%; }
  .fleet-table.stackable tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; padding: 6px 10px; background: var(--panel); }
  .fleet-table.stackable td { border: none; border-bottom: 1px dashed var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 2px; }
  .fleet-table.stackable td:last-child { border-bottom: none; }
  .fleet-table.stackable td::before { content: attr(data-label); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
  .fm-grid { grid-template-columns: 1fr; }
}


/* ---- jobsheet staff allocation table ---- */
.js-staff-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 4px; }
.js-staff-table th {
  text-align: left; padding: 6px 8px; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
  border-bottom: 2px solid var(--line);
}
.js-staff-table td { padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.js-staff-table tr:last-child td { border-bottom: none; }
.js-staff-name { font-weight: 600; }
.js-staff-num  { text-align: right; font-variant-numeric: tabular-nums; }
.js-staff-note { color: var(--muted); font-size: 11.5px; }
.js-bill-yes   { color: #2e7d32; font-weight: 600; }
.js-bill-no    { color: var(--muted); }
.js-staff-placeholder { padding: 10px 0; color: var(--muted); font-size: 13px; font-style: italic; }

/* Staff allocation — add/remove controls */
.js-staff-del-cell { width: 32px; text-align: center; }
.js-staff-del {
  background: none; border: none; cursor: pointer; color: var(--muted);
  font-size: 13px; padding: 2px 4px; border-radius: 3px; line-height: 1;
}
.js-staff-del:hover { color: var(--danger); background: #fef2f2; }

.js-staff-add-btn {
  margin-top: 10px; padding: 6px 14px; font-size: 13px; font-weight: 600;
  background: none; border: 1.5px solid var(--accent); color: var(--accent);
  border-radius: 6px; cursor: pointer; transition: background .15s, color .15s;
}
.js-staff-add-btn:hover { background: var(--accent); color: #fff; }

.js-alloc-form {
  margin-top: 12px; padding: 14px 16px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px;
}
.js-alloc-row {
  display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 10px;
}
.js-alloc-lbl {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; flex: 1; min-width: 120px;
}
.js-alloc-check-lbl {
  flex-direction: row; align-items: center; gap: 6px; padding-top: 18px;
  font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 500; color: inherit;
}
.js-alloc-input {
  padding: 6px 8px; font-size: 13px; border: 1px solid var(--line);
  border-radius: 5px; background: #fff; width: 100%; box-sizing: border-box;
}
.js-alloc-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent); }
.js-alloc-select { padding: 6px 8px; font-size: 13px; border: 1px solid var(--line); border-radius: 5px; background: #fff; width: 100%; }
.js-alloc-actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.js-alloc-save {
  padding: 7px 18px; font-size: 13px; font-weight: 600; border: none;
  background: var(--accent); color: #fff; border-radius: 6px; cursor: pointer;
}
.js-alloc-save:hover:not(:disabled) { filter: brightness(1.1); }
.js-alloc-save:disabled { opacity: .5; cursor: default; }
.js-alloc-cancel {
  padding: 7px 14px; font-size: 13px; background: none; border: 1px solid var(--line);
  border-radius: 6px; cursor: pointer; color: var(--muted);
}
.js-alloc-cancel:hover { background: var(--line); }
.js-alloc-err { font-size: 12px; color: var(--danger); }

@media print {
  .js-staff-add-btn, .js-alloc-form, .js-staff-del { display: none !important; }
}
@media print {
  .js-section-staff { page-break-inside: avoid; break-inside: avoid; }
  .js-staff-table td, .js-staff-table th { font-size: 9.5px; padding: 4px 6px; }
}

/* ---- A4 print: keep the resourcing SUMMARY, hide its controls ---- */
@media print {
  .fleet-modal-back { display: none !important; }
  .js-section-resourcing { page-break-inside: avoid; break-inside: avoid; }
  .rs-head .fleet-btn, .rs-head .fleet-write-off, #rsHoursSave, #rsAllocBtn { display: none !important; }
  /* show engine-hour values as plain boxes; inputs print their values */
  .rs-hcell input, .rs-hcell output { border: 1px solid #999 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rs-fuel { display: grid !important; grid-template-columns: repeat(3, 1fr); border: 1px solid #999 !important; gap: 4mm; padding: 4mm; }
  .rs-fuel-cell input[type="number"] { border: none !important; border-bottom: 1px solid #999 !important; background: none !important; font-size: 11px; }
  .rs-toggle-track, .bs-fuel-warn { display: none !important; }
  .rs-toggle-text { font-size: 10px; font-weight: 700; }
  .alloc-badge, .fleet-pill { -webkit-print-color-adjust: exact; print-color-adjust: exact; border: 1px solid #999; }
  .rs-alert { -webkit-print-color-adjust: exact; print-color-adjust: exact; border: 1px solid #999 !important; }
}

/* ---- Fleet detail drawer: separate labels from their values ---- */
.rs-grid label { font-weight: 600; color: var(--muted); margin-right: 6px; }


/* ============================================================
   PIPEDRIVE-STYLE DESIGN SYSTEM  (feature/pipedrive-ui)
   Re-maps the app's existing CSS variables to a Pipedrive-style
   palette and adds the application shell (dark purple side rail,
   white top header, light grey page) + reusable components.
   Loaded last so it cascades over the original rules.
   ============================================================ */
:root {
  --app-bg: #f4f5f7;
  --panel-bg: #ffffff;
  --column-bg: #f1f2f5;
  --border: #e4e6eb;
  --border-strong: #d4d7dd;
  --text: #1f2733;
  --muted: #6b7280;
  --brand-purple: #21174f;
  --brand-purple-2: #2c2069;
  --brand-purple-rail: #1c1340;
  --brand-green: #20a052;
  --brand-green-dark: #178a44;
  --accent-blue: #2f6fed;
  --warning: #e8920c;
  --warning-bg: #fdf3e2;
  --danger: #d23f3f;
  --danger-bg: #fcecec;
  --success: #20a052;
  --success-bg: #e8f6ee;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --shadow-md: 0 4px 12px rgba(16,24,40,.10);
  --rail-w: 76px;
  --bg: var(--app-bg);
  --panel: var(--panel-bg);
  --panel-2: var(--column-bg);
  --line: var(--border);
  --accent: var(--accent-blue);
  --accent-2: #1d4fc4;
  --confirmed: var(--success);
  --general: var(--accent-blue);
}
html, body { background: var(--app-bg); }
body { color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased; }
/* Global Nexus Hub bar — consistent across the Hub and its apps. */
.hub-bar { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; gap: 10px;
  height: 48px; padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.hub-back { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 8px;
  color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none; }
.hub-back:hover { background: var(--panel-2); color: var(--text); }
.hub-back svg { width: 16px; height: 16px; }
.hub-div { width: 1px; height: 20px; background: var(--line); }
.hub-mark { width: 24px; height: 24px; display: block; border-radius: 6px; }
.hub-title { font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap; }

.app-shell { display: flex; min-height: calc(100vh - 48px); width: 100%; }
.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.side-rail { width: var(--rail-w); flex: 0 0 var(--rail-w); background: var(--brand-purple-rail);
  display: flex; flex-direction: column; align-items: stretch; padding: 10px 0 14px; gap: 4px;
  position: sticky; top: 48px; height: calc(100vh - 48px); }
.rail-brand { display: none; }
/* Office/TV display mode: drop the Hub bar for a clean full-screen board. */
body[data-mode="tv"] .hub-bar { display: none; }
body[data-mode="tv"] .app-shell { min-height: 100vh; }
body[data-mode="tv"] .side-rail { top: 0; height: 100vh; }
.rail-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-purple-2);
  color: #fff; font-weight: 800; font-size: 18px; display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.rail-nav { flex-direction: column; gap: 2px; flex: 0 0 auto; padding: 0 8px; }
.side-rail .tab { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: transparent; border: 0; border-radius: 10px; color: #b9b3d6; padding: 9px 4px; cursor: pointer;
  font-size: 10.5px; line-height: 1.1; text-align: center; }
.side-rail .tab:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-rail .tab.active { background: var(--brand-purple-2); color: #fff; }
.rail-ico { width: 22px; height: 22px; display: inline-block; }
.rail-lbl { white-space: nowrap; }
.side-rail .tab .rail-ico { background: currentColor; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; -webkit-mask-size: 21px; mask-size: 21px; }
.side-rail .tab[data-icon="calendar"] .rail-ico { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='17' rx='2'/><path d='M3 9h18M8 2v4M16 2v4'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='17' rx='2'/><path d='M3 9h18M8 2v4M16 2v4'/></svg>"); }
.side-rail .tab[data-icon="list"] .rail-ico { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01'/></svg>"); }
.side-rail .tab[data-icon="fortnight"] .rail-ico, .side-rail .tab[data-icon="week"] .rail-ico { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='16' rx='2'/><path d='M3 10h18'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='16' rx='2'/><path d='M3 10h18'/></svg>"); }
.side-rail .tab[data-icon="day"] .rail-ico { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='4'/><path d='M12 2v2M12 20v2M2 12h2M20 12h2'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='4'/><path d='M12 2v2M12 20v2M2 12h2M20 12h2'/></svg>"); }
.side-rail .tab[data-icon="fleet"] .rail-ico { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 13h11V6H3zM14 9h4l3 3v4h-7z'/><circle cx='6.5' cy='17.5' r='1.8'/><circle cx='17.5' cy='17.5' r='1.8'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 13h11V6H3zM14 9h4l3 3v4h-7z'/><circle cx='6.5' cy='17.5' r='1.8'/><circle cx='17.5' cy='17.5' r='1.8'/></svg>"); }
.side-rail .tab[data-icon="alerts"] .rail-ico { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3l9 16H3z'/><path d='M12 10v4M12 17h.01'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3l9 16H3z'/><path d='M12 10v4M12 17h.01'/></svg>"); }
.side-rail .tab[data-icon="settings"] .rail-ico { -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='3.2'/><path d='M5 12a7 7 0 01.5-2.6L3 7l2-3.4 2.8 1A7 7 0 0110 3.2L10.5 1h3L14 3.2a7 7 0 012.2 1.3l2.8-1 2 3.4-2.5 2.4a7 7 0 010 2.6'/></svg>"); mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='3.2'/><path d='M5 12a7 7 0 01.5-2.6L3 7l2-3.4 2.8 1A7 7 0 0110 3.2L10.5 1h3L14 3.2a7 7 0 012.2 1.3l2.8-1 2 3.4-2.5 2.4a7 7 0 010 2.6'/></svg>"); }

/* ---------- top header ---------- */
.app-shell .app-header { gap: 16px; padding: 10px 20px; background: var(--panel-bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm); position: sticky; top: 0; z-index: 30; min-height: 60px; }
.app-titlewrap { display: flex; flex-direction: column; line-height: 1.2; min-width: 150px; }
.app-title { font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.app-subtitle { font-size: 12px; color: var(--muted); }
.app-search { flex: 1 1 auto; max-width: 560px; position: relative; display: flex; align-items: center; }
.app-search-ico { position: absolute; left: 12px; width: 16px; height: 16px; opacity: .55; background: var(--muted); -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='M21 21l-4-4'/></svg>") no-repeat center / contain; mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='M21 21l-4-4'/></svg>") no-repeat center / contain; }
.app-search input[type="search"] { width: 100%; background: var(--column-bg); border: 1px solid var(--border); border-radius: 999px; padding: 9px 14px 9px 36px; font-size: 13.5px; color: var(--text); min-width: 0; }
.app-search input[type="search"]:focus { outline: none; border-color: var(--accent-blue); background: #fff; box-shadow: 0 0 0 3px rgba(47,111,237,.14); }
.header-actions { gap: 10px; }
.db-indicator { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--success); background: var(--success-bg); border: 1px solid #bfe6cd; padding: 4px 10px; border-radius: 999px; }
.db-indicator .db-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.db-indicator.off { color: var(--danger); background: var(--danger-bg); border-color: #f2c5c5; }
.db-indicator.off .db-dot { background: var(--danger); }
.updated { font-size: 12px; color: var(--muted); }
/* ---------- buttons ---------- */
.btn { background: var(--panel-bg); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 13px; font-size: 13px; font-weight: 600; min-height: 38px; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { border-color: var(--border-strong); background: var(--column-bg); box-shadow: none; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); font-weight: 600; }
.btn.ghost:hover { background: var(--column-bg); color: var(--text); }
.btn.btn-icon { padding: 8px 11px; min-width: 38px; display: inline-flex; align-items: center; justify-content: center; }
.btn-tv { background: transparent; border-color: var(--border-strong); color: var(--brand-purple); }
.btn-tv:hover { background: var(--column-bg); }
.btn.primary, .btn-primary { background: var(--brand-green); border-color: var(--brand-green); color: #fff; }
.btn.primary:hover, .btn-primary:hover { background: var(--brand-green-dark); border-color: var(--brand-green-dark); }
button:disabled, .btn:disabled, .fleet-btn:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 1px; }
/* ---------- toolbar ---------- */
.app-shell .toolbar { background: var(--panel-bg); border-bottom: 1px solid var(--border); padding: 10px 20px; }
.period-label { font-size: 15px; font-weight: 700; color: var(--text); }
.filters select, .filters input { background: var(--panel-bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 11px; font-size: 13px; min-height: 38px; color: var(--text); }
.filters select:focus, .filters input:focus { outline: none; border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(47,111,237,.12); }
.calendar-root { background: var(--app-bg); }
/* ---------- booking cards ---------- */
.booking-card { background: var(--panel-bg); border: 1px solid var(--border); border-left-width: 3px; border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); }
.booking-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.bc-cust { font-weight: 700; font-size: 13px; color: var(--text); }
.bc-status { font-weight: 600; }
.booking-card.jt-emergency { background: var(--danger-bg); }
.booking-card.st-review, .booking-card.st-duration, .booking-card.st-equipment { box-shadow: var(--shadow-sm); border-left-color: var(--warning); }
.month-cell, .week-col { background: var(--panel-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.month-cell.today { border-color: var(--accent-blue); box-shadow: inset 0 0 0 1px var(--accent-blue); }
.month-dow { color: var(--muted); font-weight: 600; }
/* ---------- pills / chips ---------- */
.pill, .chip, .badge { font-weight: 600; border-radius: 999px; padding: 3px 9px; font-size: 11px; }
.pill { color: #fff; }
.pill.st-confirmed { background: var(--success); }
.pill.st-duration  { background: var(--warning); }
.pill.st-equipment { background: #7b5cc4; }
.pill.st-review    { background: var(--danger); }
.pill.st-completed { background: #9aa0a6; }
.pill.st-cancelled { background: #e4e6eb; color: #5b6471; }
.chip { background: #eaf1fe; color: #1d4fc4; }
.chip.jt-outage { background: var(--warning-bg); color: #b06a00; }
.chip.jt-emergency { background: var(--danger-bg); color: var(--danger); }
.chip.jt-general { background: #eaf1fe; color: #1d4fc4; }
.data-table, .fleet-table { border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.data-table thead th, .fleet-table th { background: var(--column-bg); color: var(--muted); font-weight: 700; }
.data-row:hover, .fleet-row:hover { background: #f8f9fb; }
.list-title, .day-title { color: var(--text); font-weight: 700; }
.conflict-banner { background: var(--danger-bg); color: var(--danger); border-top: 1px solid #f2c5c5; border-bottom: 1px solid #f2c5c5; }
.app-footer { background: var(--panel-bg); border-top: 1px solid var(--border); color: var(--muted); }
/* ============================================================
   FLEET CONTROL CENTRE  (Pipedrive-style operations dashboard)
   ============================================================ */
.fleet-page { background: var(--app-bg); padding: 18px 22px 48px; }
.fleet-head h2 { font-size: 20px; font-weight: 700; color: var(--text); }
.fleet-write-ok { color: var(--success); background: var(--success-bg); border: 1px solid #bfe6cd; padding: 4px 10px; border-radius: 999px; }
.fleet-write-off { color: var(--danger); background: var(--danger-bg); border: 1px solid #f2c5c5; padding: 4px 10px; border-radius: 999px; }
.fleet-write-off.sm { padding: 2px 8px; }
.fleet-stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.fleet-stat { background: var(--panel-bg); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); padding: 15px 16px; position: relative; }
.fleet-stat .fs-num { font-size: 26px; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.fleet-stat .fs-lbl { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 600; }
.fleet-stat::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--border-strong); }
.fleet-stat.ok::before { background: var(--success); }
.fleet-stat.warn::before { background: var(--warning); }
.fleet-stat.warn .fs-num { color: var(--warning); }
.fleet-stat.warn { border-color: #f3dcb0; }
.fleet-stat.crit::before { background: var(--danger); }
.fleet-stat.crit .fs-num { color: var(--danger); }
.fleet-stat.crit { border-color: #f2c5c5; }
.fleet-range { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--panel-bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 14px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.fleet-range .fr-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.fleet-range input[type="date"] { background: var(--column-bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 10px; font-size: 13px; min-height: 36px; }
.fleet-range .fr-result { font-size: 13px; }
.fleet-tabs { display: flex; flex-wrap: wrap; gap: 4px; background: var(--column-bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 4px; margin-bottom: 16px; }
.fleet-tab { background: transparent; border: 0; border-radius: var(--radius-sm); color: var(--muted); padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.fleet-tab:hover { background: rgba(33,23,79,.05); color: var(--text); }
.fleet-tab.active { background: var(--panel-bg); color: var(--brand-purple); box-shadow: var(--shadow-sm); }
.fleet-filters { gap: 10px; align-items: center; margin-bottom: 14px; }
.fleet-filters input[type="search"], .fleet-filters select { background: var(--panel-bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 11px; font-size: 13px; min-height: 38px; }
.fleet-filters input:focus, .fleet-filters select:focus { outline: none; border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(47,111,237,.12); }
.fleet-check { color: var(--muted); font-weight: 600; background: var(--panel-bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 11px; min-height: 38px; }
.fleet-table th { font-weight: 700; }
.fleet-table td { color: var(--text); }
.fleet-table .cell-strong { color: var(--brand-purple); }
.fleet-short, td.fleet-short { color: var(--danger); font-weight: 700; }
.fleet-pill { font-weight: 700; padding: 3px 9px; }
.fp-available { background: var(--success-bg); color: var(--success); }
.fp-allocated { background: #eaf1fe; color: #1d4fc4; }
.fp-on_hire   { background: #e4f2fb; color: #0a6aa3; }
.fp-service_due { background: var(--warning-bg); color: #b06a00; }
.fp-overdue   { background: var(--danger-bg); color: var(--danger); }
.fp-in_service { background: #efe9f8; color: #6b46c1; }
.fp-unavailable { background: #eef0f3; color: #5b6471; }
.fp-retired   { background: #e7e9ee; color: #434a55; }
.fleet-btn { background: var(--panel-bg); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 12px; font-size: 13px; font-weight: 600; min-height: 36px; }
.fleet-btn:hover { background: var(--column-bg); border-color: var(--border-strong); }
.fleet-btn.primary { background: var(--brand-green); color: #fff; border-color: var(--brand-green); }
.fleet-btn.primary:hover { background: var(--brand-green-dark); border-color: var(--brand-green-dark); }
.fleet-btn.ghost { background: transparent; border-color: var(--border-strong); color: var(--muted); }
.fleet-btn.warn { background: #fff; color: var(--danger); border-color: #eccaca; }
.fleet-btn.warn:hover { background: var(--danger-bg); }
.fleet-btn.sm, .fleet-btn.xs { padding: 5px 10px; min-height: 30px; font-size: 12px; }
.fleet-btn.xs { margin-left: 2px; }
.fleet-actions { white-space: nowrap; }
.fleet-alert-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); background: var(--panel-bg); }
.fleet-alert-list li { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; color: var(--text); }
.fleet-alert-list li:last-child { border-bottom: 0; }
.fleet-alert-list .al-type { font-size: 11px; font-weight: 700; text-transform: capitalize; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.fleet-alert-warn { border-left: 3px solid var(--warning); }
.fleet-alert-warn .al-type { background: var(--warning-bg); color: #b06a00; }
.fleet-alert-crit { border-left: 3px solid var(--danger); }
.fleet-alert-crit .al-type { background: var(--danger-bg); color: var(--danger); }
.fleet-empty, .empty { color: var(--muted); }
.empty-state { text-align: center; padding: 40px 20px; background: var(--panel-bg); border: 1px dashed var(--border-strong); border-radius: var(--radius-md); }
.empty-state h4 { margin: 0 0 6px; color: var(--text); font-size: 16px; }
.empty-state p { margin: 0 0 16px; color: var(--muted); font-size: 13.5px; }
.empty-state .es-actions { display: inline-flex; gap: 10px; }
.fleet-warning-panel { background: var(--warning-bg); border: 1px solid #f3dcb0; border-left: 4px solid var(--warning); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.fleet-warning-panel h3 { color: #b06a00; }
/* ---------- modals / drawers / forms ---------- */
.fleet-modal, .modal { border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 18px 50px rgba(16,24,40,.22); }
.fm-head { background: var(--panel-bg); border-bottom: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.fm-head h3 { font-weight: 700; color: var(--text); }
.fm-grid label { font-size: 12px; font-weight: 600; color: var(--muted); gap: 5px; }
.fm-grid input, .fm-grid textarea, .fleet-textarea, .fm-grid select { background: var(--panel-bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 9px 11px; font-size: 13.5px; min-height: 38px; color: var(--text); }
.fm-grid input:focus, .fm-grid textarea:focus, .fleet-textarea:focus, .fm-grid select:focus { outline: none; border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(47,111,237,.12); }
.fm-actions { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 16px; }
.fm-actions .fleet-btn.warn { margin-left: auto; }
.fleet-ok { color: var(--success); font-weight: 600; }
.fleet-err { color: var(--danger); font-weight: 600; }
.fleet-drawer-back { position: fixed; inset: 0; background: rgba(16,24,40,.4); display: flex; justify-content: flex-end; z-index: 1000; }
.fleet-drawer { background: var(--panel-bg); width: min(480px, 96vw); height: 100%; overflow-y: auto; box-shadow: -8px 0 30px rgba(16,24,40,.18); animation: drawerIn .18s ease-out; }
@keyframes drawerIn { from { transform: translateX(20px); opacity: .6; } to { transform: none; opacity: 1; } }
.rs-detail-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.rs-detail-head h4 { margin: 0; font-size: 16px; font-weight: 700; color: var(--text); flex: 1 1 100%; }
.rs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin-bottom: 14px; }
.rs-grid > div { font-size: 13px; color: var(--text); }
.rs-grid label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
.rs-notes { background: var(--column-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; color: var(--text); }
.fleet-mini { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.fleet-mini th { background: var(--column-bg); color: var(--muted); font-weight: 700; }
.fleet-drawer h5 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 6px; }
.alloc-opt { border-radius: var(--radius-sm); }
.alloc-opt.conf { border-color: #eccaca; background: var(--danger-bg); }
/* ---------- jobsheet ---------- */
.modal.jobsheet-modal { border-radius: var(--radius-lg); }
.js-toolbar { background: var(--column-bg); border-bottom: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.js-btn { border-radius: var(--radius-sm); border-color: var(--border-strong); font-weight: 600; }
.js-btn.primary { background: var(--brand-green); border-color: var(--brand-green); }
.js-btn.primary:hover { background: var(--brand-green-dark); }
.js-btn.pd { color: var(--accent-blue); border-color: var(--accent-blue); }
.js-btn.ready[data-ready="1"] { background: var(--success); border-color: var(--success); }
.js-section > h3 { background: var(--brand-purple); color: #fff; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.js-summary-strip { display: flex; flex-wrap: wrap; gap: 10px 22px; background: var(--column-bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 16px; margin-bottom: 18px; }
.js-summary-strip .ss-cell { display: flex; flex-direction: column; gap: 2px; }
.js-summary-strip .ss-k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.js-summary-strip .ss-v { font-size: 13.5px; font-weight: 600; color: var(--text); }
.js-warning { background: var(--warning-bg); border-color: #f0c36d; border-left-color: var(--warning); color: #8a5a00; border-radius: var(--radius-sm); }
.rs-alert.warn { background: var(--warning-bg); color: #8a5a00; border-color: #f0c36d; }
.rs-alert.crit { background: var(--danger-bg); color: var(--danger); border-color: #eccaca; }
.alloc-badge.ab-ok { background: var(--success); }
.alloc-badge.ab-prop { background: var(--accent-blue); }
.alloc-badge.ab-conflict { background: var(--danger); }
.alloc-badge.ab-xhire { background: var(--warning); }
/* ============================================================ RESPONSIVE ============================================================ */
@media (max-width: 1024px) { .app-search { max-width: 320px; } }
@media (max-width: 860px) {
  :root { --rail-w: 100%; }
  .app-shell { flex-direction: column; }
  .side-rail { position: sticky; bottom: 0; top: auto; order: 2; width: 100%; height: auto; flex-direction: row; padding: 4px 6px; gap: 0; overflow-x: auto; z-index: 40; border-top: 1px solid rgba(255,255,255,.08); box-shadow: 0 -2px 12px rgba(16,24,40,.18); }
  .rail-brand { display: none; }
  .rail-nav { flex-direction: row; padding: 0; gap: 2px; }
  .side-rail .tab { flex: 1 0 auto; min-width: 60px; padding: 7px 6px; font-size: 10px; }
  .app-main { order: 1; }
  .app-header { flex-wrap: wrap; }
  .app-search { order: 3; flex-basis: 100%; max-width: none; }
  .brand-logo { display: none; }
}
@media (max-width: 640px) {
  .app-header { padding: 8px 12px; gap: 10px; }
  .app-titlewrap { min-width: 0; }
  .toolbar { padding: 8px 12px; }
  .fleet-page { padding: 12px; }
  .fleet-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .fleet-filters input[type="search"] { min-width: 0; width: 100%; }
  .fleet-actions { display: flex; flex-wrap: wrap; gap: 4px; }
  .rs-grid { grid-template-columns: 1fr; }
  .btn, .fleet-btn, .js-btn { min-height: 40px; }
}
/* ============================================================ PRINT ============================================================ */
@media print {
  .side-rail, .app-search, .db-indicator, .app-header, .toolbar, .app-footer, .conflict-banner { display: none !important; }
  .app-shell, .app-main { display: block !important; }
  .js-summary-strip { -webkit-print-color-adjust: exact; print-color-adjust: exact; border: 1px solid #999 !important; }
  .js-section > h3 { background: #111 !important; }
}

/* Leaf brand mark in side rail */
.rail-mark { background: transparent; box-shadow: none; padding: 0; overflow: hidden; }
.rail-mark-img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 10px; }

/* ---------- month view: multi-day booking spans (lane-stacked) ---------- */
/* Scoped to .month-grid-spans so the fortnight view keeps the original 7-col .month-grid. */
.month-grid.month-grid-spans { grid-template-columns: 1fr; }
.month-grid-spans .month-dow-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.month-row { position: relative; }
.month-row-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.month-grid-spans .month-cell {
  position: relative;
  min-height: max(110px, calc(36px + var(--lanes, 1) * 42px));
  overflow: hidden;
}
body[data-mode="tv"] .month-grid-spans .month-cell { min-height: max(150px, calc(36px + var(--lanes, 1) * 48px)); }
.month-row-spans {
  position: absolute; inset: 30px 0 4px 0;
  display: grid; grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 38px; gap: 4px 6px; pointer-events: none;
}
.booking-span, .month-row-spans .mc-more { pointer-events: auto; }
.booking-span {
  position: relative;
  display: flex; flex-direction: column; justify-content: center; min-width: 0;
  padding: 3px 8px; background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--span-accent, var(--accent)); border-radius: 2px;
  font-size: 11px; line-height: 1.15; cursor: pointer; overflow: hidden;
}
.booking-span.span-start { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.booking-span.span-end   { border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
.booking-span.span-cont-left  { border-left-width: 0; }
.booking-span.span-cont-right { border-right-style: dashed; }
.booking-span.span-hover, .booking-span:hover, .booking-span:focus-visible {
  outline: 2px solid var(--accent); outline-offset: -1px; box-shadow: 0 1px 4px rgba(0,0,0,.12);
}
.bs-top { display: flex; justify-content: space-between; gap: 6px; }
.bs-cust { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bs-status { color: var(--span-accent, var(--muted)); white-space: nowrap; font-size: 10px; }
.bs-site { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bs-cont { color: var(--muted); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.month-row-spans .mc-more { cursor: pointer; font-size: 10px; color: var(--accent); padding: 2px 6px; align-self: center; margin: 0; }
.booking-span.st-equipment { --span-accent: var(--equipment); }
.booking-span.st-confirmed { --span-accent: var(--confirmed); }
.booking-span.st-duration  { --span-accent: var(--duration); }
.booking-span.st-review    { --span-accent: var(--review); }
.booking-span.st-completed { --span-accent: var(--completed); }
.booking-span.st-cancelled { --span-accent: var(--cancelled); }
.booking-span.jt-emergency { background: var(--danger-bg); }
body[data-mode="tv"] .month-row-spans { grid-auto-rows: 44px; }
@media (max-width: 640px) {
  .bs-status { display: none; }
  .month-row-spans { grid-auto-rows: 34px; }
}

/* fortnight (2-week) span layout: keep full-height, even rows */
.month-grid-spans.fortnight-spans { height: 100%; min-height: 0; grid-template-rows: auto 1fr 1fr; }
.fortnight-spans .month-row { height: 100%; min-height: calc(36px + var(--lanes, 1) * 42px); }
.fortnight-spans .month-row-days { height: 100%; }
.fortnight-spans .month-cell { height: 100%; min-height: calc(36px + var(--lanes, 1) * 42px); }
@media (max-width: 720px) {
  .month-grid-spans.fortnight-spans { height: auto; grid-template-rows: none; }
  .fortnight-spans .month-row, .fortnight-spans .month-cell { height: auto; }
}

/* ===================== UI polish pass: contrast, event definition, status language =====================
   Tokens first, then overrides. Scoped to existing classes; no structural changes. */
:root {
  --booking-bg: #ffffff;
  --booking-bg-multi: #f8f7fd;
  --booking-bg-hover: #faf9ff;
  --booking-border: #cfcbe8;
  --booking-border-strong: #b7b1dd;
  --booking-shadow: 0 1px 2px rgba(33,23,79,.08), 0 1px 3px rgba(33,23,79,.06);
  --booking-shadow-hover: 0 3px 10px rgba(33,23,79,.14);
  --booking-text: #1f2733;
  --booking-muted: #5b6472;
  --booking-accent: #6d28d9;
  --status-needs-bg: #fdf3e2;   --status-needs-text: #8a5200;   --status-needs-accent: #e8920c;
  --status-allocated-bg: #e8f6ee; --status-allocated-text: #15703f; --status-allocated-accent: #20a052;
  --status-conflict-bg: #fcecec;  --status-conflict-text: #a32424;  --status-conflict-accent: #d23f3f;
  --status-service-bg: #fdf3e2;   --status-service-text: #8a5200;
  --status-done-bg: #eef0f3;      --status-done-text: #5b6472;     --status-done-accent: #9ca3af;
  --calendar-cell-border: #d8dbe2;
  --calendar-cell-bg: #ffffff;
  --calendar-cell-muted-bg: #f1f2f5;
}

/* ---- 1. grid contrast ---- */
.month-grid-spans .month-cell {
  background: var(--calendar-cell-bg);
  border: 1px solid var(--calendar-cell-border);
}
.month-grid-spans .month-cell.other-month { opacity: 1; background: var(--calendar-cell-muted-bg); border-color: #e2e4e9; }
.month-grid-spans .other-month .mc-num { color: #aeb4bd; font-weight: 500; }
.month-grid-spans .mc-num { color: #3c4554; font-weight: 700; font-size: 12.5px; padding: 6px 8px 2px; margin-bottom: 0; }
.month-grid-spans .month-cell.today { background: #f3f7ff; border-color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.month-grid-spans .month-cell.today .mc-num { color: var(--accent); }
.month-dow-row .month-dow { font-weight: 700; color: #555e6b; letter-spacing: .8px; }

/* ---- 2/3. booking span definition ---- */
.booking-span {
  background: var(--booking-bg);
  border: 1px solid var(--booking-border);
  border-left: 3px solid var(--span-accent, var(--booking-accent));
  box-shadow: var(--booking-shadow);
  color: var(--booking-text);
  font-size: 11.5px;
  line-height: 1.2;
  transition: box-shadow .12s, border-color .12s, background .12s;
}
.booking-span.span-multi {
  background: var(--booking-bg-multi);
  border-color: var(--booking-border-strong);
  border-left-width: 4px;
}
.booking-span:hover, .booking-span.span-hover {
  background: var(--booking-bg-hover);
  border-color: var(--booking-border-strong);
  box-shadow: var(--booking-shadow-hover);
  outline: none;
}
.booking-span:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; box-shadow: var(--booking-shadow-hover); }
.booking-span.span-cont-right { border-right-style: dashed; border-right-color: var(--booking-border-strong); }

/* ---- 5. text hierarchy ---- */
.bs-top { justify-content: flex-start; align-items: center; gap: 6px; min-width: 0; }
.bs-cust { font-weight: 700; font-size: 11.5px; color: var(--booking-text); flex: 0 1 auto; }
.bs-site { color: var(--booking-muted); font-size: 10.5px; }
.bs-cont { color: var(--booking-muted); }

/* ---- 4. status pills (not colour-only: text always shown) ---- */
.booking-span .bs-status {
  flex: 0 0 auto;
  font-size: 9.5px; font-weight: 700; letter-spacing: .2px;
  padding: 1px 6px; border-radius: 999px;
  background: var(--status-pill-bg, var(--status-done-bg));
  color: var(--status-pill-text, var(--status-done-text));
  text-transform: uppercase;
}
.booking-span.st-equipment, .booking-span.st-duration { --status-pill-bg: var(--status-needs-bg); --status-pill-text: var(--status-needs-text); --span-accent: var(--status-needs-accent); }
.booking-span.st-confirmed { --status-pill-bg: var(--status-allocated-bg); --status-pill-text: var(--status-allocated-text); --span-accent: var(--status-allocated-accent); }
.booking-span.st-review    { --status-pill-bg: var(--status-conflict-bg); --status-pill-text: var(--status-conflict-text); --span-accent: var(--status-conflict-accent); }
.booking-span.st-completed { --status-pill-bg: var(--status-done-bg); --status-pill-text: var(--status-done-text); --span-accent: var(--status-done-accent); opacity: .8; }
.booking-span.st-cancelled { --status-pill-bg: var(--status-done-bg); --status-pill-text: var(--status-done-text); --span-accent: #d1d5db; opacity: .65; }
.booking-span.st-cancelled .bs-cust { text-decoration: line-through; }
.booking-span.jt-emergency { background: var(--danger-bg); border-color: #efc3c3; }

/* status pills on regular cards (week/day/list) for consistency */
.booking-card .bc-status { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .2px; background: var(--status-done-bg); }
.booking-card.st-equipment .bc-status, .booking-card.st-duration .bc-status { background: var(--status-needs-bg); color: var(--status-needs-text); }
.booking-card.st-confirmed .bc-status { background: var(--status-allocated-bg); color: var(--status-allocated-text); }
.booking-card.st-review .bc-status { background: var(--status-conflict-bg); color: var(--status-conflict-text); }
.booking-card { border-color: #d9dce3; box-shadow: var(--booking-shadow); }
.booking-card:hover { box-shadow: var(--booking-shadow-hover); }

/* ---- overflow chip ---- */
.month-row-spans .mc-more {
  font-weight: 700; font-size: 10px; color: var(--accent);
  background: #eef3fe; border: 1px solid #d3e0fb; border-radius: 999px;
  padding: 2px 8px; justify-self: start; align-self: center;
}
.month-row-spans .mc-more:hover { background: #dfe9fd; }

/* ---- 6/8. toolbar + page depth ---- */
.app-shell .toolbar { box-shadow: 0 1px 2px rgba(16,24,40,.05); }
.filters select:hover, .filters input:hover { border-color: var(--border-strong); }
.calendar-root { padding-top: 14px; }

/* ---- 7. side rail active clarity ---- */
.side-rail .tab.active { box-shadow: inset 3px 0 0 var(--brand-green); }

/* ---- 17. tablet tap targets ---- */
@media (max-width: 1100px) and (min-width: 641px) {
  .month-row-spans { grid-auto-rows: 42px; }
  .booking-span { font-size: 12px; }
}

/* ===================== Jobsheet v2: compact interactive dispatch sheet ===================== */
.jobsheet .js-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 18px; }
.jobsheet .js-field { display: flex; gap: 8px; align-items: baseline; padding: 3px 0; border-bottom: 1px dotted #e7e9ee; font-size: 12.5px; min-width: 0; }
.jobsheet .js-field.full { grid-column: 1 / -1; }
.jobsheet .js-field .k { color: var(--muted); flex: 0 0 auto; min-width: 96px; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
.jobsheet .js-field .v { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.jobsheet .js-field .v.missing { color: var(--danger); font-weight: 700; }
.jobsheet .js-section { margin: 10px 0; }
.jobsheet .js-section > h3 { font-size: 12px; letter-spacing: .6px; padding: 5px 10px; margin: 0 0 6px; }
.jobsheet .js-warning ul { margin: 4px 0 0 18px; padding: 0; }
.jobsheet .js-warning li { margin: 1px 0; }
.js-status-pill { font-weight: 700; }
.js-tag.st-equipment { background: var(--status-needs-bg); color: var(--status-needs-text); border-color: #f0d9ab; }
.js-tag.st-duration  { background: var(--status-needs-bg); color: var(--status-needs-text); border-color: #f0d9ab; }
.js-tag.st-confirmed { background: var(--status-allocated-bg); color: var(--status-allocated-text); border-color: #bfe3cd; }
.js-tag.st-review    { background: var(--status-conflict-bg); color: var(--status-conflict-text); border-color: #efc3c3; }
.js-tag.st-completed { background: var(--status-done-bg); color: var(--status-done-text); }

/* equipment checklist */
.js-equip th, .js-equip td { padding: 6px 8px; font-size: 12.5px; }
.js-equip .num { width: 52px; text-align: center; }
.js-equip .chk { width: 64px; text-align: center; }
.js-equip .js-chk { width: 18px; height: 18px; accent-color: var(--brand-green); cursor: pointer; }
.js-equip .js-actions-col { white-space: nowrap; text-align: right; }
.js-equip .js-actions-col .fleet-btn { margin-left: 6px; }
.js-box { display: inline-block; width: 14px; height: 14px; border: 1.5px solid #9aa1a9; border-radius: 3px; vertical-align: middle; }
.alloc-badge.none { background: var(--status-needs-bg); color: var(--status-needs-text); border-radius: 999px; padding: 1px 8px; font-size: 10.5px; font-weight: 700; }
.js-add-item { margin-top: 6px; }
.rs-herr { color: var(--danger); font-size: 12px; font-weight: 600; grid-column: 1 / -1; }
.js-line-note { color: var(--muted); font-size: 12px; margin: 4px 0; }
.js-write-line { display: flex; gap: 10px; align-items: flex-end; margin: 10px 0 2px; }
.js-write-line .lbl { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.js-write-line .rule { flex: 1; border-bottom: 1px solid #c9ced6; height: 18px; }

/* notes */
details.js-notes summary { cursor: pointer; font-weight: 700; font-size: 12px; letter-spacing: .6px; text-transform: uppercase; padding: 5px 10px; background: var(--brand-purple); color: #fff; border-radius: 4px; }
details.js-notes .js-notes-body { font-size: 12.5px; padding: 8px 10px; color: var(--text); }

/* gated ready button */
.js-btn.ready.on { background: var(--brand-green); border-color: var(--brand-green); color: #fff; }
.js-btn.ready.blocked { opacity: .75; border-style: dashed; }

/* phone: equipment rows to cards */
@media (max-width: 640px) {
  .jobsheet .js-grid { grid-template-columns: 1fr; }
  .js-equip thead { display: none; }
  .js-equip tr { display: block; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; padding: 6px 8px; }
  .js-equip td { display: flex; justify-content: space-between; gap: 10px; border: none; padding: 4px 2px; }
  .js-equip td::before { content: attr(data-label); color: var(--muted); font-size: 11px; text-transform: uppercase; }
  .js-equip .js-actions-col { justify-content: flex-end; }
}

/* ---------- ONE-PAGE A4 PRINT ---------- */
@media print {
  @page { size: A4 portrait; margin: 10mm; }
  .jobsheet { font-size: 10.5px; }
  .jobsheet .js-body { padding: 0 !important; }
  .jobsheet .js-sheet-head { margin-bottom: 4mm; }
  .jobsheet .js-brand h1 { font-size: 16px; margin: 0; }
  .jobsheet .js-sub, .jobsheet .js-headmeta { font-size: 9.5px; }
  .jobsheet .js-grid { grid-template-columns: repeat(3, 1fr); gap: 1px 14px; }
  .jobsheet .js-field { font-size: 9.5px; padding: 1.5px 0; }
  .jobsheet .js-field .k { font-size: 8px; min-width: 70px; }
  .jobsheet .js-section { margin: 3mm 0; page-break-inside: avoid; }
  .jobsheet .js-section > h3 { font-size: 9px; padding: 2px 6px; margin-bottom: 2mm;
    background: #111 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .jobsheet .js-statusline { margin: 2mm 0; }
  .jobsheet .js-tag { font-size: 9px; padding: 1px 7px; border: 1px solid #999 !important; box-shadow: none !important; }
  .jobsheet .js-warning { font-size: 9.5px; padding: 2mm; border: 1px solid #c90 !important; background: #fff8e8 !important;
    -webkit-print-color-adjust: exact; print-color-adjust: exact; page-break-inside: avoid; }
  .js-equip th, .js-equip td { padding: 2px 5px; font-size: 9.5px; border: 1px solid #bbb !important; }
  .js-equip tr { page-break-inside: avoid; }
  .js-equip .js-actions-col, .js-add-item, .fleet-btn, .fleet-write-off, .rs-hours button, #rsHoursSave { display: none !important; }
  .js-equip .js-chk { width: 12px; height: 12px; }
  .rs-hours { display: grid !important; grid-template-columns: repeat(4, 1fr); gap: 2mm; font-size: 9.5px; }
  .rs-hours input, .rs-hours output { border: none !important; border-bottom: 1px solid #999 !important; font-size: 10px; background: none !important; }
  .rs-alert { font-size: 9.5px; padding: 1.5mm 2mm; page-break-inside: avoid; }
  .rs-loading, .rs-note a { display: none !important; }
  details.js-notes { display: block; }
  details.js-notes summary { background: #111 !important; color: #fff !important; font-size: 9px; padding: 2px 6px; list-style: none; }
  details.js-notes:not([open]) .js-notes-body { display: block; } /* force notes visible on paper */
  details.js-notes .js-notes-body { font-size: 9px; padding: 1.5mm 2mm; max-height: 30mm; overflow: hidden; }
  .js-footer-sign { display: flex; gap: 8mm; margin-top: 4mm; page-break-inside: avoid; }
  .js-footer-sign .js-sign { flex: 1; }
  .js-footer-sign .lbl { font-size: 8px; text-transform: uppercase; color: #555; }
  .js-footer-sign .rule { border-bottom: 1px solid #555; height: 8mm; }
  .js-line-note, .js-write-line .lbl { font-size: 8.5px; }
  .booking-span, .month-grid { display: none !important; } /* never bleed calendar into the sheet */
}

/* ===================== fleet modal polish (allocate / stock popups) ===================== */
.fleet-modal-back { background: rgba(23, 18, 52, .48); backdrop-filter: blur(2px); animation: fmFade .12s ease-out; }
.fleet-modal { max-width: 560px; border-radius: var(--radius-md); border: 1px solid var(--border);
  box-shadow: 0 18px 50px rgba(16, 24, 40, .28); overflow: hidden; animation: fmPop .15s ease-out; }
@keyframes fmFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fmPop { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }

/* ---- pulsing fuel pump indicator on booking tiles ---- */
@keyframes fuelPulse {
  0%, 100% { opacity: 1; transform: scale(1); filter: drop-shadow(0 0 2px rgba(229,57,53,.5)); }
  50% { opacity: .75; transform: scale(1.22); filter: drop-shadow(0 0 6px rgba(229,57,53,.9)); }
}
.bs-fuel-warn {
  position: absolute; bottom: 4px; right: 5px;
  font-size: 13px; line-height: 1;
  animation: fuelPulse 1.4s ease-in-out infinite;
  pointer-events: none;
}
.fleet-modal .fm-head { background: var(--brand-purple); color: #fff; padding: 12px 18px; border-bottom: none; }
.fleet-modal .fm-head h3 { font-size: 14px; font-weight: 700; letter-spacing: .3px; color: #fff; }
.fleet-modal .fm-close { background: transparent; border: none; color: rgba(255,255,255,.75); font-size: 20px;
  line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.fleet-modal .fm-close:hover { color: #fff; background: rgba(255,255,255,.12); }
.fleet-modal .fm-body { padding: 18px; }
.fleet-modal .fm-body .subtle { font-size: 12.5px; color: var(--muted); margin: 0 0 14px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border); }

/* form rows inside modals: stacked label + full-width control */
.fm-row { display: flex; flex-direction: column; gap: 5px; margin: 0 0 14px; }
.fm-row label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.fm-row select, .fm-row input[type="number"], .fm-row input[type="text"] {
  width: 100%; min-height: 38px; padding: 8px 11px; font-size: 13px; color: var(--text);
  background: var(--panel-bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.fm-row select:focus, .fm-row input:focus { outline: none; border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(47,111,237,.12); }
.fm-row input[type="number"] { max-width: 140px; }

/* primary action button in modals */
.fleet-btn.primary { background: var(--brand-green); border-color: var(--brand-green); color: #fff; font-weight: 700; }
.fleet-btn.primary:hover { background: var(--brand-green-dark); border-color: var(--brand-green-dark); }
.fm-body > .fleet-btn { min-height: 38px; padding: 8px 18px; margin-top: 2px; }

/* generator availability options */
.alloc-opt { background: var(--panel-bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 13px; transition: border-color .12s, box-shadow .12s, background .12s; }
.alloc-opt:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.alloc-opt span strong, .alloc-opt span { color: var(--text); }
.alloc-opt.conf { background: var(--danger-bg); border-color: #efc3c3; opacity: 1; font-size: 12px; }
.alloc-opt.xhire { border-style: dashed; background: var(--warning-bg); border-color: #f0d9ab; }
.alloc-conf > strong { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--danger); margin: 12px 0 6px; }
.rs-alert { border-radius: var(--radius-sm); }
.fm-body .rs-alert.warn { background: var(--warning-bg); border: 1px solid #f0d9ab; color: var(--status-needs-text);
  padding: 9px 12px; font-size: 12.5px; font-weight: 600; margin-bottom: 12px; }

@media (max-width: 640px) {
  .fleet-modal-back { padding: 16px 8px; }
  .fleet-modal .fm-body { padding: 14px; }
  .alloc-opt { flex-wrap: wrap; }
}

/* ===================== jobsheet toolbar refinement ===================== */
.js-toolbar { gap: 10px; padding: 12px 16px 12px 24px; }
.js-btn { transition: background .12s, border-color .12s, box-shadow .12s, color .12s; }
.js-btn:hover { box-shadow: var(--shadow-sm); }
.js-btn:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 1px; }

/* ready-for-dispatch: a real stateful action button */
.js-btn.ready { border: 1.5px solid var(--brand-green); color: var(--brand-green-dark); background: #fff; font-weight: 700; }
.js-btn.ready:hover { background: var(--success-bg); border-color: var(--brand-green-dark); }
.js-btn.ready.on { background: var(--brand-green); border-color: var(--brand-green); color: #fff; }
.js-btn.ready.on:hover { background: var(--brand-green-dark); }
.js-btn.ready.blocked { border: 1px solid var(--border-strong); border-style: solid; color: var(--muted);
  background: var(--column-bg); font-weight: 600; opacity: 1; cursor: pointer; }
.js-btn.ready.blocked:hover { background: var(--column-bg); border-color: var(--border-strong); box-shadow: none; }
.js-btn.ready.blocked::before { content: "•"; color: var(--warning); font-size: 18px; line-height: 0; margin-right: 2px; }

/* close button: integrated circular control, not a floating × */
.js-toolbar .modal-close { position: static; width: 38px; height: 38px; min-height: 38px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 999px;
  font-size: 20px; line-height: 1; color: var(--muted); background: transparent; border: 1px solid transparent;
  margin-left: 2px; cursor: pointer; transition: background .12s, color .12s; }
.js-toolbar .modal-close:hover { background: rgba(16, 24, 40, .08); color: var(--text); }
.js-toolbar .modal-close:focus-visible { outline: 2px solid var(--accent-blue); }

@media (max-width: 640px) {
  .js-toolbar { padding: 10px 12px; }
  .js-toolbar .js-title-min { flex-basis: 100%; }
}

/* clickable allocation status pill -> release / un-allocate */
.alloc-badge-btn { display: inline-flex; align-items: center; gap: 5px; background: none; border: none;
  padding: 0; cursor: pointer; border-radius: 999px; }
.alloc-badge-btn .abx { display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 999px; font-size: 11px; line-height: 1;
  color: var(--muted); background: var(--column-bg); border: 1px solid var(--border-strong);
  opacity: 0; transition: opacity .12s; }
.alloc-badge-btn:hover .abx, .alloc-badge-btn:focus-visible .abx { opacity: 1; }
.alloc-badge-btn:hover .abx { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }
.alloc-badge-btn:focus-visible { outline: 2px solid var(--accent-blue); outline-offset: 2px; }
@media (pointer: coarse) { .alloc-badge-btn .abx { opacity: 1; } } /* always visible on touch */
@media print { .alloc-badge-btn .abx { display: none !important; } }

/* ---------- print: kill the blank first page ----------
   The old approach used visibility:hidden, but hidden elements (side rail,
   app main) still OCCUPY layout space, pushing the jobsheet to page 2.
   Remove them from layout entirely; only the modal chain remains. */
@media print {
  .app-shell { display: block !important; height: auto !important; min-height: 0 !important; }
  .app-shell > *:not(#modalBackdrop) { display: none !important; }
  #modalBackdrop { position: static !important; padding: 0 !important; margin: 0 !important; }
  .modal.jobsheet-modal { margin: 0 !important; }
  details.js-notes:not([open]), details.js-notes .js-notes-body:empty { display: none !important; } /* no empty NOTES header */
}

/* ===================== header: logo flush right, live-state indicator ===================== */
.header-actions { margin-left: auto; }
.app-header .brand-logo { margin-left: 14px; }

/* live data indicator: pulsing states */
.db-indicator .db-dot { animation: dbPulseGreen 2.2s ease-out infinite; }
@keyframes dbPulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(32,160,82,.45); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(32,160,82,0); }
}
.db-indicator.off .db-dot { animation: dbPulseRed 1.1s ease-out infinite; }
@keyframes dbPulseRed {
  0% { box-shadow: 0 0 0 0 rgba(210,63,63,.5); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(210,63,63,0); }
}
.db-indicator.updating { color: var(--status-needs-text); background: var(--warning-bg); border-color: #f0d9ab; }
.db-indicator.updating .db-dot { background: var(--warning); animation: dbBlink .9s ease-in-out infinite; }
@keyframes dbBlink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.db-indicator.sample { color: var(--muted); background: var(--column-bg); border-color: var(--border-strong); }
.db-indicator.sample .db-dot { background: var(--muted); animation: none; }
@media (prefers-reduced-motion: reduce) { .db-indicator .db-dot { animation: none !important; } }

/* cross-hire supplier note under item name */
.js-xhire-note { font-size: 11px; color: var(--status-needs-text); font-weight: 600; margin-top: 2px; }
.js-xhire-note.missing { color: var(--danger); }
.fm-optional { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
@media print { .js-xhire-note { font-size: 8.5px; } }

/* ===================== day-cell header strip with ops counts ===================== */
.month-grid-spans .month-cell { padding: 0; }
.month-grid-spans .mc-head { display: flex; align-items: center; justify-content: space-between; gap: 4px;
  background: var(--column-bg); border-bottom: 1px solid var(--border); padding: 3px 8px; min-height: 25px; }
.month-grid-spans .mc-head .mc-num { padding: 0; margin: 0; font-size: 12.5px; font-weight: 700; color: #3c4554; }
.month-grid-spans .month-cell.today .mc-head { background: #e7effd; border-bottom-color: #cfdffb; }
.month-grid-spans .month-cell.other-month .mc-head { background: transparent; border-bottom-color: var(--border); }
.mc-ops { display: flex; gap: 4px; min-width: 0; }
.mc-op { font-size: 10px; font-weight: 700; line-height: 16px; padding: 0 7px; border-radius: 999px; white-space: nowrap; }
.mc-op.out  { background: var(--success-bg); color: var(--status-allocated-text); }
.mc-op.back { background: #e6f1fb; color: #0c447c; }
body[data-mode="tv"] .mc-op { font-size: 13px; line-height: 20px; }
body[data-mode="tv"] .month-grid-spans .mc-head { min-height: 32px; }
@media (max-width: 640px) { .mc-op { font-size: 9px; padding: 0 5px; } }
@media print { .mc-ops { display: none !important; } }

/* full-width jobsheet rows (site address, etc.): value starts at the left
   margin next to its label instead of being pushed to the right edge */
.jobsheet .js-field.full { justify-content: flex-start; }
.jobsheet .js-field.full .v { text-align: left; margin-left: 0; flex: 0 1 auto; }

/* ops badges: proper button-style pills (per approved mockup) */
.month-grid-spans .mc-op { display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 700; line-height: 1; padding: 3px 8px;
  border-radius: 999px; border: 1px solid transparent; cursor: default; }
.month-grid-spans .mc-op.out  { background: var(--success-bg); border-color: #bfe3cd; color: #15703f; }
.month-grid-spans .mc-op.back { background: #e6f1fb; border-color: #cfdffb; color: #0c447c; }
.month-grid-spans .mc-head .mc-num { white-space: nowrap; }
@media (max-width: 900px) { .month-grid-spans .mc-head .mc-num { font-size: 11.5px; } }

/* booking tile: status pill anchored to the right margin */
.booking-span .bs-top { justify-content: space-between; }
.booking-span .bs-status { margin-left: auto; }

/* ===================== booking card refinement: floating SaaS-style tiles ===================== */
.month-row-spans { inset: 32px 0 6px 0; grid-auto-rows: 44px; gap: 5px 6px; }
.month-grid-spans .month-cell { min-height: max(118px, calc(40px + var(--lanes, 1) * 49px)); }
.booking-span {
  margin: 0 3px;
  padding: 5px 11px;
  border-radius: 4px;
  border-color: #dbd8ec;
  box-shadow: 0 1px 2px rgba(33, 23, 79, .05), 0 2px 6px rgba(33, 23, 79, .07);
  transition: box-shadow .14s, transform .14s, border-color .14s, background .14s;
}
.booking-span.span-start { border-top-left-radius: 9px; border-bottom-left-radius: 9px; }
.booking-span.span-end   { border-top-right-radius: 9px; border-bottom-right-radius: 9px; }
.booking-span.span-cont-left  { margin-left: 0; }   /* continuation bleeds to the edge */
.booking-span.span-cont-right { margin-right: 0; }
.booking-span:hover, .booking-span.span-hover {
  transform: translateY(-1px);
  border-color: var(--booking-border-strong);
  box-shadow: 0 4px 14px rgba(33, 23, 79, .16);
}
.booking-span:focus-visible { transform: translateY(-1px); }
.bs-top { gap: 8px; align-items: center; }
.bs-cust { font-size: 12px; letter-spacing: .1px; }
.bs-site { font-size: 11px; margin-top: 1px; }
.booking-span .bs-status { padding: 2.5px 8px; font-size: 9.5px; letter-spacing: .35px; }
.month-row-spans .mc-more { margin: 0 3px; align-self: center; }
body[data-mode="tv"] .month-row-spans { grid-auto-rows: 50px; }
@media (max-width: 1100px) and (min-width: 641px) { .month-row-spans { grid-auto-rows: 46px; } }
@media (max-width: 640px) { .month-row-spans { grid-auto-rows: 40px; } }
@media (prefers-reduced-motion: reduce) { .booking-span, .booking-span:hover { transition: none; transform: none; } }

/* fuel / refuelling row in the hours block */
.rs-refuel { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--text); cursor: pointer; }
.rs-refuel input { width: 17px; height: 17px; accent-color: var(--brand-green); }
@media print {
  /* rs-fuel row handles fuel in print */
}

/* status-tinted tile shadows: the card's glow matches its state */
.booking-span { --shadow-rgb: 33, 23, 79;
  box-shadow: 0 1px 2px rgba(var(--shadow-rgb), .08), 0 2px 7px rgba(var(--shadow-rgb), .14); }
.booking-span.st-confirmed { --shadow-rgb: 32, 160, 82; }    /* allocated / ready */
.booking-span.st-equipment,
.booking-span.st-duration  { --shadow-rgb: 232, 146, 12; }   /* needs equipment / part allocated / cross-hire */
.booking-span.st-review    { --shadow-rgb: 210, 63, 63; }    /* conflict / needs review */
.booking-span.st-completed,
.booking-span.st-cancelled { --shadow-rgb: 95, 94, 90; box-shadow: 0 1px 2px rgba(var(--shadow-rgb), .07), 0 1px 4px rgba(var(--shadow-rgb), .08); }
.booking-span:hover, .booking-span.span-hover, .booking-span:focus-visible {
  box-shadow: 0 4px 14px rgba(var(--shadow-rgb), .26); }
@media print { .booking-span { box-shadow: none !important; } }

/* stronger, visible status glow: tinted border + deeper two-layer shadow */
.booking-span {
  border-color: rgba(var(--shadow-rgb), .30);
  box-shadow: 0 1px 3px rgba(var(--shadow-rgb), .22), 0 4px 12px rgba(var(--shadow-rgb), .22);
}
.booking-span.span-multi { border-left-width: 4px; }
.booking-span:hover, .booking-span.span-hover, .booking-span:focus-visible {
  border-color: rgba(var(--shadow-rgb), .55);
  box-shadow: 0 2px 5px rgba(var(--shadow-rgb), .30), 0 6px 18px rgba(var(--shadow-rgb), .32);
}
.booking-span.st-completed, .booking-span.st-cancelled {
  border-color: var(--border-strong);
  box-shadow: 0 1px 3px rgba(95, 94, 90, .14);
}

/* ============================================================
   STAFF PAGE â TEAM TAB UI
   Cards, forms, badges, buttons for .sr-* and .staff-type-badge
   ============================================================ */

/* ââ wrapper & header âââââââââââââââââââââââââââââââââââââââ */
.sr-wrap {
  padding: 20px 24px;
  max-width: 1200px;
}
.sr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.sr-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .01em;
}

/* ââ Add Staff button âââââââââââââââââââââââââââââââââââââââ */
.sr-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s, box-shadow .14s;
  box-shadow: 0 1px 4px rgba(47,111,237,.25);
}
.sr-add-btn:hover { background: #1a57d6; box-shadow: 0 2px 8px rgba(47,111,237,.35); }

/* ââ staff card grid ââââââââââââââââââââââââââââââââââââââââ */
.sr-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* ââ staff card âââââââââââââââââââââââââââââââââââââââââââââ */
.sr-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  transition: box-shadow .14s, border-color .14s;
}
.sr-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.1); border-color: var(--border-strong); }
.sr-card-inactive { opacity: 0.6; }

/* card top row: name + badge */
.sr-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.sr-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

/* card info: role, email, notes */
.sr-card-info { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.sr-role  { font-size: 12px; color: var(--muted); font-weight: 500; }
.sr-email { font-size: 12px; color: var(--accent); text-decoration: none; }
.sr-notes { font-size: 11px; color: var(--muted); font-style: italic; margin-top: 2px; }

/* card action buttons */
.sr-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.sr-card-edit,
.sr-card-remove {
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  border: 1px solid;
}
.sr-card-edit {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}
.sr-card-edit:hover { background: rgba(47,111,237,.08); }

.sr-card-remove {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--muted);
}
.sr-card-remove:hover { border-color: var(--danger, #e53e3e); color: var(--danger, #e53e3e); background: rgba(229,62,62,.06); }

/* inactive pill */
.sr-inactive-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(107,114,128,.12);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ââ type badge âââââââââââââââââââââââââââââââââââââââââââââ */
.staff-type-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: capitalize;
  letter-spacing: .03em;
  white-space: nowrap;
}
.staff-type-badge.st-employee   { background: rgba(32,160,82,.12); color: #1a8c47; }
.staff-type-badge.st-contractor { background: rgba(126,87,194,.12); color: #6d43bd; }

/* ââ inline edit / add form âââââââââââââââââââââââââââââââââ */
.sr-form {
  background: var(--panel-2, #f7f8fa);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
/* form inside a card - slightly tighter */
.sr-card .sr-form {
  background: var(--panel-2, #f7f8fa);
  border-radius: 8px;
  padding: 14px;
  margin-top: 4px;
}
.sr-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}
.sr-form-lbl {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 140px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.sr-form-input,
.sr-form-select {
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
}
.sr-form-input:focus,
.sr-form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47,111,237,.12);
}
.sr-form-input::placeholder { color: var(--muted); opacity: .7; }
.sr-form-select { cursor: pointer; }

/* form action row */
.sr-form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sr-form-save {
  padding: 8px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s;
}
.sr-form-save:hover { background: #1a57d6; }
.sr-form-save:disabled { opacity: .6; cursor: not-allowed; }

.sr-form-cancel {
  padding: 8px 14px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .12s, color .12s;
}
.sr-form-cancel:hover { border-color: var(--border-strong); color: var(--text); }

/* inline error message */
.sr-form-err {
  font-size: 12px;
  color: var(--danger, #e53e3e);
  font-weight: 500;
  flex: 1;
  min-width: 0;
}

/* loading / error states */
.su-loading-text { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }
.su-error        { padding: 16px; color: var(--danger, #e53e3e); font-size: 13px; border-radius: 8px; background: rgba(229,62,62,.07); }


/* ============================================================
   ELECTRICAL-INSTALL JOBSHEET FIELDS
   Grouped sections + editable inspector time + 24hr toggle.
   Compact print so the sheet stays close to a single A4 page.
   ============================================================ */
.js-hint { color: #666; font-size: 11px; }
.js-time { font-size: 13px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 6px; min-height: 30px; }
.js-24-label { font-size: 12px; color: #444; margin-left: 8px; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.js-24-label input { width: 16px; height: 16px; }
.js-trading .v { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

@media print {
  .jobsheet { font-size: 10.5px; }
  .js-section { margin-bottom: 8px !important; }
  .js-section > h3 { font-size: 10px !important; padding: 4px 9px !important; }
  .js-section-body { padding: 8px 11px !important; }
  .js-grid { gap: 2px 22px !important; }
  .js-field { padding: 3px 0 !important; font-size: 10.5px !important; }
  .js-table th, .js-table td { padding: 4px 6px !important; font-size: 10pt !important; }
  .js-sheet-head { margin-bottom: 8px !important; padding-bottom: 8px !important; }
  .js-statusline { margin-bottom: 8px !important; }
  .js-hint, .js-24-label { font-size: 9px !important; }
  .js-time { border: none !important; padding: 0 !important; font-size: 10.5px !important; min-height: 0 !important; }
  .js-trading-24 { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}


/* ============================================================================
   PROFESSIONAL JOBSHEET DOCUMENT (rebuild)
   Light cards (not black bars), aligned grids, chips, alert boxes, clean
   tables, checklist + signature, A4 print. Cascades last to override.
   ============================================================================ */
.jobsheet { color: #1f2733; background: #fff; font-size: 13px; }
.jobsheet .js-body { padding: 16px 24px 18px; }

/* document header */
.js-doc-head { display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding-bottom: 11px; border-bottom: 2px solid var(--brand-green, #20a052); margin-bottom: 13px; }
.js-doc-brand img.js-logo-img { height: 48px; width: auto; display: block; }
.js-doc-title { text-align: right; }
.js-doc-title .job-no { font-size: 26px; font-weight: 800; letter-spacing: .3px; color: #111; line-height: 1; }
.js-doc-cust { font-size: 14px; font-weight: 600; color: #1f2733; margin-top: 3px; }
.js-doc-title .js-print-date { font-size: 11px; color: #8a93a3; margin-top: 3px; }

/* status chips */
.js-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.js-chip { font-size: 11px; font-weight: 700; padding: 4px 11px; border-radius: 999px;
  border: 1px solid #d4d7dd; background: #f4f6f8; color: #33415c; white-space: nowrap; }
.js-chip.jt-outage { background: #fff3e0; color: #b26a00; border-color: #f0c890; }
.js-chip.jt-emergency { background: #fdecea; color: #b71c1c; border-color: #f1b0a8; }
.js-chip.st-confirmed { background: #e8f6ee; color: #178a44; border-color: #a7dcbd; }
.js-chip.st-duration, .js-chip.st-equipment, .js-chip.al-fuel { background: #fff3e0; color: #b26a00; border-color: #f0c890; }
.js-chip.st-review, .js-chip.al-conflict { background: #fdecea; color: #b71c1c; border-color: #f1b0a8; }
.js-chip.js-chip-elec { background: #fff8e1; color: #8a6d00; border-color: #efd271; }
.js-chip.js-chip-solar { background: #fff3e0; color: #b26a00; border-color: #f0c890; }
.js-chip.js-chip-medical { background: #fdecea; color: #b71c1c; border-color: #f1b0a8; }
.js-chip.js-chip-standby { background: #e7f0fb; color: #1c4f8a; border-color: #aac6e8; }
/* Site warnings callout */
.js-sitewarn { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: #fff8ef; border: 1px solid #f0c890; border-left: 4px solid #e8920c; border-radius: 8px; padding: 9px 12px; margin: 0 0 12px; }
.js-sitewarn-title { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: #8a5a00; margin-right: 2px; }
.js-sitewarn-item { font-size: 12px; font-weight: 700; color: #5c4a2a; }

/* missing-info warning */
.js-warning[hidden] { display: none; }
.jobsheet .js-warning { background: #fdf3e2; border: 1px solid #f0c36d; border-left: 4px solid #e8920c;
  border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 12.5px; color: #7a4f00; }

/* cards */
.js-card { border: 1px solid #e4e6eb; border-radius: 10px; overflow: hidden; margin-bottom: 10px;
  background: #fff; break-inside: avoid; page-break-inside: avoid; }
.js-card-head { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: #33415c; background: #f4f6f8; padding: 8px 14px; margin: 0;
  border-bottom: 1px solid #e4e6eb; border-left: 3px solid var(--brand-green, #20a052); }
.js-card-body { padding: 8px 14px; }
.js-card-summary { border-color: #d4d7dd; }
.js-card-summary .js-card-head { border-left-color: #21174f; background: #f0f1f6; }
.js-card-elec .js-card-head { border-left-color: #e8920c; }

/* label / value grid (stacked, aligned) */
.jobsheet .js-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 30px; }
.jobsheet .js-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.jobsheet .js-field { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; min-width: 0; padding: 4px 0; border: none; border-bottom: 1px dotted #e7eaee; }
.jobsheet .js-field.full { grid-column: 1 / -1; }
.jobsheet .js-field .k { flex: 0 0 auto; font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; color: #8a93a3; white-space: nowrap; }
.jobsheet .js-field .v { flex: 0 1 auto; font-size: 12.5px; font-weight: 700; color: #1f2733; text-align: right; word-break: break-word; overflow-wrap: anywhere; }
.jobsheet .js-field .v.missing { color: #d23f3f; font-style: italic; }
.jobsheet .js-blank { display: inline-block; min-width: 130px; border-bottom: 1px solid #c8ccd2; height: 15px; }
.jobsheet .js-time { font-size: 13px; padding: 3px 7px; border: 1px solid #d4d7dd; border-radius: 6px; min-height: 0; }

/* alert boxes */
.js-alertbox { border-radius: 8px; padding: 10px 14px; margin: 0 0 12px; font-size: 13px; }
.js-alertbox-warn { background: #fdf3e2; border: 1px solid #f0c36d; border-left: 4px solid #e8920c; color: #7a4f00; }
.js-alertbox-crit { background: #fcecec; border: 1px solid #f1b0a8; border-left: 4px solid #d23f3f; color: #8a2a2a; }
.js-alertbox strong { color: #5a3a00; }
.js-elec-none { margin: 0 0 4px; color: #6b7280; font-style: italic; }
.js-elec-sentence { margin: 9px 0 2px; font-size: 13px; color: #1f2733; }

/* write-in line */
.jobsheet .js-write-line { margin-top: 11px; }
.jobsheet .js-write-line .lbl { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #8a93a3; display: block; margin-bottom: 6px; }
.jobsheet .js-write-line .rule { border-bottom: 1px solid #c8ccd2; height: 18px; }

/* tables inside cards */
.js-card .js-table, .js-card .js-staff-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.js-card .js-table th, .js-card .js-staff-table th { text-align: left; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: #8a93a3; padding: 7px 9px; border-bottom: 2px solid #e4e6eb; }
.js-card .js-table td, .js-card .js-staff-table td { padding: 8px 9px; border-bottom: 1px solid #eef0f3; vertical-align: middle; color: #1f2733; }
.js-card .js-table tr:last-child td, .js-card .js-staff-table tr:last-child td { border-bottom: none; }
.js-card .js-table .num, .js-card .js-table th.num { text-align: center; width: 58px; }
.js-card .js-table .chk, .js-card .js-table th.chk { text-align: center; width: 54px; }
.js-card .js-staff-num { text-align: right; font-variant-numeric: tabular-nums; }
.js-box { display: inline-block; width: 15px; height: 15px; border: 1.5px solid #9aa0a6; border-radius: 3px; }
.jobsheet tr { break-inside: avoid; page-break-inside: avoid; }

/* checklist */
.js-checklist { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 26px; margin-bottom: 14px; }
.js-check-item { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: #1f2733; }
.js-check-item input { width: 16px; height: 16px; flex: 0 0 auto; }

/* signature block */
.js-signgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 32px; margin-top: 4px; }
.js-sign { break-inside: avoid; }
.js-sign .rule { border-bottom: 1.5px solid #33415c; height: 32px; }
.js-sign .lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #8a93a3; margin-top: 5px; display: block; }

/* export: hide screen toolbar while html2pdf captures */
.js-exporting .js-toolbar { display: none !important; }

@media print {
  @page { size: A4 portrait; margin: 12mm 12mm 14mm; }
  .js-toolbar, .modal-close, .js-btn { display: none !important; }
  .side-rail, .app-header, .toolbar, .app-footer, .conflict-banner, .calendar-root, .app-search, .app-shell > *:not(#modalBackdrop) { display: none !important; }
  .modal-backdrop { position: static !important; background: none !important; display: block !important; }
  .modal.jobsheet-modal { position: static !important; box-shadow: none !important; border: none !important;
    width: 100% !important; max-width: 100% !important; max-height: none !important; overflow: visible !important; }
  .jobsheet .js-body { padding: 0 !important; }
  .js-card { break-inside: avoid; page-break-inside: avoid; }
  .js-card .js-table thead, .js-staff-table thead { display: table-header-group; }
  .js-signgrid, .js-card-signoff { break-inside: avoid; page-break-inside: avoid; }
  .jobsheet .js-time { border: none !important; padding: 0 !important; }
  .js-chip, .js-card-head, .js-alertbox, .js-card-summary .js-card-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* hide all interactive controls while exporting to PDF (clean document) */
.js-exporting .js-toolbar, .js-exporting .fleet-btn, .js-exporting .js-staff-add-btn,
.js-exporting .js-staff-del, .js-exporting .js-staff-del-cell, .js-exporting .js-alloc-form,
.js-exporting .modal-close, .js-exporting .rs-head .fleet-btn { display: none !important; }

/* jobsheet engine-hours/fuel: single save button below both rows (clear it saves both) */
.rs-save-row { display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line, #e4e6eb); }
.rs-save-hint { font-size: 11.5px; color: #8a93a3; }

/* make the hours/fuel save button stand out as the primary action */
.rs-save-row #rsHoursSave {
  background: var(--brand-green, #20a052); color: #fff;
  border-color: var(--brand-green, #20a052); font-weight: 700; padding: 7px 18px;
}
.rs-save-row #rsHoursSave:hover:not(:disabled) {
  background: var(--brand-green-dark, #178a44); border-color: var(--brand-green-dark, #178a44);
}

/* clickable site address -> opens Google/Apple Maps */
.js-maps-link { color: var(--accent-blue, #2f6fed); text-decoration: none; font-weight: 600; }
.js-maps-link:hover { text-decoration: underline; }
.js-maps-ico { display: inline-block; vertical-align: -1px; margin-left: 3px; }


/* full-width fields: keep long values left-aligned; remove last dotted divider */
.jobsheet .js-field.full .v { text-align: left; }
.jobsheet .js-grid > .js-field:last-child,
.jobsheet .js-grid > .js-field:nth-last-child(2):not(.full) { border-bottom: none; }
.js-picking { margin-top: 8px; }

/* ── Site Survey launch (nav rail external link + jobsheet button) ── */
.side-rail a.tab.rail-link { text-decoration: none; }
.side-rail .tab[data-icon="survey"] .rail-ico {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='6' y='3' width='12' height='18' rx='2'/><path d='M9 3.5h6v3H9zM9 12l2 2 4-4'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='6' y='3' width='12' height='18' rx='2'/><path d='M9 3.5h6v3H9zM9 12l2 2 4-4'/></svg>");
}
/* subtle divider + green tint so the cross-app link reads as distinct */
.side-rail a.tab.rail-link { margin-top: 6px; border-top: 1px solid rgba(255,255,255,.10); padding-top: 10px; color: var(--brand-green, #20a052); }
.side-rail a.tab.rail-link:hover { color: #fff; background: rgba(32,160,82,.18); }
.js-btn.survey { background: var(--brand-green, #20a052); color: #fff; border-color: var(--brand-green, #20a052); text-decoration: none; }
.js-btn.survey:hover { background: var(--brand-green-dark, #178a44); }

/* ─────────────────────────────────────────────────────────────────────
   JOB SHEET REFINEMENTS — compact spacing, cleaner type/alignment,
   and print flow that fills pages instead of leaving big gaps.
   (Scoped to .jobsheet so the calendar UI is unaffected.)
   ───────────────────────────────────────────────────────────────────── */
.jobsheet .js-body { padding: 18px 24px 24px; }
.jobsheet .js-card { margin-bottom: 8px; border-radius: 8px; }
.jobsheet .js-card-body { padding: 6px 14px 8px; }
.jobsheet .js-card-head { font-size: 11px; letter-spacing: .07em; padding: 6px 12px; }
.jobsheet .js-grid.js-grid-2 { gap: 2px 36px; }
.jobsheet .js-field { padding: 4px 0; font-size: 12.5px; }
.jobsheet .js-field .k { min-width: 132px; font-size: 10.5px; letter-spacing: .35px; color: #6b7280; }
.jobsheet .js-field .v { font-weight: 600; color: #111827; }
.jobsheet .js-statusline, .jobsheet .js-chips { margin: 8px 0 10px; }
.jobsheet .js-note-field .js-note-input { min-height: 32px !important; }

@media print {
  /* Let sections flow across page breaks so pages fill (kills the gaps),
     while keeping rows, headers and the sign-off block intact. */
  .jobsheet .js-card { page-break-inside: auto !important; break-inside: auto !important; margin-bottom: 5px; }
  .jobsheet .js-card-head { break-after: avoid; page-break-after: avoid; }
  .jobsheet .js-field,
  .jobsheet .js-staff-table tr,
  .jobsheet .js-table tr,
  .jobsheet .js-card-signoff,
  .jobsheet .js-signgrid { break-inside: avoid; page-break-inside: avoid; }
  .jobsheet .js-card-body { padding: 4px 12px 6px; }
}

/* Job sheet: left-align field values into a clean, consistent column
   (overrides the older right-aligned / space-between layout). */
.jobsheet .js-field { justify-content: flex-start; }
.jobsheet .js-field .v { text-align: left; margin-left: 0; }


/* =====================================================================
   OFF HIRE (return hire equipment) page, badge + home banner
   ===================================================================== */
.side-rail .tab[data-icon="offhire"] .rail-ico {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 7h13v10H3z'/><path d='M16 10h3l2 2v3h-5z'/><path d='M21 4l-4 3 4 3'/></svg>");
          mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 7h13v10H3z'/><path d='M16 10h3l2 2v3h-5z'/><path d='M21 4l-4 3 4 3'/></svg>");
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
}

/* count badge on the rail tab */
.tab[data-view="offhire"] { position: relative; }
.oh-badge {
  position: absolute; top: 6px; right: 8px; min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--danger, #d23f3f); color: #fff; font-size: 10px; font-weight: 700;
  line-height: 17px; text-align: center; border-radius: 999px; box-sizing: border-box;
}

/* dashboard banner (in-page) */
.offhire-alert {
  display: flex; align-items: center; gap: 10px; background: var(--warning-bg, #fdf3e2);
  border: 1px solid var(--warning, #e8920c); color: #8a5800; border-radius: var(--radius-md, 10px);
  padding: 12px 14px; margin-bottom: 16px; font-size: 14px;
}
.offhire-clear {
  background: var(--success-bg, #e8f6ee); border: 1px solid var(--success, #20a052); color: #156c39;
  border-radius: var(--radius-md, 10px); padding: 12px 14px; margin-bottom: 16px; font-size: 14px;
}
.oh-warn {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 20px; height: 20px; border-radius: 999px; background: var(--warning, #e8920c);
  color: #fff; font-weight: 800; font-size: 13px;
}
.oh-tick { color: var(--success, #20a052); font-weight: 800; margin-right: 4px; }

/* queue */
.offhire-queue-head { font-size: 13px; font-weight: 700; color: var(--muted, #6b7280); margin: 4px 0 10px; }
.offhire-queue { display: flex; flex-direction: column; gap: 10px; }
.offhire-row {
  display: flex; align-items: center; gap: 14px; background: var(--panel-bg, #fff);
  border: 1px solid var(--border, #e4e6eb); border-radius: var(--radius-lg, 14px);
  box-shadow: var(--shadow-sm); padding: 12px 16px;
}
.offhire-row .ohr-main { flex: 1; min-width: 0; }
.ohr-title { font-size: 15px; font-weight: 700; color: var(--text, #1f2733); }
.ohr-fleet { color: var(--brand-green, #20a052); }
.ohr-sub { font-size: 12.5px; color: var(--muted, #6b7280); margin-top: 2px; }
.ohr-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.offhire-empty {
  background: var(--panel-bg, #fff); border: 1px dashed var(--border-strong, #d4d7dd);
  border-radius: var(--radius-md, 10px); padding: 22px; text-align: center; color: var(--muted, #6b7280);
}

/* return / off-hire form */
.oh-equip {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--success-bg, #e8f6ee); border: 1px solid var(--success, #20a052);
  border-radius: var(--radius-md, 10px); padding: 12px 14px; margin-bottom: 16px;
}
.oh-equip-sub { font-size: 12px; color: var(--muted, #6b7280); margin-top: 2px; font-weight: 400; }
.oh-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #156c39; cursor: pointer; white-space: nowrap; }
.oh-field { margin-bottom: 18px; }
.oh-field > label { display: block; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted, #6b7280); font-weight: 700; margin-bottom: 6px; }
.oh-field input[type="number"], .oh-field input[type="date"], #ohTotLitres {
  width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--border-strong, #d4d7dd);
  border-radius: 9px; font-size: 15px; background: #fff; color: var(--text, #1f2733);
}
.oh-field input:focus { outline: none; border-color: var(--brand-green, #20a052); box-shadow: 0 0 0 3px rgba(32,160,82,.15); }
.oh-runtime { margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--muted, #6b7280); }
.oh-runtime.ok { color: #156c39; }
.oh-runtime.bad { color: var(--danger, #d23f3f); }
.oh-fuel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.oh-fuel-head > label { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted, #6b7280); font-weight: 700; }
.oh-seg { display: inline-flex; border: 1px solid var(--border-strong, #d4d7dd); border-radius: 8px; overflow: hidden; }
.oh-seg button { border: 0; background: transparent; padding: 6px 12px; font-size: 12px; cursor: pointer; color: var(--muted, #6b7280); }
.oh-seg button.active { background: var(--brand-green, #20a052); color: #fff; }
.oh-log-row { display: grid; grid-template-columns: 1fr 150px 34px; gap: 8px; margin-bottom: 8px; align-items: center; }
.oh-del { border: 1px solid var(--border-strong, #d4d7dd); background: #fff; border-radius: 8px; cursor: pointer; height: 38px; font-size: 16px; color: var(--muted, #6b7280); }
.oh-del:hover { border-color: var(--danger, #d23f3f); color: var(--danger, #d23f3f); }
.oh-fuel-total { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border, #e4e6eb); }
.oh-fuel-total span { font-size: 13px; color: var(--muted, #6b7280); }
.oh-fuel-total strong { font-size: 16px; color: var(--text, #1f2733); }
.oh-svc { background: var(--warning-bg, #fdf3e2); border: 1px solid var(--warning, #e8920c); color: #8a5800; border-radius: var(--radius-md, 10px); padding: 11px 13px; margin-bottom: 14px; font-size: 13px; }
.oh-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border, #e4e6eb); padding-top: 14px; }
.oh-note { font-size: 12px; color: var(--muted, #6b7280); }
.oh-result { margin-top: 10px; font-size: 13px; min-height: 18px; }
.oh-result .ok { color: #156c39; font-weight: 600; }
.oh-result .bad { color: var(--danger, #d23f3f); font-weight: 600; }

/* home banner (calendar) */
.offhire-home-banner {
  display: flex; align-items: center; gap: 12px; margin: 10px 16px 0;
  background: var(--warning-bg, #fdf3e2); border: 1px solid var(--warning, #e8920c);
  color: #8a5800; border-radius: var(--radius-md, 10px); padding: 10px 14px; font-size: 14px;
}
.offhire-home-banner .fleet-btn { margin-left: auto; }
.oh-banner-x { border: 0; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; color: #8a5800; padding: 0 2px; }


/* ---- On Hire: generator currently out (auto-derived from hire/outage window) ---- */
.booking-span.st-onhire { --status-pill-bg: #dbeafe; --status-pill-text: #1e40af; --span-accent: #2563eb; }
.booking-card.st-onhire { border-left-color: #2563eb; }
.booking-card.st-onhire .bc-status { background: #dbeafe; color: #1e40af; }
.pill.st-onhire { background: #2563eb; color: #fff; }
.chip.st-onhire, .js-tag.st-onhire { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.badge.st-onhire { color: #fff; background: #2563eb; border-color: #2563eb; }


/* ---- Prospective (in-negotiation) planned outages: greyed "tentative" tiles ---- */
.prospective-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; padding: 0 4px; white-space: nowrap; }
.prospective-toggle input { accent-color: #9aa0a6; cursor: pointer; margin: 0; }
.booking-span.is-prospective {
  --span-accent: #9aa0a6;
  background: repeating-linear-gradient(45deg, #f6f7f9, #f6f7f9 6px, #eef0f3 6px, #eef0f3 12px);
  border: 1px dashed #c4c9d1; border-left: 3px dashed #9aa0a6; box-shadow: none; opacity: .9;
}
.booking-span.is-prospective:hover, .booking-span.is-prospective.span-hover { opacity: 1; border-color: #9aa0a6; }
.booking-card.is-prospective {
  background: repeating-linear-gradient(45deg, #f6f7f9, #f6f7f9 6px, #eef0f3 6px, #eef0f3 12px);
  border-left: 3px dashed #9aa0a6 !important; opacity: .92;
}
.booking-span.is-prospective .bs-cust, .booking-card.is-prospective .bc-cust { color: #5f6571; font-style: italic; }
.booking-span.is-prospective .bs-status, .booking-card.is-prospective .bc-status { background: #e5e7eb !important; color: #4b5563 !important; }
.pill.st-prospective { background: #9aa0a6; color: #fff; }
.chip.st-prospective, .js-tag.st-prospective { background: #eef0f3; color: #5f6571; border-color: #c4c9d1; }
.badge.st-prospective { background: #9aa0a6; color: #fff; border-color: #9aa0a6; }
