/* ════════════════════════════════════════════════════
   AutoLog — Premium Dark Amber Theme
   Mobile-first, iOS-optimized
════════════════════════════════════════════════════ */

/* ─── Design Tokens ──────────────────────────────── */
:root {
  --bg: #07070b;
  --bg-2: #0f0f18;
  --bg-3: #17172a;
  --surface: #12121e;
  --surface-2: #1a1a2e;
  --border: rgba(245, 158, 11, 0.12);
  --border-subtle: rgba(255,255,255,0.06);

  --amber: #f59e0b;
  --amber-light: #fbbf24;
  --amber-dark: #d97706;
  --amber-glow: rgba(245, 158, 11, 0.15);
  --amber-glow-strong: rgba(245, 158, 11, 0.3);

  --text: #f1f5f9;
  --text-2: #94a3b8;
  --text-3: #475569;

  --red: #ef4444;
  --red-glow: rgba(239,68,68,0.15);
  --orange: #f97316;
  --green: #22c55e;
  --green-glow: rgba(34,197,94,0.15);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;

  --header-h: 60px;
  --nav-h: 72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);

  --shadow: 0 4px 24px rgba(0,0,0,0.5);
  --shadow-amber: 0 0 30px rgba(245,158,11,0.2);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { height: 100%; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }
a { color: var(--amber); text-decoration: none; }
img { max-width: 100%; }

.hidden { display: none !important; }

/* ─── Screens ─────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════
   LOGIN SCREEN
═══════════════════════════════════════════════════ */
#login-screen {
  background: var(--bg);
  justify-content: center;
  align-items: center;
  overflow: auto;
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(245,158,11,0.2) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(245,158,11,0.08) 0%, transparent 50%);
  pointer-events: none;
}

.login-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  padding: 48px 24px;
  width: 100%;
  max-width: 380px;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.login-icon {
  width: 96px;
  height: 96px;
  border-radius: 22px;
  box-shadow: 0 0 40px rgba(245,158,11,0.4);
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.login-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--amber-light), var(--amber-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  font-size: 0.875rem;
  color: var(--text-2);
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* PIN UI */
.pin-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
}

.pin-label {
  font-size: 0.875rem;
  color: var(--text-2);
  font-weight: 500;
}

.pin-dots {
  display: flex;
  gap: 16px;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--amber);
  transition: all 0.15s ease;
}

.pin-dot.filled {
  background: var(--amber);
  box-shadow: 0 0 12px var(--amber);
  transform: scale(1.1);
}

.pin-error {
  color: var(--red);
  font-size: 0.8rem;
  font-weight: 500;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 300px;
}

.pin-key {
  height: 68px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.pin-key:active { transform: scale(0.92); background: var(--surface-2); }
.pin-key--clear { color: var(--text-2); font-size: 1.2rem; }
.pin-key--ok {
  background: linear-gradient(135deg, var(--amber), var(--amber-dark));
  color: #000;
  font-weight: 700;
  border: none;
  box-shadow: 0 4px 20px rgba(245,158,11,0.4);
}
.pin-key--ok:active { transform: scale(0.92); box-shadow: 0 2px 10px rgba(245,158,11,0.3); }

/* ═══════════════════════════════════════════════════
   APP HEADER
═══════════════════════════════════════════════════ */
.app-header {
  height: var(--header-h);
  padding: calc(var(--safe-top) + 8px) 16px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(7, 7, 11, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.header-brand { display: flex; align-items: center; gap: 10px; }

.btn-back {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--surface);
  color: var(--amber);
  transition: all var(--transition);
}
.btn-back svg { width: 20px; height: 20px; }
.btn-back:active { transform: scale(0.9); }

.header-car { display: flex; flex-direction: column; }
.header-car-name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.header-car-plate {
  font-size: 0.7rem;
  color: var(--amber);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.header-actions { display: flex; gap: 8px; }

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--amber);
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.btn-icon svg { width: 20px; height: 20px; }
.btn-icon:active { transform: scale(0.9); background: var(--surface-2); }

/* ─── Page Content ────────────────────────────────── */
.page-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
}

.page-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Bottom Nav ──────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(7, 7, 11, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  color: var(--text-3);
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.nav-item svg { width: 22px; height: 22px; transition: all var(--transition); }
.nav-item span { font-size: 0.65rem; font-weight: 500; letter-spacing: 0.01em; }

.nav-item.active {
  color: var(--amber);
}
.nav-item.active svg {
  filter: drop-shadow(0 0 8px rgba(245,158,11,0.6));
}
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 2px;
  background: var(--amber);
  border-radius: 0 0 4px 4px;
}

.nav-item:active { transform: scale(0.88); }

/* ═══════════════════════════════════════════════════
   CARDS & LAYOUTS
═══════════════════════════════════════════════════ */
.page-wrapper {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245,158,11,0.3), transparent);
}

