/* =============================================================
   Vehicle Tracking — Dark Theme (Trading Terminal style)
   ============================================================= */

:root {
  --bg: #0a0f1c;
  --bg-2: #060912;
  --surface: #0f172a;
  --surface-2: #131c30;
  --surface-3: #1a2440;
  --border: rgba(148, 163, 184, 0.10);
  --border-strong: rgba(148, 163, 184, 0.20);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: rgba(59, 130, 246, 0.15);
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --purple: #a855f7;
  --teal: #14b8a6;
  --pink: #ec4899;
  --shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: 'Heebo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle ambient gradient */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 0%, rgba(59, 130, 246, 0.08) 0%, transparent 35%),
    radial-gradient(circle at 85% 100%, rgba(168, 85, 247, 0.05) 0%, transparent 35%);
  pointer-events: none;
  z-index: 0;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }
.hidden { display: none !important; }

body:not(.is-admin) .admin-only { display: none !important; }

/* =============================== Login =============================== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.18) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(168, 85, 247, 0.12) 0%, transparent 40%),
    var(--bg);
  padding: 20px;
  position: relative;
  z-index: 1;
}
.login-card {
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}
.login-logo {
  font-size: 56px;
  text-align: center;
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 12px rgba(59, 130, 246, 0.4));
}
.login-card h1 {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.login-sub {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 13px;
}
.login-card label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  margin-top: 14px;
  font-weight: 500;
}
.login-card input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--surface-2);
  color: var(--text);
  transition: all .15s;
}
.login-card input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
  background: var(--surface);
}
.login-card .btn-block { margin-top: 24px; }

/* =============================== Layout =============================== */
.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px;
}

.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.page-title .title-icon { font-size: 26px; }

/* Live (auto-refresh) indicator */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--success);
  background: var(--success-bg);
  padding: 3px 10px;
  border-radius: 999px;
  margin-right: 4px;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
}
.live-dot.pulse {
  animation: livePulse 0.9s ease-out;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); transform: scale(1); }
  60% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); transform: scale(1.3); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); transform: scale(1); }
}

.user-area {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-badge {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  white-space: nowrap;
}

/* =============================== Quick actions =============================== */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.quick-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .15s;
  text-align: right;
  position: relative;
  overflow: hidden;
}
.quick-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .15s;
}
.quick-btn:hover { transform: translateY(-2px); }
.quick-btn:hover::before { opacity: 1; }
.quick-btn:active { transform: translateY(0); }

.quick-open { border-color: rgba(34, 197, 94, 0.5); }
.quick-open::before { background: linear-gradient(135deg, rgba(34, 197, 94, 0.18) 0%, transparent 60%); }
.quick-open:hover { border-color: var(--success); box-shadow: 0 8px 24px -8px rgba(34, 197, 94, 0.4); }

.quick-close { border-color: rgba(239, 68, 68, 0.5); }
.quick-close::before { background: linear-gradient(135deg, rgba(239, 68, 68, 0.18) 0%, transparent 60%); }
.quick-close:hover { border-color: var(--danger); box-shadow: 0 8px 24px -8px rgba(239, 68, 68, 0.4); }

.qb-icon { font-size: 32px; flex-shrink: 0; position: relative; }
.qb-text { position: relative; }
.qb-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.qb-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.qb-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  background: var(--danger);
  color: white;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

/* =============================== Open trips list =============================== */
.open-trips-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
}
.open-trip-card {
  display: block;
  width: 100%;
  text-align: right;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s;
}
.open-trip-card:hover {
  background: var(--surface-3);
  border-color: var(--primary);
  transform: translateX(-2px);
}
.otc-vehicle {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.otc-route {
  font-size: 13px;
  color: var(--primary);
  margin-bottom: 8px;
  font-weight: 500;
}
.otc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.otc-meta-soldier {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

.selected-info {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.7;
}
.selected-info strong { color: var(--text); font-size: 14px; }

.auto-info {
  background: var(--primary-light);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 12px;
  color: #93c5fd;
}
.auto-info strong { color: #dbeafe; }

/* =============================== Stale trips banner =============================== */
.stale-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  background: rgba(239, 68, 68, 0.10);
  border: 2px solid var(--danger);
  border-radius: var(--radius);
  margin-bottom: 16px;
  animation: stalePulse 2.5s ease-in-out infinite;
}
.stale-icon { font-size: 28px; flex-shrink: 0; }
.stale-content { flex: 1; min-width: 0; }
.stale-title {
  font-size: 15px;
  font-weight: 700;
  color: #fca5a5;
  margin-bottom: 6px;
}
.stale-list {
  font-size: 13px;
  color: var(--text);
  line-height: 1.6;
}
.stale-list .stale-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(239, 68, 68, 0.15);
}
.stale-list .stale-row:last-child { border-bottom: 0; }
.stale-list strong { color: var(--text); }
.stale-hours {
  background: var(--danger);
  color: white;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
@keyframes stalePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.0); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.12); }
}

