/* Car Finder — Material Design 3 (feature 010).
   Sections: font · tokens · base · type scale · app frame (app bar, navigation, FAB, snackbar) ·
   buttons · cards · chips and badges · selection controls · text fields · lists · dialogs ·
   progress · tables · pages · utilities. Colours only through --md-sys-color-* roles. */

/* --- font (Roboto Flex, OFL, bundled: research R2) --------------------------------------- */

@font-face {
  font-family: "Roboto Flex";
  src: url("/static/fonts/RobotoFlex.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

/* --- tokens: Google's in-product Material 3 colour roles (research R1) -------------------- */

:root {
  --md-sys-color-primary: #0b57d0;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #d3e3fd;
  --md-sys-color-on-primary-container: #041e49;
  --md-sys-color-secondary-container: #c2e7ff;
  --md-sys-color-on-secondary-container: #001d35;
  --md-sys-color-tertiary-container: #c4eed0;
  --md-sys-color-on-tertiary-container: #072711;
  --md-sys-color-error: #b3261e;
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-error-container: #f9dedc;
  --md-sys-color-on-error-container: #410e0b;
  --md-sys-color-surface: #ffffff;
  --md-sys-color-surface-container-lowest: #ffffff;
  --md-sys-color-surface-container-low: #f8fafd;
  --md-sys-color-surface-container: #f0f4f9;
  --md-sys-color-surface-container-high: #e9eef6;
  --md-sys-color-surface-container-highest: #dde3ea;
  --md-sys-color-on-surface: #1f1f1f;
  --md-sys-color-on-surface-variant: #444746;
  --md-sys-color-outline: #747775;
  --md-sys-color-outline-variant: #c4c7c5;
  --md-sys-color-inverse-surface: #303030;
  --md-sys-color-inverse-on-surface: #f2f2f2;
  --md-sys-color-inverse-primary: #a8c7fa;
  --md-sys-color-scrim: #000000;

  --md-sys-shape-corner-extra-small: 4px;
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-extra-large: 28px;
  --md-sys-shape-corner-full: 9999px;

  --md-sys-elevation-1: 0 1px 2px rgb(0 0 0 / 30%), 0 1px 3px 1px rgb(0 0 0 / 15%);
  --md-sys-elevation-2: 0 1px 2px rgb(0 0 0 / 30%), 0 2px 6px 2px rgb(0 0 0 / 15%);
  --md-sys-elevation-3: 0 4px 8px 3px rgb(0 0 0 / 15%), 0 1px 3px rgb(0 0 0 / 30%);

  --md-sys-state-hover: 0.08;
  --md-sys-state-focus: 0.1;
  --md-sys-state-pressed: 0.1;

  --md-sys-motion-easing-standard: cubic-bezier(0.2, 0, 0, 1);
  --md-sys-motion-easing-emphasized-decelerate: cubic-bezier(0.05, 0.7, 0.1, 1);
  --md-sys-motion-duration-short: 150ms;
  --md-sys-motion-duration-medium: 300ms;

  --font: "Roboto Flex", Roboto, system-ui, -apple-system, "Segoe UI", sans-serif;
  --rail-width: 80px;
  --bar-height: 80px;
  --content-max: 1200px;
}

/* Dark: the system's choice unless the user chose Light; or the user's choice (feature 022). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --md-sys-color-primary: #a8c7fa;
    --md-sys-color-on-primary: #062e6f;
    --md-sys-color-primary-container: #0842a0;
    --md-sys-color-on-primary-container: #d3e3fd;
    --md-sys-color-secondary-container: #004a77;
    --md-sys-color-on-secondary-container: #c2e7ff;
    --md-sys-color-tertiary-container: #0f5223;
    --md-sys-color-on-tertiary-container: #c4eed0;
    --md-sys-color-error: #f2b8b5;
    --md-sys-color-on-error: #601410;
    --md-sys-color-error-container: #8c1d18;
    --md-sys-color-on-error-container: #f9dedc;
    --md-sys-color-surface: #131314;
    --md-sys-color-surface-container-lowest: #0e0e0e;
    --md-sys-color-surface-container-low: #1b1b1b;
    --md-sys-color-surface-container: #1e1f20;
    --md-sys-color-surface-container-high: #282a2c;
    --md-sys-color-surface-container-highest: #333537;
    --md-sys-color-on-surface: #e3e3e3;
    --md-sys-color-on-surface-variant: #c4c7c5;
    --md-sys-color-outline: #8e918f;
    --md-sys-color-outline-variant: #444746;
    --md-sys-color-inverse-surface: #e3e3e3;
    --md-sys-color-inverse-on-surface: #303030;
    --md-sys-color-inverse-primary: #0b57d0;
    --md-sys-color-scrim: #000000;
  }
}

:root[data-theme="dark"] {
  --md-sys-color-primary: #a8c7fa;
  --md-sys-color-on-primary: #062e6f;
  --md-sys-color-primary-container: #0842a0;
  --md-sys-color-on-primary-container: #d3e3fd;
  --md-sys-color-secondary-container: #004a77;
  --md-sys-color-on-secondary-container: #c2e7ff;
  --md-sys-color-tertiary-container: #0f5223;
  --md-sys-color-on-tertiary-container: #c4eed0;
  --md-sys-color-error: #f2b8b5;
  --md-sys-color-on-error: #601410;
  --md-sys-color-error-container: #8c1d18;
  --md-sys-color-on-error-container: #f9dedc;
  --md-sys-color-surface: #131314;
  --md-sys-color-surface-container-lowest: #0e0e0e;
  --md-sys-color-surface-container-low: #1b1b1b;
  --md-sys-color-surface-container: #1e1f20;
  --md-sys-color-surface-container-high: #282a2c;
  --md-sys-color-surface-container-highest: #333537;
  --md-sys-color-on-surface: #e3e3e3;
  --md-sys-color-on-surface-variant: #c4c7c5;
  --md-sys-color-outline: #8e918f;
  --md-sys-color-outline-variant: #444746;
  --md-sys-color-inverse-surface: #e3e3e3;
  --md-sys-color-inverse-on-surface: #303030;
  --md-sys-color-inverse-primary: #0b57d0;
  --md-sys-color-scrim: #000000;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

:root[data-theme="light"] {
  color-scheme: light;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --md-sys-motion-duration-short: 0ms;
    --md-sys-motion-duration-medium: 0ms;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0ms !important;
  }
}

/* --- base -------------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  color-scheme: light dark;
}

body {
  margin: 0;
  background: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5rem;
  letter-spacing: 0.031rem;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: var(--md-sys-color-primary);
  text-decoration: none;
}

p a,
td a,
li > a,
dd a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

:focus-visible {
  outline: 3px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

img {
  max-width: 100%;
}

.icon {
  flex: none;
  display: inline-block;
  vertical-align: middle;
}

/* --- type scale (Material 3) ------------------------------------------------------------- */

.display-small { font-size: 2.25rem; line-height: 2.75rem; font-weight: 400; letter-spacing: 0; }
.headline-large { font-size: 2rem; line-height: 2.5rem; font-weight: 400; letter-spacing: 0; }
.headline-medium { font-size: 1.75rem; line-height: 2.25rem; font-weight: 400; letter-spacing: 0; }
.headline-small { font-size: 1.5rem; line-height: 2rem; font-weight: 400; letter-spacing: 0; }
.title-large { font-size: 1.375rem; line-height: 1.75rem; font-weight: 400; letter-spacing: 0; }
.title-medium { font-size: 1rem; line-height: 1.5rem; font-weight: 500; letter-spacing: 0.009rem; }
.title-small { font-size: 0.875rem; line-height: 1.25rem; font-weight: 500; letter-spacing: 0.006rem; }
.body-large { font-size: 1rem; line-height: 1.5rem; font-weight: 400; letter-spacing: 0.031rem; }
.body-medium { font-size: 0.875rem; line-height: 1.25rem; font-weight: 400; letter-spacing: 0.016rem; }
.body-small { font-size: 0.75rem; line-height: 1rem; font-weight: 400; letter-spacing: 0.025rem; }
.label-large { font-size: 0.875rem; line-height: 1.25rem; font-weight: 500; letter-spacing: 0.006rem; }
.label-medium { font-size: 0.75rem; line-height: 1rem; font-weight: 500; letter-spacing: 0.031rem; }
.label-small { font-size: 0.6875rem; line-height: 1rem; font-weight: 500; letter-spacing: 0.031rem; }

h2 {
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 400;
}

h3 {
  font-size: 1.375rem;
  line-height: 1.75rem;
  font-weight: 400;
}

.muted,
.supporting {
  color: var(--md-sys-color-on-surface-variant);
}

/* --- app frame --------------------------------------------------------------------------- */

.app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 64px;
  padding: 8px 16px 8px 4px;
  background: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface);
}

