/* ==========================================================================
   United Express CRM theme — plain CSS on top of Filament (no Node build).
   Filament 4/5 ships its styles in CSS layers; these rules are unlayered,
   so they win without !important. Edit the variables to rebrand.
   ========================================================================== */
:root {
  /* Theme B "Petrol + Saffron" — every text/background pair meets WCAG AA (4.5:1) */
  --crm-p: #155e75;      /* primary: petrol (white text 7.3:1) */
  --crm-p2: #0e7490;     /* primary light */
  --crm-pl: #cffafe;     /* primary tint */
  --crm-accent: #d97706; /* saffron — logo only */
  --crm-ink: #0f172a;
  --crm-mut: #5b6b80;    /* muted text (4.9:1 on the page background) */
  --crm-line: #dbe3ec;
  --crm-bg: #f3f7f9;
  --crm-card: #ffffff;
  --crm-nav: #0a1a22;    /* sidebar */
  --crm-amber: #f59e0b;
  --crm-red: #ef4444;
  --crm-green: #10b981;
  --crm-blue: #3b82f6;
  --crm-radius: 12px;
  --crm-shadow: none;    /* cards use a border; only pop-ups get a shadow */
}
body { font-variant-numeric: tabular-nums; }   /* counters don't jump */
.dark {
  --crm-ink: #e2e8f0;
  --crm-mut: #94a3b8;
  --crm-line: #1e293b;
  --crm-bg: #0a101d;
  --crm-card: #111a2e;
  --crm-pl: rgba(8,145,178,.15);
  --crm-shadow: 0 1px 2px rgba(0,0,0,.3);
}

/* ---------- page background ---------- */
body.fi-body, .fi-body { background: var(--crm-bg); }
.fi-main-ctn { background: transparent; }