/* =============================== Settings =============================== */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}
.settings-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.settings-card .muted { margin-bottom: 16px; }
.setup-help {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
}
.setup-help summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--primary);
  user-select: none;
}
.setup-help summary:hover { color: #93c5fd; }
.setup-help[open] summary { margin-bottom: 10px; }
.setup-help ol {
  padding-right: 22px;
  color: var(--text-muted);
  line-height: 1.8;
}
.setup-help li::marker { color: var(--primary); font-weight: 700; }
.setup-help code {
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: #93c5fd;
}
.settings-toggles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.toggle-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* =============================== Audit log =============================== */
.audit-action {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.audit-action.create, .audit-action.open_trip { background: var(--success-bg); color: #86efac; }
.audit-action.close_trip { background: var(--primary-light); color: #93c5fd; }
.audit-action.delete, .audit-action.delete_user, .audit-action.delete_vehicle, .audit-action.delete_trip { background: var(--danger-bg); color: #fca5a5; }
.audit-action.login_failed { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.audit-action.update_settings, .audit-action.update_user, .audit-action.update_vehicle { background: rgba(168, 85, 247, 0.15); color: #d8b4fe; }
.audit-time { font-family: ui-monospace, monospace; font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* =============================== Search =============================== */
.search-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
}
.search-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.search-summary {
  background: var(--primary-light);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 500;
}

.search-result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
}
.srl-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 600;
  flex-wrap: wrap;
  gap: 8px;
}
.badge-open {
  background: var(--success-bg);
  color: #86efac;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-closed {
  background: var(--surface-3);
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.srl-irons {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.iron-block {
  flex: 1;
  min-width: 140px;
  background: var(--primary-light);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  text-align: center;
}
.iron-block.closer {
  background: rgba(34, 197, 94, 0.10);
  border-color: rgba(34, 197, 94, 0.3);
}
.iron-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.iron-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-family: ui-monospace, "Courier New", monospace;
  letter-spacing: 0.02em;
}
.srl-details {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.srl-details strong { color: var(--text); margin-left: 4px; }

/* =============================== Filter bar =============================== */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.filter-bar select {
  flex: 1;
  max-width: 360px;
  padding: 9px 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.filter-bar select:hover { border-color: var(--primary); }
.filter-bar select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}
.filter-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: auto;
}

/* =============================== Banner =============================== */
.banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.banner-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}
.banner-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.banner-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.banner-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.progress-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  max-width: 480px;
}
.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}
.progress-header strong { color: var(--text); }
.progress-bar {
  height: 6px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  border-radius: 999px;
  transition: width .3s ease;
}
.progress-fill.success { background: linear-gradient(90deg, var(--success), #4ade80); }
.progress-fill.warning { background: linear-gradient(90deg, var(--warning), #fbbf24); }

/* =============================== Stats Grid =============================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  transition: border-color .15s, transform .15s;
  position: relative;
  overflow: hidden;
}
.stat-card:hover {
  border-color: var(--border-strong);
}
.stat-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  word-break: break-word;
}
.stat-value.small { font-size: 16px; }
.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}
.stat-sub.up { color: var(--success); }
.stat-sub.down { color: var(--danger); }

/* =============================== Tabs =============================== */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  width: fit-content;
}
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  color: var(--text-muted);
  background: transparent;
  transition: all .15s;
  white-space: nowrap;
}
.tab-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}
.tab-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* =============================== Charts =============================== */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.chart-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 18px;
}
.chart-container {
  position: relative;
  height: 280px;
}
.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 280px;
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
}
.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.donut-center .num {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.donut-center .lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* =============================== Buttons =============================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13px;
  transition: all .15s;
  white-space: nowrap;
  border: 1px solid transparent;
  line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(59, 130, 246, .3); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; box-shadow: 0 4px 12px rgba(34, 197, 94, .3); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; box-shadow: 0 4px 12px rgba(239, 68, 68, .3); }
.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-3); border-color: var(--text-dim); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-block { width: 100%; padding: 12px; font-size: 14px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* =============================== Page sections =============================== */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-head h2 { font-size: 18px; font-weight: 700; color: var(--text); }

/* =============================== Vehicles grid =============================== */
.vehicles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.vehicle-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: all .15s;
  position: relative;
  overflow: hidden;
}
.vehicle-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06) 0%, transparent 50%);
  opacity: 0;
  transition: opacity .15s;
}
.vehicle-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -8px rgba(59, 130, 246, 0.3);
}
.vehicle-card:hover::before { opacity: 1; }
.vehicle-card > * { position: relative; }
.vc-icon { font-size: 28px; margin-bottom: 8px; }
.vehicle-card h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.vc-plate {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.vc-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.vc-stat {
  background: var(--primary-light);
  color: #93c5fd;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

/* =============================== Vehicle detail =============================== */
.back-btn { margin-bottom: 12px; }
.vehicle-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.vehicle-header h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.vehicle-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.muted { color: var(--text-muted); font-size: 13px; }

.trips-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 12px;
}
.trips-head h3 { font-size: 16px; font-weight: 600; color: var(--text); }

/* =============================== Tables =============================== */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}
.data-table thead {
  background: var(--surface-2);
}
.data-table th {
  text-align: right;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 6px; }

