/* ═══════════════════════════════════════════════════════════════
   AutoTrack — Main Stylesheet
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --sidebar-w: 260px;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #3b82f6;
  --sidebar-active-bg: rgba(59,130,246,.12);

  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-2: #64748b;
  --text-3: #94a3b8;

  --blue: #3b82f6;
  --blue-light: #eff6ff;
  --blue-dark: #1d4ed8;
  --green: #10b981;
  --green-light: #ecfdf5;
  --amber: #f59e0b;
  --amber-light: #fffbeb;
  --red: #ef4444;
  --red-light: #fef2f2;
  --purple: #8b5cf6;
  --purple-light: #f5f3ff;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.10), 0 10px 10px -5px rgba(0,0,0,.04);

  --topbar-h: 64px;
  --transition: .2s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, textarea, select { font: inherit; }
table { border-collapse: collapse; width: 100%; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ══════════════════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition), width var(--transition);
  overflow: hidden;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

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

.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(59,130,246,.4);
}

.logo-icon svg { width: 20px; height: 20px; }
.logo-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.3px;
  transition: opacity var(--transition);
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: .9rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  background: rgba(255,255,255,.05);
  color: #e2e8f0;
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: var(--sidebar-active);
  border-radius: 0 4px 4px 0;
}

.nav-icon {
  width: 20px; height: 20px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.nav-icon svg { width: 18px; height: 18px; }
.nav-text { transition: opacity var(--transition); }

.nav-badge {
  margin-left: auto;
  background: var(--blue);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
  animation: badgePop .3s cubic-bezier(.34,1.56,.64,1);
}

.nav-badge.alert { background: var(--red); }

@keyframes badgePop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.06);
  color: rgba(148,163,184,.5);
  font-size: .75rem;
}

/* ── Sidebar collapse ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 199;
  backdrop-filter: blur(2px);
  animation: fadeIn .2s ease;
}

/* ══════════════════════════════════════════════════════════════
   MAIN WRAPPER
   ══════════════════════════════════════════════════════════════ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin var(--transition);
}

/* ── Top Bar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.sidebar-toggle {
  width: 36px; height: 36px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 5px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  display: none; /* hidden on desktop */
}
.sidebar-toggle:hover { background: var(--bg); }
.sidebar-toggle span {
  display: block;
  width: 20px; height: 2px;
  background: var(--text-2);
  border-radius: 2px;
  transition: all var(--transition);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .85rem;
}
.breadcrumb-root { color: var(--text-3); }
.breadcrumb-sep { color: var(--text-3); }
.breadcrumb-current { color: var(--text); font-weight: 600; }

/* Notification bell */
.notif-btn {
  position: relative;
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.notif-btn:hover { background: var(--bg); color: var(--text); }
.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 17px; height: 17px;
  background: var(--red);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid #fff;
  transition: all var(--transition);
}
.notif-badge[data-count="0"],
.notif-badge:empty { opacity: 0; transform: scale(0); }

/* ══════════════════════════════════════════════════════════════
   PAGES
   ══════════════════════════════════════════════════════════════ */
.pages { flex: 1; padding: 28px 28px 48px; }

.page {
  display: none;
  animation: pageEnter .35s cubic-bezier(.4,0,.2,1);
}
.page.active { display: block; }

@keyframes pageEnter {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

.page-subtitle {
  font-size: .875rem;
  color: var(--text-2);
  margin-top: 2px;
}

/* ══════════════════════════════════════════════════════════════
   STATS GRID
   ══════════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
  animation: cardEnter .4s cubic-bezier(.4,0,.2,1) both;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card:nth-child(1) { animation-delay: .05s; }
.stat-card:nth-child(2) { animation-delay: .10s; }
.stat-card:nth-child(3) { animation-delay: .15s; }
.stat-card:nth-child(4) { animation-delay: .20s; }

@keyframes cardEnter {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }

.stat-card[data-color="blue"]  .stat-icon { background: var(--blue-light);   color: var(--blue); }
.stat-card[data-color="amber"] .stat-icon { background: var(--amber-light);  color: var(--amber); }
.stat-card[data-color="red"]   .stat-icon { background: var(--red-light);    color: var(--red); }
.stat-card[data-color="green"] .stat-icon { background: var(--green-light);  color: var(--green); }

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  letter-spacing: -1px;
  transition: all .4s ease;
}

.stat-label {
  font-size: .8rem;
  color: var(--text-2);
  margin-top: 4px;
  font-weight: 500;
}

/* ══════════════════════════════════════════════════════════════
   DASHBOARD GRID
   ══════════════════════════════════════════════════════════════ */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ══════════════════════════════════════════════════════════════
   WIDGETS
   ══════════════════════════════════════════════════════════════ */
.widget {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: cardEnter .4s cubic-bezier(.4,0,.2,1) both;
}
.widget:nth-child(2) { animation-delay: .08s; }

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.widget-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}

