/* =========================================================
   CargaPy · Portal Web
   Estructura:
   1. Tokens (:root)
   2. Reset & base
   3. Utilidades
   4. Componentes (logo, botones, campos, cards, chips, spinner, toast)
   5. Splash
   6. Login
   7. Layout App (sidebar / bottom nav, topbar)
   8. Tab: Mi Auto
   9. Tab: Nafta (historial)
   10. Tab: Mantenimiento
   11. Tab: Radar (+ overrides Leaflet)
   12. Responsive
   13. Animaciones
   ========================================================= */

/* ---------- 1. TOKENS ---------- */
:root {
  /* Superficies */
  --bg: #000000;
  --surface: #121212;
  --surface-2: #181818;
  --surface-3: #202020;
  --border: #232323;
  --border-strong: #333333;

  /* Acento */
  --accent: #FFB300;
  --accent-2: #FFC107;
  --accent-deep: #FF8F00;
  --accent-soft: rgba(255, 179, 0, 0.12);
  --accent-glow: rgba(255, 179, 0, 0.35);
  --accent-gradient: linear-gradient(135deg, #FFD54F 0%, #FFC107 35%, #FFB300 65%, #FF9800 100%);

  /* Texto */
  --text: #FFFFFF;
  --text-2: #A0A0A0;
  --text-3: #6B6B6B;

  /* Estados */
  --green: #00C853;
  --green-2: #69F0AE;
  --green-soft: rgba(0, 200, 83, 0.14);
  --red: #FF5252;
  --red-soft: rgba(255, 82, 82, 0.14);
  --blue: #64B5F6;

  /* Forma */
  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 24px;
  --pill: 999px;

  /* Sombras sutiles */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-accent: 0 8px 24px rgba(255, 179, 0, 0.28);

  /* Layout */
  --sidebar-w: 264px;
  --bottom-nav-h: 70px;
  --topbar-h: 88px;
  --content-max: 1440px;

  /* Tipografía */
  --font: 'Inter', 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;

  /* Movimiento */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur: 0.25s;
}

/* ---------- 2. RESET & BASE ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }

::selection { background: var(--accent); color: #000; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.material-symbols-rounded {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 22px;
  line-height: 1;
  user-select: none;
}

/* ---------- 3. UTILIDADES ---------- */
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.accent { color: var(--accent); }
.green { color: var(--green-2); }
.red { color: var(--red); }
.mono { font-family: var(--font-mono); }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- 4. COMPONENTES ---------- */

/* Logo placeholder: círculo amarillo con flecha de recarga */
.logo-circle {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #000;
  box-shadow: 0 0 0 6px rgba(255, 179, 0, 0.1), var(--shadow-accent);
  flex-shrink: 0;
}
.logo-circle .material-symbols-rounded { font-weight: 700; font-variation-settings: 'FILL' 1, 'wght' 700; }
.logo-sm { width: 40px; height: 40px; box-shadow: 0 0 0 4px rgba(255, 179, 0, 0.1); }
.logo-sm .material-symbols-rounded { font-size: 24px; }
.logo-lg { width: 96px; height: 96px; }
.logo-lg .material-symbols-rounded { font-size: 56px; }
.logo-xl { width: 112px; height: 112px; }
.logo-xl .material-symbols-rounded { font-size: 64px; }

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  transition: transform var(--dur) var(--ease), background var(--dur), border-color var(--dur), box-shadow var(--dur), color var(--dur);
}
.btn .material-symbols-rounded { font-size: 20px; }
.btn:active { transform: scale(0.98); }

.btn-primary {
  position: relative;
  background: var(--accent-gradient);
  background-size: 200% 200%;
  color: #000;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(255, 179, 0, 0.4); background-position: 100% 50%; }
.btn-primary:disabled { opacity: 0.85; cursor: progress; transform: none; }

.btn-secondary {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(255, 179, 0, 0.35);
}
.btn-secondary:hover { background: rgba(255, 179, 0, 0.2); border-color: var(--accent); }

.btn-ghost {
  color: var(--text-2);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); }

.btn-pill { border-radius: var(--pill); }
.btn-block { width: 100%; height: 56px; font-size: 15px; }

