/* Carvariables catalog UI on Bootstrap 5.3. Theme tokens first, then layout, then components. */

:root,
[data-bs-theme="light"] {
  --app-bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --surface-hover: #f1f4f9;
  --border: #e5e8ef;
  --border-strong: #d5dae4;
  --text: #0f1729;
  --muted: #667085;
  --primary: #0269f7;          /* brand blue from the logo */
  --primary-hover: #0157d0;
  --primary-soft: #e8f0fe;
  --primary-text: #0158d6;
  --navy: #0a1e48;             /* brand navy from the logo */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 10px 30px -12px rgba(16, 24, 40, .22), 0 2px 6px rgba(16, 24, 40, .05);
  --shadow-lg: 0 24px 60px -18px rgba(16, 24, 40, .32);
  --photo-bg: linear-gradient(180deg, #eef1f6, #e3e8ef);
  --radius: 12px;
  --radius-sm: 9px;

  --bs-body-bg: var(--app-bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-primary: var(--primary);
  --bs-primary-rgb: 2, 105, 247;
  --bs-link-color: var(--primary);
  --bs-link-hover-color: var(--primary-hover);
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

[data-bs-theme="dark"] {
  --app-bg: #0b0f17;
  --surface: #121826;
  --surface-2: #161d2d;
  --surface-hover: #1b2335;
  --border: #232c3f;
  --border-strong: #2f3a52;
  --text: #e7ebf3;
  --muted: #98a2b8;
  --primary: #2a82ff;
  --primary-hover: #4b95ff;
  --navy: #0a1e48;
  --primary-soft: rgba(61, 130, 246, .14);
  --primary-text: #7fb0ff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 12px 34px -12px rgba(0, 0, 0, .7);
  --shadow-lg: 0 24px 60px -18px rgba(0, 0, 0, .8);
  --photo-bg: linear-gradient(180deg, #182033, #121a2a);

  --bs-body-bg: var(--app-bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-primary-rgb: 42, 130, 255;
}

html, body { background: var(--app-bg); color: var(--text); }
body { font-family: var(--bs-body-font-family); font-size: 14px; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; }
.muted { color: var(--muted) !important; }
.min-w-0 { min-width: 0; }
kbd { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; font: 600 11px/1 var(--bs-body-font-family); padding: 3px 6px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: minmax(0, 1fr); min-height: 100vh; }
@media (min-width: 992px) { .app { grid-template-columns: 248px minmax(0, 1fr); } }
/* Detail column: closed (0 wide) until a car is clicked, then slides open. */
@media (min-width: 1400px) {
  .app { --pane: clamp(480px, 36vw, 640px); grid-template-columns: 248px minmax(0, 1fr) 0px; transition: grid-template-columns .32s cubic-bezier(.2, .8, .2, 1); }
  .app.detail-open { grid-template-columns: 248px minmax(0, 1fr) var(--pane); }
  .app:not(.detail-open) .detail-pane { visibility: hidden; border-left-width: 0; }
  /* The panel content keeps its width while the column animates; clip it so it never widens the page. */
  .detail-pane { overflow: hidden; }
  .detail-pane .detail-scroll { width: var(--pane); }
}
@media (min-width: 1800px) {
  .app { grid-template-columns: 260px minmax(0, 1fr) 0px; }
  .app.detail-open { grid-template-columns: 260px minmax(0, 1fr) var(--pane); }
}
@media (prefers-reduced-motion: reduce) { .app { transition: none; } }
@media (min-width: 992px) { .app.no-detail { grid-template-columns: 248px minmax(0, 1fr); } }
@media (min-width: 1800px) { .app.no-detail { grid-template-columns: 260px minmax(0, 1fr); } }

.main { padding: 16px; min-width: 0; }
@media (min-width: 576px) { .main { padding: 20px 24px 28px; } }

/* ---------- Sidebar ---------- */
.sidebar { --bs-offcanvas-width: 280px; --bs-offcanvas-bg: var(--surface); border-right: 1px solid var(--border); }
@media (min-width: 992px) {
  .sidebar { position: sticky !important; top: 0; height: 100vh; background: var(--surface) !important; }
}
.sidebar-inner { display: flex; flex-direction: column; height: 100%; width: 100%; padding: 18px 14px; overflow-y: auto; }
.brand { display: flex; flex-direction: column; gap: 6px; color: var(--text); padding: 4px 6px; min-width: 0; }
.brand img { width: 196px; max-width: 100%; height: auto; display: block; }
.brand small { display: block; font-size: 11.5px; color: var(--muted); letter-spacing: .02em; padding-left: 1px; }
/* Logo variant per theme: navy artwork on light, white artwork on dark. */
[data-bs-theme="light"] .logo-for-dark, [data-bs-theme="dark"] .logo-for-light { display: none !important; }
.topbar-symbol { width: 46px; height: 46px; flex: none; align-items: center; justify-content: center; border-radius: 11px; background: var(--surface); border: 1px solid var(--border); }
.topbar-symbol img { width: 30px; height: 30px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--text); font-weight: 500; min-width: 0; transition: background .15s; }
.side-nav a > i { font-size: 17px; color: var(--muted); width: 20px; text-align: center; }
.side-nav a:hover { background: var(--surface-hover); }
.side-nav a.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.side-nav a.active > i { color: var(--primary-text); }
.side-nav.brands a { padding: 7px 12px; font-weight: 500; }
.side-label { font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 26px 12px 8px; padding-top: 18px; border-top: 1px solid var(--border); }
.view-all { display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px; font-weight: 600; color: var(--primary-text); }
.side-footer { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.side-footer > a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--text); font-weight: 500; border: 1px solid var(--border); }
.side-footer > a:hover { background: var(--surface-hover); }
.kbd-hint { font-size: 12px; color: var(--muted); padding: 0 12px; display: flex; align-items: center; gap: 4px; }

.monogram { --hue: 210; width: 26px; height: 26px; flex: none; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 10.5px; font-weight: 700; letter-spacing: -.02em;
  color: hsl(var(--hue) 55% 32%); background: hsl(var(--hue) 70% 93%); border: 1px solid hsl(var(--hue) 45% 84%); }
[data-bs-theme="dark"] .monogram { color: hsl(var(--hue) 80% 80%); background: hsl(var(--hue) 35% 20%); border-color: hsl(var(--hue) 30% 30%); }
.monogram.lg { width: 44px; height: 44px; font-size: 14px; }
.brand-mark { width: 26px; height: 26px; flex: none; border-radius: 7px; display: inline-grid; place-items: center; background: #fff; border: 1px solid var(--border); padding: 3px; overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.brand-mark.lg { width: 44px; height: 44px; border-radius: 11px; padding: 6px; }
[data-bs-theme="dark"] .brand-mark { border-color: transparent; }
.monogram.any { color: var(--muted); background: var(--surface-2); border-color: var(--border); font-size: 13px; }

/* ---------- Top bar + search ---------- */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.search-form { display: flex; gap: 10px; flex: 1; min-width: 0; }
.search-box { position: relative; flex: 1; min-width: 0; }
.search-field { position: relative; }
.search-field > .bi-search { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 16px; pointer-events: none; }
#search-input { width: 100%; height: 46px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 11px; padding: 0 90px 0 44px; font-size: 14.5px; outline: none; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
#search-input::placeholder { color: var(--muted); }
#search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
#search-input::-webkit-search-cancel-button { display: none; }
.search-kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: flex; gap: 3px; pointer-events: none; }
@media (max-width: 575.98px) { .search-kbd { display: none; } #search-input { padding-right: 14px; } }
.search-btn { height: 46px; padding: 0 26px; border-radius: 11px; font-weight: 600; font-size: 14.5px; --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-hover); --bs-btn-hover-border-color: var(--primary-hover); }
@media (max-width: 575.98px) { .search-btn { padding: 0 15px; } }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-hover); --bs-btn-hover-border-color: var(--primary-hover); --bs-btn-active-bg: var(--primary-hover); }
.btn-soft { background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 10px; }
.btn-soft:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }
.topbar > .btn-soft { height: 46px; width: 46px; font-size: 20px; padding: 0; }

