/* ==========================================================================
   DriveTrack — design tokens
   Premium dark automotive dashboard. Editorial serif for voice + numbers,
   Inter for UI text, JetBrains Mono for tabular data.
   ========================================================================== */
:root {
  --bg: #05070C;
  --bg-alt: #070A11;
  --surface: #0E1320;
  --surface-2: #151B2B;
  --surface-3: #1C2436;
  --border: #212A3D;
  --border-soft: #171E2C;
  --border-strong: #2B3550;

  --text: #F4F6FB;
  --text-dim: #939BB0;
  --text-faint: #565F76;

  --accent: #4F8DFF;
  --accent-2: #8CB6FF;
  --accent-deep: #2E58B8;
  --accent-soft: rgba(79, 141, 255, 0.14);
  --accent-glow: #3E6FE0;

  --ok: #4ADE80;
  --ok-soft: rgba(74, 222, 128, 0.13);
  --warn: #FACC15;
  --warn-soft: rgba(250, 204, 21, 0.13);
  --danger: #FB7185;
  --danger-soft: rgba(251, 113, 133, 0.13);

  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;

  --font-display: 'Fraunces', 'Iowan Old Style', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  --shadow-soft: 0 1px 0 rgba(255,255,255,0.02) inset, 0 20px 40px -24px rgba(0,0,0,0.6);
  --shadow-lifted: 0 24px 60px -20px rgba(0,0,0,0.65), 0 1px 0 rgba(255,255,255,0.03) inset;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-tap-highlight-color: transparent; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

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

/* Ambient light field — two soft blooms instead of one flat glow, closer to
   the layered lighting in the reference direction. */
body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(90px);
}
body::before {
  top: -14%; left: 4%;
  width: 46vw; height: 46vw;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 68%);
  opacity: 0.14;
}
body::after {
  top: 30%; right: -10%;
  width: 34vw; height: 34vw;
  background: radial-gradient(circle, #7C3AED 0%, transparent 70%);
  opacity: 0.06;
}

#app { position: relative; z-index: 1; }

button, input, select, textarea { font-family: inherit; color: inherit; }
::selection { background: var(--accent-soft); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Layout ------------------------------------------------------------- */
#app {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: rgba(14, 19, 32, 0.6);
  backdrop-filter: blur(24px);
  border-right: 1px solid var(--border-soft);
  padding: 26px 16px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: flex-start; gap: 11px; padding: 2px 10px; }
.brand-mark {
  color: var(--accent); flex-shrink: 0; margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(155deg, var(--accent-soft), transparent);
  border: 1px solid var(--border-strong);
}
.brand h1 { font-family: var(--font-display); font-size: 19px; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.brand h1 .accent { color: var(--accent); font-style: italic; }
.brand-sub { font-size: 10.5px; color: var(--text-faint); margin: 3px 0 0; line-height: 1.35; letter-spacing: .01em; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  background: none; border: none; cursor: pointer;
  color: var(--text-dim); padding: 10px 13px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; text-align: left; width: 100%;
  transition: background .15s ease, color .15s ease;
  position: relative;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, var(--accent-soft), transparent);
  color: var(--accent-2);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 4px 4px 0;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.main { display: flex; flex-direction: column; min-width: 0; }
.view { padding: 30px 34px 100px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* View header ---------------------------------------------------------- */
.view-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.view-header h1 { font-family: var(--font-display); font-size: 26px; margin: 0 0 5px; font-weight: 600; letter-spacing: -0.01em; }
.subtitle { color: var(--text-dim); font-size: 13px; margin: 0; }
.eyebrow { display: block; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 6px; }

/* Buttons ---------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border-radius: 999px; border: 1px solid transparent;
  padding: 10px 18px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: filter .15s ease, background .15s ease, transform .1s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(155deg, var(--accent-2), var(--accent));
  color: #06101F;
  box-shadow: 0 8px 20px -8px var(--accent-glow);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 10px 26px -8px var(--accent-glow); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); border-radius: var(--radius-sm); }
.btn-ghost:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn-danger-ghost { background: none; color: var(--danger); border-color: rgba(251,113,133,0.3); border-radius: var(--radius-sm); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { padding: 7px 13px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; margin-top: 10px; border-radius: var(--radius-sm); }
.link-btn { background: none; border: none; color: var(--accent-2); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.link-btn:hover { color: var(--accent); }
.icon-btn { background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 4px; border-radius: 6px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* Cards ------------------------------------------------------------------- */
.card {
  background: linear-gradient(165deg, var(--surface-2) 0%, var(--surface) 60%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-soft);
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-header h3 { margin: 0; font-size: 14.5px; font-weight: 600; letter-spacing: -0.005em; }

/* ==========================================================================
   Dashboard — asymmetric composition
   ========================================================================== */
.dash-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.dash-greeting { font-family: var(--font-display); font-size: clamp(28px, 4vw, 38px); font-weight: 500; margin: 0 0 6px; letter-spacing: -0.01em; line-height: 1.05; }
.dash-greeting .accent { color: var(--accent-2); font-style: italic; font-weight: 500; }
.dash-date { color: var(--text-faint); font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; margin: 0; }

/* Hero vehicle — the centerpiece */
.hero-vehicle {
  position: relative;
  background:
    radial-gradient(120% 140% at 88% -10%, rgba(79,141,255,0.20) 0%, transparent 55%),
    linear-gradient(160deg, var(--surface-3) 0%, var(--surface) 65%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 26px 26px 22px;
  overflow: hidden;
  box-shadow: var(--shadow-lifted);
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
}
.hero-vehicle::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.25) 100%);
  pointer-events: none;
}
.hero-vehicle-photo {
  width: 108px; height: 108px; border-radius: var(--radius-lg);
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--text-faint);
  overflow: hidden; flex-shrink: 0; position: relative; z-index: 1;
}
.hero-vehicle-photo img { width: 100%; height: 100%; object-fit: cover; }
.hero-vehicle-info { position: relative; z-index: 1; min-width: 0; }
.hero-vehicle-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--accent-2); background: var(--accent-soft);
  border: 1px solid rgba(79,141,255,0.28); border-radius: 999px;
  padding: 3px 10px; margin-bottom: 10px;
}
.hero-vehicle-info h2 {
  font-family: var(--font-display); margin: 0 0 8px; font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 600; letter-spacing: -0.01em; line-height: 1.05;
}
.vehicle-meta { display: flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 13.5px; margin: 0; font-family: var(--font-mono); }
.hero-vehicle-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; position: relative; z-index: 1; }
.hero-vehicle-mileage { text-align: right; }
.hero-vehicle-mileage .big { font-family: var(--font-mono); font-size: 26px; font-weight: 700; line-height: 1; }
.hero-vehicle-mileage .cap { display: block; font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; margin-top: 5px; }

