/* ============================================================
   CARNOMICS — Premium CSS Design System
   ============================================================ */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Outfit:wght@400;600;700;800&display=swap');

/* ---- Design Tokens ---- */
:root {
  --primary: #4f8bff;
  --primary-dark: #2563eb;
  --primary-glow: rgba(79,139,255,0.35);
  --accent: #a855f7;
  --accent-glow: rgba(168,85,247,0.3);
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #38bdf8;

  --bg: #0a0a0f;
  --bg2: #0f0f1a;
  --bg3: #141428;
  --card: rgba(255,255,255,0.04);
  --card-border: rgba(255,255,255,0.08);
  --card-hover: rgba(255,255,255,0.07);

  --text: #f0f0ff;
  --text-muted: #8888aa;
  --text-dim: #555577;

  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 22px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 30px var(--primary-glow);
  --transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  --transition-fast: all 0.15s ease;

  --sidebar-width: 260px;
  --topbar-height: 64px;
}

/* ---- Reset ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

img, video, canvas, svg {
  max-width: 100%;
  height: auto;
}

body.light-mode {
  --bg: #f4f6fb;
  --bg2: #eef1f8;
  --bg3: #e8ecf5;
  --card: rgba(255,255,255,0.8);
  --card-border: rgba(0,0,0,0.08);
  --card-hover: rgba(255,255,255,1);
  --text: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
}

.hidden { display: none !important; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ============================================================
   TOAST NOTIFICATION SYSTEM
   ============================================================ */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(20, 20, 40, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 20px;
  min-width: 320px;
  max-width: 420px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(255,255,255,0.05);
  pointer-events: all;
  animation: toastIn 0.4s cubic-bezier(0.34,1.56,0.64,1) forwards;
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 14px 0 0 14px;
}

.toast.success::before { background: var(--success); }
.toast.error::before { background: var(--danger); }
.toast.warning::before { background: var(--warning); }
.toast.info::before { background: var(--info); }

.toast-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  margin-top: 1px;
}
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--info); }

.toast-body { flex: 1; }
.toast-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 2px; }
.toast-message { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; }

.toast-close {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 1rem; flex-shrink: 0; padding: 0;
  transition: var(--transition-fast);
}
.toast-close:hover { color: var(--text); }

.toast-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  border-radius: 0 0 14px 14px;
  animation: toastProgress var(--toast-duration, 4s) linear forwards;
}
.toast.success .toast-progress { background: var(--success); }
.toast.error .toast-progress { background: var(--danger); }
.toast.warning .toast-progress { background: var(--warning); }
.toast.info .toast-progress { background: var(--info); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%) scale(0.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(110%); max-height: 0; margin: 0; padding: 0; }
}
@keyframes toastProgress {
  from { width: 100%; }
  to   { width: 0%; }
}

/* ============================================================
   ANIMATIONS & KEYFRAMES
   ============================================================ */
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes fadeUp {
  from { opacity:0; transform:translateY(30px); }
  to   { opacity:1; transform:translateY(0); }
}
@keyframes fadeDown {
  from { opacity:0; transform:translateY(-20px); }
  to   { opacity:1; transform:translateY(0); }
}
@keyframes scaleIn {
  from { opacity:0; transform:scale(0.92); }
  to   { opacity:1; transform:scale(1); }
}
@keyframes shimmer {
  from { background-position: -200% center; }
  to   { background-position: 200% center; }
}
@keyframes pulse-glow {
  0%,100% { box-shadow: 0 0 0 0 var(--primary-glow); }
  50%      { box-shadow: 0 0 0 10px transparent; }
}
@keyframes float {
  0%,100% { transform: translateY(0px); }
  50%      { transform: translateY(-12px); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes countUp { from { opacity:0; transform:scale(0.7); } to { opacity:1; transform:scale(1); } }

/* Scroll reveal base classes */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.25,0.46,0.45,0.94);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.25,0.46,0.45,0.94);
}
.reveal-left.visible { opacity:1; transform:translateX(0); }
.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.25,0.46,0.45,0.94);
}
.reveal-right.visible { opacity:1; transform:translateX(0); }