.app-bar__title {
  flex: 1;
  min-width: 0;
  margin-left: 12px;
  font-size: 1.375rem;
  line-height: 1.75rem;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-bar__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 12px;
  border-radius: var(--md-sys-shape-corner-full);
  color: var(--md-sys-color-on-surface);
  font-size: 1.375rem;
  line-height: 1.75rem;
  font-weight: 400;
}

/* The AutoAlerto logo, the same as autoalerto.com's (2026-11-01). */
.app-bar__logo {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  flex: none;
}

.app-bar__brand .icon {
  color: var(--md-sys-color-primary);
}

.app-bar__brand h1 {
  font: inherit;
}

/* On pages with their own title the app name sits at the end: icon only below 840 px. */
.app-bar__brand--compact {
  margin-left: auto;
  font-size: 1rem;
}

.app-bar__brand--compact .app-bar__brand-name {
  display: none;
}

@media (min-width: 840px) {
  .app-bar__brand--compact .app-bar__brand-name {
    display: inline;
  }
}

.app-bar__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.layout {
  min-height: 100vh;
  padding-bottom: calc(var(--bar-height) + 96px);
}

.content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 8px 16px 24px;
}

.content--narrow {
  max-width: 840px;
}

/* navigation: a bottom bar on phones, a rail from 600 px (spec FR-005) */

.nav {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--bar-height);
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  padding: 0 8px;
  background: var(--md-sys-color-surface-container);
  box-shadow: var(--md-sys-elevation-2);
}

.nav__item {
  position: relative;
  flex: 1 1 0;
  min-width: 48px;
  max-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--md-sys-color-on-surface-variant);
  text-align: center;
}

.nav__indicator {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 32px;
  border-radius: var(--md-sys-shape-corner-full);
  transition: background-color var(--md-sys-motion-duration-short)
    var(--md-sys-motion-easing-standard);
}

.nav__item:hover .nav__indicator {
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
}

.nav__item[aria-current="page"] {
  color: var(--md-sys-color-on-surface);
  font-weight: 700;
}

