:root {
  --series: #1d2d65; --navy: #1d2d65; --navy-deep: #16245a; --navy-soft: #e9ecf6;
  --coral: #fe3f59; --coral-strong: #d9213a; --coral-soft: #ffe8eb;
  --bg: #f4f5f9; --card: #ffffff; --line: #e3e6ef; --field: #f4f5f9;
  --ink: #161c33; --muted: #5d6680; --quiet: #8a92a8;
  --good: #0f7b55; --good-soft: #e0f4ec;
  --warn: #9a6200; --warn-soft: #fdf1d8;
  --info: #1f5fbf; --info-soft: #e3edfb;
  --bad: #c41e36; --bad-soft: #fde6e9;
  --plain: #545d75; --plain-soft: #eceef3;
  --row: 13px; --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --series: #8ea2e6; --bg: #0f1428; --card: #171e38; --line: #2a3354; --field: #1f2746;
  --ink: #edf0f8; --muted: #a6aec6; --quiet: #828ba6; --navy-soft: #232d55;
  --coral-soft: #4a1c28; --good: #58d0a4; --good-soft: #12382c; --warn: #efc06a; --warn-soft: #3d2f12;
  --info: #8ab6f5; --info-soft: #1b2e50; --bad: #ff8c9b; --bad-soft: #471c26; --plain: #b3bad0; --plain-soft: #2a3250;
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --series: #8ea2e6; --bg: #0f1428; --card: #171e38; --line: #2a3354; --field: #1f2746;
  --ink: #edf0f8; --muted: #a6aec6; --quiet: #828ba6; --navy-soft: #232d55;
  --coral-soft: #4a1c28; --good: #58d0a4; --good-soft: #12382c; --warn: #efc06a; --warn-soft: #3d2f12;
  --info: #8ab6f5; --info-soft: #1b2e50; --bad: #ff8c9b; --bad-soft: #471c26; --plain: #b3bad0; --plain-soft: #2a3250;
  color-scheme: dark;
}
html.dense { --row: 7px; }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 Inter, system-ui, "Segoe UI", sans-serif; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }

