:root{
  --bg: #10141A;
  --panel: #171D26;
  --panel-2: #1D2530;
  --line: #2A3341;
  --text: #E8ECF2;
  --text-dim: #8C97A8;
  --amber: #FFB020;
  --teal: #00D9C0;
  --coral: #FF5A5A;
  --violet: #8B7CF6;
}
*{box-sizing:border-box; margin:0; padding:0;}
body{
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(0,217,192,0.07), transparent),
    radial-gradient(900px 500px at 0% 110%, rgba(255,176,32,0.06), transparent),
    var(--bg);
  color:var(--text);
  font-family:'Inter', sans-serif;
  min-height:100vh;
}
.mono{ font-family:'JetBrains Mono', monospace; }
.display{ font-family:'Space Grotesk', sans-serif; }
::selection{ background:rgba(0,217,192,0.3); }

/* --- Route-line signature divider --- */
.route-line{
  height:2px;
  background-image: repeating-linear-gradient(90deg, var(--teal) 0 10px, transparent 10px 18px);
  position:relative;
  margin:28px 0;
  opacity:0.55;
}
.route-line::after{ content:"▸"; position:absolute; right:-2px; top:-9px; color:var(--teal); font-size:14px; }

.shell{ display:grid; grid-template-columns:240px 1fr; min-height:100vh; }

/* --- Sidebar --- */
.sidebar{
  background: var(--panel);
  border-right:1px solid var(--line);
  padding:28px 20px;
  display:flex; flex-direction:column; gap:6px;
}
.brand{ display:flex; align-items:center; gap:10px; margin-bottom:36px; }
.brand-mark{
  width:34px;height:34px; border-radius:9px;
  background: linear-gradient(135deg, var(--amber), var(--teal));
  display:flex; align-items:center; justify-content:center;
  font-family:'Space Grotesk'; font-weight:700; color:#0B0E12; font-size:16px;
}
.brand-name{ font-family:'Space Grotesk'; font-weight:700; font-size:17px; letter-spacing:-0.02em; }
.brand-sub{ font-size:10.5px; color:var(--text-dim); letter-spacing:0.08em; text-transform:uppercase; }

.nav-item{
  display:flex; align-items:center; gap:12px;
  padding:10px 12px; border-radius:9px;
  color:var(--text-dim); font-size:13.5px; font-weight:500;
  cursor:pointer; transition:.15s;
}
.nav-item .dot{ width:6px;height:6px;border-radius:50%; background:var(--line); }
.nav-item.active{ background:var(--panel-2); color:var(--text); }
.nav-item.active .dot{ background:var(--teal); box-shadow:0 0 8px var(--teal); }
.nav-item:hover{ background:var(--panel-2); color:var(--text); }
.nav-section-label{ font-size:10.5px; color:var(--text-dim); text-transform:uppercase; letter-spacing:0.1em; margin:20px 4px 6px; }
.sidebar-footer{ margin-top:auto; display:flex; flex-direction:column; gap:10px; }

/* --- Main --- */
.main{ padding:32px 40px 60px; min-width:0; }
.topbar{ display:flex; justify-content:space-between; align-items:flex-end; margin-bottom:8px; }
.page-title{ font-family:'Space Grotesk'; font-size:28px; font-weight:700; letter-spacing:-0.02em; }
.page-sub{ color:var(--text-dim); font-size:13.5px; margin-top:4px; }
.live-pill{
  display:flex; align-items:center; gap:8px;
  background:var(--panel); border:1px solid var(--line); border-radius:100px;
  padding:7px 14px; font-size:12px; color:var(--text-dim); white-space:nowrap;
}
.live-pulse{ width:7px;height:7px;border-radius:50%; background:var(--amber); }
.live-pulse.on{ background:var(--teal); animation: pulse 1.6s infinite; }
@keyframes pulse{ 0%,100%{opacity:1; box-shadow:0 0 0 0 rgba(0,217,192,.5);} 50%{opacity:.6; box-shadow:0 0 0 5px rgba(0,217,192,0);} }