/* Stagger delays */
.delay-1 { transition-delay: 0.1s; }
.delay-2 { transition-delay: 0.2s; }
.delay-3 { transition-delay: 0.3s; }
.delay-4 { transition-delay: 0.4s; }
.delay-5 { transition-delay: 0.5s; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary, .btn-secondary, .btn-ghost, .btn-danger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 24px; border-radius: 50px;
  font-family: 'Inter', sans-serif;
  font-weight: 600; font-size: 0.95rem;
  cursor: pointer; border: none; outline: none;
  transition: var(--transition); white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 4px 20px var(--primary-glow);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--primary-glow);
  filter: brightness(1.1);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: rgba(79,139,255,0.1);
  color: var(--primary);
  border: 1.5px solid rgba(79,139,255,0.4);
}
.btn-secondary:hover {
  background: rgba(79,139,255,0.2);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.btn-ghost {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--card-border);
}
.btn-ghost:hover { background: var(--card-hover); transform: translateY(-2px); }

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--danger);
  border: 1.5px solid rgba(239,68,68,0.4);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }

.btn-icon {
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center;
  transition: var(--transition-fast);
}
.btn-icon:hover { background: var(--card-hover); color: var(--text); }

.btn-link {
  background: none; border: none;
  color: var(--primary); font-size: 0.9rem;
  font-weight: 600; cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
}
.btn-link:hover { color: var(--accent); }

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* ============================================================
   LANDING PAGE — NAVBAR
   ============================================================ */
#landing-page { min-height: 100vh; animation: fadeIn 0.5s ease; }

.navbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 5%; height: 70px;
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: rgba(10,10,15,0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--card-border);
  transition: var(--transition);
}
.navbar.scrolled {
  background: rgba(10,10,15,0.97);
  box-shadow: 0 4px 30px rgba(0,0,0,0.5);
}

.logo {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none;
}
.logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}
.logo-icon .brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  padding: 2px;
}
.logo h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem; font-weight: 800;
  background: linear-gradient(to right, var(--primary), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-links a {
  padding: 8px 16px; border-radius: 50px;
  color: var(--text-muted); text-decoration: none;
  font-weight: 500; font-size: 0.95rem;
  transition: var(--transition-fast);
}
.nav-links a:hover { color: var(--text); background: var(--card); }
.nav-links .btn-primary { padding: 9px 22px; }
.nav-links .btn-secondary { padding: 8px 20px; }

.menu-toggle {
  display: none; cursor: pointer;
  font-size: 1.4rem; color: var(--text);
  background: var(--card); border: 1px solid var(--card-border);
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  align-items: center; justify-content: center;
}

/* ============================================================
   HERO SECTION
   ============================================================ */
.hero {
  display: flex; align-items: center;
  min-height: 100vh; padding: 100px 5% 60px;
  position: relative; overflow: hidden;
  background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(79,139,255,0.12) 0%, transparent 70%),
              radial-gradient(ellipse 60% 40% at 80% 60%, rgba(168,85,247,0.08) 0%, transparent 70%),
              var(--bg);
}

/* Animated background grid */
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(79,139,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79,139,255,0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  z-index: 0;
  animation: fadeIn 2s ease;
}

.hero-content {
  flex: 1; position: relative; z-index: 2;
  animation: fadeUp 0.9s ease 0.2s both;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(79,139,255,0.12);
  border: 1px solid rgba(79,139,255,0.3);
  color: var(--primary); font-size: 0.85rem; font-weight: 600;
  padding: 6px 16px; border-radius: 50px;
  margin-bottom: 24px;
  animation: fadeDown 0.7s ease 0.1s both;
}
.hero-eyebrow span { animation: pulse-glow 2s ease infinite; }