.nav__item[aria-current="page"] .nav__indicator {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.nav__label {
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 500;
  letter-spacing: 0.031rem;
}

.nav__badge,
.badge.unseen {
  position: absolute;
  top: -4px;
  left: calc(50% + 4px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
  font-size: 0.6875rem;
  line-height: 16px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
}

@media (min-width: 600px) {
  .nav {
    top: 0;
    right: auto;
    bottom: 0;
    width: var(--rail-width);
    height: auto;
    flex-direction: column;
    justify-content: flex-start;
    gap: 12px;
    padding: 96px 0 16px;
    box-shadow: none;
    background: var(--md-sys-color-surface-container-low);
  }

  .nav__item {
    flex: 0 0 auto;
    min-height: 56px;
    max-width: none;
  }

  .nav__indicator {
    width: 56px;
  }

  .layout {
    margin-left: var(--rail-width);
    padding-bottom: 96px;
  }

  .content {
    padding: 8px 24px 24px;
  }
}

/* floating action button "New search" (spec FR-006) */

.fab {
  position: fixed;
  z-index: 25;
  right: 16px;
  bottom: calc(var(--bar-height) + 16px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 56px;
  height: 56px;
  padding: 0 16px;
  border-radius: var(--md-sys-shape-corner-large);
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  box-shadow: var(--md-sys-elevation-3);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.006rem;
  overflow: hidden;
}

button.fab {  /* "Save search" on a search form: a button that looks like the FAB */
  border: 0;
  font-family: inherit;
  cursor: pointer;
}

.fab__label {
  display: none;
}

@media (min-width: 600px) {
  .fab {
    bottom: 24px;
    right: 24px;
  }
}

@media (min-width: 840px) {
  .fab {
    padding: 0 20px 0 16px;
  }

  .fab__label {
    display: inline;
  }
}

/* snackbar (the flash message) */

.snackbar {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: calc(var(--bar-height) + 88px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: min(560px, calc(100vw - 32px));
  min-height: 48px;
  padding: 4px 4px 4px 16px;
  border-radius: var(--md-sys-shape-corner-extra-small);
  background: var(--md-sys-color-inverse-surface);
  color: var(--md-sys-color-inverse-on-surface);
  box-shadow: var(--md-sys-elevation-3);
  font-size: 0.875rem;
  line-height: 1.25rem;
  animation: snackbar-in var(--md-sys-motion-duration-medium)
    var(--md-sys-motion-easing-emphasized-decelerate);
}

.snackbar[hidden] {
  display: none;
}

.snackbar .icon-btn {
  color: var(--md-sys-color-inverse-on-surface);
}

.snackbar .snackbar__action {
  color: var(--md-sys-color-inverse-primary);
}

@media (min-width: 600px) {
  .snackbar {
    bottom: 24px;
  }
}

@keyframes snackbar-in {
  from {
    opacity: 0;
    transform: translate(-50%, 16px);
  }
}

.site-footer {
  padding: 8px 16px 16px;
  color: var(--md-sys-color-on-surface-variant);
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 12px;
  border-radius: var(--md-sys-shape-corner-full);
  color: var(--md-sys-color-primary);
  font-weight: 500;
  font-size: 0.875rem;
}

/* --- buttons (filled, tonal, outlined, text, icon) --------------------------------------- */

button,
.btn {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  letter-spacing: 0.006rem;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* state layer: hover 8%, focus and pressed 10% of the content colour */
button::before,
.btn::before,
.icon-btn::before,
.list-item--link::before,
.chip--filter::before,
.car-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: currentColor;
  opacity: 0;
  border-radius: inherit;
  pointer-events: none;
  transition: opacity var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

button:hover::before,
.btn:hover::before,
.icon-btn:hover::before,
.list-item--link:hover::before,
.chip--filter:hover::before {
  opacity: var(--md-sys-state-hover);
}

button:focus-visible::before,
.btn:focus-visible::before,
button:active::before,
.btn:active::before,
.icon-btn:active::before,
.list-item--link:active::before {
  opacity: var(--md-sys-state-pressed);
}

.btn--filled {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.btn--filled:hover,
.btn--tonal:hover {
  box-shadow: var(--md-sys-elevation-1);
}

.btn--tonal,
.button.secondary,
button.secondary {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.btn--outlined {
  background: transparent;
  color: var(--md-sys-color-primary);
  border: 1px solid var(--md-sys-color-outline);
}

.btn--text,
.button.ghost {
  background: transparent;
  color: var(--md-sys-color-primary);
  padding: 0 12px;
}

.btn--danger,
.button.danger {
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
}

.btn--big,
.button.big {
  width: 100%;
  min-height: 56px;
  font-size: 1rem;
  border-radius: var(--md-sys-shape-corner-large);
}

.btn--small {
  min-height: 40px;
  padding: 0 16px;
}

.btn .icon {
  width: 18px;
  height: 18px;
  margin-left: -8px;
}

.btn--text .icon {
  margin-left: -4px;
}

.btn--big .icon {
  width: 24px;
  height: 24px;
}

button[disabled],
.btn[aria-disabled="true"] {
  background: color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent);
  color: color-mix(in srgb, var(--md-sys-color-on-surface) 38%, transparent);
  box-shadow: none;
  cursor: progress;
}

.icon-btn {
  position: relative;
  isolation: isolate;
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: var(--md-sys-shape-corner-full);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  cursor: pointer;
  overflow: hidden;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* --- cards ------------------------------------------------------------------------------- */

.card,
.card--elevated {
  position: relative;
  background: var(--md-sys-color-surface-container-lowest);
  border-radius: var(--md-sys-shape-corner-medium);
  box-shadow: var(--md-sys-elevation-1);
  padding: 16px;
}

.card--filled {
  background: var(--md-sys-color-surface-container-highest);
  box-shadow: none;
}

.card--outlined {
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  box-shadow: none;
}

.card__title {
  margin-bottom: 12px;
}

.stack {
  display: grid;
  gap: 16px;
}

.section-title {
  margin: 24px 0 12px;
}

/* --- chips and badges -------------------------------------------------------------------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 16px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-small);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  overflow: hidden;
}

.chip .icon {
  width: 18px;
  height: 18px;
  margin-left: -8px;
  color: var(--md-sys-color-primary);
}

.chip--assist {
  min-height: 32px;
  padding: 4px 12px;
  font-size: 0.75rem;
}

.chip--input {
  background: var(--md-sys-color-surface);
}

/* filter chip: the real checkbox/radio stays in the label (names and values unchanged) */
.chip--filter {
  min-height: 48px;
  padding: 0 16px 0 12px;
  cursor: pointer;
  user-select: none;
  color: var(--md-sys-color-on-surface-variant);
}

.chip--filter input {
  appearance: none;
  flex: none;
  width: 1px;
  height: 18px;
  margin: 0;
  border: 0;
  background: transparent;
  transition: width var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.chip--filter input:checked {
  width: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z'/%3E%3C/svg%3E")
    center / 18px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z'/%3E%3C/svg%3E")
    center / 18px no-repeat;
}

.chip--filter:has(input:checked) {
  border-color: transparent;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.chip--filter:has(input:focus-visible) {
  outline: 3px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: var(--md-sys-shape-corner-small);
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 500;
  letter-spacing: 0.031rem;
  white-space: nowrap;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
}

.badge.new {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
}

.badge.removed {
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface-variant);
}

.badge.danger {
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

.badge.ok {
  background: var(--md-sys-color-tertiary-container);
  color: var(--md-sys-color-on-tertiary-container);
}

/* --- selection controls: switch, segmented button, checkbox ------------------------------ */

.switch-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  cursor: pointer;
}

input.switch {
  appearance: none;
  position: relative;
  flex: none;
  width: 52px;
  height: 32px;
  margin: 0;
  border: 2px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-surface-container-highest);
  cursor: pointer;
  transition: background-color var(--md-sys-motion-duration-short)
    var(--md-sys-motion-easing-standard);
}

input.switch::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--md-sys-color-outline);
  transform: translateY(-50%);
  transition: all var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

input.switch:checked {
  border-color: var(--md-sys-color-primary);
  background: var(--md-sys-color-primary);
}

input.switch:checked::before {
  left: 22px;
  width: 24px;
  height: 24px;
  background: var(--md-sys-color-on-primary);
}

.segmented {
  display: inline-flex;
  max-width: 100%;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-full);
  overflow: hidden;
}

.segmented .chip--filter {
  flex: 1 1 auto;
  justify-content: center;
  border: 0;
  border-radius: 0;
  min-width: 48px;
}

.segmented .chip--filter + .chip--filter {
  border-left: 1px solid var(--md-sys-color-outline);
}

.check-field {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  cursor: pointer;
}

.check-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--md-sys-color-primary);
}

/* --- outlined text fields and selects ---------------------------------------------------- */

.field {
  position: relative;
  display: block;
  margin-bottom: 16px;
}

.field input,
.field textarea,
.field select,
.select {
  display: block;
  width: 100%;
  min-height: 56px;
  padding: 16px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: var(--md-sys-shape-corner-extra-small);
  background: transparent;
  color: var(--md-sys-color-on-surface);
  font: inherit;
  font-size: 1rem;
  line-height: 1.5rem;
}

.field select,
.select {
  /* A solid background in the theme's colours: browsers draw the open list of choices from it
     (white words on white otherwise, in dark mode). */
  background-color: var(--md-sys-color-surface-container-lowest);
  appearance: none;
  padding-right: 48px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960' fill='%23747775'%3E%3Cpath d='M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 24px;
  cursor: pointer;
}

.select {
  width: auto;
  min-width: 180px;
}

.field select option,
.select option {
  background-color: var(--md-sys-color-surface-container-lowest);
  color: var(--md-sys-color-on-surface);
}

.field input:hover,
.field textarea:hover,
.field select:hover,
.select:hover {
  border-color: var(--md-sys-color-on-surface);
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.select:focus {
  outline: none;
  border: 2px solid var(--md-sys-color-primary);
  padding: 15px;
}

.field select:focus,
.select:focus {
  padding-right: 47px;
}

/* floating label: the input comes first, then the label (research R4) */
.field__label {
  position: absolute;
  top: 16px;
  left: 12px;
  padding: 0 4px;
  color: var(--md-sys-color-on-surface-variant);
  background: var(--field-bg, var(--md-sys-color-surface-container-lowest));
  font-size: 1rem;
  line-height: 1.5rem;
  pointer-events: none;
  transition: all var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.field input:focus + .field__label,
.field textarea:focus + .field__label,
.field textarea:not(:placeholder-shown) + .field__label,
.field input:not(:placeholder-shown) + .field__label,
.field select + .field__label,
.field--static .field__label {
  top: -8px;
  font-size: 0.75rem;
  line-height: 1rem;
}

.field input:focus + .field__label,
.field select:focus + .field__label {
  color: var(--md-sys-color-primary);
}

.field__support,
.field small {
  display: block;
  margin: 4px 16px 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.75rem;
  line-height: 1rem;
}

.field.has-error input,
.field.has-error select {
  border: 2px solid var(--md-sys-color-error);
  padding: 15px 47px 15px 15px;
}

.field.has-error .field__label {
  color: var(--md-sys-color-error);
}

.field.has-error::after {
  content: "";
  position: absolute;
  top: 16px;
  right: 12px;
  width: 24px;
  height: 24px;
  background: var(--md-sys-color-error);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm-40-160h80v-240h-80v240Zm40 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z'/%3E%3C/svg%3E")
    center / 24px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M480-280q17 0 28.5-11.5T520-320q0-17-11.5-28.5T480-360q-17 0-28.5 11.5T440-320q0 17 11.5 28.5T480-280Zm-40-160h80v-240h-80v240Zm40 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z'/%3E%3C/svg%3E")
    center / 24px no-repeat;
}

.field-error {
  margin: 4px 16px 0;
  color: var(--md-sys-color-error);
  font-size: 0.75rem;
  line-height: 1rem;
}

.row {
  display: grid;
  gap: 0 16px;
}

@media (min-width: 600px) {
  .row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.choice-group {
  margin-bottom: 20px;
}

.choice-group:last-child {
  margin-bottom: 0;
}

.group-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
}

/* inline forms (loan, registry mileage) */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
  align-items: flex-start;
}

.inline-form .field {
  flex: 1 1 160px;
  max-width: 240px;
}

/* --- lists ------------------------------------------------------------------------------- */

.list {
  margin: 0;
  padding: 8px 0;
  list-style: none;
  background: var(--md-sys-color-surface-container-lowest);
  border-radius: var(--md-sys-shape-corner-large);
  box-shadow: var(--md-sys-elevation-1);
}

.list-item {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 72px;
  padding: 12px 24px 12px 16px;
  color: var(--md-sys-color-on-surface);
}

.list-item + .list-item {
  border-top: 1px solid var(--md-sys-color-outline-variant);
}

.list-item__avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.list-item__text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.list-item__headline {
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  overflow-wrap: anywhere;
}

.list-item__supporting {
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--md-sys-color-on-surface-variant);
  overflow-wrap: anywhere;
}

.list-item__trailing {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--md-sys-color-on-surface-variant);
}

/* the whole row links to its page: a stretched link on the headline */
.stretched-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.list-item--link:hover {
  cursor: pointer;
}

.list-item .unseen-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--md-sys-color-primary);
}