.theme-switch { display: flex; gap: 2px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; height: 46px; align-items: center; }
.theme-switch button { border: 0; background: transparent; color: var(--muted); width: 36px; height: 36px; border-radius: 8px; font-size: 16px; }
.theme-switch button:hover { color: var(--text); }
[data-bs-theme="light"] .theme-switch [data-theme-set="light"],
[data-bs-theme="dark"] .theme-switch [data-theme-set="dark"] { background: var(--surface-2); color: var(--text); box-shadow: var(--shadow-sm); }
@media (max-width: 575.98px) { .theme-switch [data-theme-set="light"] { display: none; } .theme-switch { padding: 4px 4px; } }

/* Autocomplete */
.suggest { position: absolute; z-index: 1060; top: calc(100% + 8px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 8px; max-height: min(70vh, 560px); overflow-y: auto; }
.suggest-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px 4px; }
.suggest-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; color: var(--text); cursor: pointer; }
.suggest-item[aria-selected="true"], .suggest-item:hover { background: var(--surface-hover); }
.suggest-item[aria-selected="true"] { box-shadow: inset 0 0 0 1px var(--border-strong); }
.suggest-thumb { width: 64px; height: 42px; border-radius: 7px; background: var(--photo-bg); flex: none; overflow: hidden; display: grid; place-items: center; color: var(--muted); }
.suggest-thumb img { width: 100%; height: 100%; object-fit: cover; }
.suggest-item strong { display: block; font-weight: 600; font-size: 14px; }
.suggest-item small { color: var(--muted); font-size: 12.5px; }
.suggest-item .item-meta { margin-left: auto; }
.suggest-item mark { padding: 0; background: transparent; color: var(--primary-text); font-weight: 700; }
.suggest-foot { display: flex; gap: 14px; justify-content: flex-end; font-size: 12px; color: var(--muted); padding: 8px 10px 2px; border-top: 1px solid var(--border); margin-top: 6px; }
.suggest-empty { padding: 18px; text-align: center; color: var(--muted); }
/* Phones and tablets: the input is narrow, so the panel spans the whole top bar instead. */
@media (max-width: 991.98px) {
  .topbar { position: relative; }
  .search-box { position: static; }
  .suggest { left: 0; right: 0; max-height: min(72vh, 600px); }
}
@media (max-width: 575.98px) {
  .suggest { padding: 6px; border-radius: 12px; }
  .suggest-item { gap: 10px; padding: 8px; align-items: flex-start; }
  .suggest-thumb { width: 72px; height: 48px; }
  .suggest-item strong.text-truncate { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .suggest-foot { display: none; }
}

/* ---------- Filters (custom dropdowns) ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; max-width: 220px; font-size: 13.5px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 10px; font-weight: 500; box-shadow: var(--shadow-sm); }
.filter-btn:hover, .filter-btn.show { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.filter-btn .bi-chevron-down, .filter-btn .bi-chevron-up { font-size: 11px; color: var(--muted); transition: transform .2s; }
.filter-btn.show .bi-chevron-down { transform: rotate(180deg); }
.filter-btn.is-set { background: var(--primary-soft); border-color: transparent; color: var(--primary-text); font-weight: 600; }
.filter-btn.is-set .bi { color: var(--primary-text); }
.filter-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--primary-soft); border-color: var(--primary); }

.fancy-dropdown .dropdown-menu {
  --bs-dropdown-bg: var(--surface); --bs-dropdown-border-color: var(--border); --bs-dropdown-link-color: var(--text);
  --bs-dropdown-link-hover-bg: var(--surface-hover); --bs-dropdown-link-hover-color: var(--text);
  --bs-dropdown-link-active-bg: var(--primary-soft); --bs-dropdown-link-active-color: var(--primary-text);
  min-width: 230px; padding: 6px; border-radius: 14px; box-shadow: var(--shadow-lg); margin-top: 6px !important;
  animation: menu-in .14s ease-out; }
/* Animate translate/scale, not transform: Bootstrap (Popper) positions the menu with transform. */
@keyframes menu-in { from { opacity: 0; translate: 0 -4px; scale: .98; } to { opacity: 1; translate: 0 0; scale: 1; } }
.fancy-dropdown .dropdown-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; font-weight: 500; font-size: 14px; min-width: 0; }
.fancy-dropdown .dropdown-item.active { font-weight: 600; }
.fancy-dropdown .dropdown-item:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.item-meta { margin-left: auto; padding-left: 10px; font-size: 12px; color: var(--muted); white-space: nowrap; font-weight: 500; }
.dropdown-item.active .item-meta { color: var(--primary-text); }
.item-icon { width: 18px; color: var(--muted); text-align: center; }
.dropdown-item.active .item-icon { color: var(--primary-text); }
.menu-wide { width: 300px; }
.scroll-menu { max-height: 340px; overflow-y: auto; overscroll-behavior: contain; }
.menu-search { display: flex; align-items: center; gap: 8px; padding: 4px 6px 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-search > .bi { color: var(--muted); }
.menu-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); padding: 6px 0; font-size: 14px; }
.menu-search input::-webkit-search-cancel-button { display: none; }
.menu-search input[type=number]::-webkit-inner-spin-button { opacity: .4; }
.menu-note { padding: 12px; color: var(--muted); font-size: 13px; max-width: 280px; }
.menu-empty { padding: 14px; color: var(--muted); text-align: center; font-size: 13px; }
.menu-clear { display: flex; align-items: center; gap: 8px; padding: 9px 10px 4px; margin-top: 6px; border-top: 1px solid var(--border); color: var(--muted); font-weight: 500; }
.menu-clear:hover { color: var(--text); }
.menu-year { width: 296px; }
.year-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; max-height: 248px; }
.year-grid a { padding: 7px 0; text-align: center; border-radius: 8px; color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.year-grid a:hover { background: var(--surface-hover); }
.year-grid a.active { background: var(--primary); color: #fff; }
.clear-all { color: var(--muted); font-weight: 500; font-size: 12.5px; padding: 4px 6px; align-self: center; }
.clear-all:hover { color: var(--text); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: 12.5px; font-weight: 500; max-width: 100%; }
.chip i { font-size: 15px; color: var(--muted); }
.chip:hover { border-color: var(--border-strong); }
.chip:hover i { color: var(--text); }

/* ---------- Results ---------- */
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 20px 0 14px; }
.results-title { font-size: 19px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.results-title span { color: var(--text); }
.view-toggle { display: flex; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; height: 40px; align-items: center; }
.view-toggle button { border: 0; background: transparent; color: var(--muted); width: 32px; height: 32px; border-radius: 7px; }
.view-toggle button.active { background: var(--primary-soft); color: var(--primary-text); }
.mini-search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; height: 40px; }
.mini-search i { color: var(--muted); }
.mini-search input { border: 0; outline: 0; background: transparent; color: var(--text); width: 200px; }

.notice { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; background: var(--primary-soft); color: var(--primary-text); font-weight: 500; margin-bottom: 14px; }
.notice-warn { background: rgba(245, 158, 11, .12); color: #b45309; }
[data-bs-theme="dark"] .notice-warn { color: #fbbf24; }

.results-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); }
.car-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; color: var(--text);
  box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease, border-color .18s; }