.hero-content h1 {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(2.8rem, 6vw, 5rem);
  font-weight: 900; line-height: 1.1; margin-bottom: 16px;
}
.gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 60%, #ec4899 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-size: 200% auto;
  animation: shimmer 4s linear infinite;
}

.hero-content .subtitle {
  font-size: 1.2rem; color: var(--text-muted);
  max-width: 540px; line-height: 1.7; margin-bottom: 36px;
}

.hero-buttons { display: flex; gap: 14px; flex-wrap: wrap; }

.hero-stats {
  display: flex; gap: 36px; margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--card-border);
}
.hero-stat .stat-num {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem; font-weight: 800;
  background: linear-gradient(to right, var(--primary), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-stat .stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

.hero-visual {
  flex: 1; position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  animation: fadeUp 0.9s ease 0.4s both;
}
.hero-car-wrap {
  position: relative;
  animation: float 5s ease-in-out infinite;
}
.hero-car-wrap img {
  width: 100%; max-width: 520px;
  filter: drop-shadow(0 20px 60px rgba(79,139,255,0.35));
  border-radius: var(--radius-lg);
}
.hero-glow {
  position: absolute; inset: -20px;
  background: radial-gradient(circle, rgba(79,139,255,0.2) 0%, transparent 70%);
  z-index: -1;
}

/* ============================================================
   FEATURES SECTION
   ============================================================ */
.features {
  padding: 100px 5%;
  background: var(--bg2);
  position: relative;
}
.features::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.section-header { text-align: center; margin-bottom: 64px; }
.section-tag {
  display: inline-block;
  background: linear-gradient(135deg, rgba(79,139,255,0.15), rgba(168,85,247,0.15));
  border: 1px solid rgba(79,139,255,0.2);
  color: var(--primary); font-size: 0.8rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 6px 18px; border-radius: 50px; margin-bottom: 16px;
}
.section-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; margin-bottom: 16px;
}
.section-header p { color: var(--text-muted); font-size: 1.1rem; max-width: 600px; margin: 0 auto; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.feature-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 32px;
  transition: var(--transition);
  position: relative; overflow: hidden; cursor: pointer;
}
.feature-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(79,139,255,0.06), rgba(168,85,247,0.04));
  opacity: 0; transition: var(--transition);
}
.feature-card:hover { transform: translateY(-8px); border-color: rgba(79,139,255,0.3); box-shadow: var(--shadow-glow); }
.feature-card:hover::before { opacity: 1; }

.feature-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, rgba(79,139,255,0.2), rgba(168,85,247,0.15));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; color: var(--primary); margin-bottom: 20px;
  transition: var(--transition);
}
.feature-card:hover .feature-icon {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; transform: scale(1.1);
  box-shadow: 0 8px 20px var(--primary-glow);
}
.feature-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 10px; }
.feature-card p  { color: var(--text-muted); line-height: 1.6; font-size: 0.92rem; }

/* ============================================================
   STATS SECTION
   ============================================================ */
.stats-section {
  padding: 80px 5%;
  background: linear-gradient(135deg, rgba(79,139,255,0.06), rgba(168,85,247,0.04));
  border-top: 1px solid var(--card-border);
  border-bottom: 1px solid var(--card-border);
}
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px;
  max-width: 900px; margin: 0 auto;
}
.stat-item { text-align: center; }
.stat-item .num {
  font-family: 'Outfit', sans-serif;
  font-size: 2.8rem; font-weight: 900;
  background: linear-gradient(to right, var(--primary), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.stat-item .label { color: var(--text-muted); font-size: 0.9rem; margin-top: 6px; }

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  background: var(--bg3);
  padding: 72px 5% 28px;
  border-top: 1px solid var(--card-border);
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 48px; margin-bottom: 48px;
}
.footer-brand .logo { margin-bottom: 16px; }
.footer-brand p { color: var(--text-muted); line-height: 1.7; font-size: 0.92rem; max-width: 280px; }
.footer-col h4 {
  font-weight: 700; margin-bottom: 16px;
  color: var(--text); font-size: 0.95rem;
}
.footer-col a {
  display: block; color: var(--text-muted);
  text-decoration: none; margin-bottom: 10px;
  font-size: 0.9rem; transition: var(--transition-fast);
}
.footer-col a:hover { color: var(--primary); transform: translateX(4px); }

.social-row { display: flex; gap: 12px; margin-top: 20px; }
.social-btn {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--card-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 1rem;
  transition: var(--transition); text-decoration: none;
}
.social-btn:hover {
  background: var(--primary); border-color: var(--primary);
  color: #fff; transform: translateY(-3px);
  box-shadow: 0 8px 20px var(--primary-glow);
}

.footer-bottom {
  border-top: 1px solid var(--card-border);
  padding-top: 24px; text-align: center;
  color: var(--text-dim); font-size: 0.85rem;
}

/* ============================================================
   LOGIN / SIGNUP MODALS
   ============================================================ */
.modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 9000; align-items: center; justify-content: center;
}
.modal.open { display: flex; animation: fadeIn 0.2s ease; }