.btn-spinner {
  display: none;
  width: 22px; height: 22px;
  border: 3px solid rgba(0, 0, 0, 0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.btn.is-loading .btn-label { display: none; }
.btn.is-loading .btn-spinner { display: inline-block; }

.link-btn {
  color: var(--accent);
  opacity: 0.85;
  font-size: 13.5px;
  font-weight: 500;
  transition: opacity var(--dur);
}
.link-btn:hover { opacity: 1; text-decoration: underline; }

/* Campos de formulario */
.field {
  position: relative;
  display: flex;
  align-items: center;
  background: #0B0B0B;
  border: 1.5px solid var(--border-strong);
  border-radius: 14px;
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
}
.field:hover { border-color: #444; }
.field:focus-within {
  border-color: var(--accent);
  background: #0E0E0E;
  box-shadow: 0 0 0 4px rgba(255, 179, 0, 0.12);
}
.field-icon {
  position: absolute;
  left: 16px;
  color: var(--text-3);
  transition: color var(--dur);
  pointer-events: none;
}
.field:focus-within .field-icon { color: var(--accent); }
.field input {
  width: 100%;
  height: 56px;
  padding: 0 48px 0 52px;
  background: transparent;
  border: 0;
  outline: none;
  font-size: 15px;
}
.field input::placeholder { color: var(--text-3); }
.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 100px #0B0B0B inset;
  caret-color: var(--text);
}
.field-action {
  position: absolute;
  right: 10px;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text-3);
  transition: color var(--dur), background var(--dur);
}
.field-action:hover { color: var(--text); background: #1a1a1a; }

.form-error {
  min-height: 0;
  color: var(--red);
  font-size: 13px;
  text-align: center;
}
.form-error:empty { display: none; }

/* Cards */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur), transform var(--dur) var(--ease), box-shadow var(--dur);
}
.card:hover { border-color: var(--border-strong); }

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.card-head h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.01em;
}

.chip-icon {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}
.chip-icon .material-symbols-rounded { font-size: 20px; font-variation-settings: 'FILL' 1; }
.chip-green { background: rgba(105, 240, 174, 0.14); color: var(--green-2); }