/* Money grid — one dominant hero stat + supporting stats */
.money-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  grid-template-rows: auto auto;
  grid-template-areas:
    "hero month year"
    "hero mileage fuel";
  gap: 14px;
  margin-bottom: 16px;
}
.stat-month { grid-area: month; }
.stat-year { grid-area: year; }
.stat-mileage { grid-area: mileage; }
.stat-fuel { grid-area: fuel; }
.stat-card {
  background: linear-gradient(165deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.stat-card .label { color: var(--text-faint); font-size: 11.5px; margin: 0; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat-card .big-number { font-family: var(--font-mono); font-size: 21px; font-weight: 600; margin: 0 0 6px; letter-spacing: -0.02em; }
.stat-card .spark { position: absolute; right: 14px; bottom: 12px; opacity: .9; }

.stat-hero {
  grid-area: hero;
  background:
    radial-gradient(140% 120% at 100% 0%, rgba(79,141,255,0.16), transparent 60%),
    linear-gradient(160deg, var(--surface-3), var(--surface));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 24px 26px;
  box-shadow: var(--shadow-soft);
}
.stat-hero .eyebrow { margin-bottom: 14px; }
.stat-hero .big-number.accent {
  font-family: var(--font-mono); font-weight: 700;
  font-size: clamp(38px, 4.4vw, 52px); line-height: 1;
  letter-spacing: -0.02em; margin: 0 0 10px;
  background: linear-gradient(160deg, var(--text), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-hero .subtitle { font-size: 12.5px; }
.stat-hero .spark { margin-top: 14px; opacity: .95; }

/* Two-col section grids */
.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; margin-bottom: 16px; }
.two-col.reverse { grid-template-columns: 1fr 1.3fr; }

/* Area / line chart -------------------------------------------------------- */
.area-chart-wrap { position: relative; }
.area-chart-labels { display: flex; justify-content: space-between; margin-top: 8px; padding: 0 2px; }
.area-chart-labels span { font-size: 11px; color: var(--text-faint); font-family: var(--font-mono); }
.area-chart-total { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.area-chart-total .amt { font-family: var(--font-mono); font-size: 24px; font-weight: 700; }
.area-chart-total .delta { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.delta-up { color: var(--warn); background: var(--warn-soft); }
.delta-down { color: var(--ok); background: var(--ok-soft); }
.delta-flat { color: var(--text-faint); background: var(--surface-2); }

/* Breakdown / donut ---------------------------------------------------- */
.donut-block { display: flex; align-items: center; gap: 22px; }
.donut-wrap { position: relative; flex-shrink: 0; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.donut-center .amt { font-family: var(--font-mono); font-size: 17px; font-weight: 700; line-height: 1.1; }
.donut-center .cap { font-size: 9.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.breakdown-list { display: flex; flex-direction: column; gap: 11px; flex: 1; min-width: 0; }
.breakdown-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.breakdown-label { flex: 1; color: var(--text-dim); }
.breakdown-amt { font-family: var(--font-mono); font-weight: 600; }
.breakdown-pct { color: var(--text-faint); width: 32px; text-align: right; font-family: var(--font-mono); font-size: 11.5px; }

/* Next reminder — signature card w/ progress ring --------------------------- */
.reminder-hero { display: flex; align-items: center; gap: 18px; }
.reminder-hero-ring { position: relative; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.reminder-hero-ring .ring-icon { position: absolute; }
.reminder-hero-body { min-width: 0; }
.reminder-hero-title { font-family: var(--font-display); font-size: 19px; font-weight: 600; margin: 0 0 6px; }
.reminder-hero-sub { color: var(--text-dim); font-size: 13px; margin: 0 0 10px; }
.reminder-inline { display: flex; align-items: center; gap: 10px; }
.reminder-title { margin: 0; font-size: 14px; font-weight: 600; }

/* Empty reminder state — intentional, not apologetic */
.reminder-empty { display: flex; align-items: center; gap: 16px; }
.reminder-empty-icon {
  width: 52px; height: 52px; border-radius: 16px; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-2);
  display: flex; align-items: center; justify-content: center;
}
.reminder-empty h4 { margin: 0 0 4px; font-size: 15px; font-family: var(--font-display); font-weight: 600; }
.reminder-empty p { margin: 0; color: var(--text-dim); font-size: 12.5px; }

/* Activity timeline (dashboard "Recent Activity") --------------------------- */
.activity-list { display: flex; flex-direction: column; position: relative; }
.activity-row { display: flex; align-items: flex-start; gap: 14px; padding: 11px 4px; position: relative; cursor: pointer; border-radius: var(--radius-sm); transition: background .15s; }
.activity-row:hover { background: var(--surface-3); }
.activity-row::before {
  content: '';
  position: absolute; left: 21px; top: 42px; bottom: -4px;
  width: 1px; background: var(--border);
}
.activity-row:last-child::before { display: none; }
.activity-main { flex: 1; min-width: 0; }
.activity-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.list-row-title { margin: 0; font-size: 13.5px; font-weight: 600; }
.list-row-amt { font-family: var(--font-mono); font-weight: 600; font-size: 13.5px; }

/* Generic list rows (entries/reminders full list) ---------------------------- */
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 6px;
  border-bottom: 1px solid var(--border-soft); cursor: pointer;
  transition: background .15s;
}
.entry-list .list-row:last-child, .timeline-list .timeline-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--surface-3); border-radius: var(--radius-sm); }
.list-row-main { flex: 1; min-width: 0; }
.empty-inline { padding: 8px 4px; }

.icon-circle {
  width: 36px; height: 36px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); flex-shrink: 0;
  border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
}

.due-tag { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; display: inline-block; letter-spacing: .02em; }
.due-ok { background: var(--ok-soft); color: var(--ok); }
.due-due-soon { background: var(--warn-soft); color: var(--warn); }
.due-overdue { background: var(--danger-soft); color: var(--danger); position: relative; }

/* Reminders grouped view ----------------------------------------------------- */
.reminder-group { margin-bottom: 20px; }
.reminder-group-header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 0 4px; }
.reminder-group-header h3 { margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.reminder-group-header .count { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.reminder-group-header.group-overdue h3 { color: var(--danger); }
.reminder-group-header.group-due-soon h3 { color: var(--warn); }
.reminder-group-header.group-ok h3 { color: var(--text-dim); }

/* Timeline (dedicated view) — signature vehicle-history feature ------------- */
.timeline-year { font-family: var(--font-display); font-size: 15px; color: var(--text-faint); font-weight: 600; margin: 0 0 14px; padding: 0 4px; letter-spacing: -0.01em; }
.timeline-year:not(:first-child) { margin-top: 8px; }
.timeline-group { margin-bottom: 22px; position: relative; }
.timeline-group-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; padding: 0 4px; }
.timeline-group-header h3 { margin: 0; font-size: 13.5px; color: var(--text); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.timeline-group-header .subtitle { font-family: var(--font-mono); }
.timeline-list {
  background: linear-gradient(165deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 4px 18px;
  position: relative;
}
.timeline-row { display: flex; align-items: center; gap: 15px; padding: 13px 0; border-bottom: 1px solid var(--border-soft); cursor: pointer; }
.timeline-row:last-child { border-bottom: none; }
.timeline-row:hover { opacity: 0.85; }
.timeline-date { width: 42px; text-align: center; flex-shrink: 0; }
.timeline-day { display: block; font-family: var(--font-mono); font-size: 17px; font-weight: 700; }
.timeline-dow { display: block; font-size: 9.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .03em; }

/* Garage / vehicle collection ------------------------------------------------ */
.vehicle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.vehicle-card {
  background: linear-gradient(165deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden;
  transition: border-color .15s, transform .15s; box-shadow: var(--shadow-soft);
}
.vehicle-card.active {
  border-color: var(--accent-deep);
  box-shadow: 0 0 0 1px var(--accent-deep), var(--shadow-lifted);
}
.vehicle-card-photo { position: relative; height: 148px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--text-faint); }
.vehicle-card.active .vehicle-card-photo { background: radial-gradient(120% 130% at 90% -10%, rgba(79,141,255,0.22), transparent 60%), var(--surface-2); }
.vehicle-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.badge { position: absolute; top: 12px; right: 12px; font-size: 10.5px; font-weight: 700; padding: 4px 10px; border-radius: 20px; letter-spacing: .03em; text-transform: uppercase; }
.badge-primary { background: var(--accent); color: #06101F; box-shadow: 0 4px 14px -4px var(--accent-glow); }
.vehicle-card-body { padding: 16px 18px 18px; }
.vehicle-card-body h3 { font-family: var(--font-display); margin: 0 0 3px; font-size: 17px; font-weight: 600; }
.vehicle-card-stats { display: flex; gap: 16px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.vehicle-card-stats div { flex: 1; }
.vehicle-card-stats .v { font-family: var(--font-mono); font-size: 14px; font-weight: 700; display: block; }
.vehicle-card-stats .l { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; }
.vehicle-card-actions { display: flex; gap: 8px; margin-top: 14px; }

/* Filters -------------------------------------------------------------------- */
.filter-row { display: flex; gap: 10px; margin-bottom: 18px; }
.filter-row input[type=search] {
  flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; color: var(--text); font-size: 13.5px;
}
.filter-row select {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; color: var(--text); font-size: 13.5px;
}

/* Empty state ------------------------------------------------------------------ */
.empty-state {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 70px 20px;
  background: linear-gradient(165deg, var(--surface-2), var(--surface));
  border: 1px dashed var(--border-strong); border-radius: var(--radius-xl);
  color: var(--text-faint);
}
.empty-state > svg { color: var(--accent-2); opacity: .85; }
.empty-state h3 { font-family: var(--font-display); color: var(--text); margin: 16px 0 6px; font-size: 19px; font-weight: 600; }
.empty-state p { margin: 0 0 18px; max-width: 320px; }

/* Modal / forms ------------------------------------------------------------------ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(3,5,10,0.72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px;
  animation: fadeIn .15s ease;
}
.modal {
  background: linear-gradient(165deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  width: 100%; max-width: 440px; max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow-lifted);
  animation: modalIn .18s cubic-bezier(.2,.8,.3,1);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--border-soft); }
.modal-header h3 { font-family: var(--font-display); margin: 0; font-size: 18px; font-weight: 600; }
.modal-body { padding: 22px; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-dim); font-weight: 600; }
.form .hint { color: var(--text-faint); font-weight: 400; text-transform: none; }
.form input, .form select, .form textarea {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 13px; color: var(--text); font-size: 14px;
}
.form input:focus, .form select:focus, .form textarea:focus, .filter-row input:focus, .filter-row select:focus {
  outline: none; border-color: var(--accent);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.file-label {
  flex-direction: row !important; align-items: center; gap: 8px; cursor: pointer;
  background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  padding: 13px; color: var(--text-dim);
}
.form-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }

/* Toast --------------------------------------------------------------------------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(10px);
  background: var(--surface-3); border: 1px solid var(--border-strong); color: var(--text);
  padding: 12px 20px; border-radius: 30px; font-size: 13.5px; opacity: 0; transition: opacity .2s, transform .2s;
  z-index: 100; box-shadow: 0 12px 30px rgba(0,0,0,0.5);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Mobile tabbar (hidden on desktop) --------------------------------------------- */
.mobile-tabbar { display: none; }
.mobile-fab { display: none; }

/* Responsive ------------------------------------------------------------------- */
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .view { padding: 20px 16px 108px; }

  .hero-vehicle { grid-template-columns: auto 1fr; row-gap: 14px; padding: 20px; }
  .hero-vehicle-actions { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; width: 100%; }
  .hero-vehicle-mileage { text-align: left; }

  .money-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "hero hero"
      "month year"
      "mileage fuel";
  }

  .two-col, .two-col.reverse { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .donut-block { flex-direction: column; align-items: flex-start; }

  .mobile-tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    background: rgba(14,19,32,0.86); backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-soft);
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  }
  .tab-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
    background: none; border: none; color: var(--text-faint); font-size: 10px; padding: 6px 2px;
    font-weight: 600; letter-spacing: .01em;
    border-radius: 12px; transition: color .15s;
  }
  .tab-item.active { color: var(--accent-2); }
  .tab-item.active svg { filter: drop-shadow(0 0 6px var(--accent-glow)); }

  .mobile-fab {
    display: flex; align-items: center; justify-content: center;
    position: fixed; right: 18px; bottom: calc(70px + env(safe-area-inset-bottom));
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(155deg, var(--accent-2), var(--accent));
    color: #06101F; border: none; cursor: pointer; z-index: 25;
    box-shadow: 0 14px 30px -8px var(--accent-glow), 0 2px 0 rgba(255,255,255,0.15) inset;
    transition: transform .12s ease;
  }
  .mobile-fab:active { transform: scale(0.92); }
}

@media (max-width: 480px) {
  .view-header { flex-direction: column; align-items: stretch; }
  .dash-header { flex-direction: column; }
  .hero-vehicle-photo { width: 84px; height: 84px; }
}

/* Image viewer (receipts / vehicle photos) --------------------------------- */
.image-viewer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.92);
  display: flex; align-items: center; justify-content: center;
  z-index: 60; padding: 24px;
}
.image-viewer-img { max-width: 100%; max-height: 100%; border-radius: var(--radius-sm); object-fit: contain; }
.image-viewer-close {
  position: absolute; top: 16px; right: 16px; color: var(--text);
  background: rgba(255,255,255,0.08); z-index: 61;
}
.image-viewer-close:hover { background: rgba(255,255,255,0.16); }

/* Checkbox / radio rows (reminder-match note, import mode picker) --------- */
.checkbox-row {
  flex-direction: row !important; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-dim); font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; cursor: pointer;
}
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
.checkbox-row span { color: var(--text); }

/* Settings page ------------------------------------------------------------ */
.settings-card { display: flex; flex-direction: column; gap: 12px; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Service-worker update toast ----------------------------------------------- */
.update-toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text);
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-radius: 30px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5); z-index: 90;
  opacity: 0; transition: opacity .2s, transform .2s;
}
.update-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.update-toast button {
  background: var(--accent); color: #06101F; border: none; border-radius: 20px;
  padding: 6px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
@media (max-width: 900px) {
  .update-toast { bottom: calc(78px + env(safe-area-inset-bottom)); }
}