.modal-content {
  background: rgba(15,15,30,0.97);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 460px;
  padding: 40px; position: relative;
  box-shadow: var(--shadow), 0 0 60px rgba(79,139,255,0.1);
  animation: scaleIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

.modal-close {
  position: absolute; top: 18px; right: 18px;
  background: var(--card); border: 1px solid var(--card-border);
  color: var(--text-muted); cursor: pointer;
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; transition: var(--transition-fast);
}
.modal-close:hover { background: rgba(239,68,68,0.2); color: var(--danger); }

.modal-logo {
  display: flex; align-items: center; gap: 12px; margin-bottom: 28px;
}
.modal-logo-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: #fff;
}
.modal-logo h2 { font-size: 1.5rem; font-weight: 800; }
.modal-logo p { font-size: 0.85rem; color: var(--text-muted); }

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-size: 0.85rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: 8px; letter-spacing: 0.03em;
}
.input-wrap { position: relative; }
.input-wrap i {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim); font-size: 0.95rem; pointer-events: none;
  transition: var(--transition-fast);
}
.input-wrap input:focus ~ i, .input-wrap:focus-within i { color: var(--primary); }
.form-group input {
  width: 100%; padding: 12px 14px 12px 40px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 0.95rem;
  transition: var(--transition-fast);
  font-family: 'Inter', sans-serif;
}
.form-group input:focus {
  border-color: var(--primary);
  background: rgba(79,139,255,0.05);
  outline: none;
  box-shadow: 0 0 0 3px rgba(79,139,255,0.15);
}
.form-group input::placeholder { color: var(--text-dim); }

.input-error {
  font-size: 0.78rem; color: var(--danger);
  margin-top: 5px; display: none;
}
.form-group.error .input-error { display: block; }
.form-group.error input { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239,68,68,0.1); }

.form-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input { width: auto; padding: 0; }
.form-check label { font-size: 0.85rem; color: var(--text-muted); margin: 0; cursor: pointer; }

.modal-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0; color: var(--text-dim); font-size: 0.8rem;
}
.modal-divider::before, .modal-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--card-border);
}

.oauth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.oauth-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 0.85rem;
  cursor: pointer; transition: var(--transition);
  border: 1.5px solid var(--card-border);
  background: var(--card); color: var(--text);
  font-family: 'Inter', sans-serif;
}
.oauth-btn:hover { transform: translateY(-2px); border-color: var(--primary); box-shadow: 0 4px 15px rgba(0,0,0,0.2); }
.oauth-btn img { width: 18px; height: 18px; }

.modal-footer-note {
  text-align: center; margin-top: 20px;
  font-size: 0.88rem; color: var(--text-muted);
}
.modal-footer-note a { color: var(--primary); font-weight: 600; text-decoration: none; }
.modal-footer-note a:hover { text-decoration: underline; }

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */
.dashboard {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg2);
  border-right: 1px solid var(--card-border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 200; transition: var(--transition);
}
.sidebar.collapsed { width: 72px; }

