:root {
  color-scheme: light;
  --bg: #f6f7fa;
  --surface: #ffffff;
  --surface-muted: #eef1f5;
  --surface-translucent: rgba(255, 255, 255, 0.9);
  --surface-gradient-end: #f6f8fb;
  --hero-gradient-start: #fefefe;
  --hero-gradient-end: #f3f7ff;
  --border: #d8dde6;
  --text: #1f2933;
  --text-muted: #6b7280;
  --accent: #1f7aec;
  --accent-dark: #165db4;
  --accent-soft-bg: rgba(31, 122, 236, 0.12);
  --accent-soft-border: rgba(31, 122, 236, 0.18);
  --focus-ring: rgba(31, 122, 236, 0.12);
  --on-accent: #ffffff;
  --radius: 10px;
  --shadow: none;
  --shadow-overlay: 0 12px 34px rgba(15, 23, 42, 0.12);
  --inner-shadow: none;
  --success-text: #166534;
  --success-strong: #047857;
  --success-bg: rgba(34, 197, 94, 0.12);
  --success-border: rgba(34, 197, 94, 0.35);
  --danger-text: #991b1b;
  --danger-strong: #b91c1c;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.35);
  --warning-text: #92400e;
  --warning-strong: #b45309;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --warning-border: rgba(245, 158, 11, 0.35);
  --muted-tag-bg: #f5d0d0;
  --muted-tag-text: #8b3a3a;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 2.5rem;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0b1729;
  --surface: #121f33;
  --surface-muted: #1a273e;
  --surface-translucent: rgba(18, 31, 51, 0.88);
  --surface-gradient-end: #111d31;
  --hero-gradient-start: #15223b;
  --hero-gradient-end: #0c1627;
  --border: #22324a;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #64a5ff;
  --accent-dark: #8ab7ff;
  --accent-soft-bg: rgba(100, 165, 255, 0.18);
  --accent-soft-border: rgba(100, 165, 255, 0.3);
  --focus-ring: rgba(100, 165, 255, 0.35);
  --on-accent: #ffffff;
  --shadow: none;
  --shadow-overlay: 0 20px 48px rgba(2, 6, 23, 0.45);
  --inner-shadow: none;
  --success-text: #4ade80;
  --success-strong: #22c55e;
  --success-bg: rgba(74, 222, 128, 0.16);
  --success-border: rgba(74, 222, 128, 0.32);
  --danger-text: #fca5a5;
  --danger-strong: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.16);
  --danger-border: rgba(248, 113, 113, 0.32);
  --warning-text: #facc15;
  --warning-strong: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.18);
  --warning-border: rgba(251, 191, 36, 0.32);
  --muted-tag-bg: rgba(248, 113, 113, 0.2);
  --muted-tag-text: #fecaca;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0b1729;
    --surface: #121f33;
    --surface-muted: #1a273e;
    --surface-translucent: rgba(18, 31, 51, 0.88);
    --surface-gradient-end: #111d31;
    --hero-gradient-start: #15223b;
    --hero-gradient-end: #0c1627;
    --border: #22324a;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --accent: #64a5ff;
    --accent-dark: #8ab7ff;
    --accent-soft-bg: rgba(100, 165, 255, 0.18);
    --accent-soft-border: rgba(100, 165, 255, 0.3);
    --focus-ring: rgba(100, 165, 255, 0.35);
    --on-accent: #ffffff;
    --shadow: none;
    --shadow-overlay: 0 20px 48px rgba(2, 6, 23, 0.45);
    --inner-shadow: none;
    --success-text: #4ade80;
    --success-strong: #22c55e;
    --success-bg: rgba(74, 222, 128, 0.16);
    --success-border: rgba(74, 222, 128, 0.32);
    --danger-text: #fca5a5;
    --danger-strong: #f87171;
    --danger-bg: rgba(248, 113, 113, 0.16);
    --danger-border: rgba(248, 113, 113, 0.32);
    --warning-text: #facc15;
    --warning-strong: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.18);
    --warning-border: rgba(251, 191, 36, 0.32);
    --muted-tag-bg: rgba(248, 113, 113, 0.2);
    --muted-tag-text: #fecaca;
  }
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content-flow {
  display: grid;
  gap: var(--space-7);
  align-items: start;
  align-content: start;
}