/* --- dialogs ------------------------------------------------------------------------------ */

dialog.confirm {
  max-width: min(560px, calc(100vw - 48px));
  min-width: min(280px, calc(100vw - 48px));
  padding: 24px;
  border: 0;
  border-radius: var(--md-sys-shape-corner-extra-large);
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface);
  box-shadow: var(--md-sys-elevation-3);
}

dialog.confirm::backdrop {
  background: rgb(0 0 0 / 32%);
}

dialog.confirm p {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
  line-height: 1.25rem;
  margin-bottom: 24px;
}

.confirm__buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* --- progress ---------------------------------------------------------------------------- */

.progress-linear {
  position: relative;
  height: 4px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-secondary-container);
  overflow: hidden;
}

.progress-linear::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  border-radius: inherit;
  background: var(--md-sys-color-primary);
  animation: progress-indeterminate 1.4s var(--md-sys-motion-easing-standard) infinite;
}

@keyframes progress-indeterminate {
  from {
    left: -40%;
  }
  to {
    left: 100%;
  }
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: middle;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-block;
}

/* --- tables ------------------------------------------------------------------------------ */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.25rem;
  overflow-wrap: anywhere;
}

caption {
  padding: 16px;
  text-align: left;
  font-size: 1rem;
  font-weight: 500;
}