.sidebar-header {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--card-border);
  min-height: 70px;
}
.sidebar-header .logo-icon { flex-shrink: 0; }
.sidebar-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem; font-weight: 800;
  background: linear-gradient(to right, var(--primary), var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  white-space: nowrap; overflow: hidden;
}
.sidebar.collapsed .sidebar-header h2 { display: none; }
.sidebar-toggle-btn {
  margin-left: auto; background: none; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 1rem;
  padding: 6px; border-radius: 6px;
  transition: var(--transition-fast); flex-shrink: 0;
}
.sidebar-toggle-btn:hover { color: var(--text); background: var(--card); }

.sidebar-menu { flex: 1; padding: 16px 12px; overflow-y: auto; }

.sidebar-section-label {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-dim);
  padding: 0 8px; margin: 16px 0 6px;
}
.sidebar.collapsed .sidebar-section-label { display: none; }

.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: var(--radius-sm);
  color: var(--text-muted); text-decoration: none;
  font-weight: 500; font-size: 0.93rem;
  transition: var(--transition-fast); position: relative;
  margin-bottom: 2px; white-space: nowrap; overflow: hidden;
}
.sidebar-link i { font-size: 1.05rem; flex-shrink: 0; width: 20px; text-align: center; }
.sidebar.collapsed .sidebar-link span { display: none; }
.sidebar.collapsed .sidebar-link { justify-content: center; }
.sidebar.collapsed .sidebar-link i { width: auto; }

.sidebar-link:hover { background: var(--card); color: var(--text); }
.sidebar-link.active {
  background: linear-gradient(to right, rgba(79,139,255,0.15), rgba(79,139,255,0.05));
  color: var(--primary);
  font-weight: 600;
}
.sidebar-link.active::before {
  content: ''; position: absolute; left: 0; top: 4px; bottom: 4px;
  width: 3px; background: var(--primary); border-radius: 0 3px 3px 0;
}

/* Sidebar tooltip for collapsed */
.sidebar.collapsed .sidebar-link[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; left: 100%; top: 50%; transform: translateY(-50%);
  background: rgba(20,20,40,0.95); color: var(--text);
  padding: 6px 12px; border-radius: var(--radius-sm);
  font-size: 0.82rem; font-weight: 600;
  white-space: nowrap; margin-left: 12px;
  opacity: 0; pointer-events: none; transition: var(--transition-fast);
  box-shadow: var(--shadow);
}
.sidebar.collapsed .sidebar-link[data-tooltip]:hover::after { opacity: 1; }

.sidebar-footer {
  padding: 12px; border-top: 1px solid var(--card-border);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 150;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  min-height: 100dvh;
  min-width: 0;
  max-width: 100%;
  transition: var(--transition);
}
.main-content.expanded { margin-left: 72px; }

/* --- Top Bar --- */
.top-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 28px; height: var(--topbar-height);
  background: rgba(15,15,26,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--card-border);
  position: sticky; top: 0; z-index: 100;
  box-sizing: border-box;
  min-width: 0;
}

.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: 50px; padding: 9px 18px; width: 280px;
  max-width: 100%;
  min-width: 0;
  transition: var(--transition-fast);
}
.search-bar:focus-within {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,139,255,0.1);
}
.search-bar i { color: var(--text-dim); font-size: 0.85rem; }
.search-bar input {
  background: none; border: none; color: var(--text);
  font-size: 0.9rem; width: 100%; outline: none;
  font-family: 'Inter', sans-serif;
}
.search-bar input::placeholder { color: var(--text-dim); }

.top-bar-right { display: flex; align-items: center; gap: 16px; }

.notif-wrap {
  position: relative;
}

.notif-btn {
  position: relative; background: var(--card);
  border: 1px solid var(--card-border); border-radius: var(--radius-sm);
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-muted); font-size: 1rem;
  transition: var(--transition-fast);
  padding: 0;
  font-family: inherit;
}
.notif-btn:hover { color: var(--text); border-color: var(--primary); }
.notif-badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--danger); color: #fff;
  min-width: 18px; height: 18px; padding: 0 4px; border-radius: 50%;
  font-size: 0.65rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg2);
  box-sizing: border-box;
}

.notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, calc(100vw - 24px));
  max-height: min(420px, 70vh);
  background: rgba(15, 15, 30, 0.98);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 600;
  flex-direction: column;
  overflow: hidden;
}
.notif-dropdown.show { display: flex; }
.notif-dropdown-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.88rem;
  font-weight: 700;
  flex-shrink: 0;
}
.notif-mark-read {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 0;
}
.notif-mark-read:hover { text-decoration: underline; }
.notif-dropdown-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
}
.notif-loading,
.notif-empty {
  padding: 28px 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.notif-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--card-border);
  font-size: 0.82rem;
}
.notif-item:last-child { border-bottom: none; }
.notif-item--unread {
  background: rgba(79, 139, 255, 0.06);
  border-left: 3px solid var(--primary);
}
.notif-item-title { font-weight: 700; color: var(--text); margin-bottom: 4px; line-height: 1.3; }
.notif-item-msg { color: var(--text-muted); line-height: 1.45; word-break: break-word; }
.notif-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.notif-item-time { font-size: 0.72rem; color: var(--text-dim); }
.notif-item-link {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}
.notif-item-link:hover { text-decoration: underline; }

.user-btn {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: 50px; padding: 6px 16px 6px 6px;
  cursor: pointer; transition: var(--transition-fast);
  position: relative;
}
.user-btn:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,139,255,0.08); }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  object-fit: cover; background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.9rem; color: #fff; flex-shrink: 0;
  overflow: hidden;
}
.user-avatar .avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  margin-bottom: 8px;
}
.sb-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.sb-avatar .avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.sb-info {
  min-width: 0;
  flex: 1;
}
.sb-name {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sb-email {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-btn span { font-size: 0.88rem; font-weight: 600; }

/* Dropdown */
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: rgba(15,15,30,0.97);
  border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 8px; min-width: 200px; display: none;
  box-shadow: var(--shadow); z-index: 500;
  animation: fadeUp 0.2s ease;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 0.88rem; font-weight: 500;
  cursor: pointer; transition: var(--transition-fast);
  text-decoration: none;
}
.dropdown-item i { width: 16px; text-align: center; }
.dropdown-item:hover { background: var(--card); color: var(--text); }
.dropdown-item.danger:hover { color: var(--danger); background: rgba(239,68,68,0.1); }
.dropdown-divider { height: 1px; background: var(--card-border); margin: 6px 0; }

/* ============================================================
   DASHBOARD PAGE CONTENT
   ============================================================ */
.page-content { padding: 28px; animation: fadeIn 0.3s ease; }

.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: 4px; }
.page-header p { color: var(--text-muted); font-size: 0.9rem; }

/* Stats Cards */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; }

.stat-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 22px;
  display: flex; align-items: center; gap: 16px;
  transition: var(--transition); cursor: default;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute;
  inset: 0; opacity: 0;
  transition: var(--transition);
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.stat-card.blue::before   { background: linear-gradient(135deg, rgba(79,139,255,0.07), transparent); }
.stat-card.purple::before { background: linear-gradient(135deg, rgba(168,85,247,0.07), transparent); }
.stat-card.green::before  { background: linear-gradient(135deg, rgba(34,197,94,0.07), transparent); }
.stat-card.orange::before { background: linear-gradient(135deg, rgba(245,158,11,0.07), transparent); }
.stat-card:hover::before  { opacity: 1; }

