.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
}

.filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter label,
.filter .filter-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.filter input,
.filter select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  min-width: 0;
}

.filter input:focus,
.filter select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ----- Range slider filters (e.g. min road conditions, max traffic) ----- */
.filter-slider-wrap,
.filter-slider-row .filter-slider-ticks {
  max-width: 220px;
}
.filter-slider-wrap {
  position: relative;
  width: 100%;
  isolation: isolate;
}
.filter-slider-notch {
  position: absolute;
  top: 50%;
  width: 2px;
  height: 8px;
  background: var(--border);
  border-radius: 1px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
}
.filter input[type="range"].filter-slider {
  background: transparent;
  border: none;
  padding: 0;
  height: 16px;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  cursor: pointer;
  display: block;
  position: relative;
  z-index: 1;
}
.filter input[type="range"].filter-slider:focus {
  outline: none;
  border: none;
}
.filter input[type="range"].filter-slider::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.filter input[type="range"].filter-slider::-moz-range-track {
  height: 4px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.filter input[type="range"].filter-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  margin-top: -6px;
  cursor: pointer;
}
.filter input[type="range"].filter-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}
.filter-slider-value {
  color: var(--text);
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
}
.filter-slider-ticks {
  position: relative;
  height: 14px;
  font-size: 10px;
  color: var(--muted);
  text-transform: none;
  letter-spacing: normal;
}
.filter-slider-ticks span {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* ----- Checklist (multi-select) filters ----- */
.checklist {
  position: relative;
}

.checklist > summary {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 28px 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}

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

.checklist[open] > summary,
.checklist > summary:focus-visible {
  outline: none;
  border-color: var(--accent);
}

.checklist-summary {
  overflow: hidden;
  text-overflow: ellipsis;
}

.checklist-summary.has-selection {
  color: var(--text);
}

.checklist-caret {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 10px;
  pointer-events: none;
  transition: transform 120ms ease;
}

.checklist[open] .checklist-caret {
  transform: translateY(-50%) rotate(180deg);
}

.checklist-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 160px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  padding: 4px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  text-transform: none;
  letter-spacing: normal;
}

.checklist-item:hover {
  background: var(--panel-2);
}

.checklist-item input[type="checkbox"] {
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.checklist-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combobox {
  position: relative;
}

.combobox-input-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 6px;
  cursor: text;
}

.combobox.is-open .combobox-input-wrap,
.combobox-input-wrap:focus-within {
  border-color: var(--accent);
}

.combobox-chips {
  display: contents;
}

.combobox-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--accent-dim);
  color: var(--text);
  padding: 2px 4px 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.4;
  max-width: 100%;
}

.combobox-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combobox-chip-remove {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 3px;
}

.combobox-chip-remove:hover {
  color: var(--accent);
  background: var(--panel-2);
}

.combobox-input {
  flex: 1 0 100%;
  min-width: 60px;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font-size: 13px;
  padding: 4px 2px;
  font-family: inherit;
}

.combobox-input:focus,
.combobox-input:focus-visible {
  outline: none;
  box-shadow: none;
}

.combobox-input::placeholder {
  color: var(--muted);
}

.combobox-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 160px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  padding: 4px;
  z-index: 20;
}

.combobox-option {
  display: block;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combobox-option:hover,
.combobox-option.active {
  background: var(--panel-2);
}

.combobox-option-empty {
  padding: 6px 8px;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

.reset {
  align-self: end;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  height: 36px;
}

.reset:hover {
  color: var(--text);
  border-color: var(--accent);
}

.count {
  color: var(--muted);
  font-size: 12px;
  margin: 0 4px 12px;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 4px 10px;
}

.active-filters[hidden] {
  display: none;
}

.car-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 10px;
  background: var(--surface, rgba(0, 0, 0, 0.04));
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
}

.car-filter-pill-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.car-filter-pill-value {
  color: var(--text);
}

.car-filter-pill-clear {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 999px;
}

.car-filter-pill-clear:hover {
  color: var(--text);
  background: var(--border);
}

.filter-variant-search {
  position: relative;
  grid-column: 1 / -1;
}

.filter-variant-search input[type="search"] {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  width: 100%;
  font-family: inherit;
  box-sizing: border-box;
}

.filter-variant-search input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
}

.filter-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed var(--border);
  cursor: pointer;
}

.filter-link:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

@media (max-width: 700px) {
  .filters {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    padding: 12px;
    gap: 10px 12px;
  }
}