.shell { display: flex; min-height: 100vh; }
.sidebar { width: 296px; flex: none; display: flex; position: sticky; top: 0; height: 100vh; background: var(--card); border-right: 1px solid var(--line); }
.rail { width: 84px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px 6px; background: var(--navy); color: #fff; overflow-y: auto; }
.brand { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 11px; background: #fff; }
.brand img { width: 32px; height: 32px; object-fit: contain; }
#nav { display: grid; gap: 3px; width: 100%; }
#nav button { display: grid; justify-items: center; gap: 4px; width: 100%; padding: 9px 2px; border: 0; border-radius: 10px; background: none; color: #dfe4f3; font-size: 12px; font-weight: 500; cursor: pointer; }
#nav button:hover { background: rgba(255,255,255,.1); color: #fff; }
#nav button.on { background: #fff; color: #1d2d65; font-weight: 600; }
.subpanel { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 12px 10px; overflow-y: auto; }
.nav-search { display: flex; align-items: center; gap: 8px; padding: 0 10px; flex: none; border-radius: 9px; background: var(--field); color: var(--muted); }
.nav-search span { display: grid; }
.nav-search input { flex: 1; min-width: 0; border: 0; background: none; padding: 9px 0; outline: none; color: var(--ink); }
.nav-search:focus-within { outline: 2px solid var(--coral); }
#subnav-title { font: 700 16px/1.2 Archivo, Inter, sans-serif; margin: 6px 10px 0; }
#subnav { display: grid; gap: 2px; }
#subnav a { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 9px; color: var(--ink); font-weight: 500; }
#subnav a svg { color: var(--muted); }
#subnav a:hover { background: var(--field); }
#subnav a.on { background: var(--navy-soft); font-weight: 600; }
#subnav a.on svg { color: var(--coral-strong); }
#subnav small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
#subnav .note { padding: 6px 10px; color: var(--muted); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 900; display: flex; align-items: center; gap: 10px; padding: 10px 24px; background: var(--card); border-bottom: 1px solid var(--line); }
.search { display: flex; align-items: center; gap: 8px; flex: 0 1 420px; background: var(--field); border-radius: 9px; padding: 0 10px; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: none; padding: 9px 0; outline: none; color: var(--ink); }
.search:focus-within { outline: 2px solid var(--coral); }
kbd { font: 11px Inter; border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; color: var(--muted); }
.hours { margin-left: auto; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.hours i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--good); }
.hours.shut i { background: var(--quiet); }
.icon-btn { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 9px; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--field); color: var(--ink); }
.icon-btn .dot { position: absolute; top: 2px; right: 1px; min-width: 16px; padding: 0 4px; border-radius: 9px; background: var(--coral-strong); color: #fff; font: 700 10px/16px Inter; }
.menu { display: none; }
.bell-wrap { position: relative; }
.popover { position: absolute; right: 0; top: 44px; width: 300px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; box-shadow: 0 10px 30px rgba(15,20,40,.16); }
.popover a { display: flex; gap: 9px; padding: 9px 10px; border-radius: 8px; align-items: center; }
.popover a:hover { background: var(--field); }
.popover i { width: 8px; height: 8px; border-radius: 50%; flex: none; }

main { padding: 22px 24px 40px; outline: none; }
.head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.head h1 { font: 700 21px/1.2 Archivo, Inter, sans-serif; }
.head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--field); }
.btn.primary { background: var(--coral-strong); border-color: var(--coral-strong); color: #fff; }
.btn.primary:hover { background: #bd1a31; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg.i { width: 15px; height: 15px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card > h2, .card-head h2 { font-size: 14.5px; font-weight: 600; }
.card-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 12px; }
.card-head span, .note { color: var(--muted); font-size: 12.5px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 14px; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi .value { font: 700 25px/1.25 Archivo, Inter, sans-serif; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: 12px; }
.meter { height: 6px; border-radius: 4px; background: var(--plain-soft); overflow: hidden; margin-top: 10px; }
.meter b { display: block; height: 100%; border-radius: 4px; background: var(--series); }
.meter.good b { background: var(--good); } .meter.warn b { background: #d98e04; } .meter.bad b { background: var(--coral-strong); }
.grid { display: grid; gap: 14px; align-items: start; }
.g-2-1 { grid-template-columns: minmax(0,2fr) minmax(0,1fr); }
.g-1-1 { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
.mt { margin-top: 14px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tabs button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: 13px; cursor: pointer; }
.tabs button:hover { background: var(--field); }
.tabs button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.mini-search { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 7px 10px; width: 220px; max-width: 100%; }
.table-wrap { overflow-x: auto; position: relative; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: var(--row) 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--field); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td b { font-weight: 600; }
td small { display: block; color: var(--muted); font-size: 12px; }
.who { display: flex; gap: 10px; align-items: center; }
.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--navy-soft); color: var(--ink); font: 600 11.5px Inter; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip.good { background: var(--good-soft); color: var(--good); } .chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.info { background: var(--info-soft); color: var(--info); } .chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.plain { background: var(--plain-soft); color: var(--plain); }
.bar-cell { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.bar-cell .meter { flex: 1; margin: 0; }
.pager { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; padding-top: 10px; color: var(--muted); font-size: 12.5px; }
.pager div { display: flex; gap: 4px; }
.pager button { min-width: 32px; height: 32px; border: 1px solid var(--line); background: var(--card); border-radius: 8px; cursor: pointer; }
.pager button:disabled { opacity: .45; cursor: default; }
.pager button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.empty { padding: 36px 10px; text-align: center; color: var(--muted); }

.stats3 { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-bottom: 14px; }
.stats3 div { background: var(--field); border-radius: 10px; padding: 10px 12px; }
.stats3 b { display: block; font: 700 19px Archivo, Inter, sans-serif; }
.stats3 span { color: var(--muted); font-size: 12px; }
.chart svg { width: 100%; height: auto; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: 96px 1fr 40px; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; }
.hbar .meter { margin: 0; height: 8px; }
.hbar span:last-child { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.gauge { text-align: center; }
.gauge svg { width: 180px; max-width: 100%; }
.row-link { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.row-link:last-child { border: 0; }

.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid transparent; background: var(--field); border-radius: 8px; padding: 9px 11px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--coral); }
.price { display: grid; gap: 7px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.price div { display: flex; justify-content: space-between; color: var(--muted); }
.price .sum { color: var(--ink); font-weight: 700; font-size: 16px; padding-top: 8px; border-top: 1px solid var(--line); }
.sticky { position: sticky; top: 74px; }
.toggle-row { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.toggle-row:last-child { border: 0; }
.toggle-row small { display: block; color: var(--muted); }
.switch { position: relative; width: 40px; height: 22px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: var(--quiet); pointer-events: none; transition: background .15s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; top: 3px; left: 3px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch input:checked + span { background: var(--navy); }
.switch input:checked + span::after { left: 21px; }
.switch input:focus-visible + span { outline: 2px solid var(--coral); outline-offset: 2px; }

.map { height: 440px; border-radius: 10px; z-index: 0; background: var(--field); }
.pin { width: 16px; height: 16px; border-radius: 50%; background: var(--coral-strong); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.pin.idle { background: #7a839c; }
.stop-pin { width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff; font: 700 11.5px/20px Inter; text-align: center; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.list-btn { display: flex; width: 100%; justify-content: space-between; gap: 10px; align-items: center; text-align: left; padding: 9px; border: 0; border-radius: 9px; background: none; cursor: pointer; }
.list-btn:hover { background: var(--field); }
.list-btn.on { background: var(--navy-soft); }
.list-btn small { display: block; color: var(--muted); font-size: 12px; }

.overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(13,18,38,.5); display: grid; place-items: center; padding: 16px; }
.dialog { background: var(--card); border-radius: 14px; width: 560px; max-width: 100%; max-height: calc(100vh - 32px); overflow-y: auto; padding: 18px; }
.dialog-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 12px; }
.dialog-head h2 { font: 700 17px Archivo, Inter, sans-serif; }
.dl { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin-bottom: 14px; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; overflow-wrap: anywhere; }
.dialog-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 3000; display: grid; gap: 8px; }
.toast { background: var(--navy-deep); color: #fff; padding: 10px 14px; border-radius: 9px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 340px; }
.toast.err { background: var(--coral-strong); }
.mini-num { width: 92px; border: 1px solid var(--line); background: var(--field); border-radius: 6px; padding: 6px 8px; }
.hbar.cost { grid-template-columns: 110px 1fr 96px; }
.board { display: grid; grid-template-columns: repeat(6, minmax(190px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--plain-soft); border-radius: 10px; padding: 10px; min-height: 200px; }
.col h2 { font-size: 13.5px; margin: 0 0 8px; }
.lead { display: block; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 9px; margin-bottom: 8px; cursor: pointer; }
.lead:hover { border-color: var(--navy); }
.lead small { display: block; color: var(--muted); font-size: 12px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--navy); }
.login .card { width: 380px; max-width: 100%; padding: 26px; }
.login h1 { font: 700 21px Archivo, Inter, sans-serif; margin: 16px 0 12px; }
.login .btn { width: 100%; margin-top: 8px; padding: 11px; }
.login-err { color: var(--bad); min-height: 20px; margin: 8px 0 0; font-size: 13px; }
.login img { height: auto; max-width: 100%; }
.avatar.account { border: 0; cursor: pointer; }
.clip { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scrim { display: none; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .g-2-1, .g-1-1 { grid-template-columns: minmax(0,1fr); }
  .sticky { position: static; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 1500; left: 0; width: min(296px, 88vw); height: 100dvh; transform: translateX(-105%); transition: transform .18s; }
  .sidebar.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; z-index: 1400; background: rgba(13,18,38,.5); }
  .menu { display: grid; }
  .hours, kbd { display: none; }
  .search { flex: 1; }
  .bell-wrap { margin-left: auto; }
  .topbar { padding: 8px 16px; }
  main { padding: 16px; }
  .map { height: 320px; }
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: minmax(0,1fr); }
  .kpi .value { font-size: 21px; }
  .stats3 { grid-template-columns: minmax(0,1fr); }
  .mini-search { width: 100%; }
  .search { min-width: 0; }
  .topbar { gap: 6px; }
  .card-head { flex-wrap: wrap; row-gap: 8px; }
  .head .actions { min-width: 0; max-width: 100%; }
  .inline-pick { max-width: 100%; min-width: 0; }
  .inline-pick select { min-width: 0; max-width: 100%; }
}

/* Added screens */
.overlay.right { display: flex; justify-content: flex-end; padding: 0; }
.drawer { background: var(--card); width: 420px; max-width: 100vw; height: 100vh; height: 100dvh; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; }
.drawer-foot { margin-top: auto; padding-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.sub-h { font-size: 13.5px; margin: 8px 0 2px; }
.unread { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--coral-strong); margin-right: 7px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px 12px; font-size: 13px; }
.role h2 { font-size: 15.5px; font-weight: 600; }
.chat { display: grid; grid-template-columns: 280px minmax(0,1fr); padding: 0; height: 560px; overflow: hidden; }
.chat-list { border-right: 1px solid var(--line); padding: 8px; overflow-y: auto; }
.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-head { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.bubbles { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.bubble { align-self: flex-start; max-width: 75%; background: var(--field); padding: 8px 12px; border-radius: 10px; overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: var(--navy); color: #fff; }
.bubble small { display: block; opacity: .75; font-size: 11px; margin-top: 2px; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; background: var(--field); border: 0; border-radius: 8px; padding: 9px 11px; }
@media (max-width: 760px) {
  .chat { grid-template-columns: minmax(0,1fr); height: auto; }
  .chat-list { border-right: 0; border-bottom: 1px solid var(--line); max-height: 180px; }
  .bubbles { min-height: 280px; max-height: 50vh; }
  .perm-grid { grid-template-columns: minmax(0,1fr); }
}

.wizard { max-width: 860px; margin: 0 auto; }
.steps { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--quiet); }
.steps span.on { color: var(--ink); font-weight: 600; }
[hidden] { display: none !important; }
@media (max-width: 560px) { .steps span:not(.on) { display: none; } }

.period { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-bottom: 14px; }
.period > a { padding: 7px 14px; border-radius: 7px; font-weight: 600; font-size: 13px; color: var(--muted); }
.period > a:hover { background: var(--field); color: var(--ink); }
.period > a[aria-current] { background: var(--navy); color: #fff; }
.period-range { margin-left: auto; padding-right: 8px; font-size: 13px; color: var(--muted); }
#custom-range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; font-size: 13px; color: var(--muted); }
#custom-range input { border: 1px solid var(--line); background: var(--field); border-radius: 7px; padding: 6px 8px; }
#custom-range .btn { padding: 7px 14px; }

/* Row actions: Quick view and View on every list */
th.act, td.act { width: 1%; white-space: nowrap; text-align: right; }
td.act .btn { margin-left: 6px; }
.btn.small { padding: 6px 12px; font-size: 12.5px; }
.btn.icon { padding: 6px 8px; }
.btn.icon .i { width: 16px; height: 16px; }
tr.click td.act .btn.quick { opacity: .75; }
tr.click:hover td.act .btn.quick { opacity: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
/* Quick view side panel */
.drawer-wrap { position: fixed; inset: 0; z-index: 1200; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(15,20,40,.35); }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(460px, 100%); background: var(--card); box-shadow: -12px 0 40px rgba(15,20,40,.2); display: flex; flex-direction: column; animation: drawer-in .16s ease-out; }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer header small { color: var(--quiet); font-size: 12px; }
.drawer header h2 { margin: 2px 0 0; font-size: 18px; }
.drawer .qv { flex: 1; overflow: auto; margin: 0; padding: 14px 20px; display: grid; grid-template-columns: 130px 1fr; gap: 10px 14px; align-content: start; }
.drawer .qv dt { color: var(--muted); font-size: 12.5px; padding-top: 2px; }
.drawer .qv dd { margin: 0; font-size: 14px; word-break: break-word; }
.drawer .qv dd small { display: block; color: var(--quiet); font-size: 12px; }
.drawer .qv img { max-width: 100%; height: auto; border-radius: 8px; }
.drawer footer { display: flex; gap: 8px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); }
.drawer footer span { flex: 1; }
@media (max-width: 640px) { .drawer .qv { grid-template-columns: 1fr; } .drawer .qv dt { padding-top: 6px; } }
/* Odometer Log */
.filters .filter-row { display: grid; grid-template-columns: 170px 170px 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .filters .filter-row { grid-template-columns: 1fr 1fr; } }
.odo-table { padding: 14px 16px; }
.odo-read { display: flex; align-items: center; gap: 10px; }
.odo-read img { width: 58px; height: 44px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); flex: none; background: var(--field); }
.odo-read b { display: block; font-size: 14.5px; }
.odo-read small, .odo-read span { display: block; }
.odo-nophoto { width: 58px; height: 44px; border-radius: 7px; border: 1px dashed var(--line); color: var(--quiet); font-size: 10.5px; line-height: 1.15; display: flex !important; align-items: center; justify-content: center; text-align: center; flex: none; }
.odo-none { color: var(--quiet); font-size: 13px; }
.odo-ok { color: var(--good); font-size: 11.5px; }
.odo-bad { color: var(--coral-strong); font-size: 11.5px; font-weight: 600; }
.odo-km { font-size: 16px; }
.drawer.wide { width: min(640px, 100%); }
.odo-body { flex: 1; overflow: auto; padding: 16px 20px; }
.odo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.odo-big { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--field); }
.odo-big img { display: block; width: 100%; height: 220px; object-fit: cover; }
.odo-big-none { height: 220px; display: flex; align-items: center; justify-content: center; color: var(--quiet); }
.odo-big figcaption { padding: 10px 12px; background: var(--card); }
.odo-big figcaption span, .odo-big figcaption small { display: block; color: var(--muted); font-size: 12px; }
.odo-big figcaption b { display: block; font-size: 18px; margin: 2px 0; }
.odo-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.odo-sum div { background: var(--field); border-radius: 10px; padding: 10px 12px; }
.odo-sum span { display: block; color: var(--muted); font-size: 12px; }
.odo-sum b { font-size: 17px; }
.odo-why { background: var(--warn-soft); color: var(--ink); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }
.odo-why b { color: var(--warn); }
.odo-why ul { margin: 6px 0 0; padding-left: 18px; }
.odo-fine { background: var(--good-soft); color: var(--good); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }
@media (max-width: 640px) { .odo-pair, .odo-sum { grid-template-columns: 1fr; } }

/* Rows per page */
.pager .rows { display: inline-flex; align-items: center; gap: 6px; }
.pager .rows select { height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); }
.pager .count { flex: 1; }

/* Detail pages: jump bar and empty sections on one line */
.jump { position: sticky; top: 57px; z-index: 50; display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 0 10px; margin-bottom: 4px; background: var(--bg); }
.jump a { padding: 5px 11px; border-radius: 20px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 12.5px; text-decoration: none; }
.jump a:hover { border-color: var(--navy); }
.jump a b { margin-left: 3px; color: var(--muted); font-weight: 600; }
.jump a.dim { color: var(--quiet); }
section.card.is-empty { padding: 12px 16px; }
section.card.is-empty > .card-head { margin-bottom: 0; align-items: center; }
section.card.is-empty .table-wrap, section.card.is-empty > table { display: none; }
.empty-msg { color: var(--quiet); font-size: 12.5px; margin-right: auto; margin-left: 10px; }
section.card.is-empty > .card-head { justify-content: flex-start; }
section[id^="sec-"] { scroll-margin-top: 110px; }

/* Trip page */
.stepper { display: flex; gap: 0; overflow-x: auto; padding: 14px 10px; margin-bottom: 12px; }
.stepper .step { flex: 1 0 74px; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; font-size: 11.5px; color: var(--quiet); }
.stepper .step::before { content: ''; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.stepper .step:first-child::before { display: none; }
.stepper .step.done::before, .stepper .step.now::before { background: var(--good); }
.stepper .step i { position: relative; z-index: 1; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-style: normal; font-weight: 700; background: var(--field); border: 2px solid var(--line); color: var(--muted); margin-bottom: 5px; }
.stepper .step.done i { background: var(--good); border-color: var(--good); color: #fff; }
.stepper .step.now i { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: 0 0 0 4px var(--navy-soft, rgba(29,45,101,.15)); }
.stepper .step.done span, .stepper .step.now span { color: var(--ink); font-weight: 600; }
.stepper .step small { color: var(--quiet); font-size: 10.5px; min-height: 13px; }
.trip-cancelled { background: var(--bad-soft); color: var(--bad); margin-bottom: 12px; }
.trip-sum { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.trip-sum > div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.trip-sum span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.trip-sum b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip-sum small, .trip-sum a { display: block; font-size: 12px; color: var(--muted); }
.trip-sum a { color: var(--info, #2f5bd3); }
.trip-sum .warn { border-color: var(--warn); }
.trip-sum .warn b { color: var(--warn); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 14px; align-items: start; }
.detail-grid .main, .detail-grid .side { display: grid; gap: 14px; min-width: 0; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 12px 12px; }
.timeline li::before { content: ''; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--good); border: 2px solid var(--card); }
.timeline li:first-child::before { background: var(--navy); }
.timeline li b { display: block; font-size: 13.5px; }
.timeline li small { color: var(--muted); font-size: 12px; }
.timeline li p { margin: 3px 0 0; font-size: 12.5px; }
@media (max-width: 1200px) { .trip-sum { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .detail-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .trip-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Excel buttons */
.toolbar .tools { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.toolbar .tools .btn .i, .cardxls .i { width: 15px; height: 15px; }
.card-head .cardxls { margin-left: auto; }
.card > .cardxls { float: right; margin: -4px 0 6px 8px; }
.card > h2.with-xls { display: inline-block; }
.card > h2.with-xls + .cardxls { float: right; }
/* Driver Scores, promised dates, e-way bills */
.score-pill { display: inline-block; min-width: 38px; text-align: center; padding: 2px 8px; border-radius: 8px; font-size: 15px; }
.score-pill.ok { background: var(--good-soft); color: var(--good); } .score-pill.warn { background: var(--warn-soft); color: var(--warn); } .score-pill.bad { background: var(--bad-soft); color: var(--bad); }
.pct-ok { color: var(--good); font-weight: 600; } .pct-warn { color: var(--warn); font-weight: 600; } .pct-bad { color: var(--bad); font-weight: 600; }
small.up { color: var(--good); font-weight: 700; } small.down { color: var(--bad); font-weight: 700; }
td small.late, dd small.late { color: var(--bad); font-weight: 700; }
/* Start Fresh */
.danger-zone { border-color: var(--bad); }
.danger-zone h2 { color: var(--bad); }
.field.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.field.check input { width: 18px; height: 18px; margin-top: 2px; flex: none; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:disabled { opacity: .6; }

/* Parcels */
.parcel-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 980px) { .parcel-grid { grid-template-columns: 1fr; } }
.price-card { position: sticky; top: 70px; }
.price-total { font-size: 30px; font-weight: 800; color: var(--accent, var(--text)); margin: 8px 0 4px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 600; }
.seg label:has(input:checked) { border-color: var(--accent, #d9213a); background: var(--bad-soft); }
.seg.big label { padding: 12px 16px; font-size: 15px; }
.big-btn { width: 100%; justify-content: center; margin-top: 16px; padding: 14px; font-size: 16px; }
.booked { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: center; }
.lr-big { font-size: 34px; font-weight: 800; letter-spacing: .04em; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.bar { height: 10px; background: var(--line); border-radius: 6px; overflow: hidden; margin: 6px 0 12px; } .bar i { display: block; height: 100%; background: var(--good); transition: width .2s; }
.scanbox label { display: block; font-weight: 700; margin-bottom: 6px; }
.scanrow { display: flex; gap: 8px; } .scan-in { flex: 1; font-size: 18px; padding: 12px; letter-spacing: .05em; }
.scan-cam { margin-top: 10px; } .scan-cam video { width: 100%; max-width: 420px; border-radius: 10px; display: block; margin-bottom: 6px; background: #000; }
.scan-log { list-style: none; padding: 0; margin: 10px 0 0; max-height: 260px; overflow: auto; }
.scan-log li { padding: 7px 10px; border-radius: 8px; margin-bottom: 4px; font-weight: 600; }
.scan-log li.ok { background: var(--good-soft); color: var(--good); } .scan-log li.warn { background: var(--warn-soft); color: var(--warn); } .scan-log li.bad { background: var(--bad-soft); color: var(--bad); }
.scan-find input { width: 100%; font-size: 16px; padding: 10px 12px; }
.inline-pick { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.rate-edit input, .rate-edit select { width: 100%; min-width: 70px; }
td small.late { display: block; color: var(--bad); font-weight: 700; }.seg input[type=radio] { width: auto; height: auto; margin: 0; flex: none; }
.seg label { white-space: nowrap; }

/* Parcel invoices, dashboard and department P&L */
.notice { background: var(--warn-soft); color: var(--text, inherit); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.pnl { width: 100%; border-collapse: collapse; }
.pnl td, .pnl th { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.pnl td.num { text-align: right; white-space: nowrap; }
.pnl tr.sec th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-top: 12px; }
.pnl tr.tot td { font-weight: 600; }
.pnl tr.big td { font-size: 16px; border-bottom: 0; }
.pnl small { color: var(--muted); font-size: 11px; }
/* Slim moving bar at the top while a screen loads (added by render() after a short moment) */
.main.busy::before{content:"";position:fixed;top:0;left:0;z-index:60;height:3px;width:35%;background:linear-gradient(90deg,transparent,#e8384f,transparent);animation:fxbar 1s ease-in-out infinite;pointer-events:none}
.main.busy #view{opacity:.6;transition:opacity .2s .15s}
@keyframes fxbar{from{transform:translateX(-100%)}to{transform:translateX(300%)}}
@media (prefers-reduced-motion:reduce){.main.busy::before{animation:none;width:100%;opacity:.6}}
/* Pickers in a screen's header (Branch, date, driver, truck): a tidy card with a small caption and a clear dropdown */
.inline-pick { display: inline-flex; align-items: center; gap: 4px; height: 42px; padding: 0 4px 0 14px; background: var(--card); border: 1px solid var(--line); border-radius: 11px;
  color: var(--quiet); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; box-shadow: 0 1px 2px rgba(15,20,40,.06); transition: border-color .15s, box-shadow .15s; }
.inline-pick:hover { border-color: var(--quiet); }
.inline-pick:focus-within { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(29,45,101,.14); }
:root[data-theme="dark"] .inline-pick:focus-within { border-color: var(--series); box-shadow: 0 0 0 3px rgba(142,162,230,.18); }
.inline-pick select, .actions > select { -webkit-appearance: none; appearance: none; cursor: pointer; font: 600 13.5px/1.2 Inter, system-ui, "Segoe UI", sans-serif; color: var(--ink); letter-spacing: 0; text-transform: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a92a8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  max-width: 340px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.inline-pick select { border: 0; border-radius: 8px; height: 34px; padding: 0 32px 0 8px; }
.inline-pick select:hover { background-color: var(--field); }
.inline-pick select:focus { outline: none; }
.inline-pick select option, .actions > select option { font-weight: 500; text-transform: none; }
.actions > select, .actions > input[type="date"], .actions > input[type="month"], .actions > input[type="search"] { height: 42px; border: 1px solid var(--line); border-radius: 11px; background-color: var(--card); color: var(--ink);
  box-shadow: 0 1px 2px rgba(15,20,40,.06); transition: border-color .15s, box-shadow .15s; }
.actions > select { padding: 0 34px 0 12px; }
.actions > input[type="date"], .actions > input[type="month"], .actions > input[type="search"] { padding: 0 12px; font: 600 13.5px Inter, system-ui, "Segoe UI", sans-serif; }
.actions > select:hover, .actions > input:hover { border-color: var(--quiet); }
.actions > select:focus, .actions > input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(29,45,101,.14); }
:root[data-theme="dark"] .actions > select:focus, :root[data-theme="dark"] .actions > input:focus { border-color: var(--series); box-shadow: 0 0 0 3px rgba(142,162,230,.18); }
.actions { align-items: center; }
.actions > .chip.plain { height: 42px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 11px; font-weight: 600; }
@media (max-width: 640px) { .inline-pick { width: 100%; } .inline-pick select { flex: 1; max-width: none; } }
/* ---------- Counter Booking: numbered cards, clear labels, white fields, a price summary that stays in view ---------- */
.field label .opt { font-weight: 500; color: var(--quiet); font-size: 11.5px; margin-left: 4px; }
.pc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; max-width: 1440px; }
.pc-form { display: grid; gap: 16px; min-width: 0; }
.pc-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.pc-card { padding: 18px 20px 20px; }
.pc-h { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.pc-h h2 { margin: 0; font-size: 16px; line-height: 24px; }
.pc-h p { margin: 0; color: var(--muted); font-size: 12.5px; }
.pc-step { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font: 700 12.5px Inter, system-ui, sans-serif; }
:root[data-theme="dark"] .pc-step { background: var(--series); color: #0f1428; }
.pc-four { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.pc-four + .pc-four { margin-top: 12px; }
.pc-span2 { grid-column: span 2; }
.pc-gap { margin-top: 14px; }
.pc-form .field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.pc-form .field input, .pc-form .field select, .pc-form .field textarea { background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; font-size: 14px; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.pc-form .field input::placeholder, .pc-form .field textarea::placeholder { color: var(--quiet); }
.pc-form .field input:hover, .pc-form .field select:hover, .pc-form .field textarea:hover { border-color: var(--quiet); }
.pc-form .field input:focus, .pc-form .field select:focus, .pc-form .field textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(29,45,101,.14); }
:root[data-theme="dark"] .pc-form .field input:focus, :root[data-theme="dark"] .pc-form .field select:focus, :root[data-theme="dark"] .pc-form .field textarea:focus { border-color: var(--series); box-shadow: 0 0 0 3px rgba(142,162,230,.2); }
.pc-phone { display: flex; align-items: stretch; background: var(--card); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.pc-phone:hover { border-color: var(--quiet); }
.pc-phone span { display: flex; align-items: center; padding: 0 11px; background: var(--field); color: var(--muted); font-weight: 600; font-size: 13.5px; border-right: 1px solid var(--line); }
.pc-form .pc-phone input { border: 0; border-radius: 0; box-shadow: none; flex: 1; min-width: 0; letter-spacing: .02em; }
.pc-form .pc-phone input:focus { box-shadow: none; }
.pc-phone:focus-within { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(29,45,101,.14); }
:root[data-theme="dark"] .pc-phone:focus-within { border-color: var(--series); box-shadow: 0 0 0 3px rgba(142,162,230,.2); }
.pc-phone.bad, .pc-phone.bad:focus-within { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(196,30,54,.12); }
.pc-err { display: block; color: var(--bad); font-size: 12px; margin-top: 5px; }
.pc-form .seg label { background: var(--card); }
.pc-form .seg label:has(input:checked) { border-color: var(--navy); background: var(--navy-soft); color: var(--navy); }
:root[data-theme="dark"] .pc-form .seg label:has(input:checked) { border-color: var(--series); color: var(--ink); }
.pc-form .seg input[type=radio] { accent-color: var(--navy); }
.pc-more { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.pc-more summary { cursor: pointer; color: var(--navy); font-weight: 600; font-size: 13.5px; }
:root[data-theme="dark"] .pc-more summary { color: var(--series); }
.pc-more[open] summary { margin-bottom: 12px; }
.pc-hint { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }
.pc-check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-weight: 500; cursor: pointer; }
.pc-side { position: sticky; top: 70px; display: grid; gap: 12px; }
.pc-side .price-card { position: static; padding: 18px 20px; }
.pc-side .price-card h2 { margin-top: 0; }
.pc-side .big-btn { margin-top: 0; padding: 15px; font-size: 16px; border-radius: 11px; }
@media (max-width: 1180px) { .pc-layout { grid-template-columns: minmax(0, 1fr); } .pc-side { position: static; } }
@media (max-width: 900px) { .pc-two { grid-template-columns: minmax(0, 1fr); } .pc-four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Excel and PDF buttons side by side on a card */
.card-head .cardxls + .cardxls { margin-left: 6px; }
.card > .cardxls + .cardxls { margin-right: 0; }
.toolbar .tools .btn + .btn { margin-left: 0; }
