/* Dispatix — global styles on top of Tailwind */
:root {
  --primary: #4F46E5;
  --primary-600: #4338CA;
  --accent: #F59E0B;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
}

html, body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #F8FAFC;
  color: #0F172A;
}

.tabular { font-variant-numeric: tabular-nums; }

/* Sidebar */
.sidebar {
  width: 244px;
  background: #0D1B2E;
  color: #CBD5E1;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  border-right: 1px solid rgba(255,255,255,0.04);
}
.sidebar .nav-scroll { flex: 1; overflow-y: auto; padding-bottom: 8px; }
.sidebar .sidebar-footer { border-top: 1px solid rgba(255,255,255,.04); }
.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px 9px 17px;
  margin: 1px 10px;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 6px;
  position: relative;
  color: #94A3B8;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.sidebar .nav-item:hover { background: rgba(255,255,255,0.04); color: #E2E8F0; }
.sidebar .nav-item.active {
  background: rgba(79,70,229,0.18);
  color: #fff;
}
.sidebar .nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 6px; bottom: 6px;
  width: 3px;
  background: #6366F1;
  border-radius: 0 3px 3px 0;
}
.sidebar .nav-item i { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar .nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #475569; padding: 14px 24px 6px; font-weight: 600; }
.sidebar .nav-divider { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: #475569; padding: 16px 24px 6px 24px; font-weight: 600; margin-top: 4px; border-top: 1px solid rgba(255,255,255,.04); }

/* Collapsible nav group */
.sidebar details.nav-group { margin: 1px 10px; }
.sidebar details.nav-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 9px 14px 9px 17px; font-size: 13.5px; font-weight: 500; border-radius: 6px; color: #94A3B8; transition: background .15s, color .15s; }
.sidebar details.nav-group > summary::-webkit-details-marker { display: none; }
.sidebar details.nav-group > summary:hover { background: rgba(255,255,255,0.04); color: #E2E8F0; }
.sidebar details.nav-group > summary i[data-lucide] { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar details.nav-group .nav-group-chev { margin-left: auto; transition: transform .2s; }
.sidebar details.nav-group[open] > summary .nav-group-chev { transform: rotate(180deg); }
.sidebar details.nav-group .nav-group-body { padding: 2px 0 4px 0; }
.sidebar details.nav-group .nav-group-body .nav-item { margin-left: 24px; margin-right: 0; padding-left: 12px; font-size: 13px; }
.sidebar details.nav-group .nav-group-body .nav-item::before { content: ''; position: absolute; left: -4px; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,.06); }

.content-area {
  margin-left: 244px;
}
.topbar {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid #E2E8F0;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}

/* Status dots */
.dot { width: 6px; height: 6px; border-radius: 999px; display: inline-block; }

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}
.badge-success { background: #ECFDF5; color: #047857; }
.badge-success .dot { background: #10B981; }
.badge-warning { background: #FFFBEB; color: #B45309; }
.badge-warning .dot { background: #F59E0B; }
.badge-danger { background: #FEF2F2; color: #B91C1C; }
.badge-danger .dot { background: #EF4444; }
.badge-info { background: #EFF6FF; color: #1D4ED8; }
.badge-info .dot { background: #3B82F6; }
.badge-violet { background: #EEF2FF; color: #4338CA; }
.badge-violet .dot { background: #6366F1; }
.badge-slate { background: #F1F5F9; color: #475569; }
.badge-slate .dot { background: #64748B; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
  line-height: 1.2;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: #4F46E5; color: #fff; box-shadow: 0 1px 2px rgba(79,70,229,.25); }
.btn-primary:hover { background: #4338CA; }
.btn-secondary { background: #fff; color: #0F172A; border-color: #E2E8F0; }
.btn-secondary:hover { background: #F8FAFC; border-color: #CBD5E1; }
.btn-ghost { background: transparent; color: #475569; }
.btn-ghost:hover { background: #F1F5F9; color: #0F172A; }
.btn-danger { background: #fff; color: #B91C1C; border-color: #FECACA; }
.btn-danger:hover { background: #FEF2F2; }

.btn-icon {
  width: 32px; height: 32px; padding: 0; justify-content: center;
}

/* Cards */
.card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}

/* Table rows */
.tbl-row:hover { background: #F8FAFC; }
.tbl-row.selected { background: #EEF2FF; }

/* Inputs */
.input {
  width: 100%;
  padding: 7px 10px;
  font-size: 13.5px;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  background: #fff;
  color: #0F172A;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: #818CF8; box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
.input::placeholder { color: #94A3B8; }

/* Search input topbar */
.topbar-search {
  flex: 1;
  max-width: 520px;
  position: relative;
}
.topbar-search input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 36px;
  background: #F1F5F9;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 13.5px;
  color: #0F172A;
}
.topbar-search input:focus { background: #fff; border-color: #C7D2FE; box-shadow: 0 0 0 3px rgba(99,102,241,.10); outline: none; }
.topbar-search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #94A3B8; }
.topbar-search kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: #fff; border: 1px solid #E2E8F0; border-radius: 4px;
  font-size: 11px; font-weight: 500; padding: 1px 6px; color: #64748B;
  font-family: inherit;
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid #E2E8F0;
  gap: 4px;
}
.tab {
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: #64748B;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: #0F172A; }
.tab.active { color: #4F46E5; border-bottom-color: #4F46E5; }
.tab .count { background: #F1F5F9; color: #475569; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; font-weight: 500; }
.tab.active .count { background: #EEF2FF; color: #4338CA; }

/* Toast */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 100; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: #0F172A;
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 10px 25px -10px rgba(0,0,0,.4);
  font-size: 13.5px;
  display: flex; align-items: center; gap: 10px;
  min-width: 280px;
  pointer-events: auto;
  animation: toast-in .25s cubic-bezier(.16,1,.3,1);
}
.toast.success i { color: #34D399; }
.toast.info i { color: #60A5FA; }
.toast.warning i { color: #FBBF24; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Command palette */
#cmdk-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.55); backdrop-filter: blur(4px);
  z-index: 90; display: none; align-items: flex-start; justify-content: center; padding-top: 12vh;
}
#cmdk-backdrop.open { display: flex; }
#cmdk-modal { width: 580px; max-width: 90vw; background: #fff; border-radius: 12px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.4); overflow: hidden; }
#cmdk-modal .cmdk-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid #E2E8F0; }
#cmdk-modal .cmdk-input input { flex: 1; border: 0; outline: 0; font-size: 15px; color: #0F172A; background: transparent; }
#cmdk-modal .cmdk-list { max-height: 360px; overflow-y: auto; padding: 6px 0; }
.cmdk-group { padding: 6px 0; }
.cmdk-group-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #94A3B8; padding: 4px 16px; font-weight: 600; }
.cmdk-item { display: flex; align-items: center; gap: 10px; padding: 8px 16px; font-size: 13.5px; color: #0F172A; cursor: pointer; }
.cmdk-item:hover, .cmdk-item.active { background: #EEF2FF; color: #4338CA; }
.cmdk-item .meta { margin-left: auto; color: #94A3B8; font-size: 11.5px; }

/* Heatmap */
.heat-cell { width: 100%; aspect-ratio: 1.6 / 1; border-radius: 3px; transition: transform .1s; }
.heat-cell:hover { transform: scale(1.15); outline: 1px solid #4F46E5; }

/* SLA indicator */
.sla-bar { height: 4px; border-radius: 999px; background: #E2E8F0; overflow: hidden; width: 64px; }
.sla-bar > span { display: block; height: 100%; border-radius: 999px; }

/* Scrollbars (subtle) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #E2E8F0; border-radius: 999px; border: 2px solid #F8FAFC; }
::-webkit-scrollbar-thumb:hover { background: #CBD5E1; }
::-webkit-scrollbar-track { background: transparent; }

/* Sparkline */
.spark { width: 100%; height: 36px; }

/* Avatar */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; font-weight: 600; color: #fff; font-size: 12px;
  flex-shrink: 0;
}

/* Drag/drop */
.drag-card {
  cursor: grab;
  transition: box-shadow .15s, transform .1s, border-color .15s;
}
.drag-card:active { cursor: grabbing; }
.drag-card.dragging { opacity: .55; transform: scale(.98); }
.drop-target.drag-over { background: rgba(79,70,229,.08); outline: 2px dashed #6366F1; }

/* Gantt */
.gantt-grid { background-image: linear-gradient(to right, #F1F5F9 1px, transparent 1px); background-size: 90px 100%; }
.gantt-block {
  position: absolute;
  top: 8px; bottom: 8px;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  display: flex; align-items: center; gap: 6px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
  transition: transform .15s;
}
.gantt-block:hover { transform: translateY(-1px); box-shadow: 0 4px 12px -2px rgba(0,0,0,.18); }

/* Stepper */
.stepper { display: flex; align-items: center; gap: 0; }
.step { display: flex; align-items: center; gap: 10px; padding: 0 18px; }
.step .step-num { width: 28px; height: 28px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; background: #F1F5F9; color: #64748B; flex-shrink: 0; }
.step .step-label { font-size: 13px; font-weight: 500; color: #94A3B8; white-space: nowrap; }
.step.done .step-num { background: #ECFDF5; color: #047857; }
.step.done .step-label { color: #334155; }
.step.active .step-num { background: #4F46E5; color: #fff; box-shadow: 0 0 0 4px rgba(79,70,229,.15); }
.step.active .step-label { color: #0F172A; font-weight: 600; }
.step-divider { flex: 1; height: 1px; background: #E2E8F0; }
.step-divider.done { background: #6EE7B7; }

/* Pipeline (billing) */
.pipe-step {
  flex: 1;
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 14px 16px;
  position: relative;
}
.pipe-step + .pipe-arrow {
  width: 24px; display: flex; align-items: center; justify-content: center; color: #CBD5E1; flex-shrink: 0;
}

/* Document card */
.doc-card { padding: 16px; border: 1px solid #E2E8F0; border-radius: 8px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.doc-card:hover { border-color: #C7D2FE; box-shadow: 0 4px 12px -4px rgba(79,70,229,.18); }

/* Map */
.map-pin {
  position: absolute; transform: translate(-50%, -100%);
  display: flex; flex-direction: column; align-items: center;
}
.map-pin .pin {
  background: #4F46E5; color: #fff; padding: 4px 8px; border-radius: 6px 6px 6px 2px;
  font-size: 11px; font-weight: 600; box-shadow: 0 4px 12px -2px rgba(0,0,0,.3);
  border: 1.5px solid #fff;
}
.map-pin .pin::after {
  content: ''; position: absolute; bottom: -5px; left: 6px; width: 8px; height: 8px;
  background: #4F46E5; transform: rotate(45deg); border-radius: 0 0 2px 0;
  border-right: 1.5px solid #fff; border-bottom: 1.5px solid #fff;
}
.map-pin.success .pin, .map-pin.success .pin::after { background: #10B981; }
.map-pin.warning .pin, .map-pin.warning .pin::after { background: #F59E0B; }
.map-pin.danger .pin, .map-pin.danger .pin::after { background: #EF4444; }
.map-pin.slate .pin, .map-pin.slate .pin::after { background: #64748B; }

/* Heatmap palette */
.h0 { background: #F1F5F9; }
.h1 { background: #C7D2FE; }
.h2 { background: #A5B4FC; }
.h3 { background: #818CF8; }
.h4 { background: #6366F1; }
.h5 { background: #4F46E5; }

/* Timeline */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: #E2E8F0; }
.timeline-item { position: relative; padding-bottom: 18px; }
.timeline-item::before { content: ''; position: absolute; left: -22px; top: 4px; width: 16px; height: 16px; border-radius: 999px; background: #fff; border: 2px solid #CBD5E1; }
.timeline-item.done::before { background: #4F46E5; border-color: #4F46E5; }
.timeline-item.active::before { background: #fff; border-color: #4F46E5; box-shadow: 0 0 0 3px rgba(79,70,229,.18); }

/* Subtle separators */
hr.sep { border: 0; border-top: 1px solid #E2E8F0; margin: 16px 0; }

/* Driver list item */
.driver-li { padding: 10px 12px; border-radius: 8px; cursor: pointer; transition: background .15s; display: flex; align-items: center; gap: 10px; }
.driver-li:hover { background: #F8FAFC; }
.driver-li.active { background: #EEF2FF; }
.driver-li.active .name { color: #4338CA; }

/* KPI delta */
.kpi-delta { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 500; padding: 2px 6px; border-radius: 4px; }
.kpi-delta.up { background: #ECFDF5; color: #047857; }
.kpi-delta.down { background: #FEF2F2; color: #B91C1C; }

/* Page header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-title { font-size: 22px; font-weight: 600; color: #0F172A; letter-spacing: -.01em; }
.page-subtitle { font-size: 13px; color: #64748B; margin-top: 2px; }

/* Notification dot */
.notif-dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 999px; background: #EF4444; border: 2px solid #fff; }

/* Selected row highlight strip */
.tbl-row.selected td:first-child { border-left: 2px solid #4F46E5; }
.tbl-row td:first-child { border-left: 2px solid transparent; }

/* Bulk action bar */
.bulk-bar {
  background: #0F172A;
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 25px -10px rgba(15,23,42,.4);
}
.bulk-bar .btn-secondary { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.12); }
.bulk-bar .btn-secondary:hover { background: rgba(255,255,255,.14); }

/* ========== v2 additions ========== */

/* Role switcher menu */
.role-switcher { position: relative; }
.role-menu {
  position: absolute; top: calc(100% + 6px); left: 0;
  background: #fff; border: 1px solid #E2E8F0; border-radius: 8px;
  box-shadow: 0 12px 32px -8px rgba(15,23,42,.18);
  min-width: 260px; padding: 4px; z-index: 50; display: none;
}
.role-menu.open { display: block; }
.role-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
  font-size: 13px; color: #0F172A;
}
.role-menu-item:hover { background: #F1F5F9; }

/* Service type badges */
.svc-badge {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 5px; font-size: 11.5px; font-weight: 600; line-height: 1.5;
  letter-spacing: .01em;
}
.svc-ltl { background: #F5F3FF; color: #6D28D9; border: 1px solid #DDD6FE; }      /* фиолетовый */
.svc-ftl { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }      /* синий */
.svc-fm  { background: #ECFEFF; color: #0E7490; border: 1px solid #A5F3FC; }      /* циан */
.svc-lm  { background: #FFF7ED; color: #C2410C; border: 1px solid #FED7AA; }      /* оранжевый */
.svc-cmp { background: #EEF2FF; color: #4338CA; border: 1px solid #C7D2FE; }      /* индиго */

/* Cargo internal status badges — indigo/violet gradient */
.cint {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500;
}
.cint::before { content:''; width:5px; height:5px; border-radius:999px; background:currentColor; opacity:.85; }
.cint-1 { background:#F1F5F9; color:#475569; }                       /* Создан */
.cint-2 { background:#E0E7FF; color:#3730A3; }                       /* Ожидает приёмки */
.cint-3 { background:#DDD6FE; color:#5B21B6; }                       /* Принят */
.cint-4 { background:#C7D2FE; color:#3730A3; }                       /* Ожидает консолидации */
.cint-5 { background:#A5B4FC; color:#312E81; }                       /* Загружен */
.cint-6 { background:#818CF8; color:#fff; }                          /* В магистрали */
.cint-7 { background:#6366F1; color:#fff; }                          /* На складе назначения */
.cint-8 { background:#4F46E5; color:#fff; }                          /* На последней миле */
.cint-9 { background:#10B981; color:#fff; }                          /* Выдан */

/* Cargo external status — slate neutrals */
.cext {
  display: inline-flex; align-items: center; padding: 2px 7px;
  font-size: 11px; font-weight: 500;
  border-radius: 4px; background: #F8FAFC; color: #475569;
  border: 1px solid #E2E8F0;
}

/* Margin colors (KPI) */
.margin-good { color: #047857; }
.margin-warn { color: #B45309; }
.margin-bad  { color: #B91C1C; }
.margin-good-bg { background: #ECFDF5; }
.margin-warn-bg { background: #FFFBEB; }
.margin-bad-bg  { background: #FEF2F2; }

/* Progress bar with thresholds */
.mp-bar { height: 8px; border-radius: 999px; background: #F1F5F9; overflow: hidden; position: relative; }
.mp-bar > span { display: block; height: 100%; border-radius: 999px; transition: width .25s; }
.mp-bar.good > span { background: linear-gradient(90deg,#34D399,#10B981); }
.mp-bar.warn > span { background: linear-gradient(90deg,#FBBF24,#F59E0B); }
.mp-bar.bad  > span { background: linear-gradient(90deg,#F87171,#EF4444); }

/* Mobile frame */
.mobile-bg {
  background: linear-gradient(180deg,#0F172A 0%,#1E293B 100%);
  min-height: 100vh; padding: 32px 0; display:flex; justify-content:center; align-items:flex-start;
}
.mobile-frame {
  width: 390px; min-height: 800px;
  background:#F8FAFC; border-radius: 44px; overflow: hidden; position: relative;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.6), inset 0 0 0 2px #334155;
  padding: 12px 0 0;
}
.mobile-frame::before {
  content:''; position:absolute; top:14px; left:50%; transform:translateX(-50%);
  width: 110px; height: 28px; background:#0F172A; border-radius: 999px; z-index: 5;
}
.mobile-statusbar {
  display:flex; justify-content:space-between; align-items:center;
  padding: 4px 28px 8px; font-size: 14px; font-weight:600; color:#0F172A;
  position: relative; z-index: 2;
}
.mobile-content { padding: 8px 16px 80px; }
.mobile-tabbar {
  position: absolute; bottom: 0; left: 0; right: 0;
  background:#fff; border-top: 1px solid #E2E8F0;
  display:flex; justify-content:space-around; padding: 10px 0 22px;
}
.mobile-tabbar a {
  display:flex; flex-direction:column; align-items:center; gap:4px;
  font-size:10.5px; color:#94A3B8; padding: 4px 16px;
}
.mobile-tabbar a.active { color: #4F46E5; }

/* Sidebar scroll */
.sidebar { overflow-y: auto; }

/* Tender source pill */
.src-pill {
  display:inline-flex; align-items:center; gap:5px;
  padding: 2px 7px; border-radius: 4px;
  font-size: 11px; font-weight:500;
}
.src-ours { background:#EEF2FF; color:#4338CA; }
.src-ati  { background:#DBEAFE; color:#1D4ED8; }
.src-mon  { background:#FCE7F3; color:#9D174D; }

/* Sign markers (ЭТрН) */
.sign-marker {
  width: 22px; height: 22px; border-radius: 999px;
  display:inline-flex; align-items:center; justify-content:center;
  font-size: 11px;
}
.sign-signed   { background:#D1FAE5; color:#047857; }
.sign-pending  { background:#FEF3C7; color:#B45309; }
.sign-rejected { background:#FEE2E2; color:#B91C1C; }

/* Carrier status pill */
.crst {
  display:inline-flex; align-items:center; gap:5px;
  padding: 2px 7px; border-radius:999px; font-size: 11px; font-weight:500;
}
.crst::before { content:''; width:6px; height:6px; border-radius:999px; background:currentColor; }
.crst-verified  { background:#ECFDF5; color:#047857; }
.crst-new       { background:#EFF6FF; color:#1D4ED8; }
.crst-blacklist { background:#FEF2F2; color:#B91C1C; }

/* Mini KPI tile inside carrier card */
.kpi-tile {
  background:#F8FAFC; border:1px solid #E2E8F0; border-radius:8px; padding:10px 12px;
}

/* Map preview SVG container */
.mobile-map {
  width: 100%; height: 180px; border-radius: 12px; overflow:hidden;
  background:linear-gradient(135deg,#E0E7FF,#DBEAFE);
  position:relative; border: 1px solid #C7D2FE;
}


/* ========== v3 additions ========== */

/* KPI strip (compact horizontal row of KPI tiles) */
.kpi-strip {
  display: grid; grid-template-columns: repeat(var(--cols, 4), 1fr); gap: 12px;
  margin-bottom: 16px;
}
.kpi-strip .kpi-cell {
  background: #fff; border: 1px solid #E2E8F0; border-radius: 8px; padding: 12px 14px;
}
.kpi-strip .kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #64748B; font-weight: 600; }
.kpi-strip .kpi-value { font-size: 22px; font-weight: 600; color: #0F172A; letter-spacing: -.01em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-strip .kpi-sub { font-size: 11.5px; color: #64748B; margin-top: 2px; }

/* Drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 80; opacity: 0; pointer-events: none; transition: opacity .25s; }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 560px; max-width: 92vw; background: #fff; z-index: 90; transform: translateX(100%); transition: transform .3s cubic-bezier(.16,1,.3,1); box-shadow: -20px 0 50px -20px rgba(15,23,42,.3); display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
.drawer-header { padding: 18px 22px; border-bottom: 1px solid #E2E8F0; display: flex; align-items: center; gap: 12px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.drawer-footer { padding: 14px 22px; border-top: 1px solid #E2E8F0; display: flex; gap: 8px; justify-content: flex-end; }

/* Kanban board */
.kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.kanban-col { background: #F1F5F9; border-radius: 10px; padding: 10px; min-height: 420px; display: flex; flex-direction: column; }
.kanban-col-head { display: flex; align-items: center; gap: 6px; padding: 4px 6px 10px; }
.kanban-col-head .kc-title { font-size: 12.5px; font-weight: 600; color: #334155; letter-spacing: .01em; }
.kanban-col-head .kc-count { background: #fff; border: 1px solid #E2E8F0; border-radius: 999px; padding: 1px 8px; font-size: 11.5px; color: #475569; font-weight: 600; }
.kanban-col-head .kc-dot { width: 8px; height: 8px; border-radius: 999px; }
.kanban-list { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.kanban-card { background: #fff; border: 1px solid #E2E8F0; border-radius: 8px; padding: 10px 12px; cursor: grab; box-shadow: 0 1px 2px rgba(15,23,42,.04); transition: box-shadow .15s, transform .1s, border-color .15s; }
.kanban-card:hover { box-shadow: 0 4px 12px -2px rgba(15,23,42,.1); border-color: #C7D2FE; }
.kanban-card.dragging { opacity: .55; transform: rotate(1deg) scale(.98); }
.kanban-col.drag-over { background: #EEF2FF; outline: 2px dashed #818CF8; outline-offset: -2px; }
.kanban-card .kc-type { font-size: 11px; color: #4338CA; background: #EEF2FF; padding: 1px 6px; border-radius: 4px; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }

/* OKR cards */
.okr-card { background: #fff; border: 1px solid #E2E8F0; border-radius: 12px; padding: 22px 24px; box-shadow: 0 1px 3px rgba(15,23,42,.04); }
.okr-progress-ring { width: 88px; height: 88px; transform: rotate(-90deg); }
.okr-progress-ring circle { fill: none; stroke-width: 8; }
.okr-progress-ring .track { stroke: #F1F5F9; }
.okr-progress-ring .bar { stroke: #4F46E5; stroke-linecap: round; transition: stroke-dashoffset .6s; }
.kr-row { display: grid; grid-template-columns: 1fr 120px 80px; align-items: center; gap: 14px; padding: 10px 0; border-top: 1px solid #F1F5F9; }
.kr-row:first-child { border-top: 0; }
.kr-bar { height: 6px; background: #F1F5F9; border-radius: 999px; overflow: hidden; }
.kr-bar > span { display: block; height: 100%; border-radius: 999px; transition: width .4s; }
.kr-bar.good > span { background: linear-gradient(90deg, #34D399, #10B981); }
.kr-bar.warn > span { background: linear-gradient(90deg, #FBBF24, #F59E0B); }
.kr-bar.bad  > span { background: linear-gradient(90deg, #F87171, #EF4444); }

/* Carrier index */
.cindex-score { font-size: 56px; font-weight: 700; color: #0F172A; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.cindex-score .total { color: #94A3B8; font-size: 26px; font-weight: 600; }
.cindex-zone { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.cindex-zone.A { background: #DCFCE7; color: #15803D; }
.cindex-zone.B { background: #FEF3C7; color: #B45309; }
.cindex-zone.C { background: #FEE2E2; color: #B91C1C; }
.cindex-bar { display: grid; grid-template-columns: 200px 1fr 56px 70px; gap: 12px; align-items: center; padding: 8px 0; font-size: 13px; }
.cindex-bar .label { color: #334155; }
.cindex-bar .weight { color: #94A3B8; font-size: 11.5px; text-align: right; font-variant-numeric: tabular-nums; }
.cindex-bar .val { color: #0F172A; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.cindex-bar .bar { height: 8px; background: #F1F5F9; border-radius: 999px; overflow: hidden; }
.cindex-bar .bar > span { display: block; height: 100%; border-radius: 999px; }

/* Channel pills (inbox) */
.chan-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.chan-tg  { background: #DBEAFE; color: #1D4ED8; }
.chan-wa  { background: #DCFCE7; color: #15803D; }
.chan-email { background: #EEF2FF; color: #4338CA; }
.chan-site { background: #FAE8FF; color: #86198F; }
.chan-phone { background: #FFEDD5; color: #C2410C; }
.chan-1c  { background: #FEF3C7; color: #B45309; }
.chan-api { background: #F1F5F9; color: #334155; }

/* Inbox left list item */
.inbox-item { padding: 12px 14px; border-bottom: 1px solid #F1F5F9; cursor: pointer; transition: background .15s; }
.inbox-item:hover { background: #F8FAFC; }
.inbox-item.active { background: #EEF2FF; border-left: 3px solid #4F46E5; padding-left: 11px; }
.inbox-item.unread .preview { color: #0F172A; font-weight: 500; }

/* Sparkline svg height */
.spark-sm { width: 100%; height: 24px; }

/* External portal layout (client/carrier) */
.portal-page { background: #FAFBFC; min-height: 100vh; }
.portal-topbar { background: #fff; border-bottom: 1px solid #E2E8F0; padding: 0 32px; height: 64px; display: flex; align-items: center; gap: 28px; }
.portal-logo { display: flex; align-items: center; gap: 10px; }
.portal-nav { display: flex; gap: 4px; }
.portal-nav a { padding: 8px 14px; font-size: 13.5px; color: #475569; border-radius: 6px; font-weight: 500; }
.portal-nav a:hover { background: #F1F5F9; color: #0F172A; }
.portal-nav a.active { background: #EEF2FF; color: #4338CA; }
.portal-container { max-width: 1280px; margin: 0 auto; padding: 28px 32px 80px; }

/* Carrier-portal accent (slightly warmer/orange) */
.portal-carrier .portal-accent { color: #C2410C; }

/* Step pipeline (find carrier) */
.pipe-stage { background: #fff; border: 1px solid #E2E8F0; border-radius: 10px; padding: 14px 16px; }
.pipe-stage.done { border-color: #BBF7D0; background: #F0FDF4; }
.pipe-stage.active { border-color: #C7D2FE; box-shadow: 0 0 0 4px rgba(79,70,229,.12); }

/* Warehouse map */
.wh-grid { display: grid; gap: 3px; }
.wh-cell { aspect-ratio: 1 / 1; border-radius: 3px; min-width: 16px; }
.wh-cell.free { background: #DCFCE7; }
.wh-cell.busy { background: #C7D2FE; }
.wh-cell.work { background: #FEF3C7; }
.wh-cell.aisle { background: transparent; }

/* Mini info chips */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 500; background: #F1F5F9; color: #475569; }
.chip.indigo { background: #EEF2FF; color: #4338CA; }
.chip.emerald { background: #DCFCE7; color: #15803D; }
.chip.amber { background: #FEF3C7; color: #B45309; }
.chip.red { background: #FEE2E2; color: #B91C1C; }

/* Modal (find carrier) */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: flex-start; justify-content: center; padding-top: 6vh; z-index: 100; }
.modal { background: #fff; border-radius: 12px; width: 980px; max-width: 96vw; max-height: 88vh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 30px 60px -20px rgba(0,0,0,.4); }
.modal-head { padding: 18px 24px; border-bottom: 1px solid #E2E8F0; display: flex; align-items: center; gap: 12px; }
.modal-body { overflow-y: auto; padding: 22px 24px; flex: 1; }

/* v3 aliases & extras */
.kpi-strip .kpi-val { font-size: 22px; font-weight: 600; color: #0F172A; letter-spacing: -.01em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.cindex-zone.zone-a { background: #DCFCE7; color: #15803D; }
.cindex-zone.zone-b { background: #FEF3C7; color: #B45309; }
.cindex-zone.zone-c { background: #FEE2E2; color: #B91C1C; }

.pipe-stage { position: relative; }
.pipe-stage .pipe-num { width: 22px; height: 22px; border-radius: 999px; background: #E2E8F0; color: #64748B; font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.pipe-stage.done .pipe-num { background: #10B981; color: #fff; }
.pipe-stage.active .pipe-num { background: #4F46E5; color: #fff; }
.pipe-stage.pending .pipe-num { background: #E2E8F0; color: #94A3B8; }
.pipe-stage .pipe-t { font-size: 13px; font-weight: 600; color: #0F172A; }
.pipe-stage .pipe-s { font-size: 11.5px; color: #64748B; margin-top: 2px; }
.pipe-stage .pipe-bar { height: 4px; background: #F1F5F9; border-radius: 999px; overflow: hidden; margin-top: 10px; }
.pipe-stage .pipe-bar > span { display: block; height: 100%; background: #4F46E5; border-radius: 999px; transition: width .4s; }
.pipe-stage.done .pipe-bar > span { background: #10B981; }
.pipe-stage.pending .pipe-bar > span { background: #CBD5E1; }
