/* ==========================================================================
   CBEX Design System — Base
   --------------------------------------------------------------------------
   Source: Downloads/cbex (2)/styles.css — ported verbatim with two changes:
     (a) Tajawal font imported here so it ships with the shell.
     (b) Legacy --cbex-* token aliases declared alongside native tokens so
         existing ApexCharts code (see pages/admin/index.blade.php) keeps
         reading its computed vars without needing a rewrite.
   The 4 theme variants (default · dark · minimal · glass) live in themes.css.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800;900&display=swap');

:root {
  /* ── Navy scale ── */
  --navy-900: #1a2540;
  --navy-800: #223054;
  --navy-700: #2d3e5c;
  --navy-600: #3a4d6e;
  --navy-500: #5a6b86;
  --navy-400: #8594ab;
  --navy-300: #b5bfcf;
  --navy-200: #dde2ea;
  --navy-100: #eef1f6;
  --navy-50:  #f6f8fb;

  /* ── Red accent ── */
  --red-600: #c62836;
  --red-500: #e63946;
  --red-400: #ef5d68;
  --red-100: #fde4e6;
  --red-50:  #fef1f2;

  /* ── Semantic ── */
  --green-500: #2d9d5f;
  --green-50:  #e8f5ec;
  --amber-500: #e7a02a;
  --amber-50:  #fbf3e2;
  --blue-500:  #2d6fd9;
  --blue-50:   #e6efff;

  /* ── Ink & surfaces ── */
  --ink:    #1a2540;
  --ink-2:  #4a5870;
  --ink-3:  #7a8699;
  --line:   #e5e9f0;
  --line-2: #eef1f6;
  --bg:      #f3f5f9;
  --bg-card: #ffffff;

  /* ── Elevation ── */
  --shadow-sm: 0 1px 2px rgba(26, 37, 64, 0.04), 0 1px 1px rgba(26, 37, 64, 0.02);
  --shadow-md: 0 4px 12px rgba(26, 37, 64, 0.06), 0 2px 4px rgba(26, 37, 64, 0.04);
  --shadow-lg: 0 12px 28px rgba(26, 37, 64, 0.10), 0 4px 8px rgba(26, 37, 64, 0.04);

  /* ── Radius ── */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* ── Shell geometry ── */
  --topbar-h: 60px;
  --domainbar-h: 46px;
  --sidebar-w: 276px;
  --sidebar-w-collapsed: 72px;

  /* ── Legacy --cbex-* aliases (required by dashboard charts) ── */
  --cbex-navy-900: var(--navy-900);
  --cbex-navy-800: var(--navy-800);
  --cbex-navy-700: var(--navy-700);
  --cbex-navy-600: var(--navy-600);
  --cbex-navy-500: var(--navy-500);
  --cbex-navy-400: var(--navy-400);
  --cbex-navy-300: var(--navy-300);
  --cbex-navy-200: var(--navy-200);
  --cbex-navy-100: var(--navy-100);
  --cbex-navy-50:  var(--navy-50);
  --cbex-red-600:  var(--red-600);
  --cbex-red-500:  var(--red-500);
  --cbex-red-400:  var(--red-400);
  --cbex-red-100:  var(--red-100);
  --cbex-red-50:   var(--red-50);
  --cbex-green-500:var(--green-500);
  --cbex-green-50: var(--green-50);
  --cbex-amber-500:var(--amber-500);
  --cbex-amber-50: var(--amber-50);
  --cbex-blue-500: var(--blue-500);
  --cbex-blue-50:  var(--blue-50);
  --cbex-ink:      var(--ink);
  --cbex-ink-2:    var(--ink-2);
  --cbex-ink-3:    var(--ink-3);
  --cbex-line:     var(--line);
  --cbex-line-2:   var(--line-2);
  --cbex-bg:       var(--bg);
  --cbex-bg-card:  var(--bg-card);
  --cbex-shadow-sm: var(--shadow-sm);
  --cbex-shadow-md: var(--shadow-md);
  --cbex-shadow-lg: var(--shadow-lg);
  --cbex-radius-sm: var(--radius-sm);
  --cbex-radius:    var(--radius);
  --cbex-radius-lg: var(--radius-lg);
  --cbex-radius-xl: var(--radius-xl);
}