.card-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title a, .card-title button {
  font-size: 0.7rem;
  color: var(--amber);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--amber-glow);
  transition: all var(--transition);
}
.card-title button:active { transform: scale(0.95); }

/* ─── Stat Grid ──────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-card {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-unit {
  font-size: 0.7rem;
  color: var(--text-2);
  font-weight: 400;
}

.stat-sub {
  font-size: 0.7rem;
  color: var(--text-2);
}

/* ─── Odometer Hero ───────────────────────────────── */
.odo-hero {
  background: linear-gradient(135deg, var(--surface) 0%, var(--bg-3) 100%);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
}

.odo-hero::after {
  content: '';
  position: absolute;
  right: -20px;
  bottom: -20px;
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(245,158,11,0.1) 0%, transparent 70%);
  pointer-events: none;
}

.odo-label {
  font-size: 0.75rem;
  color: var(--amber);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.odo-value {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  background: linear-gradient(135deg, #fff 30%, var(--text-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.odo-unit {
  font-size: 1rem;
  font-weight: 400;
  -webkit-text-fill-color: var(--text-2);
}

.odo-sub {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-2);
}

/* ─── Alert Banners ──────────────────────────────── */
.alert-list { display: flex; flex-direction: column; gap: 8px; }

.alert-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  position: relative;
}

.alert-item.overdue {
  background: var(--red-glow);
  border-color: rgba(239,68,68,0.3);
}
.alert-item.soon {
  background: rgba(249,115,22,0.1);
  border-color: rgba(249,115,22,0.3);
}

.alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.overdue .alert-dot { background: var(--red); box-shadow: 0 0 8px var(--red); animation: pulse 1.5s infinite; }
.soon .alert-dot { background: var(--orange); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.alert-text { flex: 1; }
.alert-desc { font-size: 0.875rem; font-weight: 600; }
.alert-msg { font-size: 0.75rem; color: var(--text-2); margin-top: 2px; }

/* ─── List Items ──────────────────────────────────── */
.list-section {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  border: 1px solid var(--border-subtle);
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.list-item:active { transform: scale(0.98); opacity: 0.9; }

.list-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.list-item-icon.fuel { background: rgba(245,158,11,0.15); }
.list-item-icon.maint { background: rgba(99,102,241,0.15); }
.list-item-icon.trip { background: rgba(34,197,94,0.15); }
.list-item-icon.tire { background: rgba(148,163,184,0.1); }

.list-item-body { flex: 1; min-width: 0; }
.list-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item-sub {
  font-size: 0.75rem;
  color: var(--text-2);
  margin-top: 2px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.list-item-meta { text-align: right; flex-shrink: 0; }
.list-item-value { font-size: 0.95rem; font-weight: 700; }
.list-item-date { font-size: 0.7rem; color: var(--text-3); margin-top: 2px; }

/* ─── Consumption Badge ───────────────────────────── */
.consumption-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.consumption-badge.good { background: var(--green-glow); color: var(--green); }
.consumption-badge.avg { background: var(--amber-glow); color: var(--amber); }
.consumption-badge.bad { background: var(--red-glow); color: var(--red); }

/* ─── Chart Container ─────────────────────────────── */
.chart-container {
  position: relative;
  height: 180px;
  margin-top: 8px;
}

/* ─── Quick Actions ───────────────────────────────── */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.quick-action:active { transform: scale(0.96); }

.quick-action-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.quick-action-icon.fuel { background: linear-gradient(135deg, rgba(245,158,11,0.3), rgba(245,158,11,0.1)); }
.quick-action-icon.maint { background: linear-gradient(135deg, rgba(99,102,241,0.3), rgba(99,102,241,0.1)); }
.quick-action-icon.trip { background: linear-gradient(135deg, rgba(34,197,94,0.3), rgba(34,197,94,0.1)); }
.quick-action-icon.tire { background: linear-gradient(135deg, rgba(148,163,184,0.2), rgba(148,163,184,0.05)); }

.quick-action-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

/* ═══════════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════════ */
.form { display: flex; flex-direction: column; gap: 16px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input, .form-select, .form-textarea {
  background: var(--bg-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 1rem;
  color: var(--text);
  width: 100%;
  transition: all var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-glow);
  background: var(--bg-2);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-textarea { resize: vertical; min-height: 80px; }

/* Toggle switch */
.toggle-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.toggle-label { font-size: 0.9rem; font-weight: 500; }

.toggle-switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  transition: all var(--transition);
  cursor: pointer;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--text-2);
  border-radius: 50%;
  transition: all var(--transition);
}

.toggle-switch input:checked + .toggle-track {
  background: var(--amber);
  border-color: var(--amber);
}

.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(20px);
  background: #000;
}

/* Autocomplete */
.autocomplete-wrap { position: relative; }
.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  z-index: 200;
  box-shadow: var(--shadow);
  max-height: 160px;
  overflow-y: auto;
}
.autocomplete-item {
  padding: 10px 14px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background var(--transition);
}
.autocomplete-item:hover, .autocomplete-item:active { background: var(--amber-glow); }

/* ─── Buttons ─────────────────────────────────────── */
.btn {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: linear-gradient(135deg, var(--amber-light), var(--amber-dark));
  color: #000;
  border: none;
  width: 100%;
  box-shadow: 0 4px 20px rgba(245,158,11,0.3);
}

.btn-primary:active { transform: scale(0.97); box-shadow: 0 2px 10px rgba(245,158,11,0.2); }

.btn-ghost {
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border-subtle);
  width: 100%;
}
.btn-ghost:active { transform: scale(0.97); }