/* --- Stats --- */
.stats{ display:grid; grid-template-columns:repeat(5,1fr); gap:14px; margin-top:12px; }
.stat-card{ background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:18px 18px 16px; }
.stat-label{ font-size:11.5px; color:var(--text-dim); text-transform:uppercase; letter-spacing:0.06em; }
.stat-value{ font-family:'JetBrains Mono'; font-size:26px; font-weight:600; margin-top:8px; letter-spacing:-0.01em; }
.stat-accent-amber{ color:var(--amber); }
.stat-accent-teal{ color:var(--teal); }
.stat-accent-coral{ color:var(--coral); }
.stat-accent-violet{ color:var(--violet); }
.stat-note{ font-size:11px; color:var(--text-dim); margin-top:6px; }

/* --- Panels / grids --- */
.grid-2{ display:grid; grid-template-columns:1.4fr 1fr; gap:18px; }
.panel{ background:var(--panel); border:1px solid var(--line); border-radius:16px; padding:22px; }
.panel-head{ display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; gap:10px; flex-wrap:wrap; }
.panel-title{ font-family:'Space Grotesk'; font-weight:600; font-size:15.5px; }
.panel-title span{ color:var(--text-dim); font-weight:400; font-size:12.5px; margin-left:8px; }
.section-gap{ margin-top:20px; }

/* --- Buttons --- */
.btn{
  background:var(--panel-2); border:1px solid var(--line); color:var(--text);
  font-size:12.5px; font-weight:500; padding:8px 14px; border-radius:9px; cursor:pointer; font-family:'Inter';
}
.btn:hover{ border-color:var(--text-dim); }
.btn-amber{ background:var(--amber); color:#1A1400; border:none; font-weight:600; }
.btn-amber:hover{ filter:brightness(1.08); }
.btn-teal{ background:var(--teal); color:#02201C; border:none; font-weight:600; }
.btn-teal:hover{ filter:brightness(1.08); }
.btn-ghost{ background:transparent; border:1px solid var(--line); color:var(--text-dim); }
.btn-block{ width:100%; padding:11px; margin-top:6px; }
.btn-danger{ background:transparent; border:1px solid var(--coral); color:var(--coral); }
.btn-sm{ padding:5px 10px; font-size:12px; }
.btn:disabled{ opacity:.5; cursor:default; }

/* --- Inputs --- */
.input, .select{
  width:100%; background:var(--bg); border:1px solid var(--line); color:var(--text);
  padding:9px 12px; border-radius:9px; font-size:13px; font-family:'Inter';
}
.input:focus, .select:focus{ outline:none; border-color:var(--teal); }
.field-label{ display:block; font-size:11px; color:var(--text-dim); text-transform:uppercase; letter-spacing:0.06em; margin-bottom:6px; font-weight:600; }
.form-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(150px,1fr)); gap:12px; }