/* ==========================================================================
   Global base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body.cbex-shell {
  font-family: 'Tajawal', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
body.cbex-shell button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
body.cbex-shell a { color: inherit; text-decoration: none; }
body.cbex-shell input, body.cbex-shell select, body.cbex-shell textarea { font-family: inherit; }
body.cbex-shell svg { flex-shrink: 0; }

/* ==========================================================================
   TOPBAR
   ========================================================================== */
.cbex-shell .topbar {
  position: fixed;
  top: 0; right: 0; left: 0;
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 100;
  gap: 20px;
}
.cbex-shell .domainbar {
  position: fixed;
  top: var(--topbar-h);
  right: 0; left: 0;
  height: var(--domainbar-h);
  background: var(--navy-900);
  display: flex;
  align-items: center;
  padding: 0 14px;
  z-index: 99;
  overflow-x: auto;
  scrollbar-width: none;
}
.cbex-shell .domainbar::-webkit-scrollbar { display: none; }
.cbex-shell .domain-tab {
  height: 34px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: rgba(255,255,255,0.72);
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  white-space: nowrap;
  position: relative;
  transition: all 0.15s;
  flex-shrink: 0;
}
.cbex-shell .domain-tab:hover { color: #fff; background: rgba(255,255,255,0.06); }
.cbex-shell .domain-tab.active { color: #fff; background: rgba(255,255,255,0.08); }
.cbex-shell .domain-tab.active::after {
  content: "";
  position: absolute;
  bottom: -10px;
  right: 20%; left: 20%;
  height: 3px;
  background: var(--red-500);
  border-radius: 3px 3px 0 0;
}
.cbex-shell .domain-tab .d-badge {
  background: var(--red-500);
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
}
.cbex-shell .tb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: calc(var(--sidebar-w) - 20px);
  padding-left: 16px;
  border-left: 1px solid var(--line-2);
  height: 100%;
}
.cbex-shell .tb-brand .logo-mark {
  width: 38px; height: 38px;
  border-radius: 9px;
  background: var(--navy-700);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}
.cbex-shell .tb-brand .logo-mark::after {
  content: "";
  position: absolute;
  bottom: 6px;
  right: 6px; left: 6px;
  height: 2px;
  background: var(--red-500);
  border-radius: 2px;
}
.cbex-shell .tb-brand .brand-text { line-height: 1.1; }
.cbex-shell .tb-brand .brand-name { font-weight: 800; font-size: 15px; color: var(--navy-900); letter-spacing: 0.2px; }
.cbex-shell .tb-brand .brand-sub  { font-size: 10.5px; color: var(--ink-3); font-weight: 500; }

.cbex-shell .tb-search {
  flex: 1;
  max-width: 520px;
  position: relative;
}
.cbex-shell .tb-search input {
  width: 100%;
  height: 38px;
  padding: 0 38px 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--navy-50);
  outline: none;
  font-size: 13.5px;
  transition: all 0.15s;
  color: var(--ink);
}
.cbex-shell .tb-search input:focus {
  background: #fff;
  border-color: var(--navy-400);
  box-shadow: 0 0 0 3px rgba(45, 62, 92, 0.08);
}
.cbex-shell .tb-search .icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
}
.cbex-shell .tb-search .kbd {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--ink-3);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: ui-monospace, monospace;
}

.cbex-shell .tb-actions { display: flex; align-items: center; gap: 4px; margin-right: auto; }
.cbex-shell .tb-btn {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--navy-600);
  transition: background 0.15s;
}
.cbex-shell .tb-btn:hover { background: var(--navy-50); color: var(--navy-800); }
.cbex-shell .tb-btn .dot {
  position: absolute;
  top: 8px; left: 8px;
  width: 8px; height: 8px;
  background: var(--red-500);
  border: 2px solid #fff;
  border-radius: 50%;
}
.cbex-shell .tb-new {
  height: 38px;
  padding: 0 16px;
  background: var(--navy-700);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 0.15s;
}
.cbex-shell .tb-new:hover { background: var(--navy-900); }
.cbex-shell .tb-divider { width: 1px; height: 24px; background: var(--line); margin: 0 6px; }