.label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.value small { font-size: 14px; font-weight: 600; color: var(--text-2); letter-spacing: 0; }
.value-accent { color: var(--accent); }
.value-muted { color: #D0D0D0; }
.sub { margin-top: 6px; color: var(--text-2); font-size: 13px; }

.delta {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--pill);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.delta:empty { display: none; }
.delta.up { background: var(--red-soft); color: var(--red); }
.delta.down { background: var(--green-soft); color: var(--green-2); }
.delta .material-symbols-rounded { font-size: 16px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--pill);
  font-size: 12.5px;
  font-weight: 700;
}
.pill-green { background: var(--green-soft); color: var(--green-2); }
.pill-amber { background: var(--accent-soft); color: var(--accent); }
.pill-red { background: var(--red-soft); color: var(--red); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 36px 20px;
  text-align: center;
  color: var(--text-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  grid-column: 1 / -1;
}
.empty .material-symbols-rounded { font-size: 36px; color: var(--text-3); }

/* Spinner amarillo */
.spinner {
  width: 44px; height: 44px;
  border: 4px solid rgba(255, 179, 0, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 2000;
  max-width: min(92vw, 440px);
  padding: 14px 18px;
  background: #1C1C1C;
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 14px;
  transform: translate(-50%, 140%);
  opacity: 0;
  transition: transform 0.35s var(--ease), opacity 0.35s;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { border-left-color: var(--red); }
.toast.success { border-left-color: var(--green); }

/* ---------- 5. SPLASH ---------- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  background: radial-gradient(600px 400px at 50% 40%, rgba(255, 179, 0, 0.08), transparent 70%), var(--bg);
  transition: opacity 0.4s ease, visibility 0.4s;
}
.splash.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-text { color: var(--accent); font-weight: 600; letter-spacing: 0.02em; }

/* ---------- 6. LOGIN ---------- */
.login {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  overflow: hidden;
}
.login-bg { position: absolute; inset: 0; pointer-events: none; }
.glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.55; }
.glow-1 { width: 520px; height: 520px; background: rgba(255, 179, 0, 0.22); top: -180px; left: 50%; transform: translateX(-50%); animation: float 12s ease-in-out infinite; }
.glow-2 { width: 380px; height: 380px; background: rgba(255, 143, 0, 0.12); bottom: -160px; right: -80px; animation: float 16s ease-in-out infinite reverse; }
.grid-lines {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 75%);
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 44px 36px 28px;
  background: rgba(18, 18, 18, 0.72);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: rise 0.6s var(--ease) both;
}
.brand-title {
  margin-top: 22px;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -0.03em;
}
.brand-title span, .sidebar-brand strong span { color: var(--accent); }
.slogan {
  margin-top: 8px;
  max-width: 320px;
  text-align: center;
  font-style: italic;
  font-weight: 500;
  color: var(--accent-deep);
  color: #FF9F1C;
  font-size: 15px;
}
.login-form {
  width: 100%;
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-row { display: flex; justify-content: flex-end; margin: -2px 2px 6px; }

.demo-hint {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--text-2);
  background: rgba(100, 181, 246, 0.08);
  border: 1px solid rgba(100, 181, 246, 0.25);
  border-radius: var(--radius-sm);
}
.demo-hint .material-symbols-rounded { color: var(--blue); font-size: 20px; }
.demo-hint code { color: var(--blue); font-size: 12px; }

.login-foot { margin-top: 28px; font-size: 12px; color: var(--text-3); }
.login-foot a { color: var(--text-2); }

/* ---------- 7. LAYOUT APP ---------- */
.app { min-height: 100vh; }

/* Sidebar (escritorio) */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  background: linear-gradient(180deg, #0A0A0A 0%, #050505 100%);
  border-right: 1px solid var(--border);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 28px;
}
.sidebar-brand strong { display: block; font-size: 20px; font-weight: 900; letter-spacing: -0.02em; }
.sidebar-brand small { display: block; color: var(--text-3); font-size: 12px; font-weight: 500; }

.nav-caption {
  padding: 0 14px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 600;
  font-size: 14.5px;
  text-align: left;
  transition: background var(--dur), color var(--dur);
}
.nav-item:hover { background: #141414; color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -16px; top: 10px; bottom: 10px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.nav-item.active .nav-icon { font-variation-settings: 'FILL' 1; }

.sidebar-promo {
  margin-top: auto;
  padding: 16px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(255, 179, 0, 0.14), rgba(255, 179, 0, 0.02));
  border: 1px solid rgba(255, 179, 0, 0.2);
  font-size: 12.5px;
  color: var(--text-2);
}
.sidebar-promo .material-symbols-rounded { color: var(--accent); margin-bottom: 8px; display: block; }
.sidebar-promo strong { color: var(--text); }
.sidebar-footer { padding-top: 12px; margin-top: 12px; border-top: 1px solid var(--border); }
#logout-btn:hover { color: var(--red); background: var(--red-soft); }

/* Main */
.main {
  margin-left: var(--sidebar-w);
  padding: 0 40px 48px;
  max-width: calc(var(--content-max) + var(--sidebar-w));
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 1fr auto auto;
  grid-template-areas: "greet veh avatar";
  align-items: center;
  gap: 16px;
  min-height: var(--topbar-h);
  margin: 0 -40px 8px;
  padding: 16px 40px;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur);
}
.topbar.scrolled { border-bottom-color: var(--border); }
.greeting { grid-area: greet; min-width: 0; }
.eyebrow { font-size: 13px; color: var(--text-2); text-transform: capitalize; }
.greeting h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.greeting h2 #user-name { color: var(--accent); }
.wave { display: inline-block; animation: wave 2.2s ease-in-out 1s 2; transform-origin: 70% 70%; }

.vehicle-select {
  grid-area: veh;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--pill);
  cursor: pointer;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.vehicle-select:hover, .vehicle-select:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(255, 179, 0, 0.1); }
.vehicle-select > .material-symbols-rounded:first-child { color: var(--accent); font-variation-settings: 'FILL' 1; }
.vehicle-select select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  outline: none;
  font-weight: 700;
  font-size: 14.5px;
  padding-right: 26px;
  margin-right: -26px;
  min-width: 120px;
  cursor: pointer;
  position: relative;
  z-index: 1;
}
.vehicle-select select option { background: var(--surface); color: var(--text); }
.vehicle-select .chevron { color: var(--text-2); pointer-events: none; }