/* --- Map --- */
#map{ height:400px; border-radius:12px; border:1px solid var(--line); z-index:0; }
.veh-map{ height:340px; border-radius:12px; border:1px solid var(--line); z-index:0; }
.map-legend{ display:flex; flex-wrap:wrap; gap:16px; margin-top:10px; }
.map-legend-item{ display:flex; align-items:center; gap:6px; color:var(--text-dim); font-size:12px; }
.map-dot{ width:10px; height:10px; border-radius:50%; display:inline-block; }
.map-dot-teal{ background:#00D9C0; }
.map-dot-amber{ background:#FFB020; }
.map-dot-violet{ background:#8B7CF6; }
.map-dot-cab{ background:#FF5A5F; }
.map-cab{
  width:18px; height:18px; background:#FF5A5F; border:2px solid #0B0E12; border-radius:4px;
  display:flex; align-items:center; justify-content:center; box-shadow:0 0 10px rgba(255,90,95,.6);
}
.map-cab-inner{ width:6px; height:6px; background:#0B0E12; border-radius:50%; }
.leaflet-container{ background:#0D1117; }
.leaflet-control-attribution{ background:rgba(16,20,26,.8) !important; color:var(--text-dim) !important; font-size:9px; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip{ background:var(--panel-2); color:var(--text); border:1px solid var(--line); }
.leaflet-popup-content{ font-size:12px; font-family:'Inter'; }

/* --- Alert feed --- */
.alert-row{ display:flex; gap:12px; align-items:flex-start; padding:12px 0; border-bottom:1px solid var(--line); }
.alert-row:last-child{ border-bottom:none; }
.alert-icon{
  width:30px;height:30px;border-radius:9px; flex-shrink:0;
  display:flex;align-items:center;justify-content:center; font-size:14px;
  background:rgba(255,90,90,0.12); color:var(--coral);
}
.alert-icon.sos{ background:rgba(255,90,90,0.18); color:var(--coral); }
.alert-icon.amber{ background:rgba(255,176,32,0.14); color:var(--amber); }
.alert-icon.coral{ background:rgba(232,110,183,0.16); color:#E86EB7; }
.alert-text{ font-size:13px; }
.alert-meta{ font-size:11px; color:var(--text-dim); margin-top:2px; font-family:'JetBrains Mono'; }

/* --- Cab allotment --- */
.panel-inner{ border:1px solid var(--line); border-radius:12px; padding:14px; margin-bottom:12px; background:var(--bg); }
.allot-head{ display:flex; justify-content:space-between; align-items:flex-start; gap:12px; flex-wrap:wrap; }
.allot-title{ font-size:14px; font-weight:700; }
.drop-list{ margin-top:12px; }
.drop-row{ display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--line); }
.drop-row:last-child{ border-bottom:none; }
.drop-badge{
  width:24px;height:24px;border-radius:7px; flex-shrink:0;
  display:flex;align-items:center;justify-content:center;
  font-size:12px; font-weight:700; background:rgba(0,217,192,0.15); color:var(--teal);
}
.btn-ghost{ background:transparent; color:var(--text); border:1px solid var(--line); }
.btn-ghost:hover{ border-color:var(--teal); color:var(--teal); }

/* --- Tables --- */
.table-wrap{ overflow-x:auto; }
table{ width:100%; border-collapse:collapse; }
th{
  text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:0.06em;
  color:var(--text-dim); font-weight:600; padding:10px 12px; border-bottom:1px solid var(--line); white-space:nowrap;
}
td{ padding:12px; font-size:13px; border-bottom:1px solid var(--line); vertical-align:middle; }
tr:last-child td{ border-bottom:none; }
.avatar{
  width:26px;height:26px;border-radius:50%; display:inline-flex; align-items:center; justify-content:center;
  font-size:11px; font-weight:600; margin-right:8px; vertical-align:middle;
}
.badge{ font-size:11px; padding:4px 10px; border-radius:100px; font-weight:600; white-space:nowrap; }
.badge-pending{ background:rgba(255,176,32,0.15); color:var(--amber); }
.badge-amber{ background:rgba(255,176,32,0.15); color:var(--amber); }
.badge-approved{ background:rgba(0,217,192,0.15); color:var(--teal); }
.badge-rejected{ background:rgba(255,90,90,0.15); color:var(--coral); }
.badge-neutral{ background:rgba(140,151,168,0.15); color:var(--text-dim); }
.badge-coral{ background:rgba(255,90,90,0.15); color:var(--coral); }
.approve-btn, .reject-btn{ border:none; border-radius:7px; padding:6px 12px; font-size:12px; font-weight:600; cursor:pointer; margin-right:6px; font-family:'Inter'; }
.approve-btn{ background:var(--teal); color:#02201C; }
.reject-btn{ background:transparent; border:1px solid var(--coral); color:var(--coral); }
.line-chip{
  font-family:'JetBrains Mono'; font-size:11.5px; padding:4px 9px; border-radius:7px;
  background:var(--panel-2); border:1px solid var(--line); color:var(--text-dim);
}
.run-events{ min-width:320px; }
.run-stop{ display:flex; align-items:center; gap:8px; padding:3px 0; }
.run-stop .mono{ font-size:11px; font-family:'JetBrains Mono'; }
.empty{ color:var(--text-dim); font-size:13px; padding:20px 0; text-align:center; }
.trip-roster{ display:flex; flex-direction:column; gap:8px; }
.trip-driver{ border:1px solid rgba(140,151,168,0.18); border-radius:12px; overflow:hidden; }
.trip-driver-row{ display:flex; align-items:center; gap:12px; width:100%; padding:12px 14px; background:none; border:none; cursor:pointer; text-align:left; }
.trip-driver-row:hover{ background:rgba(140,151,168,0.06); }
.trip-driver-name{ font-weight:600; flex:0 0 auto; min-width:160px; }
.trip-chev{ margin-left:auto; color:var(--text-dim); }
.trip-emp-list{ border-top:1px solid rgba(140,151,168,0.18); background:rgba(140,151,168,0.04); }
.trip-emp-row{ display:flex; align-items:center; gap:10px; padding:9px 14px 9px 28px; font-size:13px; }
.trip-emp-row + .trip-emp-row{ border-top:1px solid rgba(140,151,168,0.1); }
.trip-emp-name{ font-weight:600; min-width:150px; }
.trip-emp-point{ flex:1; }
.dim{ color:var(--text-dim); font-size:12px; }
.row-actions{ display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.slot-row{ display:flex; gap:8px; align-items:center; margin:8px 0; }
.slot-row .input{ padding:7px 10px; }
.slot-head{ font-size:12px; color:var(--text-dim); text-transform:uppercase; letter-spacing:.04em; margin-top:4px; }
.hint{ color:var(--text-dim); font-size:12px; margin-top:6px; line-height:1.5; }

/* --- Login --- */
.login-screen{
  min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px;
}
.login-card{
  width:100%; max-width:380px; background:var(--panel); border:1px solid var(--line);
  border-radius:18px; padding:34px;
}
.login-error{ color:var(--coral); font-size:12.5px; margin-top:10px; min-height:16px; }
.auth-switch{ margin-top:18px; text-align:center; color:var(--text-dim); font-size:13px; }
.auth-switch a{ color:var(--teal); text-decoration:none; font-weight:600; }
.onboard-intro{ color:var(--text-dim); font-size:13px; margin-top:-10px; margin-bottom:16px; line-height:1.55; }
.onboard-intro b{ color:var(--text); }
.company-card{ }
.company-name{ font-size:18px; font-weight:700; margin-bottom:12px; }
.company-meta{ display:flex; gap:32px; margin-bottom:6px; }
.company-meta .field-label{ display:block; margin-bottom:4px; }
.invite-code{
  display:inline-block; font-size:22px; font-weight:700; letter-spacing:4px; color:var(--teal);
  background:rgba(0,217,192,0.10); border:1px dashed var(--teal); border-radius:10px; padding:10px 18px; cursor:pointer; margin-top:4px;
}
.toast{
  position:fixed; bottom:24px; left:50%; transform:translateX(-50%);
  background:var(--panel-2); border:1px solid var(--line); color:var(--text);
  padding:11px 18px; border-radius:10px; font-size:13px; opacity:0; transition:.25s; pointer-events:none; z-index:1000;
}
.toast.show{ opacity:1; }
.toast.err{ border-color:var(--coral); color:var(--coral); }
.modal-backdrop{
  position:fixed; inset:0; background:rgba(6,10,14,.6); z-index:4000;
  display:flex; align-items:center; justify-content:center; padding:18px;
}
.modal-card{
  width:100%; max-width:400px; background:var(--panel); border:1px solid var(--line);
  border-radius:18px; padding:30px;
}

/* --- Misc --- */
.muted{ color:var(--text-dim); font-size:12px; }
.mt{margin-top:18px;}
.spin{ display:inline-block; width:14px;height:14px;border:2px solid var(--line);border-top-color:var(--teal);border-radius:50%; animation:spin .8s linear infinite; }
@keyframes spin{ to{ transform:rotate(360deg);} }
.rating{ color:var(--amber); letter-spacing:1px; }

@media (max-width: 900px){
  .shell{ grid-template-columns:1fr; }
  .sidebar{ flex-direction:row; flex-wrap:wrap; padding:14px; }
  .brand{ margin-bottom:8px; width:100%; }
  .nav-section-label{ display:none; }
  .nav-item{ padding:8px 10px; }
  .sidebar-footer{ margin-top:0; flex-direction:row; align-items:center; }
  .main{ padding:20px 16px; }
  .stats{ grid-template-columns:repeat(2,1fr); }
  .grid-2{ grid-template-columns:1fr; }
}

.chat-box{ display:flex; flex-direction:column; gap:10px; max-height:60vh; overflow-y:auto; }
.chat-row{ background:var(--panel-2); border:1px solid var(--line); border-radius:8px; padding:10px 12px; }
.chat-mine{ border-color:var(--teal); }
.chat-meta{ color:var(--text-dim); font-size:11px; margin-bottom:4px; }
.chat-text{ color:var(--text); font-size:14px; white-space:pre-wrap; }
tr[onclick]{ cursor:pointer; }