.role-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.role-admin { background: var(--warning-bg); color: var(--warning); }
.role-user { background: var(--primary-light); color: #93c5fd; }

/* =============================== Empty state =============================== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-icon { font-size: 56px; margin-bottom: 12px; opacity: 0.5; }
.empty-state h3 {
  font-size: 16px;
  color: var(--text);
  margin-bottom: 4px;
  font-weight: 600;
}
.empty-state p { font-size: 13px; }

/* =============================== Modal =============================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn .15s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: slideUp .2s;
}
.modal-wide { max-width: 720px; }
.modal-narrow { max-width: 380px; }
@keyframes slideUp {
  from { transform: translateY(15px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--text); }
.modal-close {
  font-size: 22px;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.confirm-msg { color: var(--text); padding: 8px 0 16px; }

/* =============================== Forms =============================== */
.form-row { margin-bottom: 14px; }
.form-row label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-row input, .form-row textarea, .form-row select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface-2);
  color: var(--text);
  transition: all .15s;
}
.form-row input::placeholder, .form-row textarea::placeholder {
  color: var(--text-dim);
}
.form-row input:focus, .form-row textarea:focus, .form-row select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}
.form-row textarea { resize: vertical; min-height: 70px; font-family: inherit; }
.form-row select option { background: var(--surface); color: var(--text); }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.form-row-full { grid-column: 1 / -1; }
.req { color: var(--danger); }
.hint { color: var(--text-muted); font-size: 11px; display: block; margin-top: 4px; }
.form-actions {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 14px;
  text-align: center;
  min-height: 18px;
}

/* =============================== Toasts =============================== */
.toasts {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: toastIn .2s;
  pointer-events: auto;
  max-width: 360px;
}
.toast.success { border-color: var(--success); background: var(--success-bg); color: #86efac; }
.toast.error { border-color: var(--danger); background: var(--danger-bg); color: #fca5a5; }
@keyframes toastIn {
  from { transform: translateY(15px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Centered alert overlay (used for important errors) */
.alerts {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 250;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  width: 92%;
  max-width: 540px;
  align-items: center;
}
.alerts:empty { display: none; }
.alerts::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  z-index: -1;
  pointer-events: auto;
}
.alerts:empty::before { display: none; }
.alerts .toast {
  pointer-events: auto;
  font-size: 15px;
  padding: 18px 24px;
  text-align: center;
  font-weight: 500;
  line-height: 1.6;
  border-width: 2px;
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.7);
  width: 100%;
  max-width: 100%;
  animation: alertPop .25s ease-out;
}
.alerts .toast.error {
  background: rgba(127, 29, 29, 0.95);
  border-color: var(--danger);
  color: #fecaca;
}
.alert-close {
  display: block;
  margin: 10px auto 0;
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
  padding: 6px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.alert-close:hover { background: rgba(255, 255, 255, 0.18); }
@keyframes alertPop {
  0% { transform: scale(0.85); opacity: 0; }
  60% { transform: scale(1.04); }
  100% { transform: scale(1); opacity: 1; }
}

/* =============================== Responsive =============================== */
@media (max-width: 1300px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1100px) {
  .charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .container { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 14px 14px; }
  .stat-value { font-size: 20px; }
  .stat-value.small { font-size: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-content { padding: 18px; }
  .vehicle-header h2 { font-size: 18px; }
  .data-table th, .data-table td { padding: 10px 8px; font-size: 12px; }
  .page-title { font-size: 18px; }
  .page-title-row { gap: 8px; }
  .user-badge { display: none; }
  .banner { flex-direction: column; align-items: stretch; }
  .progress-block { max-width: 100%; }
  .tabs { width: 100%; overflow-x: auto; }
  .chart-container { height: 240px; }
}
@media (max-width: 768px) {
  .quick-actions { grid-template-columns: 1fr; gap: 10px; }
  .quick-btn { padding: 22px 24px; }
  .qb-icon { font-size: 38px; }
  .qb-title { font-size: 19px; }
  .qb-sub { font-size: 13px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