th,
td {
  padding: 12px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

thead th {
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 500;
}

tbody tr:last-child > * {
  border-bottom: 0;
}

[data-status="ok"] .status {
  color: var(--md-sys-color-on-tertiary-container);
  font-weight: 500;
}

[data-status="down"] .status {
  color: var(--md-sys-color-error);
  font-weight: 500;
}

/* --- pages ------------------------------------------------------------------------------- */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 16px 0;
}

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.notice.warn {
  background: var(--md-sys-color-error-container);
  color: var(--md-sys-color-on-error-container);
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
  color: var(--md-sys-color-on-surface-variant);
}

.empty-state__icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.empty-state h2 {
  color: var(--md-sys-color-on-surface);
}

.empty-state.small {
  padding: 32px 16px;
}

/* search page */
.panel {
  padding: 24px 16px;
}

@media (min-width: 600px) {
  .panel {
    padding: 24px;
  }
}

.panel__criteria {
  margin: 12px 0 20px;
}

.panel__grid {
  display: grid;
  gap: 24px;
}

@media (min-width: 840px) {
  .panel__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.panel__settings {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 16px;
  border-radius: var(--md-sys-shape-corner-large);
  background: var(--md-sys-color-surface-container);
}

.run-status {
  display: grid;
  gap: 12px;
  align-content: start;
}

.status-line {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
}

.status.running {
  color: var(--md-sys-color-primary);
  font-weight: 500;
}

.outcome {
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.outcome.error {
  color: var(--md-sys-color-error);
}

.schedule__status {
  font-size: 1rem;
  font-weight: 500;
}

.schedule__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.results__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 32px 0 16px;
}

.results__head .sort label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
}

/* The hidden attribute always hides, even on elements styled as buttons or fields (011). */
[hidden] {
  display: none !important;
}

/* New since the last check and the list filters (feature 011). */
#trash-link-slot:empty {
  display: none;
}

.results__filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: -8px 0 16px;
}

.chip--toggle {
  min-height: 48px;
  padding: 0 16px;
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
}

.chip--toggle[aria-pressed="true"] {
  border-color: transparent;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.chip--toggle[aria-pressed="true"]::before {
  content: "";
  width: 18px;
  height: 18px;
  margin-left: -4px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z'/%3E%3C/svg%3E")
    center / 18px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M382-240 154-468l57-57 171 171 367-367 57 57-424 424Z'/%3E%3C/svg%3E")
    center / 18px no-repeat;
}

/* A car first found by the latest check stands out as a whole card (feature 011, FR-002). */
.car-card.car-card--new {
  outline: 2px solid var(--md-sys-color-primary);
  outline-offset: -2px;
  background: color-mix(
    in srgb,
    var(--md-sys-color-primary-container) 40%,
    var(--md-sys-color-surface-container-low)
  );
}

/* Star rating, 0-10 (feature 011): compact on cards, a row of stars on the car page. */
.rating form {
  margin: 0;
}

.rating__summary {
  list-style: none;
  color: var(--md-sys-color-on-surface-variant);
}

.rating__summary::-webkit-details-marker {
  display: none;
}

.rating[data-stars]:not([data-stars="0"]) .rating__summary {
  color: var(--md-sys-color-primary);
}

/* An open menu takes the card's whole width, so the ten choices wrap below. */
.rating:has(.rating__menu[open]) {
  flex-basis: 100%;
}

.rating__choices {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 0 8px;
}

.rating__choice,
.rating__star {
  min-width: 48px;
  min-height: 48px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-full);
  background: transparent;
  color: var(--md-sys-color-on-surface);
  font: inherit;
  cursor: pointer;
}

.rating__choice.is-on {
  border-color: transparent;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

.rating__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.rating__star {
  border: 0;
  font-size: 1.5rem;
  color: var(--md-sys-color-outline);
}

.rating__star.is-on {
  color: var(--md-sys-color-primary);
}

.rating__text {
  margin: 0 0 8px;
}

.rating__choice:focus-visible,
.rating__star:focus-visible,
.rating__summary:focus-visible {
  outline: 3px solid var(--md-sys-color-primary);
  outline-offset: 2px;
}

/* The search form's "Use my location" button sits on its own line (feature 011). */
.form-section #use-location {
  justify-self: start;
  margin: 4px 0 16px;
}

/* Quiet hours on the search page (feature 012). */
.quiet-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 12px 0 0;
}

.quiet-note .icon {
  flex: none;
  margin-top: 2px;
  color: var(--md-sys-color-primary);
}

.quiet-note a {
  display: inline-block;
  min-height: 48px;
  padding: 12px 4px;
  margin: -12px 0;
}

/* Sites a search checks (feature 013). */
.sites__chosen {
  margin: 0 0 8px;
  padding: 0;
}

.chip .chip__remove {
  margin: -12px -14px -12px 0;
  color: var(--md-sys-color-on-surface-variant);
}

.sites__menu summary {
  list-style: none;
  width: max-content;
}

.sites__menu summary::-webkit-details-marker {
  display: none;
}

.sites__options {
  display: grid;
  gap: 0;
  margin-top: 8px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-medium);
  overflow: hidden;
}

.sites__option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 16px;
  cursor: pointer;
}