.avatar-wrap { grid-area: avatar; position: relative; }
.avatar {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 50%;
  overflow: hidden;
  background: var(--accent-gradient);
  color: #000;
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px rgba(255, 179, 0, 0.45);
  transition: transform var(--dur) var(--ease);
}
.avatar:hover { transform: scale(1.06); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  min-width: 240px;
  padding: 8px;
  background: #161616;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: rise 0.2s var(--ease) both;
}
.menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-head strong { display: block; }
.menu-head small { color: var(--text-2); font-size: 12.5px; word-break: break-all; }
.menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-2);
}
.menu-item:hover { background: var(--red-soft); color: var(--red); }

/* Secciones / Tabs */
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeUp 0.45s var(--ease) both; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 28px 0 16px;
}
.section-head h3 { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; }
.section-head p { color: var(--text-2); font-size: 13.5px; margin-top: 2px; }

/* ---------- 8. TAB: MI AUTO ---------- */
.grid-dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}
.grid-dashboard > .card { animation: fadeUp 0.5s var(--ease) both; }
.grid-dashboard > .card:nth-child(2) { animation-delay: 0.05s; }
.grid-dashboard > .card:nth-child(3) { animation-delay: 0.1s; }
.grid-dashboard > .card:nth-child(4) { animation-delay: 0.15s; }
.grid-dashboard > .card:nth-child(5) { animation-delay: 0.2s; }
.grid-dashboard > .card:nth-child(6) { animation-delay: 0.25s; }