.content-flow > :where(section, article, div) {
  display: grid;
  gap: var(--space-5);
  margin: 0;
}

.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -120%);
  background: var(--surface);
  color: var(--accent);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  z-index: 200;
  transition: transform 0.2s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translate(-50%, 0.75rem);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.sw-container {
  width: min(1100px, 92vw);
  margin: 0 auto;
}

.sw-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.sw-header .sw-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  position: relative;
}

.logo {
  font-weight: 700;
  font-size: 1.2rem;
}


.main-nav {
  display: flex;
  align-items: center;
}

.main-nav__list {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-nav__item {
  display: flex;
  align-items: center;
}

.main-nav__item form {
  margin: 0;
}

.nav-logout-form {
  display: flex;
  align-items: center;
}

.main-nav__link {
  color: var(--text-muted);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.main-nav__link:hover,
.main-nav__link:focus-visible {
  color: var(--accent-dark);
}

.main-nav__link.active {
  color: var(--accent);
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.link-button:hover,
.link-button:focus-visible,
.main-nav__link:hover,
.main-nav__link:focus-visible {
  text-decoration: underline;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.2s ease;
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  content: '';
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle-bar {
  position: relative;
}

.nav-toggle-bar::before,
.nav-toggle-bar::after {
  position: absolute;
  left: 0;
}

.nav-toggle-bar::before {
  top: -6px;
}

.nav-toggle-bar::after {
  top: 6px;
}

.nav-toggle[aria-expanded='true'] .nav-toggle-bar {
  background: transparent;
}

.nav-toggle[aria-expanded='true'] .nav-toggle-bar::before {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded='true'] .nav-toggle-bar::after {
  transform: translateY(-6px) rotate(-45deg);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.sw-main {
  padding: var(--space-6) 0 var(--space-7);
  flex: 1 0 auto;
}

.contact-intro {
  max-width: 640px;
  margin: 0 auto 2rem;
  text-align: center;
}

.contact-intro h1 {
  margin: 0;
  font-size: 2rem;
}

.contact-intro p {
  margin: 1rem 0 0;
  color: var(--text-muted);
}

.contact-form {
  max-width: 640px;
  margin: 0 auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  display: grid;
  gap: var(--space-4);
}

.contact-messages {
  margin: 1.25rem auto 1.5rem;
  max-width: 640px;
}

.contact-form button[type="submit"] {
  justify-self: start;
}

.sw-footer {
  border-top: 1px solid var(--border);
  background: transparent;
  padding: var(--space-4) 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.sw-footer__content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sw-footer__copy {
  margin: 0;
}

.sw-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
  justify-content: flex-start;
}

.sw-footer__links a {
  color: inherit;
  text-decoration: none;
  font-weight: 500;
}

.sw-footer__links a:hover,
.sw-footer__links a:focus-visible {
  color: var(--accent);
}

@media (min-width: 768px) {
  .sw-footer__content {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .sw-footer__links {
    justify-content: flex-end;
  }
}

.hero {
  display: grid;
  gap: var(--space-6);
  align-items: start;
  padding: 0;
}

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

.hero h1 {
  margin: 0;
  font-size: 2.2rem;
  line-height: 1.2;
}

.hero p {
  margin: 0.8rem 0 0;
  color: var(--text-muted);
}

.hero-search {
  display: grid;
  gap: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: relative;
}

.filter-form label {
  position: relative;
}

.form-row label,
label span {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.form-help {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-help.logout-form {
  display: inline-block;
}

.logout-form .link-button {
  color: var(--accent);
}

.logout-form .link-button:hover,
.logout-form .link-button:focus-visible {
  color: var(--accent-dark);
}

.page {
  display: block;
  line-height: 1.6;
  max-width: 760px;
  margin: 0 auto;
}

.page > * + * {
  margin-top: 1rem;
}

.page h1 {
  margin: 0;
  font-size: 2rem;
}

.page h2 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.3rem;
}

.errorlist {
  margin: 0.35rem 0 0;
  padding-left: 1.25rem;
  color: var(--danger-text);
  font-weight: 500;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
  transition: all 0.15s ease;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

textarea {
  resize: vertical;
  min-height: 160px;
  font-family: inherit;
}

.auth-form {
  display: grid;
  gap: var(--space-4);
  max-width: 420px;
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.auth-form .form-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.auth-form button[type="submit"] {
  justify-self: start;
}

.profile-messages {
  margin-top: 1rem;
  display: grid;
  gap: 0.75rem;
  max-width: 540px;
}

.profile-message {
  padding: var(--space-3);
  border-radius: 0;
  border-left: 3px solid var(--border);
  background: transparent;
  font-weight: 500;
}

.profile-message--success {
  border-color: var(--success-border);
  color: var(--success-text);
}

.profile-message--error {
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.profile-message--info {
  border-color: var(--border);
}

.profile-form {
  margin-top: var(--space-4);
  max-width: 540px;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.profile-details {
  margin: 0;
}

.profile-details dt {
  font-weight: 600;
  margin-top: 1.2rem;
  color: var(--text-muted);
}

.profile-details dt:first-of-type {
  margin-top: 0;
}

.profile-details dd {
  margin: 0.35rem 0 0;
  color: var(--text);
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.profile-field__value {
  display: block;
  min-height: 1.5rem;
}

.profile-form[data-profile-editing="true"] [data-profile-display] {
  display: none;
}

.profile-form[data-profile-editing="false"] [data-profile-input] {
  display: none;
}

.profile-field input[readonly] {
  background: var(--surface-muted);
  color: var(--text-muted);
  cursor: not-allowed;
}

.profile-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.profile-actions .button {
  min-width: 0;
}


button {
  font: inherit;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0.75rem 1.4rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.button[hidden] {
  display: none !important;
}

.button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.button--primary {
  background: var(--accent);
  color: var(--on-accent);
}

.button--primary:hover,
.button--primary:focus-visible {
  background: var(--accent-dark);
}

.button--primary:disabled,
.button--primary:disabled:hover,
.button--primary:disabled:focus-visible {
  background: var(--surface-muted);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: not-allowed;
  box-shadow: none;
}

.button--compact {
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
}

.button--subtle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.button--subtle:hover,
.button--subtle:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.input-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-overlay);
  max-height: 220px;
  overflow-y: auto;
  padding: 0.35rem 0;
  z-index: 20;
}

.input-suggestions[hidden] {
  display: none;
}

.input-suggestions__option {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
}

.input-suggestions__option:hover,
.input-suggestions__option:focus {
  background: var(--surface-muted);
}

.input-suggestions__empty {
  padding: 0.45rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-inline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin: 0;
}

.stats-grid .stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: var(--space-3) 0;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.stats-grid .stat-card:hover,
.stats-grid .stat-card:focus-visible {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
}

.stats-grid .stat-card:focus-visible {
  outline: none;
}

.stats-grid .label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.stats-grid .value {
  font-size: 1.8rem;
  font-weight: 600;
  margin-top: 0.4rem;
}

.recent-section header,
.results header,
.secondary h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.results-filter-summary {
  margin: 0.35rem 0 1rem;
  color: var(--text-muted);
}

.mobile-sort-controls {
  display: none;
  gap: 1rem;
  margin: 0.75rem 0 1rem;
}

.mobile-sort-controls__group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.mobile-sort-controls__select {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface);
  font: inherit;
  color: inherit;
}

.recent-section .card-list {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-5);
}

.vehicle-card {
  display: grid;
  gap: 0.9rem;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.vehicle-card h3 {
  margin: 0;
  font-size: 1.1rem;
}

.vehicle-card .meta {
  color: var(--text-muted);
  margin: 0.4rem 0 1rem;
}

.vehicle-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 1rem;
  margin: 0;
}

.vehicle-card dl dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.vehicle-card dl dd {
  margin: 0;
  font-weight: 600;
}

.vehicle-card .timestamp {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.insights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-5);
  margin-top: var(--space-6);
  align-items: start;
}

.insight {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--border);
  align-content: start;
}

.insight h2 {
  margin: 0;
  font-size: 1.1rem;
}

.insight ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-3);
}

.insight li {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin: 0;
}

.page-header p {
  margin: 0.4rem 0 0;
  color: var(--text-muted);
}

.filters {
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  margin: 0;
}

.filter-form .grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.filter-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-actions {
  margin-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.per-page label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-right: 0.5rem;
}

.per-page select {
  width: 90px;
}

.buttons {
  display: flex;
  gap: 0.75rem;
}

.reset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 1.2rem;
  color: var(--text);
  font-weight: 500;
}

.results-table {
  width: 100%;
  border-spacing: 0;
  border-collapse: collapse;
  background: transparent;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}

.results-table thead {
  background: transparent;
  border-bottom: 2px solid var(--border);
}

.results-table th,
.results-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 0.95rem;
}

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

.results-table td.vehicle-card-summary {
  display: none;
}

.results-table th.sortable {
  padding: 0;
}

.results-table th.sortable a,
.results-table th.sortable button.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  padding: 0.85rem 1rem;
  color: inherit;
  text-decoration: none;
  background: transparent;
  border: none;
  font: inherit;
  cursor: pointer;
}

.results-table th.sortable a:hover,
.results-table th.sortable a:focus,
.results-table th.sortable button.sort-button:hover,
.results-table th.sortable button.sort-button:focus {
  background: var(--accent-soft-bg);
}

.results-table th.sortable.sortable--active a,
.results-table th.sortable.sortable--active button.sort-button {
  font-weight: 600;
}

.results-table th.freshness-cell.sortable a,
.results-table th.freshness-cell.sortable button.sort-button {
  justify-content: flex-end;
}

.sort-indicator {
  font-size: 0.7rem;
}

.results-table td:nth-child(7) a {
  display: inline-block;
  white-space: normal;
  overflow-wrap: anywhere;
}

.results-table tbody tr:hover {
  background: var(--accent-soft-bg);
}

/* Clickable table rows */
.results-table tbody tr[data-href] {
  cursor: pointer;
}

.results-table tbody tr[data-href] td,
.results-table tbody tr[data-href] th {
  cursor: pointer;
}

.results-table tbody tr[data-href]:focus,
.results-table tbody tr[data-href]:focus-visible,
.results-table tbody tr[data-href]:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.results-table tbody tr[data-href]:focus-visible,
.results-table tbody tr[data-href]:focus-within {
  background: var(--accent-soft-bg);
}

.freshness-cell {
  text-align: right;
  white-space: nowrap;
}

.freshness-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}

.freshness-indicator::before {
  content: '';
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background-color: currentColor;
  box-shadow: 0 0 0 2px rgba(31, 41, 55, 0.08);
}

.freshness-indicator--plain::before {
  display: none;
}

.freshness-indicator--unknown {
  color: var(--text-muted);
  font-weight: 500;
}

.pagination {
  margin-top: 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-link {
  padding: 0.55rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--accent);
  font-weight: 600;
}

.pagination button.page-link {
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.page-status {
  color: var(--text-muted);
}

.empty-state {
  padding: var(--space-5);
  text-align: center;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.error-page {
  padding: clamp(2rem, 5vw, 3.5rem);
  text-align: center;
  display: grid;
  gap: 1.5rem;
  justify-items: center;
}

.error-page__code {
  font-size: clamp(2.5rem, 8vw, 4.25rem);
  font-weight: 700;
  color: var(--accent);
  margin: 0;
}

.error-page__title {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  margin: 0;
  color: var(--text);
}

.error-page__message {
  margin: 0 auto;
  max-width: 52ch;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.error-page__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.error-page__actions .button {
  min-width: 11rem;
}


.vehicle-hero {
  padding-top: var(--space-5);
  display: grid;
  gap: var(--space-4);
  border-top: 1px solid var(--border);
  margin: 0;
}

.vehicle-hero__header h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 2.5rem);
  line-height: 1.15;
}

.vehicle-hero__header .subtitle {
  margin-top: 0.6rem;
}

.vehicle-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.2rem;
  margin: 1.2rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--text-muted);
  font-weight: 500;
}

