body.light {
  --bg: #f4f7fc;
  --card: #ffffff;
  --card-inner: #f0f4f8;
  --border: #d0dce8;
  --text: #1a3a5c;
  --text-sub: #2a5fa8;
  --text-muted: #6a8aaa;
  --blue: #2a5fa8;
  --orange: #f97316;
  --healthy: #3a8a5a;
  --at-risk: #a07a2a;
  --critical: #a04a2a;
}
* {
    
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', system-ui, sans-serif;
}

:root {
  --bg: #040c18;
  --card: #0d1e2e;
  --card-inner: #0f2535;
  --border: #1a4a5a;
  --text: #d8f0e8;
  --text-sub: #5aaabb;
  --text-muted: #3a7a8a;
  --blue: #2a5fa8;
  --orange: #f97316;
  --healthy: #3a8a5a;
  --at-risk: #a07a2a;
  --critical: #a04a2a;
}

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── AUTH ── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.auth-bg-glow {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20,60,140,0.2) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.auth-corner { position: absolute; width: 20px; height: 20px; }
.auth-tl { top: 24px; left: 24px; border-top: 1.5px solid rgba(42,95,168,0.5); border-left: 1.5px solid rgba(42,95,168,0.5); }
.auth-tr { top: 24px; right: 24px; border-top: 1.5px solid rgba(42,95,168,0.5); border-right: 1.5px solid rgba(42,95,168,0.5); }
.auth-bl { bottom: 24px; left: 24px; border-bottom: 1.5px solid rgba(42,95,168,0.5); border-left: 1.5px solid rgba(42,95,168,0.5); }
.auth-br { bottom: 24px; right: 24px; border-bottom: 1.5px solid rgba(42,95,168,0.5); border-right: 1.5px solid rgba(42,95,168,0.5); }

.auth-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.auth-hex {
  width: 80px;
  height: 80px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.hex-b1 {
  position: absolute;
  width: 70px;
  height: 70px;
  border: 1.5px solid rgba(42,95,168,0.6);
  border-radius: 14px;
  transform: rotate(45deg);
  animation: hexPulse 2s ease-in-out infinite;
}

.hex-b2 {
  position: absolute;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(42,95,168,0.3);
  border-radius: 10px;
  transform: rotate(45deg);
  animation: hexPulse 2s ease-in-out infinite reverse;
}

.hex-text {
  font-size: 20px;
  font-weight: 900;
  color: #e8f0fe;
  z-index: 1;
  letter-spacing: 1px;
  text-shadow: 0 0 12px rgba(42,95,168,0.6);
}

@keyframes hexPulse {
  0%, 100% { border-color: rgba(42,95,168,0.4); }
  50% { border-color: rgba(90,170,187,0.8); }
}

.auth-title {
  font-size: 28px;
  font-weight: 900;
  color: #e8f0fe;
  text-align: center;
  letter-spacing: 4px;
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 28px;
}

.auth-tabs {
  display: flex;
  background: rgba(42,95,168,0.1);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
  gap: 4px;
}

.auth-tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s;
}

.auth-tab.active {
  background: var(--blue);
  color: #fff;
}

.auth-input {
  width: 100%;
  background: var(--card-inner);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.2s;
  display: block;
}

.auth-input:focus { border-color: var(--blue); }
.auth-input::placeholder { color: var(--text-muted); }

.auth-btn {
  width: 100%;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 10px;
  transition: opacity 0.2s;
  letter-spacing: 0.5px;
  display: block;
}

.auth-btn:hover { opacity: 0.85; }

.auth-btn-ghost {
  width: 100%;
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 10px;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.2s;
  display: block;
}

.auth-btn-ghost:hover { color: var(--text-sub); }

.auth-error {
  color: var(--critical);
  font-size: 12px;
  text-align: center;
  margin-top: 8px;
  min-height: 18px;
}

/* ── LAYOUT ── */
#app { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: 260px;
  min-height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  overflow: hidden;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-bg {
  position: absolute;
  inset: 0;
  background: #111827;
  border-right: 4px solid var(--orange);
}

.sidebar-orange-wash {
  position: absolute;
  top: 0;
  right: 0;
  width: 60%;
  height: 35%;
  background: rgba(249,115,22,0.08);
}

.sidebar-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 24px 16px;
  overflow-y: auto;
}

.sidebar-vehicle-card {
  background: rgba(249,115,22,0.12);
  border: 1px solid rgba(249,115,22,0.35);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 20px;
}

.sidebar-vehicle-label {
  font-size: 9px;
  color: #fb923c;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 4px;
}

.sidebar-vehicle-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.sidebar-vehicle-switch {
  font-size: 10px;
  color: var(--orange);
  text-decoration: none;
}

.sidebar-section-label {
  font-size: 10px;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  margin-bottom: 6px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  color: #f3f4f6;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background 0.2s;
  cursor: pointer;
}

.sidebar-nav-item:hover,
.sidebar-nav-item.active {
  background: rgba(249,115,22,0.18);
  color: var(--orange);
}

.nav-icon { font-size: 16px; }

.sidebar-divider {
  border-top: 0.5px solid rgba(255,255,255,0.1);
  margin: 10px 0;
}

.sidebar-app-card {
  background: rgba(42,95,168,0.1);
  border: 1px solid rgba(42,95,168,0.25);
  border-radius: 12px;
  padding: 14px;
  margin: 10px 0;
}