.cbex-shell .tb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  border-radius: 10px;
  transition: background 0.15s;
}
.cbex-shell .tb-user:hover { background: var(--navy-50); }
.cbex-shell .tb-user .avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--navy-700), var(--navy-500));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
}
.cbex-shell .tb-user .u-name { font-weight: 600; font-size: 13px; color: var(--navy-900); line-height: 1.1; }
.cbex-shell .tb-user .u-role { font-size: 11px; color: var(--ink-3); }
.cbex-shell .tb-user form { margin: 0; padding: 0; display: inline-flex; }

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.cbex-shell .sidebar {
  position: fixed;
  top: calc(var(--topbar-h) + var(--domainbar-h));
  right: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: #fff;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform 0.2s, width 0.18s;
}
.cbex-shell .sb-workspace {
  padding: 14px 14px;
  margin: 14px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--navy-800), var(--navy-700));
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}
.cbex-shell .sb-workspace::before {
  content: "";
  position: absolute;
  right: -20px; top: -20px;
  width: 80px; height: 80px;
  background: radial-gradient(circle, rgba(230,57,70,0.3), transparent 70%);
  border-radius: 50%;
}
.cbex-shell .sb-workspace .ws-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--red-500);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.cbex-shell .sb-workspace .ws-text { position: relative; z-index: 1; min-width: 0; }
.cbex-shell .sb-workspace .ws-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cbex-shell .sb-workspace .ws-sub  { font-size: 11px; opacity: 0.75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cbex-shell .sb-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--navy-200) transparent;
}
.cbex-shell .sb-scroll::-webkit-scrollbar { width: 6px; }
.cbex-shell .sb-scroll::-webkit-scrollbar-thumb { background: var(--navy-200); border-radius: 6px; }

.cbex-shell .sb-section-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 14px 12px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cbex-shell .sb-section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-2);
}

.cbex-shell .sb-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13.5px;
  color: var(--ink-2);
  font-weight: 500;
  margin-bottom: 1px;
  position: relative;
  transition: all 0.12s;
  cursor: pointer;
  text-decoration: none;
}
.cbex-shell .sb-item:hover { background: var(--navy-50); color: var(--navy-900); }
.cbex-shell .sb-item.active {
  background: var(--navy-50);
  color: var(--navy-900);
  font-weight: 700;
}
.cbex-shell .sb-item.active::before {
  content: "";
  position: absolute;
  right: -10px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  background: var(--red-500);
  border-radius: 3px 0 0 3px;
}
.cbex-shell .sb-item .ico { color: var(--navy-500); flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; }
.cbex-shell .sb-item.active .ico { color: var(--red-500); }
.cbex-shell .sb-item .label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cbex-shell .sb-item .badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--navy-100);
  color: var(--navy-800);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cbex-shell .sb-item .badge.red { background: var(--red-500); color: #fff; }
.cbex-shell .sb-item .badge.amber { background: var(--amber-50); color: var(--amber-500); }

.cbex-shell .sb-footer {
  border-top: 1px solid var(--line-2);
  padding: 12px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.cbex-shell .sb-mini-btn {
  flex: 1;
  height: 36px;
  border-radius: 9px;
  background: var(--navy-50);
  color: var(--navy-700);
  font-size: 12.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s;
  border: none;
  cursor: pointer;
}
.cbex-shell .sb-mini-btn:hover { background: var(--navy-100); }
.cbex-shell .sb-footer form { margin: 0; padding: 0; display: inline-flex; flex: 0 0 auto; }
.cbex-shell .sb-footer form .sb-mini-btn { flex: 0 0 auto; width: 36px; padding: 0; }

/* ==========================================================================
   MAIN
   ========================================================================== */
.cbex-shell .main {
  margin-top: calc(var(--topbar-h) + var(--domainbar-h));
  margin-right: var(--sidebar-w);
  padding: 24px 28px 40px;
  min-height: calc(100vh - var(--topbar-h) - var(--domainbar-h));
  transition: margin-right 0.18s;
}

.cbex-shell .page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 16px;
}
.cbex-shell .breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ink-3);
  margin-bottom: 6px;
  padding: 0;
  background: transparent;
  list-style: none;
}
.cbex-shell .breadcrumb .sep { opacity: 0.5; }
.cbex-shell .breadcrumb .cur { color: var(--navy-800); font-weight: 600; }
.cbex-shell .page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--navy-900);
  letter-spacing: -0.3px;
}
.cbex-shell .page-title .date {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  margin-right: 10px;
}
.cbex-shell .page-actions { display: flex; gap: 8px; align-items: center; }

