/* CrewByway Executive SaaS Design System — Light & Dark Modes */
:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;

  --sidebar-bg: #0f172a;
  --sidebar-border: #1e293b;
  --sidebar-text: #e2e8f0;
  --sidebar-muted: #94a3b8;

  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-soft: rgba(2, 132, 199, 0.1);
  --primary-border: rgba(2, 132, 199, 0.25);

  --success: #059669;
  --success-soft: rgba(5, 150, 105, 0.11);
  --warn: #d97706;
  --warn-soft: rgba(217, 119, 6, 0.12);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.1);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 12px 32px rgba(15, 23, 42, 0.09), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 24px 48px rgba(15, 23, 42, 0.18);
  --font-sans: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg: #090e1a;
  --surface: #111827;
  --surface-2: #172033;
  --surface-hover: #1e293b;
  --border: #243045;
  --border-strong: #334155;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --muted: #94a3b8;

  --sidebar-bg: #070b14;
  --sidebar-border: #1a2438;
  --sidebar-text: #f1f5f9;
  --sidebar-muted: #64748b;

  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --primary-soft: rgba(56, 189, 248, 0.14);
  --primary-border: rgba(56, 189, 248, 0.3);

  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.15);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.15);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 14px 36px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 54px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

.tabular { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
[data-theme="dark"] .leaflet-tile-pane {
  filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
.hidden { display: none !important; }

svg.ico {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
svg.ico-sm { width: 14px; height: 14px; }
svg.ico-lg { width: 20px; height: 20px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.48; cursor: not-allowed; box-shadow: none; }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}
[data-theme="dark"] .btn-primary { color: #04131f; }
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: #ffffff;
}
[data-theme="dark"] .btn-success { color: #032016; }
.btn-success:hover:not(:disabled) { filter: brightness(1.06); }

.btn-warn {
  background: var(--warn);
  border-color: var(--warn);
  color: #ffffff;
}
[data-theme="dark"] .btn-warn { color: #1c1000; }
.btn-warn:hover:not(:disabled) { filter: brightness(1.06); }

.btn-danger {
  background: var(--danger-soft);
  border-color: rgba(220, 38, 38, 0.25);
  color: var(--danger);
  box-shadow: none;
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 7px; }
.btn-xs { padding: 4px 8px; font-size: 11.5px; border-radius: 6px; }
.btn-block { width: 100%; }

/* Form Controls */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}
.input, select.input, textarea.input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
textarea.input { min-height: 92px; resize: vertical; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.badge-blue { background: var(--primary-soft); color: var(--primary); }
.badge-green { background: var(--success-soft); color: var(--success); }
.badge-amber { background: var(--warn-soft); color: var(--warn); }
.badge-red { background: var(--danger-soft); color: var(--danger); }
.badge-slate { background: var(--surface-hover); color: var(--text-secondary); border: 1px solid var(--border); }

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

/* ============================================================
   SPLIT-SCREEN EXECUTIVE AUTH & SANDBOX SHOWCASE
   ============================================================ */
.auth-split {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
}

.auth-hero {
  background:
    radial-gradient(circle at 18% 20%, rgba(14, 165, 233, 0.24), transparent 48%),
    radial-gradient(circle at 82% 82%, rgba(16, 185, 129, 0.20), transparent 50%),
    linear-gradient(155deg, #0b1224 0%, #0f172a 55%, #0c1929 100%);
  color: #f8fafc;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.auth-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(148, 163, 184, 0.14) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
}
.auth-hero-inner { position: relative; z-index: 1; max-width: 540px; }
.hero-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 36px; }
.hero-brand img { width: 40px; height: 40px; border-radius: 10px; box-shadow: 0 8px 20px rgba(2, 132, 199, 0.35); }
.hero-brand-name { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.28);
  color: #7dd3fc;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 18px;
}
.hero-h1 {
  font-size: 38px;
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
}
.hero-p {
  font-size: 15.5px;
  line-height: 1.6;
  color: #cbd5e1;
  margin: 0 0 28px;
}
.hero-features { display: grid; gap: 14px; margin-bottom: 32px; }
.hero-feat {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.14);
  padding: 13px 15px;
  border-radius: 12px;
  backdrop-filter: blur(8px);
}
.hero-feat-ico {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hero-feat h4 { margin: 0 0 2px; font-size: 14px; font-weight: 700; color: #fff; }
.hero-feat p { margin: 0; font-size: 12.5px; color: #94a3b8; line-height: 1.45; }

.hero-preview-card {
  position: relative;
  z-index: 1;
  max-width: 540px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  padding: 15px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.hero-stat { display: flex; flex-direction: column; }
.hero-stat strong { font-size: 18px; font-weight: 800; color: #fff; }
.hero-stat span { font-size: 11.5px; color: #94a3b8; }

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 28px;
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
}
.auth-card-head { margin-bottom: 20px; }
.auth-card-head h2 { margin: 0 0 4px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.auth-card-head p { margin: 0; font-size: 13.5px; color: var(--muted); }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: 10px;
}
.auth-tab {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px;
  border-radius: 7px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.demo-box {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.demo-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.demo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-card-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.demo-card-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.demo-card-btn strong { font-size: 12.5px; font-weight: 700; }
.demo-card-btn span { font-size: 11px; color: var(--muted); }

/* ============================================================
   AUTHENTICATED APP SHELL (SIDEBAR RAIL + MAIN CANVAS)
   ============================================================ */
.app-shell {
  display: grid;
  grid-template-columns: 256px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  z-index: 900;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: 14px;
}
.sidebar-brand img { width: 34px; height: 34px; border-radius: 9px; }
.sidebar-brand-title { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; color: #fff; }
.sidebar-org-sub { font-size: 11.5px; color: var(--sidebar-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--sidebar-muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-item.active {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.25);
  color: #7dd3fc;
}

.sidebar-footer {
  border-top: 1px solid var(--sidebar-border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.conn-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--sidebar-border);
  border-radius: 10px;
  padding: 10px 11px;
}
.conn-card-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 4px 0;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0284c7, #059669);
  color: #fff;
  font-weight: 800;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Main Column */
.app-main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-title-wrap { display: flex; align-items: center; gap: 10px; }
.mobile-brand-logo { display: none; width: 28px; height: 28px; border-radius: 7px; }
#connStatusMobile { display: none; }
.page-title { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.main-container {
  flex: 1;
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 20px 24px 36px;
}

/* Dispatch Change Banner */
.alert-banner {
  background: var(--warn-soft);
  border: 1px solid rgba(217, 119, 6, 0.35);
  border-left: 4px solid var(--warn);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.alert-banner h4 { margin: 0 0 4px; color: var(--warn); font-size: 14px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.alert-banner ul { margin: 4px 0 0 18px; padding: 0; font-size: 13px; color: var(--text); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* Routes Workspace Layout */
.routes-layout {
  display: grid;
  grid-template-columns: 295px 1fr;
  gap: 18px;
  align-items: start;
}
.route-workspace {
  display: grid;
  grid-template-columns: 1.12fr 1fr;
  gap: 18px;
  align-items: start;
}

.route-list-item {
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
  margin-bottom: 9px;
  transition: all 0.15s;
}
.route-list-item:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.route-list-item.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px var(--primary-border);
}

/* Route Summary Header Bar */
.route-hero-bar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}
.route-hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.route-metrics-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.mini-metric {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
}
.mini-metric-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.mini-metric-val { font-size: 16px; font-weight: 800; margin-top: 2px; }

.progress-track {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Timeline Stop Cards */
.stops-timeline { position: relative; }
.stop-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 13px 14px;
  margin-bottom: 10px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.stop-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.stop-card.dragging { opacity: 0.45; border-style: dashed; border-color: var(--primary); }
.stop-card.status-PENDING { border-left: 4px solid var(--primary); }
.stop-card.status-EN_ROUTE {
  border-left: 4px solid #6366f1;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.09) 0%, var(--surface) 28%);
}
.stop-card.status-ARRIVED {
  border-left: 4px solid var(--warn);
  background: linear-gradient(90deg, var(--warn-soft) 0%, var(--surface) 28%);
}
.stop-card.status-COMPLETED { border-left: 4px solid var(--success); }
.stop-card.status-SKIPPED { border-left: 4px solid var(--muted); opacity: 0.7; }
.status-EN_ROUTE .stop-num { background: #6366f1; }

/* Customer Live Tracker Stepper & Proof of Service Signature Pad */
.track-stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 18px 0;
}
.track-step {
  padding: 10px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.track-step.done {
  border-color: rgba(5, 150, 105, 0.35);
  background: var(--success-soft);
  color: var(--success);
}
.track-step.current {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}
.sig-wrap {
  border: 1.5px dashed var(--border-strong);
  border-radius: 10px;
  background: #ffffff;
  overflow: hidden;
  position: relative;
}
.sig-canvas {
  display: block;
  width: 100%;
  height: 155px;
  touch-action: none;
  cursor: crosshair;
}
.proof-preview-img {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-top: 8px;
}

.stop-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.stop-left { display: flex; gap: 11px; align-items: flex-start; min-width: 0; }
.drag-grip {
  color: var(--muted);
  cursor: grab;
  padding: 4px 2px;
  margin-left: -4px;
  opacity: 0.65;
}
.drag-grip:hover { opacity: 1; color: var(--text); }
.stop-num {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 800;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}
.status-COMPLETED .stop-num { background: var(--success); }
.status-ARRIVED .stop-num { background: var(--warn); }
.status-SKIPPED .stop-num { background: var(--muted); }

.stop-cust { font-weight: 700; font-size: 14.5px; cursor: pointer; }
.stop-cust:hover { color: var(--primary); }
.stop-addr { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.stop-note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
}
.stop-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  font-size: 12px;
  color: var(--muted);
}
.stop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* Map Card */
.map-sticky { position: sticky; top: 76px; }
#routeMap, #shareMap {
  width: 100%;
  height: 540px;
  border-radius: 10px;
  border: 1px solid var(--border);
  z-index: 1;
}
.map-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}
.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

/* KPI Grid & Billing Tables */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.kpi-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.kpi-label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; font-weight: 700; letter-spacing: 0.04em; }
.kpi-val { font-size: 25px; font-weight: 800; margin-top: 4px; letter-spacing: -0.02em; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface-2);
}
tbody tr:hover { background: var(--surface-hover); }

.bar-cell { display: flex; align-items: center; gap: 8px; }
.mini-bar-bg { flex: 1; min-width: 60px; max-width: 120px; height: 7px; background: var(--border); border-radius: 999px; overflow: hidden; }
.mini-bar-fill { height: 100%; background: var(--primary); border-radius: 999px; }

/* Activity Feed */
.activity-list { display: flex; flex-direction: column; gap: 7px; max-height: 200px; overflow-y: auto; }
.activity-item {
  font-size: 12.5px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(4px);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-lg);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 800; }

/* Toast */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1500;
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #f8fafc;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
}

/* Mobile Nav */
.mobile-nav { display: none; }

/* Print Stylesheet */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .sidebar, .topbar, .mobile-nav, .no-print, #toast, .modal-backdrop { display: none !important; }
  .app-shell { display: block !important; }
  .main-container { padding: 0 !important; max-width: 100% !important; }
  .card, .kpi-card, .stop-card { background: #fff !important; color: #000 !important; border: 1px solid #cbd5e1 !important; box-shadow: none !important; break-inside: avoid; }
  th, td { color: #000 !important; border-color: #cbd5e1 !important; }
}

/* Responsive Breakpoints */
@media (max-width: 1220px) {
  .routes-layout { grid-template-columns: 1fr; }
  .route-workspace { grid-template-columns: 1fr; }
  .map-sticky { position: static; }
  #routeMap { height: 360px; }
}

@media (max-width: 960px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-hero { padding: 28px 24px; }
  .hero-h1 { font-size: 28px; }
  .hero-features, .hero-preview-card { display: none; }

  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-brand-logo { display: block; }
  #connStatusMobile { display: inline-flex; }
  #btnLogoutMobile { display: inline-flex !important; }
  .topbar { padding: 10px 14px; }
  .main-container { padding: 14px 14px 86px; }
  .route-metrics-strip { grid-template-columns: 1fr 1fr; }
  #toast { bottom: 78px; right: 12px; left: 12px; max-width: none; }

  .mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 950;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
  }
  .mobile-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    padding: 6px 4px;
    border-radius: 8px;
    cursor: pointer;
  }
  .mobile-nav button.active {
    color: var(--primary);
    background: var(--primary-soft);
  }
}