.widget-body { padding: 16px 20px; }
.mt-6 { margin-top: 24px; }

/* ══════════════════════════════════════════════════════════════
   TOOLBAR
   ══════════════════════════════════════════════════════════════ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-3);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: .875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}

.filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.filter-tab {
  padding: 5px 14px;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.filter-tab:hover { color: var(--text); }
.filter-tab.active {
  background: var(--surface);
  color: var(--blue);
  box-shadow: var(--shadow);
}

.select-filter {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: .875rem;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}
.select-filter:focus { border-color: var(--blue); }

/* ══════════════════════════════════════════════════════════════
   TABLE
   ══════════════════════════════════════════════════════════════ */
.table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: auto;
}

.data-table {
  min-width: 700px;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 16px;
  font-size: .875rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  transition: background var(--transition);
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr {
  animation: rowEnter .3s ease both;
}

@keyframes rowEnter {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.data-table tbody tr:hover td { background: #f8fafc; }

.col-actions { width: 120px; text-align: right; }

.table-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.empty-row td { padding: 0; }

/* ── Car name cell ── */
.car-name-cell { display: flex; flex-direction: column; gap: 2px; }
.car-name { font-weight: 600; color: var(--text); }
.car-sub  { font-size: .78rem; color: var(--text-3); }

/* ── Status badges ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 700;
  white-space: nowrap;
}
.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }

.status-badge.ok      { background: var(--green-light); color: #065f46; }
.status-badge.ok::before { background: var(--green); }

.status-badge.soon    { background: var(--amber-light); color: #92400e; }
.status-badge.soon::before { background: var(--amber); animation: pulse 1.5s infinite; }

.status-badge.overdue { background: var(--red-light); color: #991b1b; }
.status-badge.overdue::before { background: var(--red); animation: pulse 1s infinite; }

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

/* ── Repair type badge ── */
.repair-type {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 600;
  background: var(--blue-light);
  color: var(--blue-dark);
}

/* ══════════════════════════════════════════════════════════════
   REMINDERS PAGE
   ══════════════════════════════════════════════════════════════ */
.reminders-filters {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  width: fit-content;
}

.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot.red   { background: var(--red); }
.dot.amber { background: var(--amber); }
.dot.blue  { background: var(--blue); }

.reminders-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reminder-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border-left: 4px solid transparent;
  transition: all var(--transition);
  animation: cardEnter .3s ease both;
}

.reminder-card:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.reminder-card.overdue { border-left-color: var(--red); }
.reminder-card.this_month { border-left-color: var(--amber); }
.reminder-card.next_month { border-left-color: var(--blue); }

.reminder-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.reminder-icon svg { width: 20px; height: 20px; }

.reminder-card.overdue   .reminder-icon { background: var(--red-light);   color: var(--red); }
.reminder-card.this_month .reminder-icon { background: var(--amber-light); color: var(--amber); }
.reminder-card.next_month .reminder-icon { background: var(--blue-light);  color: var(--blue); }

.reminder-body { flex: 1; }

.reminder-title {
  font-weight: 700;
  font-size: .95rem;
  margin-bottom: 4px;
  color: var(--text);
}

.reminder-desc {
  font-size: .82rem;
  color: var(--text-2);
  line-height: 1.5;
}

.reminder-date {
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: 6px;
  align-self: center;
}

.reminder-card.overdue   .reminder-date { background: var(--red-light);   color: #991b1b; }
.reminder-card.this_month .reminder-date { background: var(--amber-light); color: #92400e; }
.reminder-card.next_month .reminder-date { background: var(--blue-light);  color: var(--blue-dark); }

/* ══════════════════════════════════════════════════════════════
   REPORTS PAGE
   ══════════════════════════════════════════════════════════════ */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.report-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  gap: 20px;
  transition: transform var(--transition), box-shadow var(--transition);
  animation: cardEnter .4s ease both;
}
.report-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.report-card-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.report-card-icon svg { width: 24px; height: 24px; }
.report-card-icon.blue   { background: var(--blue-light);   color: var(--blue); }
.report-card-icon.green  { background: var(--green-light);  color: var(--green); }
.report-card-icon.amber  { background: var(--amber-light);  color: var(--amber); }

.report-card-body { flex: 1; }
.report-card-body h3 { font-weight: 700; margin-bottom: 6px; }
.report-card-body p  { font-size: .83rem; color: var(--text-2); margin-bottom: 16px; line-height: 1.5; }

.report-actions { display: flex; gap: 8px; }
.report-type-tabs { display: flex; gap: 4px; }

/* ══════════════════════════════════════════════════════════════
   DASHBOARD WIDGETS — Compact lists
   ══════════════════════════════════════════════════════════════ */
.compact-list { display: flex; flex-direction: column; gap: 8px; }

.compact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  transition: background var(--transition);
  animation: rowEnter .3s ease both;
}
.compact-item:hover { background: #eef2f7; }

.compact-item-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}
.compact-item-body { flex: 1; min-width: 0; }
.compact-item-title {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compact-item-sub {
  font-size: .75rem;
  color: var(--text-2);
  margin-top: 1px;
}
.compact-item-badge { flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition);
}
.btn:hover::after { background: rgba(255,255,255,.1); }
.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 1px 2px rgba(59,130,246,.3);
}
.btn-primary:hover { background: var(--blue-dark); }

.btn-outline {
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
}
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }

.btn-ghost {
  color: var(--text-2);
  background: transparent;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover { background: #dc2626; }

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center; justify-content: center;
}
.btn-icon svg { width: 15px; height: 15px; }

.btn-sm { padding: 5px 12px; font-size: .8rem; }

/* ── Icon buttons ── */
.icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center; justify-content: center;
  color: var(--text-2);
  transition: all var(--transition);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg); }
.icon-btn.edit:hover { color: var(--blue); background: var(--blue-light); }
.icon-btn.del:hover  { color: var(--red);  background: var(--red-light); }
.icon-btn.view:hover { color: var(--green); background: var(--green-light); }
.icon-btn svg { width: 15px; height: 15px; }

/* ══════════════════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px) scale(.97);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s ease;
  opacity: 0;
}

.modal-backdrop.open .modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal-wide { max-width: 760px; }
.modal-sm   { max-width: 420px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

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

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

.modal-body { padding: 24px; }

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ── Forms ── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: .01em;
}

.req { color: var(--red); }

.form-input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: .875rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  width: 100%;
}

.form-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
  background: var(--surface);
}

.form-textarea {
  height: auto;
  resize: vertical;
  padding: 10px 12px;
  line-height: 1.5;
}

/* Quick dates */
.quick-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
  font-size: .78rem;
  color: var(--text-2);
}
.quick-dates span { font-weight: 500; }
.quick-dates button {
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: .78rem;
  font-weight: 600;
  color: var(--blue);
  transition: all var(--transition);
}
.quick-dates button:hover { background: var(--blue-light); border-color: var(--blue); }

/* ══════════════════════════════════════════════════════════════
   CAR DETAIL MODAL
   ══════════════════════════════════════════════════════════════ */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}

.detail-field { padding: 12px 0; }
.detail-field-label {
  font-size: .73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  margin-bottom: 4px;
}
.detail-field-value {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
}

.detail-section-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.car-repairs-table .data-table th,
.car-repairs-table .data-table td { padding: 10px 14px; }

/* ══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: all;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--text);
  color: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 380px;
  font-size: .875rem;
  font-weight: 500;
  animation: toastIn .35s cubic-bezier(.34,1.56,.64,1) both;
}

.toast.removing {
  animation: toastOut .25s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(60px) scale(.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(60px) scale(.9); }
}

.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast-msg { flex: 1; }

.toast.success { background: linear-gradient(135deg, #059669, var(--green)); }
.toast.error   { background: linear-gradient(135deg, #dc2626, var(--red)); }
.toast.warning { background: linear-gradient(135deg, #d97706, var(--amber)); }
.toast.info    { background: linear-gradient(135deg, #1d4ed8, var(--blue)); }

/* ══════════════════════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════════════════════ */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-3);
  font-size: .875rem;
  font-weight: 500;
}

.empty-state.small { padding: 24px 16px; font-size: .83rem; }

/* ══════════════════════════════════════════════════════════════
   LOADING SKELETON
   ══════════════════════════════════════════════════════════════ */
@keyframes shimmer {
  from { background-position: -400px 0; }
  to   { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .dash-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 260px; }

  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }
  .sidebar-overlay.open { display: block; }

  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .topbar { padding: 0 16px; }

  .pages { padding: 20px 16px 40px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }

  .toolbar { flex-direction: column; align-items: stretch; }
  .search-wrap { max-width: none; }

  .btn span { display: none; }

  #topAddBtn span { display: inline; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .reports-grid { grid-template-columns: 1fr; }
  .modal { border-radius: 16px 16px 0 0; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
}

/* ══════════════════════════════════════════════════════════════
   UTILITY
   ══════════════════════════════════════════════════════════════ */
.text-muted { color: var(--text-2); }
.text-sm    { font-size: .8rem; }
.font-mono  { font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace; }

/* Fade in animation utility */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Reminder icon colors (Django template classes) ─────────── */
.reminder-icon-overdue    { background: var(--red-light);   color: var(--red); }
.reminder-icon-this_month { background: var(--amber-light); color: var(--amber); }
.reminder-icon-next_month { background: var(--blue-light);  color: var(--blue); }