.stat-card-icon {
  width: 48px; height: 48px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.stat-card.blue .stat-card-icon   { background: rgba(79,139,255,0.15); color: var(--primary); }
.stat-card.purple .stat-card-icon { background: rgba(168,85,247,0.15); color: var(--accent); }
.stat-card.green .stat-card-icon  { background: rgba(34,197,94,0.15);  color: var(--success); }
.stat-card.orange .stat-card-icon { background: rgba(245,158,11,0.15); color: var(--warning); }

.stat-card-info { flex: 1; min-width: 0; }
.stat-card-info h3 { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; letter-spacing: 0.03em; }
.stat-card-value  { font-family: 'Outfit', sans-serif; font-size: 1.7rem; font-weight: 800; line-height: 1; }
.stat-card-change { display: inline-flex; align-items: center; gap: 4px; font-size: 0.75rem; font-weight: 600; margin-top: 4px; }
.stat-card-change.up   { color: var(--success); }
.stat-card-change.down { color: var(--danger); }

/* Charts */
.charts-row { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 24px; }
.chart-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 22px;
}
.chart-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px;
}
.chart-header h3 { font-size: 1rem; font-weight: 700; }
.chart-actions { display: flex; gap: 8px; }
.chart-body { height: 240px; position: relative; }

/* Dashboard (index.html) — two-column chart rows; stack on narrow screens */
.dash-chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-bottom: 22px;
}
.dash-chart-row--power {
  grid-template-columns: 1fr minmax(260px, 320px);
}

/* Activity */
.activity-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 22px;
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.card-header h3 { font-size: 1rem; font-weight: 700; }

.activity-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--card-border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; flex-shrink: 0;
}
.activity-dot.blue   { background: rgba(79,139,255,0.15); color: var(--primary); }
.activity-dot.green  { background: rgba(34,197,94,0.15);  color: var(--success); }
.activity-dot.orange { background: rgba(245,158,11,0.15); color: var(--warning); }
.activity-dot.red    { background: rgba(239,68,68,0.15);  color: var(--danger); }
.activity-info h4 { font-size: 0.9rem; font-weight: 600; margin-bottom: 3px; }
.activity-info p  { font-size: 0.82rem; color: var(--text-muted); line-height: 1.4; }
.activity-time    { font-size: 0.75rem; color: var(--text-dim); margin-top: 4px; }

/* ============================================================
   CAR CARDS
   ============================================================ */
.cars-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.car-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); overflow: hidden;
  transition: var(--transition); cursor: pointer;
}
.car-card:hover { transform: translateY(-6px); border-color: rgba(79,139,255,0.3); box-shadow: var(--shadow); }

.car-card-img {
  position: relative; height: 180px; overflow: hidden;
  background: var(--bg3);
}
.car-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.car-card:hover .car-card-img img { transform: scale(1.05); }
.car-fuel-badge {
  position: absolute; top: 12px; left: 12px;
  padding: 4px 10px; border-radius: 50px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em;
}
.car-fuel-badge.electric { background: rgba(34,197,94,0.2); color: var(--success); border: 1px solid rgba(34,197,94,0.4); }
.car-fuel-badge.petrol   { background: rgba(79,139,255,0.2); color: var(--primary); border: 1px solid rgba(79,139,255,0.4); }
.car-fuel-badge.diesel   { background: rgba(245,158,11,0.2); color: var(--warning); border: 1px solid rgba(245,158,11,0.4); }
.car-fuel-badge.cng      { background: rgba(56,189,248,0.2); color: var(--info); border: 1px solid rgba(56,189,248,0.4); }

.car-card-body { padding: 18px; }
.car-card-body h3 { font-size: 1rem; font-weight: 700; margin-bottom: 2px; }
.car-brand  { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 12px; }
.car-specs-row { display: flex; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.car-spec { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-muted); }
.car-spec i { color: var(--primary); font-size: 0.75rem; }

.car-card-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 12px; border-top: 1px solid var(--card-border);
}
.car-price { font-family: 'Outfit', sans-serif; font-size: 1.1rem; font-weight: 800; color: var(--primary); }
.car-actions { display: flex; gap: 8px; }

/* ============================================================
   FORMS & FILTERS
   ============================================================ */
