/* IT Lobby Delivery Partners portal
   One stylesheet, system font stack, no framework. Strict CSP: no inline styles,
   so every visual state is a class here. */

:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8ef;
  --border-strong: #cfd7e3;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --primary: #0f3d6e;
  --primary-2: #13508f;
  --primary-soft: #e8f0fa;
  --accent: #2563eb;
  --success: #15803d;
  --success-soft: #e9f7ef;
  --warning: #b45309;
  --warning-soft: #fff6e6;
  --danger: #b91c1c;
  --danger-soft: #fdecec;
  --info: #0e7490;
  --info-soft: #e6f6f9;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .05);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, .18);
  --sidebar: 248px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon { width: 18px; height: 18px; flex: 0 0 auto; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--primary); color: #fff; padding: 8px 12px; border-radius: var(--radius-sm); }
.skip-link:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
  display: flex; flex-direction: column;
  background: #0b2440; color: #cbd5e1;
  z-index: 40; transition: transform .25s var(--ease);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 18px; color: #fff; }
.brand-mark { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: #fff; box-shadow: 0 2px 8px rgba(15, 23, 42, .18); flex: 0 0 auto; }
.brand-mark img { width: 30px; height: 30px; object-fit: contain; display: block; }
.brand-lg .brand-mark { width: 48px; height: 48px; border: 1px solid var(--border); box-shadow: none; }
.brand-lg .brand-mark img { width: 36px; height: 36px; }
.brand-text { font-size: 15px; letter-spacing: .01em; }
.brand-text strong { font-weight: 800; margin-left: 2px; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 12px; flex: 1; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: #cbd5e1; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav-link.is-active { background: rgba(37, 99, 235, .22); color: #fff; box-shadow: inset 3px 0 0 #3b82f6; }
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255, 255, 255, .08); display: grid; gap: 10px; }
.company-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.company-chip img, .avatar { width: 36px; height: 36px; border-radius: 10px; object-fit: contain; background: #fff; flex: 0 0 auto; }
.avatar { display: grid; place-items: center; background: #1e3a5f; color: #fff; font-weight: 700; }
.company-chip-text { display: grid; min-width: 0; }
.company-chip-text strong { color: #fff; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-chip-text small { color: #94a3b8; font-size: 12px; }
.sidebar .btn-ghost { color: #cbd5e1; border-color: rgba(255, 255, 255, .14); }
.sidebar .btn-ghost:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar-backdrop { display: none; }

.main-wrap { flex: 1; min-width: 0; margin-left: var(--sidebar); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: 64px; padding: 0 28px;
  background: rgba(244, 246, 250, .86);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.page-title { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-company { color: var(--muted); font-weight: 600; font-size: 13px; }
.icon-btn.menu-btn { display: none; }
.content { padding: 24px 28px 48px; width: 100%; outline: none; }

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 35; }
  .main-wrap { margin-left: 0; }
  .icon-btn.menu-btn { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px 40px; }
  .topbar-company { display: none; }
}

/* ---------- Primitives ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { font-size: 15px; font-weight: 700; }
.card-sub { color: var(--muted); font-size: 12.5px; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-head { padding: 16px 18px 0; }

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid-kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
@media (max-width: 1200px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 .span-2 { grid-column: span 2; } }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } .span-2, .grid-3 .span-2 { grid-column: auto; } }

.kpi { position: relative; display: grid; gap: 4px; padding: 16px 18px; }
.kpi-label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi-value { font-size: 22px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-value small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.kpi-hint { color: var(--faint); font-size: 12px; }
.kpi-accent { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-2); }
.kpi.is-good .kpi-value { color: var(--success); }
.kpi.is-warn .kpi-value { color: var(--warning); }
.kpi.is-bad .kpi-value { color: var(--danger); }

.queue-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; color: inherit; transition: border-color .15s, transform .15s var(--ease); }
.queue-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }
.queue-num { font-size: 24px; font-weight: 800; min-width: 44px; font-variant-numeric: tabular-nums; }
.queue-label { font-weight: 600; color: var(--text-2); }
.queue-sub { color: var(--muted); font-size: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn-danger { color: var(--danger); border-color: #f3c7c7; }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 46px; font-size: 15px; }
.btn-block { width: 100%; }
.btn.is-loading { pointer-events: none; opacity: .7; }
.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.input[type="date"] { min-width: 0; }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .help { font-size: 12px; color: var(--muted); }
.req { color: var(--danger); }
.form { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.col-12 { grid-column: span 12; } .col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-8 { grid-column: span 8; }
@media (max-width: 640px) { .col-6, .col-4, .col-3, .col-8 { grid-column: span 12; } }
.form-section-title { grid-column: span 12; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding-top: 6px; border-top: 1px solid var(--border); margin-top: 4px; }
.form-section-title:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); }
.check:hover { border-color: var(--faint); }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.check.is-off { opacity: .6; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.filters { display: grid; grid-template-columns: minmax(200px, 2fr) repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.filters .input, .filters .select { height: 36px; }
.segmented { display: inline-flex; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 0 12px; height: 30px; border-radius: 6px; font-weight: 600; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.segmented button.is-active { background: var(--primary); color: #fff; }
.date-range { display: inline-flex; align-items: center; gap: 6px; }
.date-range .input { height: 36px; width: 150px; }

.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; border: 1px solid transparent; }
.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: #f5c2c2; }
.alert-info { background: var(--info-soft); color: var(--info); border-color: #b5e3ec; }
.alert-warn { background: var(--warning-soft); color: var(--warning); border-color: #f6d9a8; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; background: #eef2f7; color: #475569; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-plain::before { display: none; }
.st-new { background: #eef2ff; color: #4338ca; }
.st-accepted { background: #e0f2fe; color: #0369a1; }
.st-assigned { background: #f3e8ff; color: #7e22ce; }
.st-picked_up { background: #e6f6f9; color: #0e7490; }
.st-out_for_delivery { background: #fff6e6; color: #b45309; }
.st-delivered, .st-active, .st-paid { background: var(--success-soft); color: var(--success); }
.st-failed, .st-suspended, .st-expired { background: var(--danger-soft); color: var(--danger); }
.st-returned { background: #fff1e7; color: #c2410c; }
.st-cancelled, .st-inactive { background: #f1f5f9; color: #64748b; }
.st-pending { background: #fff6e6; color: #b45309; }
.pay-cash { background: #fff6e6; color: #92400e; }
.pay-online { background: #e0f2fe; color: #0369a1; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #f8fbff; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.is-click { cursor: pointer; }
.table tr.is-selected { background: #eef5ff; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .check-col { width: 36px; padding-right: 0; }
.table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }
.t-main { font-weight: 650; color: var(--text); }
.t-sub { color: var(--muted); font-size: 12px; }
.t-mono { font-family: var(--mono); font-size: 12.5px; }
.pos { color: var(--warning); font-weight: 700; }
.neg { color: var(--success); font-weight: 700; }
.text-muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }

.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.pager { display: flex; gap: 4px; align-items: center; }
.pager button { min-width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); cursor: pointer; font-weight: 600; color: var(--text-2); }
.pager button.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager button:disabled { opacity: .45; cursor: default; }

.strip { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); font-size: 13px; color: var(--muted); }
.strip strong { color: var(--text); font-variant-numeric: tabular-nums; }

.bulk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; background: #eef5ff; border-bottom: 1px solid #cfe0fb; }
.bulk-bar .select { width: auto; min-width: 200px; height: 34px; }

/* ---------- Empty / loading / error ---------- */
.empty { text-align: center; padding: 42px 16px; color: var(--muted); }
.empty-title { font-weight: 700; color: var(--text-2); margin-bottom: 4px; }
.error-box { padding: 16px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.skeleton { position: relative; overflow: hidden; background: #edf1f6; border-radius: 6px; min-height: 14px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .6), transparent); animation: shimmer 1.3s infinite; }
.sk-line { height: 14px; margin: 6px 0; }
.sk-lg { height: 26px; width: 60%; }
.sk-block { height: 220px; }
@keyframes shimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skeleton::after { animation: none; } * { transition: none !important; } }

/* ---------- Charts ---------- */
.chart { width: 100%; min-height: 220px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { stroke: var(--border); stroke-width: 1; }
.chart .grid-line { stroke: #edf1f6; stroke-width: 1; }
.chart .tick { fill: var(--faint); font-size: 10.5px; }
.chart .series-a { stroke: #2563eb; fill: none; stroke-width: 2.25; }
.chart .series-b { stroke: #16a34a; fill: none; stroke-width: 2.25; }
.chart .area-a { fill: rgba(37, 99, 235, .10); stroke: none; }
.chart .bar { fill: #2563eb; }
.chart .bar-b { fill: #14b8a6; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover + .hover-line, .chart .hover-line.is-on { opacity: 1; }
.chart .dot-a { fill: #2563eb; }
.chart .dot-b { fill: #16a34a; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg-a { background: #2563eb; } .lg-b { background: #16a34a; } .lg-c { background: #14b8a6; }
.chart-tip { position: fixed; z-index: 80; pointer-events: none; background: #0f172a; color: #fff; padding: 8px 10px; border-radius: 8px; font-size: 12px; box-shadow: var(--shadow-lg); white-space: nowrap; }
.chart-tip strong { display: block; margin-bottom: 2px; }

.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { width: 160px; height: 160px; flex: 0 0 auto; }
.donut-center { font-size: 22px; font-weight: 800; fill: var(--text); }
.donut-center-sub { font-size: 10px; fill: var(--muted); }
.donut-legend { display: grid; gap: 6px; flex: 1; min-width: 150px; font-size: 12.5px; }
.donut-legend div { display: flex; align-items: center; gap: 8px; }
.donut-legend b { margin-left: auto; font-variant-numeric: tabular-nums; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.sw-new { background: #6366f1; } .sw-accepted { background: #0ea5e9; } .sw-assigned { background: #a855f7; }
.sw-picked_up { background: #06b6d4; } .sw-out_for_delivery { background: #f59e0b; } .sw-delivered { background: #16a34a; }
.sw-failed { background: #dc2626; } .sw-returned { background: #ea580c; } .sw-cancelled { background: #94a3b8; }
.donut .seg-new { stroke: #6366f1; } .donut .seg-accepted { stroke: #0ea5e9; } .donut .seg-assigned { stroke: #a855f7; }
.donut .seg-picked_up { stroke: #06b6d4; } .donut .seg-out_for_delivery { stroke: #f59e0b; } .donut .seg-delivered { stroke: #16a34a; }
.donut .seg-failed { stroke: #dc2626; } .donut .seg-returned { stroke: #ea580c; } .donut .seg-cancelled { stroke: #94a3b8; }
.donut .seg-empty { stroke: #edf1f6; }

.hbars { display: grid; gap: 10px; }
.hbar { display: grid; gap: 4px; }
.hbar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.hbar-top span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-top b { font-variant-numeric: tabular-nums; }
.hbar-track { height: 8px; border-radius: 99px; background: #edf1f6; overflow: hidden; }
.hbar-track svg { display: block; width: 100%; height: 8px; }
.hbar-track rect { fill: #2563eb; }

.money-list { display: grid; gap: 2px; }
.money-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.money-row:last-child { border-bottom: 0; }
.money-row span { color: var(--text-2); }
.money-row b { font-variant-numeric: tabular-nums; }
.money-hero { padding: 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 8px; }
.money-hero .kpi-value { font-size: 26px; }
.money-hero.owes { background: var(--warning-soft); border-color: #f6d9a8; }
.money-hero.owed { background: var(--success-soft); border-color: #bfe5cc; }

/* ---------- Modal & drawer ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(15, 23, 42, .5); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; animation: fade .18s var(--ease); }
.modal { width: 100%; max-width: 640px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); animation: rise .22s var(--ease); display: flex; flex-direction: column; max-height: 88vh; }
.modal-lg { max-width: 900px; }
.modal-head, .drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2, .drawer-head h2 { font-size: 16px; font-weight: 700; }
.modal-head .icon-btn, .drawer-head .icon-btn { margin-left: auto; border: 0; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.modal-foot .spacer { flex: 1; }
.overlay.is-drawer { padding: 0; justify-content: flex-end; align-items: stretch; }
.drawer { width: min(640px, 100%); height: 100%; background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .24s var(--ease); }
.drawer-body { padding: 18px 20px 28px; overflow-y: auto; flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
body.no-scroll { overflow: hidden; }

.detail-section { margin-bottom: 22px; }
.detail-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.action-box { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline .t-sub { display: block; }
.items-table td { padding: 8px 10px; }
.totals { display: grid; gap: 4px; margin-top: 10px; font-size: 13.5px; }
.totals div { display: flex; justify-content: space-between; }
.totals .grand { font-weight: 800; font-size: 15px; padding-top: 6px; border-top: 1px solid var(--border); }
.collect-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--warning-soft); color: var(--warning); font-weight: 700; margin-bottom: 18px; }
.collect-banner.is-paid { background: var(--success-soft); color: var(--success); }

/* ---------- Toasts ---------- */
.toast-host { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { padding: 12px 14px; border-radius: 10px; background: #0f172a; color: #fff; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: rise .2s var(--ease); }
.toast.is-error { background: var(--danger); }
.toast.is-success { background: #166534; }

/* ---------- Driver cards / chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; background: #eef2f7; color: #475569; font-size: 12px; font-weight: 600; }
.chip-warn { background: var(--danger-soft); color: var(--danger); }
.summary-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.summary-pills .pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.summary-pills .pill b { color: var(--text); }

.coverage-list { display: grid; gap: 10px; }
.coverage-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.coverage-item h4 { margin: 0 0 6px; font-size: 14px; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.circle-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--muted); padding: 4px 0; border-top: 1px dashed var(--border); }
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.profile-head img, .profile-head .avatar { width: 64px; height: 64px; border-radius: 14px; border: 1px solid var(--border); font-size: 24px; }

/* ---------- Auth ---------- */
.auth-body { background: #0b2440; }
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); }
.auth-panel { background: var(--surface); padding: 56px clamp(24px, 6vw, 72px); display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.auth-panel .brand { padding: 0; color: var(--text); }
.auth-title { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.auth-sub { margin: -8px 0 6px; color: var(--muted); }
.auth-foot { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }
.auth-aside { position: relative; overflow: hidden; color: #e2e8f0; display: flex; align-items: center; padding: 56px; background: radial-gradient(1200px 600px at 80% -10%, #1d4ed8 0%, transparent 60%), radial-gradient(800px 500px at 0% 110%, #0891b2 0%, transparent 55%), #0b2440; }
.auth-aside-inner { max-width: 440px; }
.auth-aside h2 { font-size: 34px; font-weight: 800; color: #fff; letter-spacing: -.02em; margin-bottom: 18px; }
.auth-aside ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; font-size: 15px; }
.auth-aside li { padding-left: 28px; position: relative; }
.auth-aside li::before { content: ""; position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: rgba(56, 189, 248, .25); box-shadow: inset 0 0 0 5px #38bdf8; }
@media (max-width: 900px) { .auth { grid-template-columns: minmax(0, 1fr); } .auth-aside { display: none; } .auth-panel { padding: 40px 20px; } }
.mb-16 { margin-bottom: 16px; }
.form > .form-section-title { grid-column: auto; }

/* ================= v1.1: topbar menu, queue, orders, exports ================= */

/* ---------- Top bar: bell + profile menu ---------- */
.topbar-right { gap: 10px; }
.bell { position: relative; color: var(--text-2); }
.bell:hover { text-decoration: none; }
.bell.is-ringing .icon { animation: ring 1s var(--ease) 2; transform-origin: 50% 0; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(14deg); } 40% { transform: rotate(-12deg); } 60% { transform: rotate(8deg); } 80% { transform: rotate(-4deg); } }
.bell-badge, .nav-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.bell-badge { position: absolute; top: -5px; right: -5px; box-shadow: 0 0 0 2px var(--bg); }
.nav-badge { margin-left: auto; }

.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 4px 10px 4px 5px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.user-btn:hover, .user-btn[aria-expanded="true"] { border-color: var(--border-strong); box-shadow: var(--shadow); }
.user-btn .avatar, .menu-head .avatar { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--primary); color: #fff; font-weight: 700; object-fit: contain; flex: 0 0 auto; }
.avatar-img { background: #fff !important; border: 1px solid var(--border); }
.user-btn-text { display: grid; text-align: left; line-height: 1.2; max-width: 180px; }
.user-btn-text strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn-text small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-sm { width: 14px; height: 14px; color: var(--muted); }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 270px; z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; animation: rise .16s var(--ease);
}
.menu-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-head .avatar-lg { width: 40px; height: 40px; }
.menu-head div { display: grid; min-width: 0; }
.menu-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-head small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-2); font-weight: 500; font-size: 13.5px; cursor: pointer; text-align: left;
}
.menu-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.menu-item.is-danger { color: var(--danger); }
.menu-item.is-danger:hover { background: var(--danger-soft); }
.menu-form { margin: 6px 0 0; padding-top: 6px; border-top: 1px solid var(--border); }
@media (max-width: 640px) { .user-btn-text { display: none; } .user-btn { padding: 4px; } }

/* ---------- Buttons ---------- */
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-success { background: #15803d; border-color: #15803d; color: #fff; }
.btn-success:hover { background: #166534; border-color: #166534; }

/* ---------- Status chips (orders) ---------- */
.status-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 14px; scrollbar-width: thin; }
.status-tab {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; flex: 0 0 auto;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font-weight: 600; font-size: 12.5px; color: var(--text-2); cursor: pointer; white-space: nowrap;
}
.status-tab b { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: #eef2f7; color: var(--text-2); font-size: 11.5px; line-height: 20px; text-align: center; }
.status-tab:hover { border-color: var(--faint); }
.status-tab.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.status-tab.is-active b { background: rgba(255, 255, 255, .2); color: #fff; }
.filters-advanced { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.filters-advanced .input, .filters-advanced .select { height: 36px; }
.grid-kpis-sm { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.grid-kpis-sm .kpi { padding: 13px 15px; }
.grid-kpis-sm .kpi-value { font-size: 18px; }
.per-page { display: inline-flex; align-items: center; gap: 8px; }
.per-page .select { height: 32px; width: auto; }

/* ---------- Order modal ---------- */
.modal-xl { max-width: 1180px; }
.order-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 22px; }
@media (max-width: 900px) { .order-layout { grid-template-columns: minmax(0, 1fr); } }
.map-box { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #eef2f7; }
.map-box iframe { display: block; width: 100%; height: 300px; border: 0; }
.map-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border-top: 1px solid var(--border); background: var(--surface); }
.map-empty { display: grid; place-items: center; height: 180px; color: var(--muted); font-size: 13px; text-align: center; padding: 16px; }
.order-head-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- Queue board ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(260px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; padding-bottom: 6px; }
.lane { background: #eef2f7; border-radius: 14px; padding: 10px; min-height: 240px; display: flex; flex-direction: column; gap: 10px; }
.lane-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 2px; font-weight: 700; font-size: 13.5px; }
.lane-head .count { margin-left: auto; min-width: 26px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--surface); font-size: 12px; line-height: 22px; text-align: center; color: var(--text-2); }
.lane-dot { width: 9px; height: 9px; border-radius: 50%; }
.lane-new .lane-dot { background: #6366f1; } .lane-accepted .lane-dot { background: #0ea5e9; }
.lane-road .lane-dot { background: #f59e0b; } .lane-failed .lane-dot { background: #dc2626; }
.lane-hint { font-size: 12px; color: var(--muted); padding: 0 4px; }
.qcard { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; box-shadow: 0 1px 2px rgba(15, 23, 42, .05); display: grid; gap: 8px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.qcard:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.qcard.is-fresh { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99, 102, 241, .18); animation: pulse 1.6s var(--ease) 3; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(99, 102, 241, .08); } }
.qcard-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qcard-num { font-family: var(--mono); font-size: 12px; font-weight: 700; }
.qcard-age { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.qcard-age.is-late { color: var(--danger); font-weight: 700; }
.qcard-cust { font-weight: 650; }
.qcard-addr { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qcard-money { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.qcard-actions { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 4px; border-top: 1px dashed var(--border); }
.qcard-actions .select { height: 32px; flex: 1; min-width: 0; font-size: 12.5px; }
.lane-empty { text-align: center; padding: 26px 10px; color: var(--faint); font-size: 12.5px; border: 1px dashed var(--border-strong); border-radius: 12px; }
.live-dot { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.live-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, .5); animation: live 2s infinite; }
.live-dot.is-off::before { background: var(--faint); animation: none; }
@keyframes live { 70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
.toast.is-order { background: #1e1b4b; cursor: pointer; }
.toast.is-order strong { display: block; }

Parse error: syntax error, unexpected token "/" in Command line code on line 6
.table-foot-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: 1; flex-wrap: wrap; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--border); padding: 11px 14px; }
.toolbar .input[type="search"] { width: 260px; max-width: 100%; }
.qcard-num { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filters-advanced input[type="search"] { grid-column: span 2; }
@media (max-width: 640px) { .filters-advanced input[type="search"] { grid-column: auto; } }

/* ---------- Driver badges & scanner ---------- */
.badge-card { width: 100%; max-width: 430px; margin: 4px auto 12px; aspect-ratio: 85.6 / 54; border-radius: 16px; overflow: hidden; background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.badge-card-band { display: flex; align-items: center; gap: 10px; height: 19%; padding: 0 16px; background: linear-gradient(90deg, #0f3d6e, #1d4ed8); color: #fff; font-weight: 800; }
.badge-card-band img { width: 30px; height: 30px; border-radius: 7px; background: #fff; object-fit: contain; }
.badge-card-band span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-card-band em { font-style: normal; font-size: 10px; letter-spacing: .14em; opacity: .85; }
.badge-card-body { flex: 1; display: flex; flex-direction: column; padding: 12px 16px 10px; min-height: 0; }
.badge-card-name { font-size: 19px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-card-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12px; color: var(--text-2); margin-top: 2px; }
.badge-card-code { margin-top: auto; text-align: center; }
.badge-card-code .barcode { display: block; width: 100%; height: 64px; }
.badge-card-code { padding-bottom: 6px; }
.badge-card-code .t-mono { font-size: 11px; letter-spacing: .04em; margin-top: 4px; }
.badge-note { text-align: center; max-width: 520px; margin: 0 auto; }
.scan-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.scan-input { flex: 1; min-width: 220px; height: 46px; font-family: var(--mono); font-size: 15px; letter-spacing: .03em; }
.scan-form .btn { height: 46px; }
.scan-video { width: 100%; max-height: 300px; border-radius: 12px; background: #000; margin-bottom: 14px; object-fit: cover; }
.scan-ok { border: 1px solid #bfe5cc; background: var(--success-soft); border-radius: 12px; padding: 14px; margin-bottom: 16px; display: grid; gap: 10px; }
.scan-ok-head { display: flex; align-items: center; gap: 12px; }
.scan-check { width: 36px; height: 36px; border-radius: 50%; background: var(--success); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; flex: 0 0 auto; }
.scan-list { display: grid; gap: 6px; margin-bottom: 10px; max-height: 260px; overflow-y: auto; }
.scan-order { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: var(--surface); }
.scan-order:hover { border-color: var(--faint); }
.scan-order.is-static { cursor: default; }
.scan-order input { width: 18px; height: 18px; accent-color: var(--primary); flex: 0 0 auto; }
.scan-order > span:nth-child(2), .scan-order.is-static > span:first-child { flex: 1; min-width: 0; }
.scan-order .num { white-space: nowrap; font-weight: 700; font-size: 12.5px; }
.pill.chip-warn { background: var(--danger-soft); color: var(--danger); border-color: #f5c2c2; }
/* Proof of delivery photos */
.proof-photos { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.proof-photo { margin: 0; width: 180px; }
.proof-photo-ph { height: 135px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.proof-photo-img { display: block; width: 180px; height: 135px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.proof-photo figcaption { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