.car-card:hover { color: var(--text); transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.car-card.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow-md); }
.car-card:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--primary-soft); border-color: var(--primary); }
.car-img { position: relative; aspect-ratio: 3 / 2; background: var(--photo-bg); overflow: hidden; }
.car-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.car-card:hover .car-img img { transform: scale(1.035); }
.img-badge { position: absolute; left: 10px; top: 10px; display: inline-flex; gap: 5px; align-items: center; padding: 3px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: rgba(255, 255, 255, .92); color: #1d2939; backdrop-filter: blur(6px); }
.img-badge.alt { left: auto; right: 10px; }
.photo-empty { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.photo-empty i { font-size: 24px; opacity: .7; }
.car-body { padding: 13px 15px 14px; display: flex; flex-direction: column; flex: 1; }
.car-make { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.car-make i { font-size: 13px; color: var(--muted); transition: transform .18s; }
.car-card:hover .car-make i { transform: translateX(2px); color: var(--text); }
.car-title { font-size: 16.5px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; margin-top: 2px; overflow-wrap: anywhere; }
.car-sub { font-size: 13px; color: var(--muted); margin-top: 3px; min-height: 1.4em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.car-years { font-size: 13px; color: var(--muted); margin-top: 1px; }
.car-fuels { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; min-height: 22px; }
.fuel { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 7px; font-size: 12px; font-weight: 500; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); white-space: nowrap; }
.fuel-electric { background: rgba(16, 185, 129, .1); border-color: rgba(16, 185, 129, .25); color: #047857; }
.fuel-hybrid { background: rgba(14, 165, 233, .1); border-color: rgba(14, 165, 233, .25); color: #0369a1; }
[data-bs-theme="dark"] .fuel-electric { color: #6ee7b7; }
[data-bs-theme="dark"] .fuel-hybrid { color: #7dd3fc; }
.car-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: auto; padding-top: 12px; font-size: 12.5px; color: var(--muted); }
.car-meta i { margin-right: 3px; }

/* List view */
.results-list { display: flex; flex-direction: column; gap: 10px; }
.results-list .car-card { flex-direction: row; }
.results-list .car-img { width: 200px; flex: none; aspect-ratio: auto; min-height: 128px; }
.results-list .car-body { padding: 12px 16px; }
@media (max-width: 575.98px) { .results-list .car-img { width: 128px; } .results-list .car-title { font-size: 15px; } }

.pager { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.pagination { --bs-pagination-bg: var(--surface); --bs-pagination-border-color: var(--border); --bs-pagination-color: var(--text);
  --bs-pagination-hover-bg: var(--surface-hover); --bs-pagination-hover-color: var(--text); --bs-pagination-hover-border-color: var(--border-strong);
  --bs-pagination-active-bg: var(--primary); --bs-pagination-active-border-color: var(--primary);
  --bs-pagination-disabled-bg: var(--surface); --bs-pagination-disabled-color: var(--muted); --bs-pagination-disabled-border-color: var(--border);
  --bs-pagination-focus-box-shadow: 0 0 0 4px var(--primary-soft); gap: 6px; }
.pagination .page-link { border-radius: 9px !important; min-width: 38px; height: 38px; display: grid; place-items: center; font-weight: 500; padding: 0 10px; }

.empty-state { text-align: center; padding: 64px 20px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.empty-state > i { font-size: 34px; color: var(--muted); }
.empty-state h2 { font-size: 19px; font-weight: 700; margin: 10px 0 6px; }
.empty-state p { color: var(--muted); max-width: 420px; margin: 0 auto 16px; }

/* Manufacturers */
.make-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.make-tile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); transition: border-color .15s, box-shadow .15s; }
.make-tile:hover { color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.make-tile small { color: var(--muted); font-size: 12.5px; }

/* ---------- Detail panel ---------- */
.detail-pane { --bs-offcanvas-width: min(620px, 100vw); --bs-offcanvas-bg: var(--surface); border-left: 1px solid var(--border); }
.detail-pane .offcanvas-body { padding: 0; }
@media (min-width: 1400px) {
  .detail-pane { position: sticky !important; top: 0; height: 100vh; background: var(--surface) !important; }
  .detail-pane .offcanvas-body { height: 100%; }
}
.detail-scroll { width: 100%; height: 100%; overflow-y: auto; padding: 20px 22px 32px; }
.detail-scroll.loading { opacity: .5; pointer-events: none; transition: opacity .15s; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--primary-text); font-weight: 500; }
.crumbs i { font-size: 10px; }
.detail-title { font-size: 26px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; margin: 8px 0 0; overflow-wrap: anywhere; }
.title-mark { display: inline-block; vertical-align: -3px; margin-right: 10px; }
.title-mark .brand-mark, .title-mark .monogram { width: 30px; height: 30px; }
.ov-info { margin-top: 16px; }

/* Full car page */
.car-page { max-width: 1180px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; margin-bottom: 14px; }
.back-link:hover { color: var(--text); }
.detail-inner.is-full { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 24px; box-shadow: var(--shadow-sm); }
.detail-inner.is-full .detail-title { font-size: 32px; }
@media (max-width: 575.98px) { .detail-inner.is-full { padding: 16px; } .detail-inner.is-full .detail-title { font-size: 25px; } }
@media (min-width: 992px) {
  .detail-inner.is-full .overview-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; align-items: start; }
  .detail-inner.is-full .ov-info { margin-top: 0; }
  .detail-inner.is-full .ov-info .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-inner.is-full .ov-info .section-title:first-of-type { margin-top: 20px; }
}
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 500; color: var(--text); }
.pill-primary { background: var(--primary-soft); color: var(--primary-text); border-color: transparent; }
.detail-tabs { border-bottom: 1px solid var(--border); gap: 4px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.detail-tabs::-webkit-scrollbar { display: none; }
.detail-tabs .nav-link { border: 0; background: none; color: var(--muted); font-weight: 500; padding: 10px 12px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.detail-tabs .nav-link:hover { color: var(--text); }
.detail-tabs .nav-link.active { color: var(--primary-text); border-bottom-color: var(--primary); font-weight: 600; }
.detail-tabs .count { font-size: 11px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; margin-left: 3px; color: var(--muted); }

.hero-photo { position: relative; aspect-ratio: 3 / 2; border-radius: var(--radius); overflow: hidden; background: var(--photo-bg); }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-count { position: absolute; right: 12px; bottom: 12px; background: rgba(15, 23, 41, .72); color: #fff; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 7px; }
.thumbs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 10px; }
.thumb { aspect-ratio: 3 / 2; border-radius: 8px; overflow: hidden; background: var(--photo-bg); display: grid; place-items: center; color: var(--muted); border: 2px solid transparent; opacity: .85; transition: opacity .15s, border-color .15s; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb:hover { opacity: 1; }
.thumb.active { border-color: var(--primary); opacity: 1; }

.stat-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 576px) { .stat-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat-tile { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; min-width: 0; }
.stat-tile > i { font-size: 17px; color: var(--muted); margin-top: 1px; }
.stat-tile small { display: block; font-size: 11.5px; color: var(--muted); }
.stat-tile strong { display: block; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.section-title { font-size: 16px; font-weight: 700; letter-spacing: -.01em; margin: 24px 0 10px; }
.body-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.body-card { display: block; padding: 10px; border: 1px solid var(--border); border-radius: 11px; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.body-card:hover { color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.body-img { aspect-ratio: 3 / 2; border-radius: 8px; overflow: hidden; background: var(--photo-bg); display: grid; place-items: center; color: var(--muted); margin-bottom: 8px; }
.body-img img { width: 100%; height: 100%; object-fit: cover; }
.body-card strong { display: block; font-size: 13.5px; }
.body-card small { color: var(--muted); font-size: 12px; }
.spec-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 576px) { .spec-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
#detail .tab-pane[id^="t-dims"] .spec-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 576px) { #detail .tab-pane[id^="t-dims"] .spec-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.spec-tile { padding: 12px 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); min-width: 0; }
.spec-tile small { display: block; font-size: 12px; color: var(--muted); }
.spec-tile strong { display: block; font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; margin-top: 3px; overflow-wrap: anywhere; }

.variant-table { border: 1px solid var(--border); border-radius: 11px; }
.variant-table .table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--border); font-size: 13px; }
.variant-table thead th { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); padding: 9px 10px; white-space: nowrap; }
.variant-table td { padding: 9px 10px; }
.variant-table tbody tr:last-child td { border-bottom: 0; }
.variant-table td strong { font-weight: 600; }

.spec-section { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 6px; }
.spec-section:first-child { margin-top: 4px; }
.spec-list { margin: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.spec-list > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.spec-list > div:nth-child(even) { background: var(--surface-2); }
.spec-list > div:last-child { border-bottom: 0; }
.spec-list dt { font-weight: 500; color: var(--muted); font-size: 13px; }
.spec-list dd { margin: 0; font-weight: 500; font-size: 13px; overflow-wrap: anywhere; }

.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding-left: 24px; margin-bottom: 8px; }
.timeline li::before { content: ""; position: absolute; left: 1px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); }
.timeline li.current::before { border-color: var(--primary); background: var(--primary); }
.timeline a { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--border); border-radius: 11px; color: var(--text); }
.timeline a:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-hover); }
.timeline li.current a { border-color: var(--primary); }
.tl-img { width: 84px; aspect-ratio: 3 / 2; border-radius: 7px; overflow: hidden; background: var(--photo-bg); display: grid; place-items: center; color: var(--muted); flex: none; }
.tl-img img { width: 100%; height: 100%; object-fit: cover; }
.timeline small { color: var(--muted); }

.empty-note { padding: 40px 16px; text-align: center; color: var(--muted); }
.empty-note > i { font-size: 30px; display: block; margin-bottom: 8px; }

.toast { --bs-toast-bg: var(--text); color: var(--surface); }
.toast .btn-close { filter: invert(1) grayscale(1); }
[data-bs-theme="dark"] .toast .btn-close { filter: none; }

/* ---------- Photo loading state ----------
   A spinning ring with a car icon sits behind each photo; the photo fades in over it
   when loaded (is-loaded is set by the script in the page head). */
.car-img, .hero-photo, .thumb, .body-img, .tl-img, .suggest-thumb { position: relative; --spin: 22px; }
.car-img, .hero-photo { --spin: 46px; }
.body-img { --spin: 30px; }
:is(.car-img, .hero-photo, .thumb, .body-img, .tl-img, .suggest-thumb) > img { position: relative; z-index: 1; transition: opacity .35s ease, transform .4s ease; }
:is(.car-img, .hero-photo, .thumb, .body-img, .tl-img, .suggest-thumb):has(> img)::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: var(--spin); height: var(--spin);
  margin: calc(var(--spin) / -2) 0 0 calc(var(--spin) / -2); border-radius: 50%;
  border: 3px solid rgba(var(--bs-primary-rgb), .16); border-top-color: var(--primary);
  animation: photo-spin .8s linear infinite; }
:is(.car-img, .hero-photo, .body-img):has(> img)::after {
  /* Car glyph (Bootstrap Icons car-front) as an inline mask, so it shows before any font loads. */
  content: ""; position: absolute; left: 50%; top: 50%; width: calc(var(--spin) * .44); height: calc(var(--spin) * .44);
  transform: translate(-50%, -50%); background: var(--primary); opacity: .75;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%0A  %3Cpath d='M4 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0m10 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0M6 8a1 1 0 0 0 0 2h4a1 1 0 1 0 0-2zM4.862 4.276 3.906 6.19a.51.51 0 0 0 .497.731c.91-.073 2.35-.17 3.597-.17s2.688.097 3.597.17a.51.51 0 0 0 .497-.731l-.956-1.913A.5.5 0 0 0 10.691 4H5.309a.5.5 0 0 0-.447.276'/%3E%0A  %3Cpath d='M2.52 3.515A2.5 2.5 0 0 1 4.82 2h6.362c1 0 1.904.596 2.298 1.515l.792 1.848c.075.175.21.319.38.404.5.25.855.715.965 1.262l.335 1.679q.05.242.049.49v.413c0 .814-.39 1.543-1 1.997V13.5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-1.338c-1.292.048-2.745.088-4 .088s-2.708-.04-4-.088V13.5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-1.892c-.61-.454-1-1.183-1-1.997v-.413a2.5 2.5 0 0 1 .049-.49l.335-1.68c.11-.546.465-1.012.964-1.261a.8.8 0 0 0 .381-.404l.792-1.848ZM4.82 3a1.5 1.5 0 0 0-1.379.91l-.792 1.847a1.8 1.8 0 0 1-.853.904.8.8 0 0 0-.43.564L1.03 8.904a1.5 1.5 0 0 0-.03.294v.413c0 .796.62 1.448 1.408 1.484 1.555.07 3.786.155 5.592.155s4.037-.084 5.592-.155A1.48 1.48 0 0 0 15 9.611v-.413q0-.148-.03-.294l-.335-1.68a.8.8 0 0 0-.43-.563 1.8 1.8 0 0 1-.853-.904l-.792-1.848A1.5 1.5 0 0 0 11.18 3z'/%3E%0A%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%0A  %3Cpath d='M4 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0m10 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0M6 8a1 1 0 0 0 0 2h4a1 1 0 1 0 0-2zM4.862 4.276 3.906 6.19a.51.51 0 0 0 .497.731c.91-.073 2.35-.17 3.597-.17s2.688.097 3.597.17a.51.51 0 0 0 .497-.731l-.956-1.913A.5.5 0 0 0 10.691 4H5.309a.5.5 0 0 0-.447.276'/%3E%0A  %3Cpath d='M2.52 3.515A2.5 2.5 0 0 1 4.82 2h6.362c1 0 1.904.596 2.298 1.515l.792 1.848c.075.175.21.319.38.404.5.25.855.715.965 1.262l.335 1.679q.05.242.049.49v.413c0 .814-.39 1.543-1 1.997V13.5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-1.338c-1.292.048-2.745.088-4 .088s-2.708-.04-4-.088V13.5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-1.892c-.61-.454-1-1.183-1-1.997v-.413a2.5 2.5 0 0 1 .049-.49l.335-1.68c.11-.546.465-1.012.964-1.261a.8.8 0 0 0 .381-.404l.792-1.848ZM4.82 3a1.5 1.5 0 0 0-1.379.91l-.792 1.847a1.8 1.8 0 0 1-.853.904.8.8 0 0 0-.43.564L1.03 8.904a1.5 1.5 0 0 0-.03.294v.413c0 .796.62 1.448 1.408 1.484 1.555.07 3.786.155 5.592.155s4.037-.084 5.592-.155A1.48 1.48 0 0 0 15 9.611v-.413q0-.148-.03-.294l-.335-1.68a.8.8 0 0 0-.43-.563 1.8 1.8 0 0 1-.853-.904l-.792-1.848A1.5 1.5 0 0 0 11.18 3z'/%3E%0A%3C/svg%3E") center / contain no-repeat; }
.thumb:has(> img)::before, .tl-img:has(> img)::before, .suggest-thumb:has(> img)::before { border-width: 2px; }
@keyframes photo-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { :is(.car-img, .hero-photo, .thumb, .body-img, .tl-img, .suggest-thumb)::before { animation-duration: 2.4s; } }
.img-fade :is(.car-img, .hero-photo, .thumb, .body-img, .tl-img, .suggest-thumb) > img:not(.is-loaded) { opacity: 0; }
/* Loaded: stop the animation. Failed: hide the broken image, show a plain picture icon. */
:is(.car-img, .hero-photo, .thumb, .body-img, .tl-img, .suggest-thumb):has(> img.is-loaded)::before { display: none; }
:is(.car-img, .hero-photo, .body-img):has(> img.is-loaded:not(.is-error))::after { display: none; }
:is(.car-img, .hero-photo, .thumb, .body-img, .tl-img, .suggest-thumb) > img.is-error { visibility: hidden; }
:is(.car-img, .hero-photo, .body-img):has(> img.is-error)::after { background: var(--muted); opacity: .5; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--border); }
.footer-grid { display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: 1.3fr .8fr 1.6fr; } }
.site-footer h2 { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 10px; }
.site-footer nav a { display: block; color: var(--text); padding: 3px 0; font-weight: 500; }
.site-footer nav a:hover { color: var(--primary-text); }
.footer-brands { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
@media (min-width: 576px) { .footer-brands { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.footer-bottom { margin-top: 24px; padding: 16px 0 4px; border-top: 1px solid var(--border); }
.car-summary { margin: 16px 0 0; font-size: 15px; line-height: 1.65; color: var(--text); max-width: 75ch; }

/* ---------- Pricing ---------- */
.pricing { max-width: 1180px; }
.pricing section { margin-top: 44px; }
.pricing-intro { margin: 8px 0 0; }
.pricing-intro h1 { font-size: clamp(28px, 4vw, 38px); font-weight: 800; letter-spacing: -.03em; margin: 0 0 8px; }
.pricing-intro p { font-size: 16px; color: var(--muted); max-width: 62ch; margin: 0; }
.pricing-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.pricing h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 4px; }
.billing-toggle { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.billing-toggle button { border: 0; background: transparent; color: var(--muted); font-weight: 600; padding: 8px 14px; border-radius: 9px; }
.billing-toggle button.active { background: var(--primary); color: #fff; }
.billing-toggle .save { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: rgba(16,185,129,.15); color: #047857; margin-left: 4px; }
.billing-toggle button.active .save { background: rgba(255,255,255,.2); color: #fff; }
[data-bs-theme="dark"] .billing-toggle .save { color: #6ee7b7; }
.plan-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.dataset-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.plan, .dataset { position: relative; display: flex; flex-direction: column; padding: 22px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.plan.is-popular, .dataset.is-best { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow-md); }
.plan-badge { position: absolute; top: -11px; left: 22px; padding: 3px 10px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 11.5px; font-weight: 700; }
.plan h3, .dataset h3 { font-size: 18px; font-weight: 700; margin: 0; }
.plan-tag { color: var(--muted); font-size: 13.5px; margin: 4px 0 14px; min-height: 2.6em; }
.plan-price { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.plan-price .amount { font-size: 34px; font-weight: 800; letter-spacing: -.03em; }
.plan-price .per { color: var(--muted); font-weight: 500; }
.plan-price .was { color: var(--muted); text-decoration: line-through; font-size: 14px; }
.plan-note { color: var(--muted); font-size: 12.5px; margin: 2px 0 16px; min-height: 1.4em; }
.plan-features { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.plan-features li { display: flex; gap: 8px; align-items: flex-start; }
.plan-features i { color: var(--primary); font-size: 16px; line-height: 1.2; }
.dataset-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); font-size: 20px; margin-bottom: 12px; }
.faq .accordion { --bs-accordion-bg: var(--surface); --bs-accordion-border-color: var(--border); --bs-accordion-active-bg: var(--primary-soft);
  --bs-accordion-active-color: var(--primary-text); --bs-accordion-btn-focus-box-shadow: 0 0 0 3px var(--primary-soft); --bs-accordion-border-radius: 14px;
  --bs-accordion-inner-border-radius: 13px; --bs-accordion-color: var(--text); --bs-accordion-btn-color: var(--text); margin-top: 14px; }
.faq .accordion-button { font-weight: 600; font-size: 15px; }
.faq .accordion-body { color: var(--muted); line-height: 1.65; }
.pricing-cta { display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap; padding: 26px 28px; border-radius: 16px; background: var(--navy); color: #fff; }
.pricing-cta h2 { color: #fff; }
.pricing-cta p { color: #c7d6f5; }

/* ---------- Model pages and model links ---------- */
.model-page { max-width: 1180px; }
.era { margin-top: 18px; }
.era-title { font-size: 14px; font-weight: 700; color: var(--muted); margin: 0 0 10px; display: flex; align-items: center; gap: 12px; }
.era-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.era-title span { color: var(--text); }
.model-specs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 576px) { .model-specs { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* Model index: plain text links in columns (brand pages, "more models"). */
.model-index { columns: 5 150px; column-gap: 28px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.model-index a { display: block; padding: 4px 0; color: var(--text); font-weight: 500; font-size: 14px; break-inside: avoid; }
.model-index a:hover { color: var(--primary-text); }
/* Model page: compact version rows per era. */
.gen-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.gen-row { display: flex; align-items: center; gap: 14px; padding: 9px 14px 9px 9px; color: var(--text); border-top: 1px solid var(--border); }
.gen-row:first-child { border-top: 0; }
.gen-row:hover { background: var(--surface-hover); color: var(--text); }
.gen-thumb { width: 96px; flex: none; aspect-ratio: 3 / 2; border-radius: 8px; overflow: hidden; display: grid; place-items: center; color: var(--muted); --spin: 20px; }
.gen-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gen-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gen-main strong { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gen-main small { color: var(--muted); font-size: 12.5px; }
.gen-meta { display: flex; flex-direction: column; align-items: flex-end; font-size: 13px; font-weight: 600; white-space: nowrap; }
.gen-meta small { color: var(--muted); font-weight: 500; font-size: 12px; }
.gen-chevron { color: var(--muted); font-size: 13px; }
@media (max-width: 575.98px) { .gen-thumb { width: 72px; } .gen-meta { display: none; } }
.brand-models { margin: 4px 0 26px; }

/* ---------- Brand page: model cards ---------- */
.brand-section { margin-bottom: 26px; }
.model-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.model-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; color: var(--text); box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease, border-color .18s; }
.model-card:hover { color: var(--text); transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.model-card .car-img { aspect-ratio: 3 / 2; }
.model-card-body { padding: 10px 13px 12px; display: flex; flex-direction: column; gap: 2px; }
.model-card-body strong { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.model-card-body small { color: var(--muted); font-size: 12.5px; }
.model-index a small { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 4px; }

/* ---------- Model tools: body filter + year jumps ---------- */
.model-tools { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; margin: 4px 0 6px; }
.chip-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-filter button { border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 500; font-size: 13px; padding: 5px 12px; border-radius: 999px; }
.chip-filter button:hover { border-color: var(--border-strong); }
.chip-filter button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.era-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.era-nav a { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 4px 8px; border-radius: 7px; font-variant-numeric: tabular-nums; }
.era-nav a:hover { background: var(--surface-hover); color: var(--text); }
.era { scroll-margin-top: 16px; }
/* ---------- Car page: previous / next generation ---------- */
.gen-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }
.gen-nav-link { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); background: var(--surface); min-width: 0; }
.gen-nav-link:hover { border-color: var(--border-strong); background: var(--surface-hover); color: var(--text); }
.gen-nav-link.next { justify-content: flex-end; text-align: right; }
.gen-nav-link span { min-width: 0; display: flex; flex-direction: column; }
.gen-nav-link small { color: var(--muted); font-size: 12px; }
.gen-nav-link strong { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gen-nav-link i { color: var(--muted); }

/* ---------- List view: key specs beside each car when the list is wide enough ---------- */
.results { container-type: inline-size; }
.car-specs { display: none; }
@container (min-width: 900px) {
  .results-list .car-body { flex-direction: row; align-items: center; gap: 24px; }
  .results-list .car-info { flex: 0 0 240px; min-width: 0; display: flex; flex-direction: column; }
  .results-list .car-specs { display: grid; flex: 1; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .results-list .meta-hp { display: none; }
  .results-list .car-make i { display: none; } /* whole row is the link; a mid-row arrow looks stray */
}
.spec-chip { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.spec-chip > i { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; background: var(--primary-soft); color: var(--primary-text); }
.spec-chip > div { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.spec-chip small { font-size: 11px; color: var(--muted); font-weight: 500; }
.spec-chip strong { font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spec-chip em { font-style: normal; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spec-chip.is-empty { opacity: .55; }
.spec-chip.is-empty > i { background: var(--surface); color: var(--muted); }

/* ---------- Compare: card toggle, panel button, sidebar count ---------- */
.car-card-wrap { position: relative; display: flex; min-width: 0; }
.car-card-wrap > .car-card { flex: 1; min-width: 0; }
.compare-toggle { position: absolute; z-index: 3; top: 10px; right: 10px; display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px; border: 0; font-size: 12px; font-weight: 600;
  background: rgba(255, 255, 255, .94); color: #1d2939; box-shadow: var(--shadow-sm); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .15s, background .15s; }
.car-card-wrap:hover .compare-toggle, .compare-toggle:focus-visible, .compare-toggle.is-added { opacity: 1; }
@media (hover: none) { .compare-toggle { opacity: 1; } }
.compare-toggle:hover { background: #fff; }
.compare-toggle.is-added, .compare-btn.is-added { background: var(--primary); color: #fff; border-color: var(--primary); }
.compare-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* The "Nearest year" / alias badges sit top-left; the compare pill top-right. */
.results-list .compare-toggle { top: 8px; left: 8px; right: auto; }
.nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  font-size: 11.5px; font-weight: 700; background: var(--primary); color: #fff; }

/* ---------- Compare tray (bottom of the screen) ---------- */
.compare-tray { position: fixed; z-index: 1040; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(860px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.compare-tray[hidden] { display: none; }
@media (min-width: 992px) { .compare-tray { left: calc(50% + 124px); } }
body.has-compare-tray .main { padding-bottom: 110px; }
.compare-tray-items { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.compare-tray-item, .compare-tray-slot { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.compare-tray-slot { justify-content: center; color: var(--muted); font-size: 12px; border-style: dashed; background: transparent; }
.compare-tray-thumb { width: 48px; flex: none; aspect-ratio: 3 / 2; border-radius: 6px; overflow: hidden; background: var(--photo-bg); display: grid; place-items: center; color: var(--muted); }
.compare-tray-thumb img { width: 100%; height: 100%; object-fit: cover; }
.compare-tray-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.compare-tray-text strong { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compare-tray-text small { font-size: 11px; color: var(--muted); }
.compare-tray-remove { margin-left: auto; flex: none; border: 0; background: transparent; color: var(--muted); width: 24px; height: 24px; border-radius: 6px; }
.compare-tray-remove:hover { background: var(--surface-hover); color: var(--text); }
.compare-tray-actions { display: flex; flex-direction: column; align-items: stretch; gap: 2px; flex: none; }
.compare-tray-actions .btn-primary.disabled { opacity: .5; pointer-events: none; }
@media (max-width: 767.98px) {
  .compare-tray { flex-direction: column; align-items: stretch; }
  .compare-tray-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compare-tray-slot { display: none; }
  .compare-tray-actions { flex-direction: row; justify-content: space-between; }
}

/* ---------- Compare page ---------- */
.compare-page { max-width: 1280px; }
.compare-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.compare-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 680px; table-layout: fixed; } /* equal car columns */
.compare-table th, .compare-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; text-align: left; font-size: 13.5px; }
.compare-table tbody tr:last-child th, .compare-table tbody tr:last-child td { border-bottom: 0; }
.compare-label { position: sticky; left: 0; z-index: 1; width: 150px; background: var(--surface); color: var(--muted); font-weight: 500; }
.compare-table td { font-weight: 600; overflow-wrap: anywhere; }
.compare-table td.is-best { color: var(--primary-text); background: var(--primary-soft); }
.compare-table td.is-best i { font-size: 12px; }
.compare-section th { background: var(--surface-2); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 7px 14px; }
.compare-car { position: relative; }
.compare-car-link { display: flex; flex-direction: column; gap: 1px; color: var(--text); }
.compare-car-link:hover { color: var(--primary-text); }
.compare-car-link strong { font-size: 15px; font-weight: 700; line-height: 1.25; }
.compare-car-link small { color: var(--muted); font-weight: 500; font-size: 12px; }
.compare-img { display: block; width: 100%; aspect-ratio: 3 / 2; border-radius: 10px; overflow: hidden; margin-bottom: 8px; background: var(--photo-bg); }
.compare-img img { width: 100%; height: 100%; object-fit: cover; }
.compare-remove { position: absolute; z-index: 2; top: 16px; right: 20px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .92); color: #1d2939; box-shadow: var(--shadow-sm); }
.compare-remove:hover { background: #fff; color: #b42318; }
.compare-add { background: var(--surface-2); }
.compare-add-btn { width: 100%; height: 100%; min-height: 170px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 1.5px dashed var(--border-strong); border-radius: 10px; background: transparent; color: var(--muted); padding: 14px; text-align: center; }
.compare-add-btn:hover { color: var(--primary-text); border-color: var(--primary); }
.compare-add-btn i { font-size: 22px; }
.compare-add-btn strong { color: var(--text); font-size: 14px; }
.compare-add-btn small { font-size: 12px; font-weight: 400; }
body.has-compare-tray .toast-container { bottom: 104px !important; }
@media (max-width: 767.98px) { body.has-compare-tray .toast-container { bottom: 190px !important; } }
@media (max-width: 575.98px) { .compare-label { width: 108px; font-size: 12.5px; } .compare-table { min-width: 560px; } .compare-table th, .compare-table td { padding: 9px 10px; } }

/* ---------- Country flags (flag-icons) ---------- */
.flag { width: 1.25em; line-height: 1em; border-radius: 2px; box-shadow: 0 0 0 1px rgba(16, 24, 40, .12); flex: none; }
.car-make-name { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.car-make-name .flag { font-size: 11px; }
.pill .flag { font-size: 12px; margin-right: 2px; }
.suggest-item .item-meta .flag { font-size: 11px; vertical-align: -1px; }

/* ---------- "Add car" search dialog ---------- */
.compare-tray-slot { cursor: pointer; font-weight: 500; gap: 4px; }
.compare-tray-slot:hover { color: var(--primary-text); border-color: var(--primary); }
.compare-search-modal .modal-content { --bs-modal-bg: var(--surface); --bs-modal-color: var(--text); --bs-modal-border-color: var(--border);
  --bs-modal-header-border-color: var(--border); --bs-modal-footer-border-color: var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); }
.compare-search-modal .modal-title { font-size: 17px; font-weight: 700; }
.compare-search-modal .modal-body { padding-top: 12px; min-height: 320px; }
.compare-search-box { position: sticky; top: -12px; z-index: 1; display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 46px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }
.compare-search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.compare-search-box i { color: var(--muted); }
.compare-search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 15px; }
.compare-search-box input::-webkit-search-cancel-button { display: none; }
.compare-search-hint { color: var(--muted); font-size: 13.5px; padding: 18px 4px; margin: 0; text-align: center; }
.compare-search-results { display: flex; flex-direction: column; gap: 6px; }
.compare-pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; text-align: left; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.compare-pick:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.compare-pick.is-added { border-color: var(--primary); background: var(--primary-soft); }
.compare-pick-thumb { order: 1; width: 72px; flex: none; aspect-ratio: 3 / 2; border-radius: 7px; overflow: hidden; background: var(--photo-bg); display: grid; place-items: center; color: var(--muted); }
.compare-pick-thumb img { width: 100%; height: 100%; object-fit: cover; }
.compare-pick-text { order: 2; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.compare-pick-text strong { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compare-pick-text small { font-size: 12.5px; color: var(--muted); }
.compare-pick-icon { order: 3; color: var(--primary-text); }
.compare-pick-label { order: 4; font-size: 12.5px; font-weight: 600; color: var(--primary-text); min-width: 56px; }
.compare-pick.is-added .compare-pick-label, .compare-pick.is-added .compare-pick-icon { color: var(--primary-text); }

/* ---------- Detail header: toolbar row, then a full-width title ---------- */
.detail-inner { container-type: inline-size; }
.detail-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.crumbs-line { flex: 1; min-width: 0; padding-top: 6px; }
.detail-actions { display: flex; gap: 6px; flex: none; }
/* Narrow header (side panel, phones): icon-only buttons so the breadcrumbs keep their room. */
@container (max-width: 640px) {
  .detail-actions .btn > span { display: none !important; }
  .detail-actions .btn { width: 34px; height: 32px; padding: 0; display: inline-grid; place-items: center; }
}
.detail-inner .detail-title { margin-top: 12px; }