.sites__option + .sites__option {
  border-top: 1px solid var(--md-sys-color-outline-variant);
}

.sites__option input {
  width: 20px;
  height: 20px;
  accent-color: var(--md-sys-color-primary);
}

/* A search row's photo: the car it found most recently (feature 014). */
.search-card__photo {
  flex: none;
  width: 72px;
  height: 54px;
  border-radius: var(--md-sys-shape-corner-small);
  object-fit: cover;
  background: var(--md-sys-color-surface-container-high);
}

.search-card__media {
  display: contents;  /* only a wrapper the list refresh keeps (hx-preserve) */
}

/* Rows without a photo keep the same text column as rows with one. */
.search-card .list-item__avatar {
  margin: 0 16px;
}

@media (max-width: 599px) {
  .search-card__photo {
    width: 56px;
    height: 42px;
  }

  .search-card .list-item__avatar {
    margin: 0 8px;
  }
}

/* Search rows you can act on (feature 014): buttons above the row's link. */
.search-card__actions {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
}

.search-card__actions form {
  margin: 0;
}

.page-head--end {
  justify-content: flex-end;
}

.run-all {
  margin: 0;
}

/* Starred cars on the home page (feature 014). */
.starred {
  margin-top: 24px;
}

.starred-list__stars {
  color: var(--md-sys-color-primary);
  font-weight: 500;
  white-space: nowrap;
}

.starred-list .list-item__avatar {
  margin: 0 16px;
}

/* Pages of a long list (feature 015). */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 8px 16px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
}

.pager__moves,
.pager__sizes {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pager__sizes .chip {
  min-width: 48px;
  justify-content: center;
}

/* Where the car is (feature 011). */
.car-card__place {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
}

.car-card__place .icon {
  flex: none;
  color: var(--md-sys-color-primary);
}

/* Edit, Reset search and Delete, right under Run search now (feature 011). */
.search-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.search-actions [data-testid="delete-open"] {
  color: var(--md-sys-color-error);
}

/* "Sites checked", right under the main panel (feature 013). */
section.sites {
  margin-top: 16px;
}

.sites ul {
  padding-left: 1.25rem;
  overflow-wrap: anywhere;
}

/* car grid and car cards */
.car-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .car-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .car-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.car-grid > .more {
  grid-column: 1 / -1;
  text-align: center;
}

.car-card {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface-container-lowest);
  box-shadow: var(--md-sys-elevation-1);
  transition: box-shadow var(--md-sys-motion-duration-short) var(--md-sys-motion-easing-standard);
}

.car-card:hover,
.car-card:focus-within {
  box-shadow: var(--md-sys-elevation-2);
}

.car-card:hover::before {
  opacity: 0.04;
}

.car-card.removed {
  opacity: 0.6;
}

.car-card__media {
  display: block;
  margin: 8px 8px 0;
  border-radius: var(--md-sys-shape-corner-medium);
  overflow: hidden;
  background: var(--md-sys-color-surface-container-highest);
}

.car-card__photo,
.card-photo-placeholder {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.card-photo-placeholder {
  display: grid;
  place-items: center;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
}

.car-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 16px;
}

.car-card__price {
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 400;
}

.car-card__price s {
  margin-right: 8px;
  font-size: 0.875rem;
  color: var(--md-sys-color-on-surface-variant);
}

.car-card__title {
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.car-card__link {
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
}

.car-card__version {
  margin-top: -6px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
  line-height: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.car-card__dealer {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.car-card__badges:empty {
  display: none;
}

.car-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.car-card__actions {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: auto;
  padding-top: 8px;
}

/* Move to trash / Restore sits at the end of the card's actions (feature 011). */
.car-card__trash {
  margin: 0 0 0 auto;
}

.car-card__phone {
  margin: 0;
}

/* forms */
.form-section {
  margin: 0 0 16px;
  padding: 20px 16px 8px;
  border: 0;
  border-radius: var(--md-sys-shape-corner-large);
  background: var(--md-sys-color-surface-container-lowest);
  box-shadow: var(--md-sys-elevation-1);
  min-width: 0;
}

.form-section > legend {
  float: left;
  width: 100%;
  margin-bottom: 20px;
  padding: 0;
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 500;
}

.form-section > legend + * {
  clear: both;
}

@media (min-width: 600px) {
  .form-section {
    padding: 24px 24px 12px;
  }
}

/* car page */
.car-page {
  display: grid;
  gap: 16px;
}

.car-hero {
  display: grid;
  gap: 16px;
  padding: 8px;
}

@media (min-width: 840px) {
  .car-hero {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    align-items: start;
    padding: 16px;
  }
}

.car-page__photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--md-sys-shape-corner-large);
  background: var(--md-sys-color-surface-container-highest);
}

.car-hero__text {
  display: grid;
  gap: 8px;
  padding: 8px;
}

.car-page__price {
  font-size: 2rem;
  line-height: 2.5rem;
  font-weight: 400;
}

.phone-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.facts-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
}

@media (min-width: 840px) {
  .facts-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.facts-list dt {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.75rem;
  line-height: 1rem;
  letter-spacing: 0.031rem;
}

.facts-list dd {
  margin: 2px 0 0;
  font-size: 1rem;
  line-height: 1.5rem;
  overflow-wrap: anywhere;
}

.details-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 12px;
}

.price-chart {
  width: 100%;
  max-width: 560px;
  height: auto;
  color: var(--md-sys-color-primary);
}

.price-list,
.copy-values {
  padding-left: 1.25rem;
  overflow-wrap: anywhere;
}

.copy-values li {
  margin-bottom: 8px;
}

/* Vehicle history: title and the register's address on one line, the button, then one line
   per value (the user's layout, 2026-10-23). */
.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.history-head h3 {
  margin: 0;
  min-width: 0;
}

.history-head .btn {
  flex: none;
  padding-inline: 8px;
}

@media (max-width: 420px) {
  .history-head h3 {
    font-size: 1.125rem;
  }
}

.history-values {
  list-style: none;
  padding: 0;
  margin: 8px 0 16px;
}

.history-values li {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 48px;
}

.history-values code {
  white-space: nowrap;
}