.filter-bar {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 14px 18px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.filter-select {
  padding: 8px 12px; background: var(--bg);
  border: 1px solid var(--card-border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 0.88rem; cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: var(--transition-fast);
}
.filter-select:focus { border-color: var(--primary); outline: none; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-muted);
  padding: 12px 16px; text-align: left;
  border-bottom: 1px solid var(--card-border);
}
.data-table td {
  padding: 14px 16px; font-size: 0.9rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.data-table tr:hover td { background: var(--card); }
.data-table tr:last-child td { border-bottom: none; }

/* Tags / Badges */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 50px;
  font-size: 0.72rem; font-weight: 700;
}
.badge-success { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-danger  { background: rgba(239,68,68,0.15);  color: var(--danger); }
.badge-info    { background: rgba(56,189,248,0.15); color: var(--info); }
.badge-primary { background: rgba(79,139,255,0.15); color: var(--primary); }

/* ============================================================
   SETTINGS PAGE
   ============================================================ */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.settings-card {
  background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 24px;
}
.settings-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.settings-card .card-desc { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 20px; }
.settings-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0; border-bottom: 1px solid var(--card-border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label { font-size: 0.9rem; font-weight: 500; }
.settings-row-desc { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* Toggle */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--bg3); border-radius: 24px;
  cursor: pointer; transition: var(--transition);
}
.toggle-slider::before {
  content: ''; position: absolute;
  height: 18px; width: 18px; left: 3px; bottom: 3px;
  background: var(--text-muted); border-radius: 50%;
  transition: var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); background: #fff; }

/* Theme Options */
.theme-options { display: flex; gap: 12px; }
.theme-opt {
  padding: 10px 20px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1.5px solid var(--card-border);
  color: var(--text-muted); font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: var(--transition-fast);
}
.theme-opt.active { border-color: var(--primary); color: var(--primary); background: rgba(79,139,255,0.1); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px;
  padding: 60px 20px; text-align: center;
}
.empty-state i { font-size: 3rem; color: var(--text-dim); }
.empty-state h3 { font-size: 1.1rem; font-weight: 700; }
.empty-state p { color: var(--text-muted); font-size: 0.9rem; max-width: 320px; line-height: 1.6; }

/* ============================================================
   LOADING OVERLAY
   ============================================================ */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 20px;
}
.loading-overlay .big-spinner {
  width: 56px; height: 56px;
  border: 3px solid rgba(79,139,255,0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  box-shadow: 0 0 20px var(--primary-glow);
}
.loading-overlay p { color: var(--text-muted); font-size: 0.9rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid  { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  .sidebar { transform: translateX(-100%); width: 260px; }
  .sidebar.mobile-open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,0.4); }
  .main-content { margin-left: 0 !important; }

  .hero { flex-direction: column; text-align: center; padding: 110px 5% 60px; }
  .hero-buttons { justify-content: center; }
  .hero-visual { display: none; }
  .hero-stats { justify-content: center; }

  .nav-links { display: none; }
  .menu-toggle { display: flex; }
  .mobile-menu-btn { display: flex; }

  .stats-row { grid-template-columns: 1fr 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr; }

  /* Dashboard: fit top bar + content to viewport width (no horizontal scroll) */
  .top-bar {
    height: auto;
    min-height: var(--topbar-height);
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 10px 12px 10px 12px;
    row-gap: 8px;
  }
  .top-bar .search-bar {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .mobile-menu-btn { flex-shrink: 0; }
  .top-bar-right {
    flex-shrink: 0;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .user-btn span {
    max-width: 88px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page-content {
    padding: 16px 14px;
    max-width: 100%;
    box-sizing: border-box;
  }

  .charts-row { min-width: 0; }
  .chart-card { min-width: 0; overflow: hidden; }

  .dash-chart-row,
  .dash-chart-row--power {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 16px;
  }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .oauth-grid { grid-template-columns: 1fr; }
  .hero-stats { flex-direction: column; gap: 20px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }

  .page-content { padding: 14px 12px; }
  .user-btn span { display: none; }
}