.btn-danger {
  background: var(--red-glow);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.3);
  width: 100%;
}

/* ─── Section Header ─────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 4px;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-count {
  font-size: 0.75rem;
  color: var(--text-3);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: 20px;
}

/* ─── Filter Bar ─────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-2);
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.filter-chip.active {
  background: var(--amber-glow);
  border-color: var(--amber);
  color: var(--amber);
}

.filter-chip:active { transform: scale(0.95); }

/* ─── Empty State ─────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  gap: 16px;
  text-align: center;
}

.empty-icon { font-size: 3rem; opacity: 0.3; }
.empty-title { font-size: 1rem; font-weight: 600; color: var(--text-2); }
.empty-sub { font-size: 0.85rem; color: var(--text-3); }

/* ═══════════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 500;
  display: flex;
  align-items: flex-end;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding-bottom: calc(var(--safe-bottom) + 16px);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.modal-title { font-size: 1.1rem; font-weight: 700; }

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition: all var(--transition);
}
.modal-close svg { width: 16px; height: 16px; }
.modal-close:active { transform: scale(0.9); }

.modal-body { padding: 16px 20px 0; }

/* ═══════════════════════════════════════════════════
   TOAST
═══════════════════════════════════════════════════ */
.toast {
  position: fixed;
  top: calc(var(--safe-top) + var(--header-h) + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 40px;
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 1000;
  white-space: nowrap;
  box-shadow: var(--shadow);
  animation: slideDown 0.25s ease;
}

@keyframes slideDown {
  from { transform: translateX(-50%) translateY(-20px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.toast.success { border-color: rgba(34,197,94,0.4); color: var(--green); }
.toast.error { border-color: rgba(239,68,68,0.4); color: var(--red); }

/* ═══════════════════════════════════════════════════
   MORE MENU / VEHICLE / SETTINGS
═══════════════════════════════════════════════════ */
.more-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
}

.more-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.more-item:active { transform: scale(0.96); }
.more-item-icon { font-size: 1.5rem; }
.more-item-label { font-size: 0.875rem; font-weight: 600; }
.more-item-sub { font-size: 0.7rem; color: var(--text-3); }

/* ─── Vehicle Profile ─────────────────────────────── */
.vehicle-photo {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.vehicle-info-list { display: flex; flex-direction: column; gap: 1px; }

.vehicle-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.vehicle-info-row:last-child { border-bottom: none; }
.vehicle-info-label { font-size: 0.8rem; color: var(--text-2); }
.vehicle-info-value { font-size: 0.875rem; font-weight: 600; }

/* ─── Swipe to delete ─────────────────────────────── */
.swipe-wrap { position: relative; overflow: hidden; border-radius: var(--radius-sm); margin-bottom: 6px; }
.swipe-delete-bg {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 80px;
  background: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
}
.swipe-wrap .list-item { margin-bottom: 0; border-radius: 0; }

/* ─── Progress bar ────────────────────────────────── */
.progress-bar-wrap {
  height: 6px;
  background: var(--bg-3);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
  background: linear-gradient(90deg, var(--amber), var(--amber-light));
}

/* ─── Year Selector ───────────────────────────────── */
.year-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}
.year-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  font-size: 1rem;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.year-btn:active { transform: scale(0.9); }
.year-display { font-size: 1rem; font-weight: 700; min-width: 50px; text-align: center; }

/* ─── Import section ──────────────────────────────── */
.import-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}
.import-zone:hover, .import-zone.drag-over {
  border-color: var(--amber);
  background: var(--amber-glow);
}
.import-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.import-icon { font-size: 2.5rem; margin-bottom: 12px; }
.import-label { font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; }
.import-sub { font-size: 0.8rem; color: var(--text-3); }

/* ─── Scrollbar (desktop) ─────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 4px; }

/* ─── Utilities ───────────────────────────────────── */
.text-amber { color: var(--amber); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--text-2); }
.text-sm { font-size: 0.8rem; }
.font-bold { font-weight: 700; }
.mt-4 { margin-top: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-2 { gap: 8px; }
.w-full { width: 100%; }
.text-center { text-align: center; }

/* ─── Premium Grid Menu Launcher ──────────────────── */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
}

.menu-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.menu-item:active {
  transform: scale(0.97);
  background: var(--bg-3);
}

.menu-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.menu-item-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.menu-item-desc {
  font-size: 0.72rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* Specific Accent Borders and Icon BG Gradients */
.border-fuel { border-left: 3px solid #f59e0b; }
.bg-fuel { background: rgba(245, 158, 11, 0.1); }

.border-maint { border-left: 3px solid #6366f1; }
.bg-maint { background: rgba(99, 102, 241, 0.1); }

.border-library { border-left: 3px solid #10b981; }
.bg-library { background: rgba(16, 185, 129, 0.1); }

.border-trips { border-left: 3px solid #14b8a6; }
.bg-trips { background: rgba(20, 184, 166, 0.1); }

.border-tires { border-left: 3px solid #64748b; }
.bg-tires { background: rgba(100, 116, 139, 0.1); }

.border-vehicle { border-left: 3px solid #a855f7; }
.bg-vehicle { background: rgba(168, 85, 247, 0.1); }

.border-settings { border-left: 3px solid #ef4444; }
.bg-settings { background: rgba(239, 68, 68, 0.1); }

/* Prevención de desbordamientos / Mobile adjustments */
@media (max-width: 380px) {
  .menu-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .menu-item {
    padding: 10px;
  }
  .menu-icon-wrap {
    width: 30px;
    height: 30px;
    font-size: 0.95rem;
    margin-bottom: 8px;
  }
  .menu-item-title {
    font-size: 0.8rem;
  }
  .menu-item-desc {
    font-size: 0.65rem;
  }
  .stat-grid {
    gap: 8px;
  }
  .stat-card {
    padding: 8px;
  }
  .stat-value {
    font-size: 1.15rem;
  }
  .odo-value {
    font-size: 2.2rem;
  }
}

@media (max-width: 340px) {
  .menu-grid {
    grid-template-columns: 1fr;
  }
  .menu-item[style*="grid-column: span 2"] {
    grid-column: span 1 !important;
  }
  .stat-grid {
    grid-template-columns: 1fr;
  }
}

/* Force global horizontal limit */
html, body, .screen, #main-app, .page-content, .page-wrapper {
  max-width: 100vw;
  overflow-x: hidden !important;
}

/* Prevent image/canvas stretching beyond cards */
img, canvas, svg {
  max-width: 100% !important;
}

/* Break words for long codes (e.g. VIN) */
.vehicle-info-value, .list-item-title, .list-item-sub span {
  word-break: break-word;
  overflow-wrap: break-word;
}


