/* Sharco Express — Back-Office Document Store (light, office-friendly) */
:root {
  --bg: #eef1f6; --surface: #ffffff; --surface-2: #f7f9fc;
  --text: #1a2332; --dim: #5a6a82; --faint: #8a97ab;
  --line: #e2e8f2; --line-2: #d3dbe8;
  --brand: #ff7a1a; --blue: #2f7bf6;
  --ok: #12a150; --warn: #c77700; --danger: #d64545; --info: #2f7bf6;
  --radius: 12px; --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; }

/* Top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; }
button.brand { border: 0; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; padding: 4px; margin: -4px; border-radius: 10px; }
button.brand:hover { background: var(--surface-2); }
button.brand:active { transform: translateY(1px); }
.brand__mark { width: 44px; height: 44px; border-radius: 10px; background: #fff; overflow: hidden;
  display: grid; place-items: center; }
.brand__mark img { width: 100%; height: 100%; object-fit: contain; }
.brand__name { font-weight: 800; font-size: 16px; }
.brand__sub { color: var(--faint); font-size: 12px; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; text-align: center; min-width: 76px; }
.stat b { display: block; font-size: 20px; font-weight: 800; line-height: 1.1; }
.stat span { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .4px; }
.stat--alert b { color: var(--brand); }

/* Top navigation (sections) */
.topnav { display: flex; gap: 6px; flex-wrap: wrap; }
.navtab { font: inherit; font-weight: 700; font-size: 13.5px; cursor: pointer; border: 1px solid transparent;
  background: transparent; color: var(--dim); border-radius: 10px; padding: 9px 14px; }
.navtab:hover { background: var(--surface-2); color: var(--text); }
.navtab.on { background: rgba(255,122,26,.12); color: #b85700; border-color: rgba(255,122,26,.28); }
.navtab__badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 800; font-style: normal; }