.card-fuel { grid-column: span 2; }
.fuel-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 24px;
  align-items: end;
}
.fuel-compare { display: flex; flex-direction: column; gap: 18px; }
.bar {
  height: 6px;
  margin-top: 8px;
  border-radius: var(--pill);
  background: #1E1E1E;
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent-gradient);
  transition: width 1s var(--ease);
}
.bar-muted span { background: #5A5A5A; }

.mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 150px;
  padding-top: 8px;
}
.mini-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}
.mini-col .col {
  position: relative;
  width: 100%;
  max-width: 34px;
  height: 0;
  min-height: 4px;
  border-radius: 8px 8px 4px 4px;
  background: #262626;
  transition: height 0.9s var(--ease), background var(--dur);
}
.mini-col:hover .col { background: #3a3a3a; }
.mini-col.current .col { background: var(--accent-gradient); box-shadow: 0 6px 18px rgba(255, 179, 0, 0.3); }
.mini-col .col::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 4px 8px;
  border-radius: 6px;
  background: #000;
  border: 1px solid var(--border-strong);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.mini-col:hover .col::after { opacity: 1; transform: translateX(-50%) translateY(0); }
.mini-col span { font-size: 11px; color: var(--text-3); font-weight: 600; }
.mini-col.current span { color: var(--accent); }

/* Rendimiento (verde destacado) */
.card-perf {
  grid-column: span 2;
  overflow: hidden;
  background:
    radial-gradient(420px 220px at 100% 0%, rgba(0, 200, 83, 0.35), transparent 70%),
    linear-gradient(145deg, #06351B 0%, #0A2414 55%, #07140C 100%);
  border-color: rgba(0, 200, 83, 0.35);
}
.card-perf:hover { border-color: rgba(105, 240, 174, 0.6); box-shadow: 0 12px 40px rgba(0, 200, 83, 0.15); }
.card-perf .card-head h4 { color: #BFF5D6; }
.perf-bg {
  position: absolute;
  right: -20px; bottom: -40px;
  font-size: 220px !important;
  color: rgba(105, 240, 174, 0.07);
  font-variation-settings: 'FILL' 1 !important;
  pointer-events: none;
}
.perf-value { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.perf-value span {
  font-size: 64px;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 40px rgba(105, 240, 174, 0.35);
  font-variant-numeric: tabular-nums;
}
.perf-value small { font-size: 16px; font-weight: 700; color: var(--green-2); }
.perf-sub { margin-top: 14px; color: #BFF5D6; font-size: 13.5px; opacity: 0.85; }

.card-stat .value { font-size: 28px; }

/* Reportes */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
}
.report-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  animation: fadeUp 0.45s var(--ease) both;
}
.report-card:hover { transform: translateY(-3px); border-color: rgba(255, 179, 0, 0.35); }
.report-top { display: flex; align-items: center; gap: 12px; }
.report-info { flex: 1; min-width: 0; }
.report-info strong { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-info small { color: var(--text-2); font-size: 12.5px; }
.report-price { text-align: right; }
.report-price strong { display: block; font-size: 19px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.report-price small { color: var(--text-3); font-size: 11px; font-weight: 600; }
.report-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12.5px;
}
.report-foot .material-symbols-rounded { font-size: 16px; color: var(--text-3); }
.report-foot time { margin-left: auto; color: var(--text-3); }

.brand-badge {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: #fff;
  background: var(--brand, #333);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* ---------- 9. TAB: NAFTA ---------- */
.history-totals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.total-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
}
.total-tile .value { font-size: 22px; }

.history-list { display: flex; flex-direction: column; gap: 14px; }
.month-card { padding: 0; overflow: hidden; animation: fadeUp 0.45s var(--ease) both; }
.month-card summary {
  list-style: none;
  display: grid;
  grid-template-columns: 180px repeat(3, minmax(0, 1fr)) 32px;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  cursor: pointer;
  transition: background var(--dur);
}
.month-card summary::-webkit-details-marker { display: none; }
.month-card summary:hover { background: #151515; }
.month-title { display: flex; flex-direction: column; }
.month-title strong { font-size: 18px; font-weight: 800; }
.month-title small { color: var(--text-3); font-size: 12px; }
.month-stat small { display: block; color: var(--text-2); font-size: 12px; font-weight: 500; }
.month-stat strong { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.month-stat.total strong { color: var(--accent); }
.month-card .chev { color: var(--text-3); transition: transform var(--dur) var(--ease); justify-self: end; }
.month-card[open] .chev { transform: rotate(180deg); color: var(--accent); }
.month-card[open] summary { border-bottom: 1px solid var(--border); }

.carga-rows { padding: 6px 22px 14px; }
.carga-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #1a1a1a;
  font-size: 13.5px;
}
.carga-row:last-child { border-bottom: 0; }
.carga-row .date { color: var(--text-2); }
.carga-row .station { display: flex; align-items: center; gap: 10px; min-width: 0; }
.carga-row .station .brand-badge { width: 30px; height: 30px; border-radius: 8px; font-size: 10px; }
.carga-row .station span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carga-row .num { text-align: right; font-variant-numeric: tabular-nums; }
.carga-row .num.amount { font-weight: 700; }

/* ---------- 10. TAB: MANTENIMIENTO ---------- */
.mant-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.card-odo { grid-column: 1 / -1; }
.odo-digits { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.odo-digit {
  display: grid;
  place-items: center;
  width: 56px; height: 76px;
  border-radius: 12px;
  background: linear-gradient(180deg, #1D1D1D 0%, #0C0C0C 50%, #151515 51%, #0A0A0A 100%);
  border: 1px solid #2E2E2E;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono);
  font-size: 40px;
  font-weight: 700;
  color: #F5F5F5;
  animation: flip 0.6s var(--ease) both;
}
.odo-digit.last { color: var(--accent); border-color: rgba(255, 179, 0, 0.4); }
.odo-unit { margin-left: 10px; font-size: 18px; font-weight: 800; color: var(--text-2); letter-spacing: 0.1em; }

.card-ring { grid-column: span 2; display: flex; align-items: center; gap: 32px; }
.ring {
  position: relative;
  width: 180px; height: 180px;
  flex-shrink: 0;
}
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: #1E1E1E; }
.ring .progress {
  stroke: var(--ring-color, var(--green));
  stroke-linecap: round;
  filter: drop-shadow(0 0 8px var(--ring-glow, rgba(0, 200, 83, 0.5)));
  transition: stroke-dashoffset 1.2s var(--ease);
}
.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.ring-center strong { font-size: 34px; font-weight: 900; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ring-center small { color: var(--text-2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.ring-info { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ring-info h4 { font-size: 22px; font-weight: 800; }
.ring-info p { color: var(--text-2); font-size: 14px; }
.ring-meta { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 6px; }
.ring-meta div small { display: block; color: var(--text-3); font-size: 12px; }
.ring-meta div strong { font-variant-numeric: tabular-nums; }

.card-mant-stats { display: flex; flex-direction: column; gap: 18px; }
.mant-stat { display: flex; align-items: center; gap: 14px; }
.mant-stat small { display: block; color: var(--text-2); font-size: 12.5px; }
.mant-stat strong { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }

.mant-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.mant-item { display: flex; gap: 14px; align-items: flex-start; padding: 18px; animation: fadeUp 0.45s var(--ease) both; }
.mant-item .info { flex: 1; min-width: 0; }
.mant-item strong { display: block; }
.mant-item small { color: var(--text-2); font-size: 12.5px; }
.mant-item .cost { font-weight: 800; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- 11. TAB: RADAR ---------- */
.radar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  height: calc(100vh - var(--topbar-h) - 56px);
  min-height: 520px;
  margin-top: 20px;
}
.map-card { padding: 0; overflow: hidden; }
#map { width: 100%; height: 100%; background: #0A0A0A; }
.map-overlay {
  position: absolute;
  top: 16px; left: 16px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--pill);
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(8px);
  font-size: 12.5px;
  font-weight: 600;
}
.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.6);
  animation: ping 1.6s infinite;
}

.price-panel { display: flex; flex-direction: column; min-height: 0; padding: 20px; }
.price-panel .card-head { margin-bottom: 14px; }
.fuel-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.fuel-chip {
  padding: 7px 14px;
  border-radius: var(--pill);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  transition: all var(--dur);
}
.fuel-chip:hover { color: var(--text); border-color: #555; }
.fuel-chip.active { background: var(--accent); border-color: var(--accent); color: #000; }

.price-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -8px; padding: 0 8px; display: flex; flex-direction: column; gap: 8px; }
.price-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid transparent;
  text-align: left;
  transition: border-color var(--dur), background var(--dur), transform var(--dur) var(--ease);
}
.price-item:hover { border-color: rgba(255, 179, 0, 0.4); background: #1B1B1B; transform: translateX(3px); }
.price-item .brand-badge { width: 40px; height: 40px; font-size: 12px; }
.price-item .info { flex: 1; min-width: 0; }
.price-item .info strong { display: block; font-size: 14px; }
.price-item .info small { color: var(--text-2); font-size: 12px; }
.price-item .price { text-align: right; }
.price-item .price strong { display: block; color: var(--accent); font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.price-item .price small { color: var(--text-3); font-size: 11px; }
.price-item.best { border-color: rgba(0, 200, 83, 0.4); background: linear-gradient(90deg, rgba(0, 200, 83, 0.1), var(--surface-2)); }
.price-item.best .price strong { color: var(--green-2); }
.best-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: var(--pill); background: var(--green-soft); color: var(--green-2); font-size: 10px; font-weight: 800; vertical-align: middle; }

/* Pin del mapa */
.pin-wrap { background: none; border: 0; }
.map-pin {
  position: absolute;
  transform: translate(-50%, calc(-100% - 8px));
  padding: 5px 10px;
  border-radius: var(--pill);
  background: var(--accent);
  color: #000;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 0 0 4px rgba(255, 179, 0, 0.22), 0 6px 16px rgba(0, 0, 0, 0.6);
  transition: transform 0.2s var(--ease);
}
.map-pin::after {
  content: '';
  position: absolute;
  left: 50%; top: 100%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--accent);
}
.map-pin:hover { transform: translate(-50%, calc(-100% - 12px)) scale(1.08); }

/* Overrides Leaflet (dark) */
.leaflet-container { font-family: var(--font); background: #0A0A0A; }
.leaflet-tile-pane {
  filter: invert(100%) hue-rotate(180deg) brightness(85%) contrast(95%);
}
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: #141414;
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
}
.leaflet-popup-content-wrapper { border-radius: var(--radius-sm); }
.leaflet-popup-content { margin: 14px 16px; font-size: 13px; line-height: 1.45; }
.leaflet-popup-content strong.pop-price { display: block; font-size: 20px; color: var(--accent); margin: 2px 0; }
.leaflet-popup-content small { color: var(--text-2); }
.leaflet-container a.leaflet-popup-close-button { color: var(--text-2); }
.leaflet-bar a, .leaflet-bar a:hover {
  background: #141414;
  color: var(--text);
  border-bottom-color: var(--border-strong);
}
.leaflet-bar { border: 1px solid var(--border-strong) !important; border-radius: 12px !important; overflow: hidden; }
.leaflet-control-attribution { background: rgba(0, 0, 0, 0.6) !important; color: var(--text-3) !important; }
.leaflet-control-attribution a { color: var(--text-2) !important; }

/* ---------- 12. RESPONSIVE ---------- */
@media (max-width: 1280px) {
  .main { padding: 0 28px 40px; }
  .topbar { margin: 0 -28px 8px; padding: 16px 28px; }
  .radar-layout { grid-template-columns: minmax(0, 1fr) 330px; }
}

/* Tablet & móvil: Sidebar → Bottom Nav */
@media (max-width: 1023px) {
  .sidebar {
    top: auto;
    right: 0;
    width: auto;
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
    padding: 0 8px env(safe-area-inset-bottom);
    flex-direction: row;
    align-items: center;
    background: rgba(10, 10, 10, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 0;
    border-top: 1px solid var(--border);
  }
  .sidebar-brand, .nav-caption, .sidebar-promo, .sidebar-footer { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; gap: 0; }
  .nav-item {
    flex: 1;
    flex-direction: column;
    gap: 4px;
    padding: 6px 4px;
    font-size: 11.5px;
    text-align: center;
    background: none !important;
  }
  .nav-item .nav-icon {
    width: 60px; height: 32px;
    display: grid; place-items: center;
    border-radius: var(--pill);
    transition: background var(--dur);
  }
  .nav-item.active .nav-icon { background: var(--accent-soft); }
  .nav-item.active::before { display: none; }

  .main { margin-left: 0; padding: 0 20px calc(var(--bottom-nav-h) + 32px + env(safe-area-inset-bottom)); }
  .topbar { margin: 0 -20px 4px; padding: 14px 20px; }

  .grid-dashboard { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-fuel, .card-perf { grid-column: span 2; }

  .mant-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-ring { grid-column: span 2; }
  .card-mant-stats { grid-column: span 2; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .radar-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }
  .map-card { height: 55vh; min-height: 340px; }
  .price-list { max-height: none; overflow: visible; }

  .toast { bottom: calc(var(--bottom-nav-h) + 16px + env(safe-area-inset-bottom)); }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "greet avatar"
      "veh veh";
    gap: 12px;
  }
  .greeting h2 { font-size: 21px; }
  .vehicle-select { width: 100%; }
  .vehicle-select select { flex: 1; }

  .fuel-body { grid-template-columns: 1fr; }
  .mini-chart { height: 110px; }

  .history-totals { grid-template-columns: 1fr; }
  .month-card summary {
    grid-template-columns: repeat(3, minmax(0, 1fr)) 24px;
    grid-template-areas: "title title title chev" "a b c c";
    row-gap: 14px;
  }
  .month-card summary .month-title { grid-area: title; }
  .month-card summary .chev { grid-area: chev; }
  .month-card summary .month-stat:nth-of-type(2) { grid-area: a; }
  .month-card summary .month-stat:nth-of-type(3) { grid-area: b; }
  .month-card summary .month-stat:nth-of-type(4) { grid-area: c; }
  .carga-row { grid-template-columns: 64px minmax(0, 1fr) auto; }
  .carga-row .num.liters, .carga-row .num.odo { display: none; }

  .card-ring { flex-direction: column; text-align: center; }
  .ring-meta { justify-content: center; }
  .card-mant-stats { grid-template-columns: 1fr; }
  .odo-digit { width: 40px; height: 56px; font-size: 28px; border-radius: 9px; }

  .section-head { flex-wrap: wrap; align-items: flex-start; }
}

@media (max-width: 420px) {
  .main { padding-left: 14px; padding-right: 14px; }
  .topbar { margin: 0 -14px 4px; padding: 12px 14px; }
  .grid-dashboard { gap: 12px; }
  .card { padding: 18px; }
  .card-stat .value { font-size: 22px; }
  .card-stat .card-head h4 { font-size: 12.5px; }
  .card-stat .chip-icon { width: 30px; height: 30px; }
  .perf-value span { font-size: 52px; }
  .login-card { padding: 36px 22px 24px; }
  .odo-digit { width: 34px; height: 48px; font-size: 24px; }
}

/* ---------- 13. ANIMACIONES ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes flip { from { opacity: 0; transform: rotateX(90deg); } to { opacity: 1; transform: none; } }
@keyframes float { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-46%, 30px); } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.6); } 80%, 100% { box-shadow: 0 0 0 10px rgba(255, 82, 82, 0); } }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(-4deg); } 50% { transform: rotate(10deg); } }
@keyframes pulseLogo { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 6px rgba(255, 179, 0, 0.1), var(--shadow-accent); } 50% { transform: scale(1.05); box-shadow: 0 0 0 14px rgba(255, 179, 0, 0.06), 0 12px 40px rgba(255, 179, 0, 0.4); } }
.pulse { animation: pulseLogo 1.8s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