/* ---------- sidebar (dark navy in both modes) ---------- */
.fi-sidebar { background: var(--crm-nav); border: 0; color: #cbd5e1; }
/* safety net: whatever the inner class names are, text and icons stay light on navy */
:where(.fi-sidebar :is(a, button, span, svg):not(.fi-badge):not(.fi-badge *)) { color: #cbd5e1; }
.fi-sidebar :is(.fi-active, .fi-sidebar-item-active, [aria-current="page"]) :is(a, span, svg):not(.fi-badge):not(.fi-badge *),
.fi-sidebar a[aria-current="page"], .fi-sidebar a[aria-current="page"] :is(span, svg) { color: #67e8f9; }
.fi-sidebar-header { background: var(--crm-nav); box-shadow: none; border-bottom: 1px solid rgba(255,255,255,.06); }
.fi-sidebar-nav { scrollbar-color: #1e293b transparent; }
.fi-sidebar-group-label { color: #94a3b8; font-size: .75rem; letter-spacing: .02em; }
.fi-sidebar-group-btn, .fi-sidebar-group-button { color: #94a3b8; }
.fi-sidebar-group-collapse-btn, .fi-sidebar-group-collapse-button { color: #94a3b8; }
.fi-sidebar-item-label { color: #cbd5e1; font-weight: 500; }
.fi-sidebar-item-icon, .fi-sidebar-item-grouped-border-part { color: #94a3b8; }
.fi-sidebar-item-btn, .fi-sidebar-item-button { border-radius: 11px; }
.fi-sidebar-item-btn:hover, .fi-sidebar-item-button:hover { background: rgba(255,255,255,.05); }
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn,
.fi-sidebar-item-active > .fi-sidebar-item-button,
.fi-sidebar-item.fi-active > a,
.fi-sidebar-item-active > a { background: rgba(8,145,178,.14); }
.fi-sidebar-item.fi-active .fi-sidebar-item-label,
.fi-sidebar-item-active .fi-sidebar-item-label,
.fi-sidebar-item.fi-active .fi-sidebar-item-icon,
.fi-sidebar-item-active .fi-sidebar-item-icon { color: #67e8f9; }
.fi-sidebar .fi-badge { border-radius: 99px; }
.fi-sidebar .fi-icon-btn { color: #94a3b8; }

/* ---------- brand ---------- */
.crm-brand { display: flex; align-items: center; gap: 10px; }
.crm-brand-logo { width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center;
  background: linear-gradient(135deg, #f59e0b, var(--crm-accent)); color: #fff; font-weight: 800; font-size: 14px;
  box-shadow: 0 6px 18px rgba(217,119,6,.30); overflow: hidden; }
.crm-brand-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.crm-brand-name { font-weight: 700; font-size: 15px; line-height: 1.2; color: var(--crm-ink); white-space: nowrap; }
.crm-brand-sub { font-size: 12px; color: var(--crm-mut); font-weight: 500; }
.fi-sidebar .crm-brand-name { color: #fff; }
.fi-sidebar .crm-brand-sub { color: #94a3b8; }

/* ---------- top bar ---------- */
.fi-topbar, .fi-topbar-ctn > nav { background: rgba(255,255,255,.85); backdrop-filter: blur(8px); box-shadow: none; border-bottom: 1px solid var(--crm-line); }
.dark .fi-topbar, .dark .fi-topbar-ctn > nav { background: rgba(17,26,46,.85); }
.fi-global-search-field .fi-input-wrp { border-radius: 8px; background: #f1f5f9; box-shadow: none; }
.dark .fi-global-search-field .fi-input-wrp { background: #0f172a; }

/* ---------- surfaces ---------- */
.fi-section, .fi-wi-stats-overview-stat, .fi-ta-ctn, .fi-fo-tabs, .fi-sc-tabs, .fi-in-entry-wrp-ctn {
  border-radius: var(--crm-radius); }
.fi-section, .fi-wi-stats-overview-stat, .fi-ta-ctn {
  box-shadow: var(--crm-shadow); border: 1px solid var(--crm-line); }
.dark .fi-section, .dark .fi-wi-stats-overview-stat, .dark .fi-ta-ctn { border-color: var(--crm-line); background: var(--crm-card); }
.fi-wi-stats-overview-stat-value { font-weight: 700; letter-spacing: -.01em; }
.fi-ta-header-cell { font-weight: 600; color: var(--crm-mut); }
.fi-ta-row:hover { background: rgba(8,145,178,.04); }
.fi-header-heading { font-weight: 700; letter-spacing: -.01em; }

/* ---------- controls ---------- */
.fi-btn { border-radius: 8px; font-weight: 600; }
.fi-btn.fi-color-primary, .fi-btn-color-primary { box-shadow: none; }
.fi-badge { border-radius: 99px; }
.fi-input-wrp { border-radius: 8px; }
.fi-modal-window { border-radius: 16px; box-shadow: 0 24px 48px -16px rgba(15,23,42,.35); }
.fi-dropdown-panel { border-radius: 10px; }

/* phone inputs keep digit groups in order inside the RTL layout */
input[type="tel"] { direction: ltr; text-align: end; unicode-bidi: plaintext; }
.crm-ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.crm-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; direction: ltr; unicode-bidi: isolate; font-weight: 600; }

/* ---------- toasts ---------- */
.fi-no-notification { border-radius: 16px; box-shadow: 0 14px 34px -12px rgba(15,23,42,.30); border-inline-start: 4px solid var(--crm-p); }

/* ---------- empty states ---------- */
.fi-ta-empty-state-icon-ctn, .fi-ta-empty-state-icon-bg { background: var(--crm-pl); border-radius: 14px; }
.fi-ta-empty-state-icon { color: var(--crm-p); } .dark .fi-ta-empty-state-icon { color: #67e8f9; }
.fi-ta-empty-state-heading { font-weight: 700; }

/* ==========================================================================
   Login page — split layout with a branded panel
   ========================================================================== */
.fi-simple-layout:has(.crm-auth-hero) { flex-direction: row; align-items: stretch; background: #fff; }
.dark .fi-simple-layout:has(.crm-auth-hero) { background: var(--crm-bg); }
.fi-simple-layout:has(.crm-auth-hero) > .fi-simple-main-ctn { flex: 1 1 0; }
.fi-simple-layout:has(.crm-auth-hero) .fi-simple-main { box-shadow: none; background: transparent; border: 0; }
.crm-auth-hero { order: 2; flex: 1.1 1 0; position: relative; overflow: hidden; color: #fff; padding: 56px;
  background: radial-gradient(circle at 30% 20%, #083344, #0a1a22 60%); display: flex; flex-direction: column; justify-content: space-between; }
.crm-auth-hero .ring { position: absolute; border-radius: 50%; border: 1px solid rgba(103,232,249,.15); }
.crm-auth-hero h2 { font-size: 38px; line-height: 1.35; font-weight: 700; margin: 0; }
.crm-auth-hero h2 span { color: #67e8f9; }
.crm-auth-hero p { color: #94a3b8; font-size: 16px; margin-top: 14px; max-width: 470px; }
.crm-auth-hero .chips { display: flex; gap: 12px; flex-wrap: wrap; position: relative; }
.crm-auth-hero .chip { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); border-radius: 16px; padding: 14px 18px; }
.crm-auth-hero .chip b { display: block; font-size: 18px; }
.crm-auth-hero .chip small { color: #94a3b8; font-size: 12.5px; }
.crm-auth-hero .live { align-self: flex-start; background: rgba(103,232,249,.15); color: #67e8f9; border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 600; position: relative; }
@media (max-width: 1023px) { .crm-auth-hero { display: none; } .fi-simple-layout:has(.crm-auth-hero) { flex-direction: column; } }

/* ==========================================================================
   Shared building blocks for the custom pages (crm-*)
   ========================================================================== */
.crm-card { background: var(--crm-card); border-radius: var(--crm-radius); padding: 16px 18px; box-shadow: var(--crm-shadow); border: 1px solid #eef2f6; min-width: 0; }
.dark .crm-card { border-color: var(--crm-line); }
.crm-card-title { font-weight: 700; font-size: 15px; color: var(--crm-ink); }
.crm-mut { color: var(--crm-mut); font-size: 12.5px; }
.crm-grid { display: grid; gap: 14px; }
.crm-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.crm-pill-success { background: #ecfdf5; color: #047857; } .crm-pill-danger { background: #fef2f2; color: #dc2626; }
.crm-pill-warning { background: #fffbeb; color: #b45309; } .crm-pill-info { background: #eff6ff; color: #1d4ed8; }
.crm-pill-primary { background: var(--crm-pl); color: #164e63; } .crm-pill-gray { background: #f1f5f9; color: #475569; }
.dark .crm-pill-success { background: rgba(16,185,129,.15); color: #34d399; } .dark .crm-pill-danger { background: rgba(239,68,68,.15); color: #f87171; }
.dark .crm-pill-warning { background: rgba(245,158,11,.15); color: #fbbf24; } .dark .crm-pill-info { background: rgba(59,130,246,.15); color: #60a5fa; }
.dark .crm-pill-primary { color: #67e8f9; } .dark .crm-pill-gray { background: #1e293b; color: #cbd5e1; }
.crm-avatar { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
  background: linear-gradient(135deg, #a5f3fc, #67e8f9); color: #065f46; }
.crm-avatar.round { border-radius: 50%; }
.crm-kpi-label { color: var(--crm-mut); font-size: 12.5px; }
.crm-kpi-value { font-size: 28px; font-weight: 700; color: var(--crm-ink); letter-spacing: -.01em; line-height: 1.25; }
.crm-kpi-icon { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-size: 16px; }
.crm-trend-good { color: #059669; font-size: 12px; font-weight: 600; } .crm-trend-bad { color: #dc2626; font-size: 12px; font-weight: 600; }
.crm-bar { height: 8px; background: #eef2f6; border-radius: 99px; overflow: hidden; } .dark .crm-bar { background: #1e293b; }
.crm-bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--crm-p2), var(--crm-p)); }
.crm-chip-btn { display: flex; align-items: center; gap: 8px; border: 1px solid var(--crm-line); border-radius: 8px; padding: 11px 12px;
  font-weight: 600; font-size: 13px; background: var(--crm-card); color: var(--crm-ink); cursor: pointer; text-align: start; width: 100%; }
.crm-chip-btn:hover { border-color: var(--crm-p2); background: var(--crm-pl); }
.crm-chart text { fill: #5b6b80; font-size: 12px; font-family: inherit; }

/* skeleton shimmer */
.crm-sk { background: linear-gradient(90deg, #eef2f6 0%, #f8fafc 50%, #eef2f6 100%); background-size: 200% 100%; animation: crm-sh 1.2s infinite linear; border-radius: 8px; }
.dark .crm-sk { background: linear-gradient(90deg, #1e293b 0%, #263449 50%, #1e293b 100%); background-size: 200% 100%; }
@keyframes crm-sh { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* empty state */
.crm-empty { text-align: center; padding: 28px 12px; }
.crm-empty svg { margin: 0 auto; display: block; }
.crm-empty b { display: block; font-size: 16px; margin-top: 10px; color: var(--crm-ink); }

/* ==========================================================================
   Inbox (WhatsApp style)
   ========================================================================== */
.crm-inbox { display: grid; grid-template-columns: 330px minmax(0,1fr) 300px; height: calc(100vh - 10.5rem); min-height: 34rem;
  background: var(--crm-card); border-radius: var(--crm-radius); box-shadow: var(--crm-shadow); border: 1px solid #eef2f6; overflow: hidden; }
.dark .crm-inbox { border-color: var(--crm-line); }
.crm-inbox-list { border-inline-end: 1px solid var(--crm-line); display: flex; flex-direction: column; min-height: 0; }
.crm-inbox-item { display: flex; gap: 12px; padding: 11px 14px; width: 100%; text-align: start; border-inline-start: 3px solid transparent; }
.crm-inbox-item:hover { background: rgba(8,145,178,.05); }
.crm-inbox-item.on { background: var(--crm-pl); border-inline-start-color: var(--crm-p); }
.crm-ch-badge { width: 18px; height: 18px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-size: 10px;
  position: absolute; bottom: -2px; inset-inline-end: -2px; border: 2px solid var(--crm-card); }
.crm-ch-whatsapp { background: #22c55e; } .crm-ch-messenger { background: linear-gradient(135deg,#3b82f6,#a855f7); } .crm-ch-instagram { background: linear-gradient(135deg,#f59e0b,#ec4899,#8b5cf6); }
.crm-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; background-color: #efeae2;
  background-image: radial-gradient(#e2dbd0 1px, transparent 1px); background-size: 18px 18px; }
.dark .crm-thread { background-color: #0b141a; background-image: radial-gradient(#16232b 1px, transparent 1px); }
.crm-thread-head { background: var(--crm-card); padding: 10px 16px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--crm-line); flex-wrap: wrap; }
.crm-msgs { flex: 1; overflow-y: auto; padding: 16px 22px; display: flex; flex-direction: column; gap: 8px; }
.crm-bubble { max-width: 64%; padding: 8px 12px 6px; border-radius: 16px; box-shadow: 0 1px 1px rgba(0,0,0,.07); white-space: pre-wrap; font-size: 14px; line-height: 1.55; color: #111b21; word-wrap: break-word; }
.crm-bubble.in { align-self: flex-start; background: #fff; border-start-start-radius: 4px; }
.crm-bubble.out { align-self: flex-end; background: #d9fdd3; border-start-end-radius: 4px; }
.crm-bubble.bot { align-self: flex-end; background: #e0f7fa; border-start-end-radius: 4px; }
.dark .crm-bubble { color: #e9edef; } .dark .crm-bubble.in { background: #202c33; } .dark .crm-bubble.out { background: #005c4b; } .dark .crm-bubble.bot { background: #083344; }
.crm-bubble .who { font-size: 11.5px; font-weight: 700; color: #164e63; margin-bottom: 2px; } .dark .crm-bubble .who { color: #67e8f9; }
.crm-bubble .meta { font-size: 11px; color: #667781; margin-top: 2px; text-align: end; white-space: nowrap; } .dark .crm-bubble .meta { color: #8696a0; }
.crm-tick-read { color: #53bdeb; } .crm-tick-failed { color: #ef4444; }
.crm-sys { align-self: center; background: #fef3c7; color: #92400e; border-radius: 10px; padding: 4px 12px; font-size: 12px; }
.dark .crm-sys { background: rgba(245,158,11,.15); color: #fbbf24; }
.crm-media { width: 220px; max-width: 100%; height: 120px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 28px; background: linear-gradient(135deg,#cbd5e1,#94a3b8); margin-bottom: 4px; }
.crm-composer { background: var(--crm-card); padding: 10px 14px; border-top: 1px solid var(--crm-line); }
.crm-composer textarea { flex: 1; background: #f1f5f9; border: 0; border-radius: 22px; padding: 11px 18px; resize: none; color: var(--crm-ink); font-size: 14px; outline: none; }
.dark .crm-composer textarea { background: #0f172a; }
.crm-send { width: 44px; height: 44px; border-radius: 50%; background: var(--crm-p); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.crm-quick { display: flex; gap: 6px; margin-bottom: 8px; overflow-x: auto; }
.crm-inbox-side { border-inline-start: 1px solid var(--crm-line); padding: 16px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
@media (max-width: 1279px) { .crm-inbox { grid-template-columns: 280px minmax(0,1fr); } .crm-inbox-side { display: none; } }

/* ==========================================================================
   Wallboard (dark, TV friendly)
   ========================================================================== */
.crm-wb { background: #060b16; color: #e2e8f0; border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.crm-wb.tv { position: fixed; inset: 0; z-index: 60; border-radius: 0; padding: 30px; overflow: auto; }
.crm-wb-tile { background: #0d1526; border: 1px solid #1a2540; border-radius: 14px; padding: 20px; min-width: 0; }
.crm-wb-label { color: #64748b; font-size: 15px; }
.crm-wb-big { font-size: 54px; font-weight: 700; line-height: 1.2; margin-top: 4px; color: #fff; }
.crm-wb-agent { background: #111c33; border-radius: 16px; padding: 14px; border-top: 4px solid #334155; }
.crm-wb.tv .crm-wb-big { font-size: 64px; }

/* ==========================================================================
   Command palette (Ctrl + K)
   ========================================================================== */
.crm-cmdk-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(15,23,42,.55); display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; }
.crm-cmdk { width: 560px; max-width: calc(100vw - 2rem); background: var(--crm-card); border-radius: 18px; box-shadow: 0 30px 60px -12px rgba(0,0,0,.45); overflow: hidden; color: var(--crm-ink); }
.crm-cmdk input { width: 100%; border: 0; border-bottom: 1px solid var(--crm-line); padding: 16px 18px; font-size: 16px; background: transparent; outline: none; color: var(--crm-ink); }
.crm-cmdk-group { color: var(--crm-mut); font-size: 12px; padding: 8px 18px 4px; }
.crm-cmdk-item { display: flex; gap: 10px; align-items: center; padding: 9px 14px; margin: 0 6px; border-radius: 12px; color: var(--crm-ink); }
.crm-cmdk-item:hover, .crm-cmdk-item.on { background: var(--crm-pl); }
.crm-kbd { font-size: 11px; background: var(--crm-card); border: 1px solid var(--crm-line); border-radius: 6px; padding: 1px 6px; color: var(--crm-mut); margin-inline-start: auto; }
.crm-wb .crm-brand-name { color: #fff; } .crm-wb .crm-brand-sub { color: #64748b; }
[x-cloak] { display: none !important; }
.crm-cmdk-hint { display: inline-flex; align-items: center; gap: 8px; background: #f1f5f9; color: var(--crm-mut); border-radius: 12px; padding: 7px 10px 7px 12px; font-size: 13px; margin-inline-end: 8px; white-space: nowrap; }
.dark .crm-cmdk-hint { background: #0f172a; }
.crm-cmdk-hint .crm-kbd { margin: 0; }
@media (max-width: 767px) { .crm-cmdk-hint { display: none; } }

/* ---------- Theme B extras ---------- */
.dark .crm-chart text { fill: #94a3b8; }
/* keyboard focus stays visible everywhere, including the dark sidebar */
:focus-visible { outline: 2px solid var(--crm-p2); outline-offset: 2px; }
.fi-sidebar :focus-visible { outline-color: #67e8f9; }

/* ==========================================================================
   Delivery system (release 2.0): scan station, dispatch board, import, timeline
   ========================================================================== */
.dlv-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.dlv-field { display: flex; flex-direction: column; gap: 4px; min-width: 12rem; flex: 1; font-size: 13px; font-weight: 600; color: var(--crm-mut); }
.dlv-field small { font-weight: 400; }
.dlv-input { width: 100%; border: 1px solid var(--crm-line); border-radius: 8px; padding: 9px 12px; background: var(--crm-card); color: var(--crm-ink); font: inherit; font-weight: 500; }
.dlv-input:focus { outline: 2px solid var(--crm-p2); outline-offset: 1px; }
.dlv-hint { color: var(--crm-mut); font-size: 13px; margin: 4px 0; }
.dlv-error { color: #b91c1c; font-size: 13px; margin: 6px 0; }
.dlv-errors { margin: 8px 0 0; padding-inline-start: 18px; color: #b91c1c; font-size: 13px; max-height: 18rem; overflow: auto; }
.dlv-h3 { font-size: 15px; font-weight: 700; margin: 4px 0 8px; color: var(--crm-ink); }
.dlv-h4 { font-size: 14px; font-weight: 700; margin: 12px 0 6px; }
.dlv-link { color: var(--crm-p); font-weight: 600; font-size: 13px; text-decoration: underline; }
.dlv-stat { background: var(--crm-card); border: 1px solid var(--crm-line); border-radius: 12px; padding: 10px 16px; min-width: 9rem; }
.dlv-stat b { display: block; font-size: 24px; line-height: 1.2; } .dlv-stat span { color: var(--crm-mut); font-size: 12px; }
.dlv-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 16px; }
.dlv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dlv-table th, .dlv-table td { border-bottom: 1px solid var(--crm-line); padding: 6px 8px; text-align: start; white-space: nowrap; }
.dlv-table th { color: var(--crm-mut); font-weight: 600; }
.dlv-table tr.muted td { color: var(--crm-mut); }
.dlv-steps { margin: 0; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 8px; }

/* scan station */
.dlv-scan { display: flex; flex-direction: column; gap: 14px; }
.dlv-modes { display: flex; flex-wrap: wrap; gap: 6px; background: var(--crm-card); border: 1px solid var(--crm-line); border-radius: 12px; padding: 5px; }
.dlv-mode { flex: 1; min-width: 8rem; border: 0; background: transparent; border-radius: 8px; padding: 10px 12px; font-weight: 600; color: var(--crm-mut); cursor: pointer; }
.dlv-mode.is-on { background: var(--crm-p); color: #fff; }
.dlv-scanbox { display: flex; align-items: center; gap: 10px; background: var(--crm-card); border: 2px solid var(--crm-p2); border-radius: 14px; padding: 8px 8px 8px 14px; }
[dir="rtl"] .dlv-scanbox { padding: 8px 14px 8px 8px; }
.dlv-scanbox-icon { width: 28px; height: 28px; color: var(--crm-p); flex-shrink: 0; }
.dlv-scan-input { flex: 1; border: 0; outline: 0; background: transparent; font: 600 22px ui-monospace, Menlo, monospace; direction: ltr; text-align: center; color: var(--crm-ink); min-width: 0; letter-spacing: .04em; }
.dlv-counts { align-items: center; }
.dlv-pill { border-radius: 99px; padding: 4px 12px; font-weight: 700; font-size: 13px; background: #e2e8f0; color: #334155; }
.dlv-pill.ok { background: #d1fae5; color: #065f46; } .dlv-pill.bad { background: #fee2e2; color: #991b1b; }
.dlv-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.dlv-result { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; background: var(--crm-card); border: 1px solid var(--crm-line); border-inline-start: 5px solid #94a3b8; border-radius: 10px; padding: 10px 14px; }
.dlv-result.ok { border-inline-start-color: #059669; } .dlv-result.bad { border-inline-start-color: #dc2626; background: #fef2f2; }
.dark .dlv-result.bad { background: rgba(220,38,38,.12); }
.dlv-result-main { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: baseline; }
.dlv-result-meta { grid-column: 1; display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--crm-mut); font-size: 13px; }
.dlv-result time { grid-row: 1; grid-column: 2; color: var(--crm-mut); font-size: 12px; font-variant-numeric: tabular-nums; }
.dlv-warn { color: #92400e; background: #fef3c7; border-radius: 6px; padding: 0 8px; font-size: 13px; font-weight: 600; }
.dlv-empty { color: var(--crm-mut); text-align: center; padding: 24px; }

/* dispatch board */
.dlv-drivers { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 10px; }
.dlv-driver { background: var(--crm-card); border: 1px solid var(--crm-line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.dlv-driver-name { font-weight: 700; }
.dlv-driver-meta { display: flex; gap: 12px; color: var(--crm-mut); font-size: 13px; }
.dlv-driver-cash { font-size: 13px; font-weight: 600; color: var(--crm-p); }
.dlv-driver-cash.over { color: #b91c1c; }

/* order timeline */
.dlv-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.dlv-tl-item { display: flex; gap: 12px; padding-bottom: 14px; position: relative; }
.dlv-tl-item:not(:last-child)::before { content: ""; position: absolute; inset-inline-start: 6px; top: 16px; bottom: 0; width: 2px; background: var(--crm-line); }
.dlv-tl-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--crm-p2); flex-shrink: 0; margin-top: 4px; box-shadow: 0 0 0 3px var(--crm-pl); }
.dlv-tl-dot[data-status="delivered"] { background: #059669; box-shadow: 0 0 0 3px #d1fae5; }
.dlv-tl-dot[data-status="failed_delivery"], .dlv-tl-dot[data-status="cancelled"], .dlv-tl-dot[data-status="returned"] { background: #dc2626; box-shadow: 0 0 0 3px #fee2e2; }
.dlv-tl-dot[data-status="rescheduled"], .dlv-tl-dot[data-status="returning"], .dlv-tl-dot[data-status="out_for_delivery"] { background: #d97706; box-shadow: 0 0 0 3px #fef3c7; }
.dlv-tl-body { flex: 1; min-width: 0; font-size: 14px; }
.dlv-tl-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; }
.dlv-tl-tag { font-size: 12px; background: var(--crm-pl); color: var(--crm-p); border-radius: 99px; padding: 0 8px; font-weight: 600; }
.dlv-tl-time { margin-inline-start: auto; color: var(--crm-mut); font-size: 12px; font-variant-numeric: tabular-nums; direction: ltr; }
.dlv-tl-who { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--crm-mut); font-size: 12px; margin-top: 2px; }
.dlv-tl-src { opacity: .8; }

/* ---------- scan station: smart mode ---------- */
.dlv-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.dlv-here { display: inline-flex; align-items: center; gap: 8px; background: var(--crm-pl); color: #164e63; border: 0; border-radius: 99px;
  padding: 8px 16px; font: inherit; font-size: 15px; cursor: pointer; }
.dlv-here small { color: #155e75; text-decoration: underline; font-size: 12px; }
.dlv-here.is-open { border-radius: 12px; background: #fef3c7; color: #92400e; cursor: default; flex-wrap: wrap; }
.dlv-here-icon { width: 20px; height: 20px; flex-shrink: 0; }
.dark .dlv-here { color: #a5f3fc; } .dark .dlv-here small { color: #67e8f9; }
.dlv-switch { display: inline-flex; background: var(--crm-card); border: 1px solid var(--crm-line); border-radius: 10px; padding: 3px; }
.dlv-switch button { border: 0; background: transparent; border-radius: 8px; padding: 7px 14px; font: inherit; font-weight: 600; color: var(--crm-mut); cursor: pointer; }
.dlv-switch button.is-on { background: var(--crm-p); color: #fff; }
.dlv-smart-grid { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .dlv-smart-grid { grid-template-columns: 1fr; } }
.dlv-auto { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--crm-mut); }
.dlv-next { background: var(--crm-card); border: 1px solid var(--crm-line); border-radius: 12px; overflow: hidden; }
.dlv-next-head { display: flex; gap: 10px; align-items: center; padding: 12px 18px; font-weight: 700; font-size: 17px; background: #e0f2fe; color: #075985; }
.dlv-next.tone-warn .dlv-next-head { background: #fef3c7; color: #92400e; }
.dlv-next.tone-ok .dlv-next-head { background: #d1fae5; color: #065f46; }
.dark .dlv-next-head { background: rgba(14,116,144,.25); color: #a5f3fc; }
.dark .dlv-next.tone-warn .dlv-next-head { background: rgba(245,158,11,.18); color: #fcd34d; }
.dark .dlv-next.tone-ok .dlv-next-head { background: rgba(16,185,129,.18); color: #6ee7b7; }
.dlv-next-icon { width: 22px; height: 22px; flex-shrink: 0; }
.dlv-next-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.dlv-next-title { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.dlv-next-title .crm-mono { font-size: 22px; }
.dlv-next-meta { display: flex; flex-wrap: wrap; gap: 4px 20px; color: var(--crm-mut); }
.dlv-next-meta b { color: var(--crm-ink); }
.dlv-next-actions, .dlv-next-drivers { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dlv-kbd-hint { font-size: 11px; opacity: .75; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin-inline-start: 6px; }
.dlv-open { display: flex; flex-direction: column; gap: 12px; }
.dlv-open-card { background: var(--crm-card); border: 1px solid var(--crm-line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.dlv-open-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dlv-open-head b { display: inline-flex; gap: 6px; align-items: center; }
.dlv-open-icon { width: 18px; height: 18px; color: var(--crm-p2); }
.dlv-open-items { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; max-height: 8rem; overflow: auto; }
.dlv-open-items button { border: 0; background: transparent; color: #b91c1c; cursor: pointer; padding: 0 2px; }

/* ---- 2.3 warehouse board (مستودع الفرع) ---- */
.dlv-wtabs { flex-wrap: wrap; }
.dlv-wtabs button { display: inline-flex; align-items: center; gap: 6px; }
.dlv-wcount { min-width: 22px; padding: 0 6px; border-radius: 99px; font-size: 12px; line-height: 20px; text-align: center; background: var(--crm-line); color: var(--crm-ink); }
.dlv-wtabs button.is-on .dlv-wcount { background: rgba(255,255,255,.25); color: #fff; }
.dlv-wgrid { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .dlv-wgrid { grid-template-columns: 1fr; } .dlv-wgrid aside { position: static !important; } }
.dlv-wgroup { background: var(--crm-card); border: 1px solid var(--crm-line); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.dlv-wgroup-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 10px 14px; background: var(--crm-bg); border-bottom: 1px solid var(--crm-line); cursor: pointer; }
.dlv-wrows { display: flex; flex-direction: column; }
.dlv-wrow { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; padding: 8px 14px; border-top: 1px solid var(--crm-line); font-size: 14px; cursor: pointer; }
.dlv-wrow:first-child { border-top: 0; }
.dlv-wrow:hover { background: var(--crm-bg); }
.dlv-wrow > b:last-child { margin-inline-start: auto; }
.dlv-wrow:has(input:checked) { background: var(--crm-pl); }
.dark .dlv-wrow:has(input:checked) { background: rgba(14,116,144,.18); }
.dlv-wdriver { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--crm-line); border-radius: 10px; cursor: pointer; }
.dlv-wdriver > .dlv-pill { margin-inline-start: auto; }
.dlv-wdriver.is-on { border-color: var(--crm-p); background: var(--crm-pl); }
.dark .dlv-wdriver.is-on { background: rgba(14,116,144,.18); }
input[type=checkbox], input[type=radio] { accent-color: var(--crm-p); }