/* Compliance (credential expirations) */
.stage { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .2px; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.stage--expired  { background: #000000; color: #ffffff; }   /* expired: white text on black */
.stage--critical,
.stage--urgent,
.stage--soon     { background: #e11d1d; color: #ffffff; }                                /* <30 days: bright red */
.stage--upcoming { background: #f57c00; color: #ffffff; }                                /* 30–90 days: orange */
.stage--ok       { background: rgba(18,161,80,.16); color: #0c7a3c; }
.comp-dqtools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.comp-dq { font-weight: 700; color: var(--accent, #2f7bf6); text-decoration: none; }
.comp-dq:hover { text-decoration: underline; }
.comp-dq__ic { font-size: 12px; opacity: .8; }
.comp-cell { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.comp-date { font-weight: 600; font-variant-numeric: tabular-nums; }
.comp-summary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.comp-sum { flex: 1 1 120px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; text-align: center; background: var(--surface); }
.comp-sum b { display: block; font-size: 22px; font-weight: 800; line-height: 1.1; }
.comp-sum span { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--dim); }
.comp-sum.stage--expired b { color: #d64545; } .comp-sum.stage--critical b { color: #d64545; }
.comp-sum.stage--urgent b { color: #c77700; } .comp-sum.stage--soon b { color: #c77700; }
.comp-sum.stage--upcoming b { color: var(--blue); }
.comp-sum.stage--expired, .comp-sum.stage--critical, .comp-sum.stage--urgent, .comp-sum.stage--soon, .comp-sum.stage--upcoming { background: var(--surface); }
.comp-tools { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.comp-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.comp-form #compName { flex: 1 1 220px; }
.comp-form #compEmail { flex: 1 1 200px; }
.comp-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--dim); font-weight: 600; }
.comp-import { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.comp-import summary { cursor: pointer; font-weight: 700; color: var(--blue); }
.comp-import textarea { width: 100%; margin-top: 8px; font: inherit; border: 1px solid var(--line-2); border-radius: 9px; padding: 10px; resize: vertical; }
.comp-dash .stage { margin: 0 6px 6px 0; }
.comp-soon { display: flex; flex-direction: column; }
.comp-soon__head, .comp-soon__row { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 8px; align-items: center; padding: 8px 2px; }
.comp-soon__head { font-size: 11px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: var(--faint); border-bottom: 1px solid var(--line); }
.comp-soon__row { border-top: 1px solid var(--line); }
.comp-soon__head + .comp-soon__row { border-top: 0; }
.comp-soon__name { font-weight: 700; min-width: 0; }   /* full first + last name */
.comp-mini { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.comp-mini__date { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.btn--sm { padding: 6px 10px; font-size: 12.5px; }
/* Compliance page split: driver credentials left, vehicle health right.
   minmax(0,1fr) lets each column's .table-wrap scroll instead of blowing out. */
.comp-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 1280px) { .comp-split { grid-template-columns: minmax(0, 1fr); } }

/* Section headers */
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.section-head--pad { padding: 20px 24px 4px; }
.section-title { font-size: 20px; font-weight: 800; }
.section-sub { color: var(--faint); font-size: 12.5px; margin-top: 2px; }

/* Dashboard */
#section-dashboard { padding-top: 22px; }
#podStats { padding: 6px 24px 0; }
.dash-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.dash-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.dash-card:hover { border-color: var(--line-2); box-shadow: 0 6px 24px rgba(20,35,60,.08); }
.dash-card__head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.dash-card__icon { font-size: 26px; }
.dash-card__title { font-weight: 800; font-size: 16px; }
.dash-card__go { margin-top: 16px; }
.dash-recent { display: flex; flex-direction: column; }
.dash-recent__row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-top: 1px solid var(--line); }
.dash-recent__row:first-child { border-top: 0; }
.dash-recent__row:hover { background: var(--surface-2); }
.dash-recent__type { font-size: 18px; }
.dash-recent__main { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.dash-recent__main b { font-size: 13.5px; }
.dash-recent__main .muted { font-size: 12px; }
.dash-recent__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 11px; }
/* Dashboard: Shift notes window */
.dash-card--notes { cursor: default; }
/* Free-form note composer (attach a load is optional) */
.dash-note-add { display: flex; flex-direction: column; gap: 8px; padding: 4px 2px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.dash-note-add__text { font: inherit; border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 11px;
  resize: vertical; min-height: 42px; background: var(--surface); color: var(--text); }
.dash-note-add__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dash-note-add__load { flex: 1 1 180px; min-width: 150px; font: inherit; border: 1px solid var(--line-2);
  border-radius: 8px; padding: 7px 10px; background: var(--surface); color: var(--text); }
.dash-note-add__crit { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; cursor: pointer; }
.dash-note-add__msg { font-size: 12.5px; }
.dash-note__general { font-size: 11px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase;
  color: var(--faint); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; }
.dash-notes { display: flex; flex-direction: column; }
.dash-note { display: flex; align-items: flex-start; gap: 8px; padding: 10px 4px; border-top: 1px solid var(--line); }
.dash-note:first-child { border-top: 0; }
.dash-note--crit { background: color-mix(in srgb, var(--danger) 7%, transparent); border-radius: 8px; margin: 2px 0; padding: 10px 10px; border-top: 0; }
.dash-note--crit + .dash-note { border-top: 0; }
.dash-note__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dash-note__head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.dash-note__crit { font-size: 12px; }
.dash-note__meta { font-size: 12px; }
.dash-note__text { font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.dash-note__by { font-size: 11.5px; }
.dash-note__ack { font-size: 11.5px; font-weight: 700; color: var(--ok); }
.dash-note__resolved { font-size: 11.5px; font-weight: 700; color: var(--ok); margin-top: 2px; }
.dash-note--acked { opacity: .82; }
.dash-note__acts { flex: none; display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.dash-note__acts .btn { white-space: nowrap; }
/* Resolved-note archive (collapsible) */
.dash-notes-history { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.dash-notes-history > summary { cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--dim); list-style: none; padding: 4px 2px; }
.dash-notes-history > summary::-webkit-details-marker { display: none; }
.dash-notes-history > summary::before { content: "▸ "; color: var(--faint); }
.dash-notes-history[open] > summary::before { content: "▾ "; }
.dash-notes-history__n { color: var(--faint); font-weight: 600; }
.dash-notes-history__body { margin-top: 4px; }
.dash-note--resolved { opacity: .75; }
.dash-note--resolved .dash-note__text { text-decoration: none; }
/* Time off: a denied request in history reads red instead of green */
.dash-note--denied { opacity: .75; }
.dash-note--denied .dash-note__resolved { color: var(--danger); }
/* Dashboard: Driver messages card — thread list + unread badges */
.dash-msg__badge { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 6px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 800;
  line-height: 18px; text-align: center; vertical-align: middle; }
.dash-msgs { display: flex; flex-direction: column; }
.dash-msg { position: relative; text-align: left; width: 100%; background: none; border: 0;
  border-top: 1px solid var(--line); padding: 10px 4px; cursor: pointer; font: inherit; color: inherit; }
.dash-msg:first-child { border-top: 0; }
.dash-msg:hover { background: var(--surface-2); border-radius: 8px; }
.dash-msg--unread { font-weight: 600; }
.dash-msg__row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.dash-msg__name { color: var(--text); }
.dash-msg__time { font-size: 12px; white-space: nowrap; }
.dash-msg__preview { margin-top: 2px; font-size: 13px; color: var(--dim); padding-right: 26px; }
.dash-msg--unread .dash-msg__preview { color: var(--text); }
.dash-msg__dot { position: absolute; top: 10px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--blue); color: #fff; font-size: 11px; font-weight: 800;
  line-height: 18px; text-align: center; }
/* Driver-thread reply modal — chat bubbles */
.modal--chat { display: flex; flex-direction: column; width: 520px; }
.chat-thread { flex: 1 1 auto; min-height: 220px; max-height: 52vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px; padding: 10px 2px; margin: 8px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.chat-b { max-width: 78%; padding: 8px 11px; border-radius: 13px; font-size: 14px; line-height: 1.4; }
.chat-b--in { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line);
  border-bottom-left-radius: 4px; color: var(--text); }
.chat-b--out { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.chat-b__img { display: block; max-width: 100%; border-radius: 8px; margin-bottom: 4px; }
.chat-b__meta { display: block; margin-top: 3px; font-size: 11px; opacity: .8; }
.chat-b--out .chat-b__meta { text-align: right; }
.chat-reply { display: flex; gap: 8px; align-items: center; }
.chat-reply input { flex: 1 1 auto; font: inherit; border: 1px solid var(--line-2);
  border-radius: 9px; padding: 9px 11px; background: var(--surface); color: var(--text); }
.chat-reply__err { margin-top: 8px; font-size: 12.5px; }
/* Driver messages card: New-message button + sent confirmation flash */
.dash-card--msgs .dash-card__head { align-items: flex-start; }
.dash-msg__new { flex: 0 0 auto; white-space: nowrap; }
.dash-msg__flash { margin-top: 10px; padding: 8px 11px; border-radius: 8px; font-size: 13px;
  background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); font-weight: 600;
  opacity: 0; max-height: 0; overflow: hidden; transition: opacity .2s, max-height .2s, padding .2s; padding-block: 0; }
.dash-msg__flash.is-on { opacity: 1; max-height: 60px; padding-block: 8px; }
/* Broadcast composer modal */
.bcast { display: flex; flex-direction: column; }
.bcast__groups { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 10px; }
.bcast__grouplbl { font-size: 12.5px; }
.chip.bcast__group { cursor: pointer; border: 1px solid var(--line-2); background: var(--surface-2);
  color: var(--text); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; }
.chip.bcast__group:hover { border-color: var(--blue); color: var(--blue); }
.chip.bcast__group--clear { margin-left: auto; color: var(--dim); }
.bcast__pickwrap { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.bcast__search { width: 100%; border: 0; border-bottom: 1px solid var(--line); font: inherit;
  padding: 9px 11px; background: var(--surface); color: var(--text); }
.bcast__list { max-height: 240px; overflow-y: auto; }
.bcast__row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer;
  border-top: 1px solid var(--line); }
.bcast__row:first-child { border-top: 0; }
.bcast__row:hover { background: var(--surface-2); }
.bcast__cb { width: auto; margin: 0; }
.bcast__name { flex: 1 1 auto; font-size: 14px; color: var(--text); }
.bcast__tag { font-size: 10.5px; font-weight: 800; letter-spacing: .04em; padding: 2px 7px; border-radius: 999px; }
.bcast__tag--otr { background: color-mix(in srgb, var(--blue) 16%, transparent); color: var(--blue); }
.bcast__tag--local { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.bcast__text { margin-top: 12px; font: inherit; border: 1px solid var(--line-2); border-radius: 9px;
  padding: 10px 11px; background: var(--surface); color: var(--text); resize: vertical; }
.bcast__err { margin-top: 8px; font-size: 12.5px; }
.bcast__count { margin-right: auto; font-size: 12.5px; }
/* Order Planning: inline shift-note composer under a load row */
#ordRows tr.is-noting > td { border-bottom: 0; }
.note-compose-row > td { background: var(--surface-2); padding: 0; }
.note-compose { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; }
.note-compose__text { flex: 1 1 320px; min-width: 240px; font: inherit; border: 1px solid var(--line-2);
  border-radius: 9px; padding: 9px 11px; resize: vertical; background: var(--surface); color: var(--text); }
.note-compose__crit { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; cursor: pointer; }
.note-compose__btns { display: flex; align-items: center; gap: 8px; }
.dash-fuelmap { position: relative; isolation: isolate; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.dash-fuelmap__map { height: 260px; }
.dash-fuelmap__map .leaflet-container { width: 100%; height: 100%; background: var(--surface-2); }
.dash-terminals { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.dash-terminals__label { font-size: 11px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; color: var(--faint); padding: 9px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.dash-term { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-top: 1px solid var(--line); }
.dash-term:first-of-type { border-top: 0; }
.dash-term__name { font-weight: 600; font-size: 13px; }
.dash-term__ex { font-weight: 800; font-size: 16px; color: var(--ok); font-variant-numeric: tabular-nums; }

/* Toolbar */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 24px; }
.search { flex: 1 1 320px; min-width: 220px; }
input, select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 9px; padding: 9px 12px; outline: none; }
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255,122,26,.15); }
.filter--date { color: var(--dim); }
.btn { font: inherit; font-weight: 600; cursor: pointer; border-radius: 9px; padding: 9px 14px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #241203; }
.btn--blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn--ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn:active { transform: translateY(1px); }

/* Table */
.content { padding: 0 24px 40px; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.doc-table { width: 100%; border-collapse: collapse; }
.doc-table th { text-align: left; font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: var(--faint);
  padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.doc-table th.c, .doc-table td.c { text-align: center; }
.doc-table th.r, .doc-table td.r { text-align: right; }
/* Reports */
.rep-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.rep-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--dim); font-weight: 600; }
.rep-field select { font: inherit; font-weight: 400; color: var(--text); border: 1px solid var(--line-2);
  border-radius: 9px; padding: 8px 10px; background: var(--surface); }
.rep-trk { cursor: pointer; }
.rep-trk:hover { background: var(--surface-2, rgba(127,127,127,.05)); }
.rep-caret { display: inline-block; transition: transform .15s; color: var(--dim); font-size: 11px; }
.rep-trk.rep-open .rep-caret { transform: rotate(90deg); }
.rep-detail > td { padding: 0 0 8px 0 !important; background: var(--surface-2, rgba(127,127,127,.04)); }
.rep-loads { margin: 0; font-size: 12.5px; }
.rep-loads th { color: var(--dim); font-weight: 600; }
/* Reports sub-tabs (Truck loads / Time off) */
.rep-subtabs { display: flex; gap: 6px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.rep-subtab { font: inherit; font-weight: 700; font-size: 13.5px; cursor: pointer; border: 0; background: transparent;
  color: var(--dim); padding: 9px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.rep-subtab:hover { color: var(--text); }
.rep-subtab.on { color: #b85700; border-bottom-color: var(--brand); }
/* Time-off report */
.rep-note { font-size: 12px; line-height: 1.5; margin-bottom: 16px; max-width: 720px; }
.rep-year { margin-bottom: 22px; }
.rep-year__head { font-size: 15px; font-weight: 800; margin-bottom: 8px; }
.rep-timeoff th, .rep-timeoff td { white-space: nowrap; }
/* IFTA quarterly fuel-tax report */
.ifta-tools { flex-wrap: wrap; align-items: center; gap: 12px; }
.ifta-tools .rep-field select { min-width: 150px; }
.ifta-table td { vertical-align: middle; }
.ifta-in { width: 96px; font: inherit; text-align: right; padding: 4px 7px; border: 1px solid var(--line);
  border-radius: 7px; background: var(--surface, #fff); color: var(--text); }
.ifta-in:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.ifta-credit { color: #1a8f3c; }              /* a fuel-tax credit reads green */
.ifta-del { border: 0; background: transparent; cursor: pointer; color: var(--dim); font-size: 14px;
  line-height: 1; padding: 4px 6px; border-radius: 6px; }
.ifta-del:hover { background: rgba(225,29,29,.12); color: #c11; }
.ifta-summary .ifta-net b { color: #b85700; }
.ifta-summary .ifta-net--credit b { color: #1a8f3c; }
.ifta-add { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.ifta-add select { font: inherit; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface, #fff); color: var(--text); }
.ifta-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.ifta-msg { font-size: 12.5px; }
/* EFS fuel-card report */
.efs-status { font-size: 12.5px; padding: 8px 12px; border-radius: 9px; margin-bottom: 12px; border: 1px solid var(--line); }
.efs-status code { font-size: 11.5px; background: rgba(127,127,127,.12); padding: 1px 5px; border-radius: 5px; }
.efs-status--dark { background: var(--surface-2, rgba(127,127,127,.06)); color: var(--dim); }
.efs-status--live { background: rgba(26,143,60,.10); border-color: rgba(26,143,60,.35); color: #1a8f3c; }
.efs-tools { flex-wrap: wrap; align-items: center; gap: 12px; }
.mf-import__btn { cursor: pointer; display: inline-flex; align-items: center; }
.efs-summary .efs-total b { color: #b85700; }
/* Status pill — shared base for detention (.det-pill), order (.ostat) and
   invoice (.istat) badges; each family adds its own --variant colors. */
.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
/* Detention */
.det-pill { padding: 2px 9px; }
.det--waiting { background: rgba(47,123,246,.14); color: #1d5fd0; }
.det--risk { background: rgba(199,119,0,.18); color: #b56b00; }
.det--det { background: #e11d1d; color: #fff; }
.det--closed { background: var(--surface-2, rgba(127,127,127,.12)); color: var(--dim); }
.det-otr { display: inline-block; margin-left: 5px; padding: 1px 6px; border-radius: 6px; font-size: 10.5px;
  font-weight: 800; background: rgba(18,161,80,.16); color: #0c7a3c; letter-spacing: .3px; }
.det-sum--alert b { color: #e11d1d; }
.det-rates { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.det-rates input { width: 120px; }
.det-ratebar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12.5px; margin-bottom: 14px; }
.det-alerts .det-alert { border: 1px solid var(--line); border-left-width: 4px; border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px; background: var(--surface); }
.det-alert--warn { border-left-color: #c77700; }
.det-alert--det { border-left-color: #e11d1d; }
.det-alert--sent { border-left-color: #0c7a3c; opacity: .8; }
.det-alert__head { font-size: 13.5px; margin-bottom: 8px; }
.det-alert__to { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim);
  font-weight: 600; margin-bottom: 8px; }
.det-alert__to input { flex: 0 1 300px; font: inherit; font-weight: 400; color: var(--text);
  border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 9px; background: var(--surface); }
.det-alert__subj { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.det-alert__body { font-size: 12.5px; color: var(--dim); white-space: pre-line; line-height: 1.45;
  max-height: 96px; overflow: auto; border-left: 2px solid var(--line); padding-left: 10px; }
/* Admin + master files */
.adm-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.adm-tab { font: inherit; font-weight: 600; font-size: 13px; color: var(--dim); background: transparent;
  border: 1px solid var(--line-2); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.adm-tab:hover { background: var(--surface-2, rgba(127,127,127,.06)); }
.adm-tab.on { background: var(--accent, #2f7bf6); color: #fff; border-color: transparent; }
.mf-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 12px; align-items: end; }
.mf-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--dim); font-weight: 600; }
.mf-field input, .mf-field select, .mf-field textarea { font: inherit; font-weight: 400; color: var(--text);
  border: 1px solid var(--line-2); border-radius: 9px; padding: 8px 10px; background: var(--surface); }
.mf-field textarea { resize: vertical; min-height: 38px; }
.mf-field--wide { grid-column: 1 / -1; }
.mf-hint { font-size: 11px; font-weight: 400; color: var(--dim); line-height: 1.35; }
.mf-import { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.mf-import > summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--accent, #2f7bf6); }
.mf-import__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.mf-import__result { font-size: 12.5px; line-height: 1.5; }
.mf-summary { padding: 10px 2px 0; font-size: 13px; color: var(--text); }
.pm-row--overdue td:first-child { box-shadow: inset 3px 0 0 var(--danger, #e11d1d); }
.pm-row--due td:first-child { box-shadow: inset 3px 0 0 var(--brand, #f57c00); }

/* Center modal (e.g. create-customer prompt from the order form) */
.modal-scrim { position: fixed; inset: 0; z-index: 200; background: rgba(20,28,42,.5);
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; width: 560px; max-width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 18px 50px rgba(0,0,0,.3); }
.modal__title { font-size: 17px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.modal__grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 12px; align-items: end; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.req { color: var(--red, #d64524); }
.modal .mf-field input.is-error, .modal .mf-field textarea.is-error {
  border-color: var(--red, #d64524); box-shadow: 0 0 0 2px rgba(214,69,36,.18); }
.mf-check { flex-direction: row; align-items: center; gap: 8px; }
.mf-check input { width: auto; }
.mf-actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.doc-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.doc-table tbody tr { cursor: pointer; }
.doc-table tbody tr:hover { background: var(--surface-2); }
.doc-table tbody tr:last-child td { border-bottom: 0; }

/* Ready-to-invoice: expandable inline load-detail panel */
.ready-caret { display: inline-block; width: 0.9em; color: var(--dim); transition: transform .12s ease; }
tr.row-link.is-open .ready-caret { transform: rotate(90deg); color: var(--text); }
tr.ready-detail-row, tr.ready-detail-row:hover { cursor: default; background: var(--surface-2); }
tr.ready-detail-row td { padding: 0; border-bottom: 1px solid var(--line); }
.ready-detail { padding: 14px 16px 16px 34px; }
.ready-detail__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 32px; }
.ready-kvs { margin: 0; }
.ready-kv { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.ready-kv:last-child { border-bottom: 0; }
.ready-kv dt { color: var(--dim); font-size: 13px; }
.ready-kv dd { margin: 0; text-align: right; font-size: 13px; }
.ready-det { display: flex; justify-content: space-between; gap: 16px; font-size: 13px; }
.ready-detail__actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.type-cell { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.muted { color: var(--dim); }
.strong { font-weight: 700; }

/* Status badge */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: .3px;
  text-transform: uppercase; padding: 4px 9px; border-radius: 999px; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--new { background: rgba(255,122,26,.14); color: #b85700; }
.badge--reviewed { background: rgba(47,123,246,.14); color: #1f5fce; }
.badge--filed { background: rgba(18,161,80,.14); color: #0c7a3c; }
.badge--archived { background: #eceff4; color: #71809a; }

.empty { padding: 48px; text-align: center; color: var(--faint); }

/* Detail drawer */
.scrim { position: fixed; inset: 0; background: rgba(15,25,40,.35); z-index: 20; }
.detail { position: fixed; top: 0; right: 0; height: 100%; width: min(460px, 92vw); background: var(--surface);
  border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgba(0,0,0,.14); z-index: 21; overflow-y: auto;
  animation: slidein .18s ease; }
@keyframes slidein { from { transform: translateX(20px); opacity: .5; } }
.detail__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
.detail__title { font-size: 17px; font-weight: 800; }
.detail__sub { color: var(--dim); font-size: 12.5px; margin-top: 2px; }
.x { border: 0; background: var(--surface-2); width: 34px; height: 34px; border-radius: 9px; cursor: pointer; font-size: 18px; color: var(--dim); }
.detail__body { padding: 18px 20px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; margin-bottom: 18px; }
.kv dt { color: var(--dim); font-size: 12.5px; }
.kv dd { margin: 0; font-weight: 600; }
.pages { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.page-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.page-card img { display: block; width: 100%; background: #fff; }
.page-card__bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: var(--surface-2); font-size: 12px; color: var(--dim); }
.original-dls { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.original-dl { text-decoration: none; font-size: 13px; padding: 8px 12px; }
.map-wrap { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 8px; background: var(--surface-2); min-height: 200px; }
.map-wrap::before { content: "Map preview — requires internet"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); font-size: 12px; }
.map { display: block; position: relative; width: 100%; height: 200px; border: 0; }
.map-meta { font-size: 12.5px; color: var(--dim); margin-bottom: 18px; }
.map-meta a { color: var(--blue); }
.map-meta .place { display: block; font-weight: 700; color: var(--text); font-size: 13.5px; margin-bottom: 1px; }
.map-meta .place-note { display: block; font-size: 11px; color: var(--faint); margin-bottom: 6px; }

/* Page image → click to enlarge */
.page-card img { cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 40; background: rgba(8,14,24,.9); display: grid; place-items: center; cursor: zoom-out; padding: 24px; }
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,.5); background: #fff; }
.lightbox__x { position: fixed; top: 16px; right: 20px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff; font-size: 26px; cursor: pointer; }

/* Invoice drawer — POD review + edit */
.inv-poddoc { margin-bottom: 14px; }
.inv-pay { font-size: 13px; padding: 3px 0; }
.pod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pod-thumb { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pod-thumb img { display: block; width: 100%; background: #fff; cursor: zoom-in; }
.pod-thumb__bar { display: flex; gap: 4px; padding: 6px; background: var(--surface-2); }
.pod-thumb__bar .btn { flex: 1; padding: 4px 6px; font-size: 11.5px; }
.pod-doc-acts { display: flex; justify-content: flex-end; margin-top: 8px; }
.pod-reject-btn { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.pod-reject-btn:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.inv-poddoc--rejected { opacity: .82; }
.inv-poddoc--rejected .pod-thumb img { filter: grayscale(.35); }
.pod-rejected-flag { display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline;
  font-size: 12.5px; font-weight: 700; color: var(--danger); margin-bottom: 8px;
  padding: 6px 10px; border-radius: 8px;
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
.pod-rejected-flag .muted { font-weight: 500; }

/* Crop overlay */
.crop-ov { position: fixed; inset: 0; z-index: 50; background: rgba(8,14,24,.92); display: flex; flex-direction: column; }
.crop-ov__bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 18px; color: #fff; }
.crop-ov__btns { display: flex; gap: 8px; }
.crop-ov__stage { position: relative; flex: 1; display: grid; place-items: center; overflow: hidden; padding: 12px; }
.crop-ov__stage img { max-width: 94vw; max-height: 80vh; touch-action: none; user-select: none; -webkit-user-drag: none; }
.crop-rect { position: absolute; border: 2px dashed #4da3ff; background: rgba(77,163,255,.12); pointer-events: none; }
.detail__actions { display: flex; gap: 8px; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--surface); padding: 14px 20px; border-top: 1px solid var(--line); }
.section-label { font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--faint); margin: 0 0 8px; }

/* Login screen */
.login-scrim { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: grid; place-items: center; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; width: min(360px, 90vw); display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.12); }
.login-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.login-brand .brand__mark { width: 28px; height: 28px; border-radius: 7px; font-size: 15px; }
.login-title { color: var(--dim); font-size: 13px; margin-bottom: 4px; }
.login-card input { width: 100%; }
.login-msg { color: var(--danger); font-size: 12.5px; min-height: 16px; }

/* Fuel section */
.fuel-map-inline { position: relative; isolation: isolate; margin-bottom: 16px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.fuel-map-inline__map { height: 420px; }
.fuel-map-inline__map .leaflet-container { width: 100%; height: 100%; background: var(--surface-2); }
.fuel-bar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.fuel-bar .btn { white-space: nowrap; flex: 0 0 auto; }
.fuel-row--loc { cursor: pointer; }
.fuel-row--loc:hover { background: var(--surface-2); }
.fuel-pin { font-size: 11px; }
.fuel-search { width: 100%; margin-bottom: 12px; }
.fuel-filters { display: flex; gap: 8px; margin-bottom: 12px; }
.fuel-filters .fuel-state { flex: 0 0 auto; max-width: 220px; }
.fuel-filters .fuel-search { flex: 1 1 auto; margin-bottom: 0; }
.fuel-rankline { font-size: 11.5px; color: var(--blue); font-weight: 600; margin-top: 3px; }

/* Fuel-stop satellite map modal */
.fuelmap { position: fixed; inset: 0; z-index: 2000; background: rgba(8,14,24,.6);
  display: grid; place-items: center; padding: 20px; }
.fuelmap__card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  width: min(680px, 96vw); overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,.35); }
.fuelmap__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.fuelmap__title { font-weight: 800; font-size: 16px; }
.fuelmap__addr { color: var(--dim); font-size: 13px; margin-top: 2px; }
.fuelmap__map { height: 380px; background: var(--surface-2); }
.fuelmap__map iframe { display: block; width: 100%; height: 100%; border: 0; }
.fuelmap__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; }
.fuel-bar__btns { display: flex; gap: 8px; flex: 0 0 auto; }
.fuelmap__card--full { width: min(1100px, 96vw); height: 88vh; display: flex; flex-direction: column; position: relative; }
.fuelmap__bigmap { flex: 1 1 auto; min-height: 0; }
.fuelmap__bigmap .leaflet-container { width: 100%; height: 100%; background: var(--surface-2); }
.fuelmap__legend { position: absolute; left: 12px; bottom: 14px; z-index: 1000;
  background: rgba(255,255,255,.95); color: #1a2332; border-radius: 8px; padding: 8px 10px;
  font-size: 11px; box-shadow: 0 2px 10px rgba(0,0,0,.28); }
.fuelmap__legend-bar { height: 10px; width: 168px; border-radius: 5px;
  background: linear-gradient(to right, hsl(0,78%,48%), hsl(38,78%,48%), hsl(60,78%,48%),
    hsl(120,78%,48%), hsl(185,78%,48%), hsl(245,78%,48%), hsl(275,78%,48%)); }
.fuelmap__legend-labels { display: flex; justify-content: space-between; margin-top: 3px; font-weight: 700; }
.fuelmap__legend-note { margin-top: 5px; color: #5a6a82; }

/* Truck parking map (dispatcher view) — layer toggles + markers */
.parkmap .fuelmap__bigmap { min-height: 0; }
.park-bar { flex: 0 0 auto; padding: 10px 14px; background: var(--surface); border-top: 1px solid var(--line); }
.park-toggles { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.park-tog { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--text); cursor: pointer; }
.park-tog input { width: 15px; height: 15px; accent-color: var(--blue); }
.park-actions { display: flex; align-items: center; gap: 12px; margin-top: 9px; }
.park-research { width: auto; }
.park-note { font-size: 12px; color: var(--dim); line-height: 1.35; }
.park-pin { font-size: 18px; line-height: 24px; text-align: center; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
.park-live { display: grid; place-items: center; }
.park-live span {
  min-width: 22px; padding: 1px 6px; border-radius: 999px;
  font: 700 12px/1.5 var(--font); color: #fff; text-align: center;
  border: 1.5px solid rgba(255,255,255,.9); box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.park-live--open span    { background: #1f9d55; }
.park-live--low span     { background: #e08e0b; }
.park-live--full span    { background: #d11d1d; }
.park-live--closed span  { background: #4b5563; }
.park-live--unknown span { background: #2f6fae; }

.fuel-table th, .fuel-table td { padding: 9px 10px; }
.fuel-table th.fuel-sort { cursor: pointer; user-select: none; white-space: nowrap; }
.fuel-table th.fuel-sort:hover { color: var(--text); }
.fuel-table th.fuel-sort.sorted { color: var(--blue); }
.fuel-table th.fuel-sort .sort-ind { font-size: 10px; }
.fuel-table .fuel-name { font-weight: 700; }
.fuel-table .fuel-ex { color: var(--ok); font-size: 15px; }
.fuel-note { margin-top: 6px; padding: 6px 9px; border-radius: 8px; background: rgba(47,123,246,.08);
  border: 1px solid rgba(47,123,246,.25); color: #1f5fce; font-size: 11.5px; line-height: 1.35; }
.pill-sample { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .3px;
  text-transform: uppercase; padding: 3px 7px; border-radius: 999px; background: var(--surface-2);
  color: var(--faint); border: 1px dashed var(--line-2); }

@media (max-width: 720px) {
  .doc-table th:nth-child(4), .doc-table td:nth-child(4),
  .doc-table th:nth-child(6), .doc-table td:nth-child(6) { display: none; }
  .topbar { flex-direction: column; align-items: flex-start; }
}

/* ---- Orders / dispatch ---- */
.ord-summary { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ord-sum { flex: 1 1 120px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
  text-align: center; background: var(--surface); }
.ord-sum b { display: block; font-size: 20px; font-weight: 800; line-height: 1.1; }
.ord-sum span { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--dim); }
.ord-sum--mi { background: var(--surface-2, rgba(127,127,127,.06)); }
.ord-dh-wrap { display: inline-flex; align-items: center; gap: 4px; }
.ord-dh-input { width: 66px; font: inherit; text-align: right; border: 1px solid var(--line-2);
  border-radius: 8px; padding: 4px 6px; background: var(--surface); }
.ord-dh-input::placeholder { color: var(--faint); }
.ord-dh-u { font-size: 11px; color: var(--faint); }
.ord-dh-saved { outline: 2px solid rgba(18,161,80,.5); transition: outline .2s; }
.ord-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 12px; align-items: end; }
.ord-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--dim); font-weight: 600; }
.ord-field input, .ord-field select, .ord-field textarea { font: inherit; font-weight: 400; color: var(--text);
  border: 1px solid var(--line-2); border-radius: 9px; padding: 8px 10px; background: var(--surface); }

/* Editable combobox (master-file picker): scrollable dropdown + free text */
.combo { position: relative; display: block; }
.combo .combo__input { width: 100%; box-sizing: border-box; padding-right: 28px; }
.combo__caret { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); z-index: 1;
  color: var(--dim); font-size: 11px; line-height: 1; cursor: pointer; user-select: none; }
.combo.is-open .combo__caret { color: var(--brand); }
.combo__menu { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 4px);
  max-height: 240px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 10px; box-shadow: 0 10px 28px rgba(20,30,50,.16); padding: 4px; }
.combo__opt { padding: 8px 10px; border-radius: 7px; font-size: 14px; font-weight: 400; color: var(--text); cursor: pointer; }
.combo__opt:hover, .combo__opt.is-hi { background: var(--surface-2); }
.combo__empty { padding: 8px 10px; font-size: 12.5px; color: var(--faint); }
.ord-field textarea { resize: vertical; }
.ord-field--wide { grid-column: span 2; }
.ord-field--full { grid-column: 1 / -1; }
.ord-group { grid-column: 1 / -1; font-size: 11px; font-weight: 800; letter-spacing: .5px;
  text-transform: uppercase; color: var(--faint); border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.ord-group:first-of-type, #ordFormTitle { border-top: 0; padding-top: 0; margin-top: 0; color: var(--text); font-size: 13px; }
.ord-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; padding-top: 6px; }
.ord-filled { background: #fff7ec !important; border-color: var(--brand) !important; }
.ord-paste { margin-top: 14px; }
.ord-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.ord-toolbar .search { flex: 1 1 240px; }
.th-sort { cursor: pointer; user-select: none; white-space: nowrap; }
.th-sort:hover { color: var(--brand); }
.th-sort--active { color: var(--brand); }
/* global click-to-sort affordance (applied to every doc-table heading) */
.th-gsort { cursor: pointer; user-select: none; }
.th-gsort:hover { color: var(--brand); }
.doc-table thead th.gsort--active { color: var(--brand); }
.ord-plan-section { margin: 22px 0 10px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 14px; font-weight: 800; color: var(--text); }
.ord-filters { gap: 6px; }
.ord-filters .filter { flex: 1 1 96px; min-width: 72px; padding: 6px 8px; font-size: 12.5px; }
.ord-filters .filter--st { flex: 0 0 58px; min-width: 0; text-transform: uppercase; }
.ord-filters .filter--num { flex: 0 0 74px; min-width: 0; }
.ostat--draft { background: var(--surface-2); color: var(--dim); border: 1px solid var(--line-2); }
.ostat--assigned { background: rgba(47,123,246,.14); color: #1d5fd0; }
.ostat--transit { background: rgba(199,119,0,.16); color: #b56b00; }
.ostat--delivered { background: rgba(18,161,80,.16); color: #0c7a3c; }
.ostat--canceled { background: rgba(214,69,69,.14); color: #c0392b; }
.ord-lane { white-space: nowrap; }
.ord-lane__ar { color: var(--faint); margin: 0 5px; }
.ord-nstops { display: inline-block; margin-left: 6px; padding: 2px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 800; background: rgba(47,123,246,.12); color: #1d5fd0; white-space: nowrap; }
.ord-jit { display: inline-block; margin-left: 6px; padding: 2px 7px; border-radius: 999px;
  font-size: 10.5px; font-weight: 800; background: rgba(214,60,40,.14); color: #c2331f; white-space: nowrap; }
.ord-trip { display: inline-block; margin-left: 6px; padding: 2px 7px; border-radius: 999px;
  font-size: 10.5px; font-weight: 800; background: var(--surface-2); color: var(--text-dim); white-space: nowrap; }
.ord-check { flex-direction: row; align-items: center; gap: 8px; }
.ord-check input { width: 16px; height: 16px; }
/* Trailer handling (PRELOAD / DROP) — sits with the stops it describes */
.ord-handling { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 8px; }
.ord-handling .ord-check { display: flex; cursor: pointer; }

/* Drivers master file: recurring-deductions list editor */
.mf-ded { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.mf-ded [data-dlabel] { flex: 2 1 180px; min-width: 0; }
.mf-ded [data-damount] { flex: 0 1 110px; }
.mf-ded select { flex: 0 0 auto; }

/* Settlement: weekly bonus board + settings modal */
.bn-row { cursor: pointer; }
.bn-row:hover td { background: var(--surface-2); }
.bn-detail > td { background: var(--surface-2); padding: 12px 14px; }
.bn-detail__box { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.bn-entry { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.bn-entry input[type="number"] { width: 90px; }
.modal--wide { max-width: 780px; width: min(780px, 96vw); }
.bn-set { max-height: 66vh; overflow: auto; }
.bn-set__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }

/* Hourly driver: manual payable-hours override under the shifts table */
.dp-hoursedit { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 10px;
  padding-top: 10px; border-top: 1px solid var(--line); }
.dp-hoursedit .mf-field { flex: 0 0 auto; }
.dp-hoursedit input { width: 140px; }

/* Settlement: driver-pay rollup with expandable per-driver load detail */
.dp-row { cursor: pointer; }
.dp-row:hover td { background: var(--surface-2); }
.dp-caret { color: var(--faint); font-size: 11px; display: inline-block; width: 12px; }
.dp-detail > td { background: var(--surface-2); padding: 12px 14px; }
.dp-detail__box table { background: var(--surface); }

/* Master files: multi-select + bulk edit/delete toolbar */
.mf-bulk { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 12px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.mf-bulk__msg { font-size: 12.5px; }
.mf-selcol { width: 34px; }
.doc-table input[type="checkbox"][data-mfsel], .doc-table input[type="checkbox"][data-mfselall] {
  width: 15px; height: 15px; cursor: pointer; }

/* Recurring orders — picker above the form + the save-as-recurring modal */
.ord-recur { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.ord-recur__row { display: flex; gap: 10px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.ord-recur__combo { flex: 1 1 340px; }
.recur-opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.recur-opt__main { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 13px; }
.recur-opt__main .muted { font-size: 12px; }
.recur-opt__del { flex: 0 0 auto; }
.recur-days { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.recur-day { display: flex; gap: 5px; align-items: center; font-size: 13px; font-weight: 600; cursor: pointer; }
.recur-day input { width: 15px; height: 15px; }

/* Live address suggestions on stop rows — floating, viewport-positioned */
.addr-menu { position: fixed; right: auto; z-index: 3000; max-height: 300px; overflow: auto; }
.addr-menu .combo__opt { font-size: 13px; white-space: normal; line-height: 1.35; }
.addr-menu__src { padding: 5px 10px 3px; font-size: 10.5px; color: var(--faint); text-align: right;
  border-top: 1px solid var(--line); }
.ord-dims { display: flex; align-items: center; gap: 6px; }
.ord-dims input { width: 100%; }
.ord-dims span { color: var(--faint); font-weight: 700; }
.ord-sub { font-size: 12.5px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 6px; }
.commodity-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.commodity-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 999px; padding: 4px 6px 4px 11px; }
.commodity-chip .chip-x { border: 0; background: none; cursor: pointer; color: var(--faint); font-size: 12px; padding: 0 2px; }
.commodity-chip .chip-x:hover { color: #c2331f; }
.ord-ref { display: grid; grid-template-columns: 1fr 1.2fr auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.ord-ref input { font: inherit; border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 8px; background: var(--surface); }
@media (max-width: 900px) { .ord-form { grid-template-columns: repeat(2, 1fr); } }

/* stops editor rows */
.ord-stop { display: grid; grid-template-columns: 92px 1.3fr 1.5fr 1fr 44px 96px 238px 60px 84px;
  gap: 6px; align-items: center; margin-bottom: 6px; }
.ord-stop input, .ord-stop select { font: inherit; font-weight: 400; color: var(--text); width: 100%;
  border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 8px; background: var(--surface); }
.ord-stop input.is-error { border-color: var(--red, #d64524); box-shadow: 0 0 0 2px rgba(214,69,36,.18); }
.os-times { display: flex; align-items: center; gap: 3px; }
.os-times input { flex: 1 1 0; min-width: 0; padding: 7px 4px; text-align: center; }
.os-times .os-tz { flex: 0 0 56px; width: 56px; padding: 7px 4px; margin-left: 2px; text-align: left; }
.os-times__dash { color: var(--faint); font-weight: 700; }
.ord-stop--head { margin-bottom: 2px; }
.ord-stop--head span { font-size: 10.5px; font-weight: 800; letter-spacing: .4px;
  text-transform: uppercase; color: var(--faint); }
.os-prog { font-size: 11.5px; font-weight: 700; color: #0c7a3c; white-space: nowrap; }
.os-btns { display: flex; gap: 3px; }
.os-btns .btn { padding: 4px 7px; font-size: 12px; }
.os-det { grid-column: 1 / -1; display: flex; gap: 18px; align-items: center; font-size: 12px;
  color: var(--dim); font-weight: 600; padding: 2px 0 4px 2px; }
.os-det__f { display: inline-flex; align-items: center; gap: 6px; }
.os-det input[type="time"] { width: auto; padding: 4px 6px; }
.os-det input[type="checkbox"] { width: auto; }

/* relay rows + panel */
.ord-stop--relay { background: rgba(139,92,246,.06); border-radius: 8px; }
.ord-stop--relay input { background: transparent; }
.os-relay { font-size: 12px; font-weight: 800; color: #7c4fd8; white-space: nowrap; }
.relay-panel { margin-top: 10px; padding: 14px; border: 1px dashed #b79df0; border-radius: var(--radius);
  background: rgba(139,92,246,.05); }
.relay-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; align-items: end; }
.relay-form .ord-field--wide { grid-column: span 3; }
.relay-custom { grid-column: span 3; display: grid; grid-template-columns: 1.4fr 1.6fr 1fr 60px auto; gap: 8px;
  align-items: center; }
.relay-custom input { font: inherit; border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 8px; }
.relay-save { font-size: 12.5px; display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.relay-row { font-size: 13px; padding: 6px 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rl-tbd { color: #b45309; }
.queue-row { display: flex; gap: 12px; align-items: center; padding: 8px 10px;
  border: 1px solid var(--line-2); border-radius: 8px; margin-bottom: 6px; background: var(--surface); }
.queue-row__n { font-weight: 800; color: #1d5fd0; min-width: 28px; }
.ord-truck { display: inline-block; margin-left: 6px; font-size: 11.5px; font-weight: 700;
  color: var(--faint); white-space: nowrap; }
.rl-assign-sel { font: inherit; font-size: 12.5px; border: 1px solid var(--line-2); border-radius: 8px; padding: 5px 7px; }
@media (max-width: 1000px) { .relay-form { grid-template-columns: 1fr; }
  .relay-form .ord-field--wide, .relay-custom { grid-column: span 1; grid-template-columns: 1fr 1fr; } }
@media (max-width: 1100px) {
  .ord-stop { grid-template-columns: 90px 1fr 1fr 1fr; }
  .ord-stop--head { display: none; }
}

/* ---- Rate-con PDF dropzone ---- */
.ord-drop { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 14px 16px;
  border: 2px dashed var(--line-2); border-radius: var(--radius); background: var(--surface-2);
  transition: border-color .15s, background .15s; }
.ord-drop--over { border-color: var(--blue); background: rgba(47,123,246,.07); }
.ord-drop__icon { font-size: 22px; }
.ord-drop__text { font-size: 13px; line-height: 1.45; }
.ord-drop__text .muted { font-size: 12px; }
.linklike { background: none; border: 0; padding: 0; font: inherit; font-weight: 700;
  color: var(--blue); cursor: pointer; text-decoration: underline; }
#rateconDropNote { margin-left: auto; font-size: 12px; white-space: nowrap; }

/* ---- Billing / AR ---- */
.ord-sum--bad b { color: var(--danger); }
.bill-card-title { font-weight: 800; font-size: 13.5px; margin-bottom: 10px; }
.bill-card-title .muted { font-weight: 500; font-size: 12.5px; }
.istat--draft { background: var(--surface-2); color: var(--dim); border: 1px solid var(--line-2); }
.istat--sent { background: rgba(47,123,246,.14); color: #1d5fd0; }
.istat--partial { background: rgba(199,119,0,.16); color: #b56b00; }
.istat--paid { background: rgba(18,161,80,.16); color: #0c7a3c; }
.istat--void { background: var(--surface-2); color: var(--faint); border: 1px dashed var(--line-2); text-decoration: line-through; }
.bill-overdue { color: var(--danger); font-weight: 700; }
.bill-actions { white-space: nowrap; }
.bill-line { display: grid; grid-template-columns: 1fr 130px auto; gap: 8px; margin-bottom: 6px; }
.bill-line input { font: inherit; border: 1px solid var(--line-2); border-radius: 9px; padding: 8px 10px; background: var(--surface); }
.bill-apply-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; }
.bill-apply-row { display: grid; grid-template-columns: 150px 1fr 110px 130px; gap: 10px; align-items: center;
  padding: 5px 0; border-top: 1px solid var(--line); font-size: 13px; }
.bill-apply-row input { font: inherit; border: 1px solid var(--line-2); border-radius: 9px; padding: 6px 10px; text-align: right; }
.bill-emailtest__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bill-emailtest__row .search { flex: 0 1 320px; }
.bill-emailtest__ok { color: #0c7a3c; font-size: 12.5px; font-weight: 600; }
.bill-emailtest__err { color: var(--danger); font-size: 12.5px; font-weight: 600; }