/* --- utilities --------------------------------------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.more {
  text-align: center;
}

/* Copy buttons say how it went for 2 s (2026-10-22). */
.copy-btn--done {
  color: var(--md-sys-color-primary);
}

.copy-btn--done .copy-btn__label::before {
  content: "\2713\00a0";
}

/* Vehicle history check, filled in by Car Finder (feature 017). */
.history-actions {
  margin: 12px 0;
}

.history-bookmarks {
  margin: 12px 0;
}

.history-bookmarks .bookmarks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-readings {
  margin: 8px 0;
  padding-left: 20px;
}

.history-text {
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  font-size: 0.8125rem;
}

/* Sign in (feature 018). */
.app-bar__user {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 0 auto;
}

.app-bar__user-name {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.875rem;
}

.sign-in {
  max-width: 420px;
  margin: 24px auto;
}

.sign-in__form {
  display: grid;
  gap: 16px;
}

/* Sign in with Google (feature 029). */
/* Notification addresses in Settings (feature 032). */
.chip--disabled {
  opacity: 0.55;
}

.address-list {
  list-style: none;
  margin: 8px 0 16px;
  padding: 0;
}

.address-list__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.address-list__address {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.address-list__actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.address-add {
  display: grid;
  gap: 12px;
}

.sign-in__switch {
  text-align: center;
  margin-top: 16px;
}

.sign-in__resend {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.confirm-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sign-in__or {
  text-align: center;
  margin: 16px 0 8px;
}

.google-sign-in {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 44px;
}

/* Admin service (feature 019). */
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-left: 16px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.admin-table {
  width: 100%;
}

.admin-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.admin-add {
  margin-top: 24px;
}

/* Accent colours chosen in Settings (feature 022): light values, then dark. */
:root[data-accent="green"] {
  --md-sys-color-primary: #146c2e;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #c4eed0;
  --md-sys-color-on-primary-container: #072711;
}

:root[data-accent="purple"] {
  --md-sys-color-primary: #6750a4;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #eaddff;
  --md-sys-color-on-primary-container: #21005d;
}

:root[data-accent="orange"] {
  --md-sys-color-primary: #8b5000;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #ffdcbe;
  --md-sys-color-on-primary-container: #2c1600;
}

:root[data-theme="dark"][data-accent="green"] {
  --md-sys-color-primary: #6dd58c;
  --md-sys-color-on-primary: #0a3818;
  --md-sys-color-primary-container: #0f5223;
  --md-sys-color-on-primary-container: #c4eed0;
}

:root[data-theme="dark"][data-accent="purple"] {
  --md-sys-color-primary: #d0bcff;
  --md-sys-color-on-primary: #381e72;
  --md-sys-color-primary-container: #4f378b;
  --md-sys-color-on-primary-container: #eaddff;
}

:root[data-theme="dark"][data-accent="orange"] {
  --md-sys-color-primary: #ffb870;
  --md-sys-color-on-primary: #4a2800;
  --md-sys-color-primary-container: #693c00;
  --md-sys-color-on-primary-container: #ffdcbe;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"])[data-accent="green"] {
    --md-sys-color-primary: #6dd58c;
    --md-sys-color-on-primary: #0a3818;
    --md-sys-color-primary-container: #0f5223;
    --md-sys-color-on-primary-container: #c4eed0;
  }

  :root:not([data-theme="light"])[data-accent="purple"] {
    --md-sys-color-primary: #d0bcff;
    --md-sys-color-on-primary: #381e72;
    --md-sys-color-primary-container: #4f378b;
    --md-sys-color-on-primary-container: #eaddff;
  }

  :root:not([data-theme="light"])[data-accent="orange"] {
    --md-sys-color-primary: #ffb870;
    --md-sys-color-on-primary: #4a2800;
    --md-sys-color-primary-container: #693c00;
    --md-sys-color-on-primary-container: #ffdcbe;
  }
}

/* Settings (feature 022). */
.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* --- Support (feature 027) --------------------------------------------------------------- */

.field textarea {
  resize: vertical;
}

/* A message box: tall enough to write in, its label always on the top border, never over the
   text (2026-10-26). */
.field--message textarea {
  min-height: 180px;
}

.support-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.support-head p {
  margin: 0;
}

.support-close {
  margin-top: 8px;
}

.support-sent {
  display: flex;
  gap: 8px;
  align-items: center;
}

.support-new h2 {
  margin: 0 0 4px;
}

.support-form {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.support-form .choice-row {
  margin-bottom: 12px;
}

.support-form .field {
  margin-bottom: 8px;
}

.support-form__count {
  text-align: right;
}

.support-form__send {
  justify-self: start;
}

@media (max-width: 599px) {
  .support-form__send {
    justify-self: stretch;
  }
}

.support-tickets {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.support-ticket {
  position: relative;
  display: grid;
  gap: 4px;
}

.support-ticket--unread {
  outline: 2px solid var(--md-sys-color-primary);
}

.support-ticket > .badge {
  justify-self: start;
}

.support-ticket__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.support-ticket__head h2 {
  margin: 0;
}

.support-ticket__preview {
  margin: 4px 0 0;
  color: var(--md-sys-color-on-surface-variant);
  overflow-wrap: anywhere;
}

/* Ticket status, the same colours for users and the admin. */
.status-chip {
  flex: none;
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  line-height: 1.25rem;
  font-weight: 500;
  white-space: nowrap;
}

.status-chip--open {  /* amber: waiting for an answer */
  background: #ffe08a;
  color: #3d2f00;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .status-chip--open {
    background: #574500;
    color: #ffe08a;
  }
}

:root[data-theme="dark"] .status-chip--open {
  background: #574500;
  color: #ffe08a;
}

.status-chip--answered {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

.status-chip--closed {
  background: var(--md-sys-color-surface-container-highest);
  color: var(--md-sys-color-on-surface-variant);
}

.support-message__who {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  color: inherit;
  opacity: 0.8;
}

.support-messages {
  list-style: none;
  padding: 0;
  margin: 16px 0;
  display: grid;
  gap: 12px;
}

.support-message {
  padding: 12px 16px;
  border-radius: var(--md-sys-shape-corner-medium, 12px);
  background: var(--md-sys-color-surface-container);
  max-width: 90%;
}

.support-message--admin {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  justify-self: start;
}

.support-message--user {
  justify-self: end;
}

.support-message__body {
  margin: 4px 0 0;
  white-space: pre-wrap;  /* plain text, as written */
  overflow-wrap: anywhere;
}

/* Admin: ticket tabs and the ticket page (feature 027). */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 16px;
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  border-bottom: 3px solid transparent;
}

.tab--active {
  color: var(--md-sys-color-primary);
  border-bottom-color: var(--md-sys-color-primary);
  font-weight: 500;
}

.tab__count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--md-sys-color-surface-container-highest);
  font-size: 0.75rem;
  text-align: center;
}