.cbex-shell .btn {
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s;
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
}
.cbex-shell .btn-primary { background: var(--navy-700); color: #fff; }
.cbex-shell .btn-primary:hover { background: var(--navy-900); }
.cbex-shell .btn-danger { background: var(--red-500); color: #fff; }
.cbex-shell .btn-danger:hover { background: var(--red-600); }
.cbex-shell .btn-ghost { background: #fff; color: var(--navy-700); border-color: var(--line); }
.cbex-shell .btn-ghost:hover { background: var(--navy-50); border-color: var(--navy-300); }

/* ==========================================================================
   GRIDS / KPI
   ========================================================================== */
.cbex-shell .kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.cbex-shell .grid-2   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cbex-shell .grid-3   { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.cbex-shell .grid-4   { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.cbex-shell .grid-2-3-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

.cbex-shell .kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: relative;
  overflow: hidden;
}
.cbex-shell .kpi .row1 { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.cbex-shell .kpi .kpi-icon { width: 42px; height: 42px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; }
.cbex-shell .kpi.blue  .kpi-icon { background: var(--blue-50);  color: var(--blue-500); }
.cbex-shell .kpi.green .kpi-icon { background: var(--green-50); color: var(--green-500); }
.cbex-shell .kpi.amber .kpi-icon { background: var(--amber-50); color: var(--amber-500); }
.cbex-shell .kpi.red   .kpi-icon { background: var(--red-50);   color: var(--red-500); }
.cbex-shell .kpi .trend { font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 20px; display: inline-flex; align-items: center; gap: 3px; }
.cbex-shell .kpi .trend.up   { background: var(--green-50); color: var(--green-500); }
.cbex-shell .kpi .trend.down { background: var(--red-50);   color: var(--red-500); }
.cbex-shell .kpi .label { font-size: 12.5px; color: var(--ink-3); font-weight: 500; }
.cbex-shell .kpi .value { font-size: 26px; font-weight: 800; color: var(--navy-900); letter-spacing: -0.5px; margin-top: 2px; line-height: 1.1; }
.cbex-shell .kpi .sub   { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }

.cbex-shell .dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; }

/* ==========================================================================
   CARDS / TABS / TABLES / STATUS
   ========================================================================== */
.cbex-shell .card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.cbex-shell .card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-2);
}
.cbex-shell .card-title { font-size: 15px; font-weight: 700; color: var(--navy-900); }
.cbex-shell .card-sub   { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.cbex-shell .card-body  { padding: 18px; }
.cbex-shell .card-body.flush { padding: 0; }

.cbex-shell .tabs { display: flex; gap: 4px; background: var(--navy-50); padding: 3px; border-radius: 8px; }
.cbex-shell .tabs button { padding: 6px 12px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.cbex-shell .tabs button.on { background: #fff; color: var(--navy-900); box-shadow: var(--shadow-sm); }

.cbex-shell .tbl { width: 100%; border-collapse: collapse; }
.cbex-shell .tbl th {
  text-align: right;
  padding: 12px 18px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-3);
  background: var(--navy-50);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--line-2);
}
.cbex-shell .tbl td {
  padding: 14px 18px;
  font-size: 13px;
  color: var(--ink);
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.cbex-shell .tbl tr:last-child td { border-bottom: none; }
.cbex-shell .tbl tr.clickable { cursor: pointer; transition: background 0.1s; }
.cbex-shell .tbl tr.clickable:hover { background: var(--navy-50); }
.cbex-shell .tbl .track-id { font-family: ui-monospace, 'Courier New', monospace; font-weight: 700; color: var(--navy-900); font-size: 12.5px; }

.cbex-shell .status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
}
.cbex-shell .status .s-dot { width: 6px; height: 6px; border-radius: 50%; }
.cbex-shell .status.delivered  { background: var(--green-50); color: var(--green-500); }
.cbex-shell .status.delivered  .s-dot { background: var(--green-500); }
.cbex-shell .status.in-transit { background: var(--blue-50);  color: var(--blue-500); }
.cbex-shell .status.in-transit .s-dot { background: var(--blue-500); }
.cbex-shell .status.pending    { background: var(--amber-50); color: var(--amber-500); }
.cbex-shell .status.pending    .s-dot { background: var(--amber-500); }
.cbex-shell .status.cancelled  { background: var(--red-50);   color: var(--red-500); }
.cbex-shell .status.cancelled  .s-dot { background: var(--red-500); }

/* ==========================================================================
   TIMELINE / MAP / FLEET
   ========================================================================== */
.cbex-shell .timeline-item { display: flex; gap: 12px; padding: 12px 0; position: relative; }
.cbex-shell .timeline-item:not(:last-child)::before {
  content: "";
  position: absolute;
  right: 15px;
  top: 36px;
  bottom: -6px;
  width: 2px;
  background: var(--line);
}
.cbex-shell .timeline-item .tl-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--navy-50);
  color: var(--navy-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
}
.cbex-shell .timeline-item.done .tl-dot   { background: var(--green-500); color: #fff; box-shadow: 0 0 0 1px var(--green-500); }
.cbex-shell .timeline-item.active .tl-dot { background: var(--red-500);   color: #fff; box-shadow: 0 0 0 1px var(--red-500); }
.cbex-shell .timeline-item .tl-title { font-weight: 700; font-size: 13px; color: var(--navy-900); }
.cbex-shell .timeline-item .tl-meta  { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.cbex-shell .timeline-item .tl-desc  { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }

.cbex-shell .mini-map {
  position: relative;
  width: 100%;
  height: 280px;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 30% 40%, rgba(45,111,217,0.08), transparent 40%),
    radial-gradient(circle at 70% 60%, rgba(230,57,70,0.08), transparent 40%),
    linear-gradient(180deg, #f5f7fb, #eef2f8);
  overflow: hidden;
  border: 1px solid var(--line);
}
.cbex-shell .mini-map .grid-lines {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--navy-200) 1px, transparent 1px),
    linear-gradient(90deg, var(--navy-200) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.35;
}
.cbex-shell .map-pin {
  position: absolute;
  width: 26px; height: 26px;
  background: var(--red-500);
  border-radius: 50% 50% 50% 0;
  transform: translate(50%, -100%) rotate(-45deg);
  box-shadow: 0 4px 10px rgba(230,57,70,0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cbex-shell .map-pin::after { content: ""; width: 10px; height: 10px; background: #fff; border-radius: 50%; }
.cbex-shell .map-pin.navy { background: var(--navy-700); box-shadow: 0 4px 10px rgba(45,62,92,0.4); }
.cbex-shell .map-pulse {
  position: absolute;
  transform: translate(50%, -50%);
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(230, 57, 70, 0.2);
  animation: cbex-pulse 2s infinite;
}
@keyframes cbex-pulse {
  0%, 100% { transform: translate(50%, -50%) scale(1);   opacity: 0.7; }
  50%      { transform: translate(50%, -50%) scale(1.6); opacity: 0;   }
}
.cbex-shell .route-line {
  position: absolute;
  stroke: var(--navy-700);
  stroke-width: 2.5;
  stroke-dasharray: 6 4;
  fill: none;
  animation: cbex-dash 20s linear infinite;
}
@keyframes cbex-dash { to { stroke-dashoffset: -200; } }

.cbex-shell .fleet-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  transition: all 0.15s;
}
.cbex-shell .fleet-card:hover { border-color: var(--navy-300); background: var(--navy-50); }
.cbex-shell .fleet-card .truck-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--navy-50);
  color: var(--navy-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cbex-shell .chart-wrap { height: 240px; position: relative; }

/* ==========================================================================
   SIDEBAR COLLAPSE — desktop-only, toggled by adding .sb-collapsed to body
   ========================================================================== */
body.cbex-shell.sb-collapsed { --sidebar-w: var(--sidebar-w-collapsed); }
body.cbex-shell.sb-collapsed .tb-brand { min-width: calc(var(--sidebar-w-collapsed) - 20px); }
body.cbex-shell.sb-collapsed .tb-brand .brand-text { display: none; }
body.cbex-shell.sb-collapsed .sb-workspace .ws-text,
body.cbex-shell.sb-collapsed .sb-section-title,
body.cbex-shell.sb-collapsed .sb-item .label,
body.cbex-shell.sb-collapsed .sb-item .badge,
body.cbex-shell.sb-collapsed .sb-mini-btn span { display: none; }
body.cbex-shell.sb-collapsed .sb-workspace { justify-content: center; padding: 10px; }
body.cbex-shell.sb-collapsed .sb-item { justify-content: center; padding: 11px; }
body.cbex-shell.sb-collapsed .sb-item.active::before { right: -5px; }
body.cbex-shell.sb-collapsed .sb-section-title { padding: 10px 0 4px; justify-content: center; }
body.cbex-shell.sb-collapsed .sb-section-title::after { display: none; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1200px) {
  .cbex-shell .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .cbex-shell .dash-grid { grid-template-columns: 1fr; }
  .cbex-shell .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .cbex-shell .grid-2 { grid-template-columns: 1fr; }
  .cbex-shell .grid-3 { grid-template-columns: 1fr 1fr; }
  .cbex-shell .grid-2-3-1 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .cbex-shell .sidebar { transform: translateX(100%); transition: transform 0.2s; }
  body.cbex-shell.sb-open .sidebar { transform: translateX(0); }
  .cbex-shell .main { margin-right: 0; padding: 16px; }
  .cbex-shell .tb-brand { min-width: auto; border-left: none; }
  .cbex-shell .tb-search { display: none; }
  /* Overlay — visible only when the mobile drawer is open. Clicking it
     closes the drawer (wired in layouts/cbex.blade.php). */
  body.cbex-shell.sb-open .cbex-overlay {
    position: fixed; inset: 0;
    z-index: 50;
    background: rgba(26, 37, 64, 0.5);
    backdrop-filter: blur(2px);
  }
}
.cbex-shell .cbex-overlay { display: none; }
body.cbex-shell.sb-open .cbex-overlay { display: block; }
@media (min-width: 769px) { body.cbex-shell.sb-open .cbex-overlay { display: none; } }

/* ==========================================================================
   LEGACY ESCAPES — allow child views using Bootstrap/Vuexy markup to remain
   readable during the wrapper-cutover phase. These are a temporary bridge
   and will be removed in Phase 3 when individual pages adopt CBEX classes.
   ========================================================================== */
.cbex-shell .main .card:not([class*="cbex-"]) { background: var(--bg-card); }
.cbex-shell img { max-width: 100%; }

/* ==========================================================================
   PHASE 2 — SHARED COMPONENT RE-SKINS
   --------------------------------------------------------------------------
   Styles for the 15 Blade components re-skinned in resources/views/components/
   (badge, card, page-header, stat-card, toast, filter-bar, empty-state,
    detail-header, section-title, timeline, modal, info-row, kv-pair,
    metric-widget, settings-form). These are all scoped to `.cbex-shell`
   so they never leak outside the admin surface.
   ========================================================================== */

/* — Status chip: two extra variants beyond the 4 in the core set ---------- */
.cbex-shell .status.processing  { background: rgba(139, 92, 246, 0.12); color: #7c3aed; }
.cbex-shell .status.processing  .s-dot { background: #7c3aed; }
.cbex-shell .status.neutral     { background: var(--navy-50); color: var(--ink-3); }
.cbex-shell .status.neutral     .s-dot { background: var(--ink-3); }

/* — Page head: small additions -------------------------------------------- */
.cbex-shell .page-head-main     { flex: 1; min-width: 0; }
.cbex-shell .card-head-actions  { display: flex; gap: 8px; align-items: center; }

/* — Toast ----------------------------------------------------------------- */
.cbex-shell .cbex-toast-host {
  position: fixed; bottom: 24px; inset-inline-start: 24px; z-index: 90;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.cbex-shell .cbex-toast {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 10px;
  min-width: 280px; max-width: 420px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
  border-inline-start-width: 3px;
  box-shadow: var(--shadow);
  font-size: 13px; color: var(--ink);
  transition: opacity 0.25s, transform 0.25s;
}
.cbex-shell .cbex-toast-icon {
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; flex-shrink: 0;
}
.cbex-shell .cbex-toast-body  { flex: 1; line-height: 1.4; }
.cbex-shell .cbex-toast-close {
  width: 24px; height: 24px; border-radius: 6px;
  background: transparent; border: none; cursor: pointer;
  color: var(--ink-3); font-size: 13px;
}
.cbex-shell .cbex-toast-close:hover { background: var(--navy-50); color: var(--ink); }
.cbex-shell .cbex-toast-success { border-inline-start-color: var(--green-500); }
.cbex-shell .cbex-toast-success .cbex-toast-icon { background: var(--green-50); color: var(--green-500); }
.cbex-shell .cbex-toast-error   { border-inline-start-color: var(--red-500); }
.cbex-shell .cbex-toast-error   .cbex-toast-icon { background: var(--red-50);   color: var(--red-500); }
.cbex-shell .cbex-toast-warning { border-inline-start-color: var(--amber-500); }
.cbex-shell .cbex-toast-warning .cbex-toast-icon { background: var(--amber-50); color: var(--amber-500); }
.cbex-shell .cbex-toast-info    { border-inline-start-color: var(--blue-500); }
.cbex-shell .cbex-toast-info    .cbex-toast-icon { background: var(--blue-50);  color: var(--blue-500); }

/* — Filter-bar toolbar ---------------------------------------------------- */
.cbex-shell .cbex-toolbar {
  display: flex; gap: 12px; flex-wrap: wrap;
  align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}
.cbex-shell .cbex-toolbar-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; flex: 1; min-width: 220px; }
.cbex-shell .cbex-toolbar-actions { display: flex; gap: 8px; align-items: center; }

.cbex-shell .cbex-search {
  position: relative;
  display: inline-flex; align-items: center;
  min-width: 240px;
  background: var(--navy-50);
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: all 0.15s;
}
.cbex-shell .cbex-search:focus-within {
  background: #fff; border-color: var(--navy-300);
  box-shadow: 0 0 0 3px rgba(45, 111, 217, 0.1);
}
.cbex-shell .cbex-search-icon {
  position: absolute; inset-inline-start: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}
.cbex-shell .cbex-search-input {
  flex: 1;
  height: 38px;
  padding: 0 36px 0 14px;
  padding-inline-start: 36px;
  padding-inline-end: 14px;
  background: transparent;
  border: none;
  font-size: 13px; color: var(--ink);
  outline: none;
}
.cbex-shell .cbex-search-input::placeholder { color: var(--ink-3); }

/* — Empty state ----------------------------------------------------------- */
.cbex-shell .cbex-empty {
  text-align: center;
  padding: 56px 24px;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
}
.cbex-shell .cbex-empty-icon  { font-size: 40px; line-height: 1; margin-bottom: 12px; opacity: 0.75; }
.cbex-shell .cbex-empty-title { font-size: 15px; font-weight: 700; color: var(--navy-900); }
.cbex-shell .cbex-empty-desc  { font-size: 13px; color: var(--ink-3); margin-top: 6px; max-width: 480px; margin-inline: auto; line-height: 1.5; }

/* — Detail header --------------------------------------------------------- */
.cbex-shell .cbex-detail-head {
  display: flex; gap: 16px;
  align-items: center;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.cbex-shell .cbex-detail-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: var(--navy-50); color: var(--navy-700);
  flex-shrink: 0;
}
.cbex-shell .cbex-detail-info { flex: 1; min-width: 0; }
.cbex-shell .cbex-detail-title {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 17px; font-weight: 800; color: var(--navy-900);
  letter-spacing: -0.2px;
}
.cbex-shell .cbex-detail-sub {
  font-size: 12.5px; color: var(--ink-3);
  margin-top: 4px;
}

/* — Section title (in-content divider) ----------------------------------- */
.cbex-shell .cbex-section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--ink-2);
  padding: 8px 0;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line-2);
}
.cbex-shell .cbex-section-title-text { color: var(--navy-900); }
.cbex-shell .cbex-section-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px;
  padding: 0 7px;
  border-radius: 10px;
  background: var(--navy-50); color: var(--navy-700);
  font-size: 11.5px; font-weight: 700;
}
.cbex-shell .cbex-section-extra { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; font-size: 12.5px; }

/* — Timeline wrapper + fixed per-item layout ----------------------------- */
.cbex-shell .cbex-timeline { position: relative; padding: 4px 0; }
.cbex-shell .cbex-timeline .timeline-item .tl-body { flex: 1; min-width: 0; }

/* — Modal ---------------------------------------------------------------- */
.cbex-shell .cbex-modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(26, 37, 64, 0.55);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
}
.cbex-shell .cbex-modal-backdrop.open,
.cbex-shell .cbex-modal-backdrop[open],
.cbex-shell .cbex-modal-backdrop.show {
  display: flex;
}
.cbex-shell .cbex-modal {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 40px);
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.22);
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.cbex-shell .cbex-modal.wide { max-width: 780px; }
.cbex-shell .cbex-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-2);
}
.cbex-shell .cbex-modal-title {
  font-size: 15px; font-weight: 700; color: var(--navy-900); margin: 0;
}
.cbex-shell .cbex-modal-close {
  width: 30px; height: 30px; border-radius: 8px;
  background: transparent; border: none; cursor: pointer;
  color: var(--ink-3); font-size: 14px;
}
.cbex-shell .cbex-modal-close:hover { background: var(--navy-50); color: var(--ink); }
.cbex-shell .cbex-modal-body {
  padding: 18px;
  overflow-y: auto;
  font-size: 13px;
  color: var(--ink);
}