.sidebar-app-title {
  font-size: 12px;
  font-weight: 700;
  color: #e8f0fe;
  margin-bottom: 6px;
}

.sidebar-app-desc {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.sidebar-app-list {
  list-style: none;
  margin-bottom: 12px;
}

.sidebar-app-list li {
  font-size: 10px;
  color: #5aaabb;
  margin-bottom: 4px;
}

.sidebar-app-btn {
  display: block;
  background: var(--blue);
  color: #fff;
  text-decoration: none;
  text-align: center;
  border-radius: 8px;
  padding: 8px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 6px;
  transition: opacity 0.2s;
}

.sidebar-app-btn:hover { opacity: 0.85; }

.sidebar-app-btn-secondary {
  background: rgba(42,95,168,0.2);
  border: 1px solid rgba(42,95,168,0.3);
}

.sidebar-spacer { flex: 1; }

.sidebar-footer {
  border-top: 0.5px solid rgba(255,255,255,0.1);
  padding-top: 10px;
}

.sidebar-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-bottom: 4px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s;
}

.sidebar-user-row:hover { background: rgba(255,255,255,0.05); }

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user-info { flex: 1; overflow: hidden; }

.sidebar-user-email {
  font-size: 12px;
  color: #f3f4f6;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-plan { font-size: 10px; color: #9ca3af; }
.sidebar-version { font-size: 10px; color: #374151; text-align: center; margin-top: 8px; }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: 260px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-left { display: flex; align-items: center; gap: 14px; }

.menu-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.header-title { font-size: 18px; font-weight: 800; color: #e8f0fe; letter-spacing: 1px; }
.header-right { display: flex; align-items: center; gap: 6px; }
.connected-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--healthy); }
.connected-text { font-size: 11px; color: var(--text-muted); }

/* ── SCREENS ── */
.screen { display: none; padding: 24px; flex: 1; max-width: 900px; margin: 0 auto; width: 100%; }
.screen.active { display: block; }

/* ── CARDS ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}

.card-inner {
  background: var(--card-inner);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.section-title {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
  margin-top: 8px;
}

/* ── BUTTONS ── */
.btn-primary {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-secondary:hover { background: var(--card-inner); }

.btn-danger {
  background: rgba(160,74,42,0.2);
  color: var(--critical);
  border: 1px solid var(--critical);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ── INPUTS ── */
.input {
  width: 100%;
  background: var(--card-inner);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  margin-bottom: 12px;
  transition: border-color 0.2s;
  display: block;
}

.input:focus { border-color: var(--blue); }
.input::placeholder { color: var(--text-muted); }
textarea.input { resize: vertical; min-height: 80px; }

.label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
  display: block;
}

/* ── GRID ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 10px; margin-bottom: 16px; }

/* ── STAT CARD ── */
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.stat-card-accent { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--blue); }
.stat-value { font-size: 28px; font-weight: 900; color: var(--text); margin-bottom: 4px; padding-left: 8px; }
.stat-label { font-size: 9px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; padding-left: 8px; }
.stat-sub { font-size: 9px; color: var(--text-muted); padding-left: 8px; margin-top: 2px; }

/* ── CHIPS ── */
.chips-wrap { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

.chip {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.chip:hover { border-color: var(--blue); }
.chip.selected { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }

/* ── CAUSE CARD ── */
.cause-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; margin-bottom: 12px; }
.cause-header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.cause-rank { background: var(--blue); color: #fff; width: 24px; height: 24px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.cause-title { flex: 1; font-size: 14px; font-weight: 700; color: var(--text); }
.cause-likelihood { font-size: 11px; font-weight: 600; }
.cause-body { padding: 16px; }
.cause-row-label { font-size: 9px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 2px; margin-top: 10px; }
.cause-row-text { font-size: 12px; color: var(--text-sub); line-height: 1.5; }
.cost-badge { background: var(--card-inner); border-radius: 6px; padding: 10px; margin-top: 12px; font-size: 12px; font-weight: 600; color: var(--text); }

/* ── HISTORY CARD ── */
.history-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.2s;
  position: relative;
  overflow: hidden;
}

.history-card:hover { border-color: var(--blue); }
.history-accent { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--blue); }
.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.history-status { font-size: 14px; font-weight: 700; }
.history-date { font-size: 11px; color: var(--text-muted); }
.history-vehicle { font-size: 12px; color: var(--text-sub); margin-bottom: 6px; }
.history-view { font-size: 12px; color: var(--blue); font-weight: 700; margin-top: 10px; text-align: right; }

/* ── PROGRESS BAR ── */
.progress-bar { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin: 8px 0; }
.progress-fill { height: 100%; background: var(--blue); border-radius: 2px; transition: width 0.3s; }

/* ── LOADING ── */
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; color: var(--text-muted); font-size: 14px; gap: 10px; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-state-text { font-size: 13px; line-height: 1.6; }

/* ── DISCLAIMER ── */
.disclaimer { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px; font-size: 11px; color: var(--text-muted); line-height: 1.6; text-align: center; margin-top: 8px; }

/* ── TOAST ── */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 20px; font-size: 13px; color: var(--text); z-index: 999; transform: translateY(100px); opacity: 0; transition: all 0.3s; pointer-events: none; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { border-color: var(--healthy); color: var(--healthy); }
.toast.error { border-color: var(--critical); color: var(--critical); }

/* ── OVERLAY ── */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99; }
.overlay.show { display: block; }


/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .menu-btn { display: flex !important; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .screen { padding: 16px; }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--blue); }