.vehicle-hero__meta li {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.vehicle-hero__meta li + li::before {
  content: "•";
  color: var(--text-muted);
  font-weight: 700;
  margin-right: 0.6rem;
}


.vehicle-hero__stats {
  margin: var(--space-4) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  border-top: 1px solid var(--border);
}

.vehicle-hero__stat {
  display: grid;
  grid-template-columns: minmax(0, 140px) minmax(0, 1fr);
  gap: 0.75rem;
  align-items: baseline;
  padding-top: var(--space-3);
}

.vehicle-hero__stat dt {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.vehicle-hero__stat dd {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  word-break: break-word;
}

@media (max-width: 640px) {
  .vehicle-hero__stat {
    grid-template-columns: minmax(0, 1fr);
  }
}

.vehicle-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  margin-bottom: 3rem;
}

.vehicle-layout__main,
.vehicle-layout__aside {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.vehicle-panel {
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  display: grid;
  gap: var(--space-4);
}

.vehicle-panel--subdued {
  background: none;
}

.vehicle-panel h2 {
  margin: 0 0 1.2rem;
  font-size: 1.25rem;
}

.vehicle-detail-grid,
.vehicle-vin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 0;
}

.vehicle-detail-grid > div,
.vehicle-vin-grid > div {
  padding: var(--space-3) 0;
  min-height: auto;
  background: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
}

.vehicle-detail-grid dt,
.vehicle-vin-grid dt {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.vehicle-detail-grid dd,
.vehicle-vin-grid dd {
  margin: 0;
  font-weight: 600;
  font-size: 1.05rem;
  word-break: break-word;
}

.vehicle-context {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin: 0;
}

.vehicle-context > div {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.vehicle-context dt {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0;
}

.vehicle-context dd {
  margin: 0;
  font-weight: 600;
}

.vehicle-back-link {
  margin: 2rem 0 0;
  font-weight: 600;
}

@media (max-width: 960px) {
  .vehicle-layout {
    grid-template-columns: 1fr;
  }

  .vehicle-layout__aside {
    order: -1;
  }
}

.meta-grid,
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.2rem;
  margin: 1.5rem 0 2rem;
}

.meta-grid .label,
.detail-grid .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.meta-grid .value,
.detail-grid .value {
  font-weight: 600;
  font-size: 1rem;
}

.page-summary {
  margin-top: 1rem;
  max-width: 65ch;
  color: var(--text-muted);
}

.meta-grid .value-line {
  display: inline-block;
}

.map-embed {
  margin: 2rem 0 3rem;
}

.map-embed__frame {
  position: relative;
  padding-top: 56.25%;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--border);
}

.map-embed__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.secondary {
  margin: 3rem 0;
}

.secondary h2 {
  margin-bottom: 1rem;
}

.context {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.context li {
  margin: 0;
}

.context strong {
  display: inline-block;
  width: 120px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.subtitle {
  color: var(--text-muted);
}

.tag {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--surface-muted);
  color: var(--text-muted);
}

.tag.muted {
  background: var(--muted-tag-bg);
  color: var(--muted-tag-text);
}

.muted {
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-search {
    grid-template-columns: 1fr;
  }

  .results header {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: flex-start;
  }

  .mobile-sort-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .results-table {
    display: block;
    background: transparent;
    box-shadow: none;
  }

  .results-table thead {
    display: none;
  }

  .results-table tbody {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }

  .results-table tbody tr {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-3);
    box-shadow: none;
  }

  .results-table tbody tr:hover {
    background: transparent;
  }

  .results-table td {
    border-bottom: none;
    padding: 0;
    display: none;
  }

  .results-table td::before {
    display: none;
    content: none;
  }

  .results-table td.vehicle-card-summary {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
  }

  .vehicle-card-summary__title {
    font-weight: 600;
    font-size: 1.05rem;
    color: inherit;
    text-decoration: none;
  }

  .vehicle-card-summary__title:hover,
  .vehicle-card-summary__title:focus {
    text-decoration: underline;
  }

  .vehicle-card-summary__location {
    font-size: 0.85rem;
    color: var(--text-muted);
  }

  .vehicle-card-summary__status {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: none;
    gap: 0.3rem;
  }

  .vehicle-card-summary__status.freshness-indicator::before {
    box-shadow: none;
  }

  .vehicle-card-summary__status.freshness-indicator {
    display: inline-flex;
    align-items: center;
  }

  .nav-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  .main-nav {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    width: min(320px, calc(100vw - 2rem));
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.75rem 1rem;
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
  }

  .main-nav__list {
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    text-align: center;
  }

  .main-nav.is-open {
    display: flex;
  }

  .main-nav__link {
    margin: 0;
    padding: 0.35rem 0;
    justify-content: center;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 600px) {
  .sw-main {
    padding: 1.5rem 0 3rem;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .results-table {
    font-size: 0.85rem;
  }

  .filters {
    padding-top: 1rem;
  }
}

.browse-section {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.browse-controls {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  width: 100%;
}

.browse-filters {
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  display: grid;
  gap: var(--space-4);
}

.browse-filters-layout {
  display: flex;
  gap: 1.5rem;
  align-items: stretch;
}

.browse-filter-menu {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 180px;
}

.browse-filter-menu__item {
  border: none;
  border-left: 2px solid transparent;
  background: transparent;
  padding: 0.75rem 0.85rem;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  color: inherit;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.browse-filter-menu__item:hover,
.browse-filter-menu__item:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.browse-filter-menu__item.is-active {
  background: var(--accent-soft-bg);
  color: var(--accent-dark);
  border-color: var(--accent);
}

.browse-filter-panels {
  flex: 1 1 auto;
  min-width: 0;
}

.browse-filter-panel {
  display: none;
  flex-direction: column;
  gap: 1rem;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.browse-filter-panel.is-active {
  display: flex;
}

.browse-filter-panel__header h2 {
  margin: 0;
  font-size: 1rem;
}

.browse-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.browse-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  padding: var(--space-3) 0;
  font: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.browse-item:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.browse-item.is-active {
  border-color: var(--accent);
  background: var(--accent-soft-bg);
}

.browse-item-label {
  font-weight: 600;
}

.browse-item-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.browse-placeholder,
.browse-error {
  margin: auto 0;
  padding: 0.75rem 0;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.9rem;
}

.browse-error {
  color: var(--danger-strong);
}

.browse-summary,
.browse-results {
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.browse-summary {
  align-self: stretch;
}

.browse-results {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.browse-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.browse-summary-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.browse-summary-header h2 {
  margin: 0;
  font-size: 1.05rem;
}

.browse-export {
  min-width: 0;
}

.browse-summary-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
}

.browse-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.browse-summary-row dt {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.browse-summary-row dd {
  margin: 0;
  font-weight: 600;
}

.browse-results-header {
  font-weight: 600;
  margin-bottom: 1rem;
}

.browse-vehicle-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.browse-vehicle {
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: var(--space-3) 0;
  background: transparent;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.browse-vehicle:hover,
.browse-vehicle:focus-within {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.browse-vehicle:focus:not(:focus-visible) {
  outline: none;
}

.browse-vehicle:focus-visible {
  border-color: var(--accent);
  color: var(--accent-dark);
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--accent-soft-bg);
}

.browse-vehicle h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.browse-vehicle-meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.browse-vehicle-timeline {
  margin: 0.6rem 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
}

.browse-pagination {
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.browse-pagination-button {
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.browse-pagination-button:hover:not(:disabled),
.browse-pagination-button:focus-visible:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.browse-pagination-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.browse-pagination-status {
  font-weight: 600;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .browse-filters-layout {
    flex-direction: column;
  }

  .browse-filter-menu {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .browse-filter-menu__item {
    flex: 1 1 160px;
    text-align: center;
  }
}

@media (min-width: 960px) {
  .browse-controls {
    flex-direction: row;
    align-items: stretch;
  }

  .browse-filters,
  .browse-summary {
    flex: 1 1 0;
    max-width: none;
  }
}

@media (max-width: 600px) {
  .browse-filters {
    padding-top: 1rem;
  }

  .browse-filter-menu {
    gap: 0.5rem;
  }

  .browse-filter-menu__item {
    flex: 1 1 100%;
  }
}

.admin-dashboard {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.admin-messages {
  display: grid;
  gap: 0.75rem;
}

.admin-message {
  padding: var(--space-3);
  border-radius: 0;
  border-left: 3px solid var(--border);
  background: transparent;
  font-weight: 500;
}

.admin-message--success {
  border-color: var(--success-border);
  color: var(--success-text);
}

.admin-message--error {
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.admin-message--warning {
  border-color: var(--warning-border);
  color: var(--warning-text);
}

.admin-message--info {
  border-color: var(--accent-soft-border);
}

.admin-dashboard__header h1 {
  margin-bottom: 0.5rem;
}

.admin-dashboard__header p {
  margin: 0;
  color: var(--text-muted);
}

.admin-section {
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  display: grid;
  gap: var(--space-4);
}

.admin-section h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
}

.admin-section__lead {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.admin-stat-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.admin-stat-card {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.admin-stat-card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.admin-stat-card__value {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
}

.admin-stat-card__meta {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.admin-quick-actions {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.admin-quick-action {
  display: block;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.admin-quick-action:hover,
.admin-quick-action:focus-visible {
  text-decoration: none;
  outline: none;
  border-bottom-color: var(--accent);
  color: var(--accent-dark);
}

.admin-quick-action__title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.admin-quick-action__meta {
  display: block;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.admin-alert-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 2rem;
}

.admin-alert {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.admin-alert h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.admin-alert__value {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 700;
}

.admin-alert__meta {
  margin: 0.4rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.admin-form {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
  max-width: 420px;
}

.admin-form button[type="submit"] {
  justify-self: start;
}

.admin-email-settings {
  margin: 1.25rem 0 0;
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  display: grid;
  gap: 0.85rem;
}

.admin-email-settings__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
}

.admin-email-settings__row dt {
  margin: 0;
  font-weight: 600;
  color: var(--text-muted);
}

.admin-email-settings__row dd {
  margin: 0;
  font-weight: 500;
  text-align: right;
  word-break: break-word;
}

.admin-email-settings__note {
  margin: 0.75rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.admin-two-column {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-bottom: 2rem;
}

.admin-two-column--stack {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.admin-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.admin-list li {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.admin-list li:last-child {
  border-bottom: none;
}

.admin-list__meta {
  display: block;
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-top: 0.2rem;
}

.admin-list__more {
  margin-top: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.admin-empty {
  margin: 0;
  color: var(--text-muted);
  font-style: italic;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
  border-radius: 0;
  overflow: visible;
}

.admin-table th,
.admin-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
}

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

.admin-table thead {
  background: transparent;
  color: inherit;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}

.admin-table tbody tr:nth-child(even) {
  background: transparent;
}

.admin-table tbody tr:hover {
  background: var(--accent-soft-bg);
}

.admin-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.admin-status--active {
  background: var(--success-bg);
  color: var(--success-strong);
}

.admin-status--inactive {
  background: var(--danger-bg);
  color: var(--danger-strong);
}

.admin-status--warning {
  background: var(--warning-bg);
  color: var(--warning-strong);
}

.admin-vehicle-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.admin-vehicle-card {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.admin-vehicle-card h4 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.admin-vehicle-card__meta {
  margin: 0.2rem 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

@media (max-width: 720px) {
  .admin-section {
    padding-top: 1.5rem;
  }
}