/* — Info row (label : value, same line) ---------------------------------- */
.cbex-shell .cbex-info-row {
  display: flex; align-items: baseline; gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px;
}
.cbex-shell .cbex-info-row:last-child { border-bottom: none; }
.cbex-shell .cbex-info-label { flex: 0 0 38%; color: var(--ink-3); font-weight: 500; }
.cbex-shell .cbex-info-value { flex: 1; color: var(--navy-900); font-weight: 600; min-width: 0; word-break: break-word; }

/* — Key/value cell (stacked) --------------------------------------------- */
.cbex-shell .cbex-kv {
  display: flex; flex-direction: column; gap: 2px;
  padding: 4px 0;
}
.cbex-shell .cbex-kv-label { font-size: 11.5px; color: var(--ink-3); font-weight: 500; letter-spacing: 0.3px; text-transform: uppercase; }
.cbex-shell .cbex-kv-value { font-size: 14px; color: var(--navy-900); font-weight: 700; }
.cbex-shell .cbex-mono { font-family: ui-monospace, "Courier New", monospace; letter-spacing: 0.2px; }

/* — Metric widget (compact value/label/delta) ---------------------------- */
.cbex-shell .cbex-metric {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.cbex-shell .cbex-metric-value { font-size: 22px; font-weight: 800; color: var(--navy-900); line-height: 1.1; letter-spacing: -0.3px; }
.cbex-shell .cbex-metric-label { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

/* — Settings form (shared form primitives) ------------------------------- */
.cbex-shell .cbex-form-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}
@media (max-width: 640px) {
  .cbex-shell .cbex-form-grid { grid-template-columns: 1fr; }
}
.cbex-shell .cbex-form-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cbex-shell .cbex-label {
  font-size: 12px; font-weight: 600; color: var(--ink-2);
}
.cbex-shell .cbex-input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px; color: var(--ink);
  font-family: inherit;
  transition: all 0.15s;
  outline: none;
}
.cbex-shell textarea.cbex-input { height: auto; min-height: 84px; padding-block: 10px; resize: vertical; }
.cbex-shell select.cbex-input { cursor: pointer; }
.cbex-shell .cbex-input:focus {
  border-color: var(--navy-300);
  box-shadow: 0 0 0 3px rgba(45, 111, 217, 0.12);
}
.cbex-shell .cbex-input::placeholder { color: var(--ink-3); }
.cbex-shell .cbex-form-actions {
  display: flex; gap: 10px; align-items: center;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-2);
}

/* ==========================================================================
   Phase 6 — Legacy alias block RETIRED.
   --------------------------------------------------------------------------
   The compatibility shim that aliased pre-CBEX tokens (--tx/--td/--bd/--tm/
   --sf/--sf-2/--pr/--pr-100/--dg/--ac/--wr and the --sp-*/--text-*/--font-*
   families) has been removed. Every authenticated blade view that used to
   reference those names has been rewritten to use CBEX primitives directly
   (--ink, --ink-2, --ink-3, --line, --line-2, --bg, --bg-card, --navy-*,
   --red-*, --green-500, --amber-500, --blue-500) or literal px/font values.
   offline.blade.php keeps its own self-contained :root declaration — it is
   a standalone service-worker page that does not load this stylesheet.
   ========================================================================== */