.ticket-layout {
  display: grid;
  gap: 16px;
  align-items: start;
}

@media (min-width: 900px) {
  .ticket-layout {
    grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
  }
}

/* The Searches page's name filter, from more than 10 searches (2026-10-26). */
.search-bar {
  flex-wrap: nowrap;
}

@media (max-width: 599px) {
  /* On a phone the field gets the whole line; Run all goes below it (2026-10-26). */
  .search-bar {
    flex-wrap: wrap;
  }

  .search-bar .search-filter {
    flex: 1 1 100%;
  }
}

.search-bar .run-all {
  margin-left: auto;
  flex: none;
}

.search-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.search-filter__field {
  flex: 1;
  max-width: 480px;
  margin: 0;
}

/* Search everything from Home (2026-10-26). */
.home-find {
  margin: 8px 0 16px;
}

.home-find__field {
  max-width: 640px;
  margin: 0;
}

.find-results {
  display: grid;
  gap: 16px;
}

.find-group h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
}

/* The admin's Email page (feature 030): three panes like a mail app (2026-11-01). */
.content--wide {
  max-width: none;
}

.mail-app {
  display: grid;
  grid-template-columns: 250px minmax(280px, 380px) minmax(0, 1fr);
  gap: 0;
  min-height: calc(100vh - 140px);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: 16px;
  overflow: hidden;
  background: var(--md-sys-color-surface, #fff);
}

.mail-app__nav {
  padding: 16px 12px;
  border-right: 1px solid var(--md-sys-color-outline-variant);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mail-app__write {
  justify-content: center;
}

.mail-app__boxes,
.mail-app__folders,
.mail-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mail-app__box > a,
.mail-app__folder {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
}

.mail-app__box > a:hover,
.mail-app__folder:hover {
  background: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent);
}

.mail-app__box--current > a {
  font-weight: 700;
}

.mail-app__box-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.mail-app__folders {
  margin: 2px 0 6px 18px;
}

.mail-app__folder span:first-child {
  flex: 1;
}

.mail-app__folder--current {
  background: color-mix(in srgb, var(--md-sys-color-primary) 14%, transparent);
  font-weight: 700;
}

.mail-app__count {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--md-sys-color-primary);
}

.mail-app__new-folder {
  display: flex;
  gap: 4px;
  margin-top: auto;
}

.mail-app__new-folder input {
  min-width: 0;
  flex: 1;
}

.mail-app__list {
  border-right: 1px solid var(--md-sys-color-outline-variant);
  overflow-y: auto;
  max-height: calc(100vh - 140px);
}

.mail-app__heading {
  margin: 0;
  padding: 16px;
  font-size: 1.1rem;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.mail-list__item {
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.mail-list__link {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  padding: 10px 16px;
  color: var(--md-sys-color-on-surface);
  text-decoration: none;
}

.mail-list__link:hover {
  background: color-mix(in srgb, var(--md-sys-color-primary) 6%, transparent);
}

.mail-list__item--open .mail-list__link {
  background: color-mix(in srgb, var(--md-sys-color-primary) 14%, transparent);
  box-shadow: inset 3px 0 0 var(--md-sys-color-primary);
}

.mail-list__who,
.mail-list__subject {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-list__date {
  font-size: 0.8rem;
  color: var(--md-sys-color-on-surface-variant);
}

.mail-list__subject {
  grid-column: 1 / -1;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.92rem;
}

.email-row--unread .mail-list__who,
.email-row--unread .mail-list__subject {
  font-weight: 700;
  color: var(--md-sys-color-on-surface);
}

.email-row--unread .mail-list__link {
  box-shadow: inset 3px 0 0 var(--md-sys-color-primary);
}

.mail-list__empty {
  padding: 24px 16px;
  color: var(--md-sys-color-on-surface-variant);
}

.mail-app__pane {
  padding: 16px 24px;
  overflow-y: auto;
  max-height: calc(100vh - 140px);
  min-width: 0;
}

.mail-app__placeholder {
  height: 100%;
  min-height: 240px;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--md-sys-color-on-surface-variant);
}

.email-message__subject {
  margin: 12px 0 4px;
  font-size: 1.3rem;
}

.email-message__head {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  margin: 8px 0 16px;
}

.email-message__head dt {
  color: var(--md-sys-color-on-surface-variant);
}

.email-message__head dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.email-message__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.email-message__html {
  width: 100%;
  min-height: 60vh;
  border: 0;
  background: #fff;
}

.email-message__text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
}

/* The send form: a new-message window (To, Cc, Subject lines, then the text). */
.mail-compose {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.mail-compose__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.mail-compose__title {
  flex: 1;
  margin: 0;
  font-size: 1.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-compose__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.mail-compose__label {
  width: 64px;
  color: var(--md-sys-color-on-surface-variant);
  flex: none;
}

.mail-compose__row input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  padding: 6px 0;
  color: inherit;
}

.mail-compose__row input:focus {
  outline: none;
}

.mail-compose__body {
  flex: 1;
  min-height: 18rem;
  margin-top: 8px;
  border: 0;
  resize: vertical;
  font: inherit;
  background: transparent;
  color: inherit;
}

.mail-compose__body:focus {
  outline: none;
}

.mail-compose__files {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
}

/* Phones and narrow windows: one pane under the other. */
@media (max-width: 960px) {
  .mail-app {
    grid-template-columns: 1fr;
  }

  .mail-app__nav,
  .mail-app__list {
    border-right: 0;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    max-height: none;
  }

  .mail-app__pane {
    max-height: none;
  }
}
