:root {
  --bg: #0c0f12;
  --bg-elevated: #141a21;
  --bg-card: #1a222b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #ece8e1;
  --text-muted: #9aa3ad;
  --text-dim: #6b7680;
  --accent: #e8a54b;
  --accent-soft: rgba(232, 165, 75, 0.14);
  --accent-glow: rgba(232, 165, 75, 0.35);
  --success: #3ecf8e;
  --success-soft: rgba(62, 207, 142, 0.12);
  --warning: #f0b429;
  --warning-soft: rgba(240, 180, 41, 0.12);
  --error: #f07178;
  --error-soft: rgba(240, 113, 120, 0.12);
  --idle: #7c8a96;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.page-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 15% -5%, rgba(232, 165, 75, 0.12), transparent 55%),
    radial-gradient(ellipse 50% 35% at 90% 0%, rgba(62, 207, 142, 0.06), transparent 50%);
  z-index: 0;
}

.container {
  width: min(1080px, calc(100% - 2.5rem));
  margin-inline: auto;
  position: relative;
  z-index: 1;
}

.mono {
  font-family: var(--mono);
  font-size: 0.82rem;
}

/* Header */

.site-header {
  padding: 1.25rem 0 1rem;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(12, 15, 18, 0.82);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-link {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.nav-link.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(232, 165, 75, 0.25);
}

.brand-mark {
  width: 10px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), #c47d24);
  box-shadow: 0 0 24px var(--accent-glow);
}

.brand-eyebrow {
  margin: 0 0 0.1rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.brand-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.65rem, 3.5vw, 2.15rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

/* Page layout */

.page {
  padding: 2rem 0 4rem;
}

.page-body {
  background: linear-gradient(165deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}

.page-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.85rem;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.page-desc {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
  max-width: 52ch;
  font-size: 0.95rem;
}

.loading-line {
  color: var(--text-dim);
  margin: 0;
  font-style: italic;
}

/* Form */

.settings-form {
  display: grid;
  gap: 1.25rem;
}

.form-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.field-label-note {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-dim);
}

.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  padding: 0.8rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus {
  outline: none;
  border-color: rgba(232, 165, 75, 0.5);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-hint {
  font-size: 0.76rem;
  color: var(--text-dim);
}

.input-with-btn {
  display: grid;
  gap: 0.5rem;
}

@media (min-width: 520px) {
  .input-with-btn {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}

.input-with-btn .btn {
  white-space: nowrap;
}

.toggle-field {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

.toggle-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  flex-shrink: 0;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border);
  position: relative;
  margin-top: 2px;
  transition: background 0.2s;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.2s, background 0.2s;
}

.toggle-field input:checked + .toggle-track {
  background: var(--accent-soft);
  border-color: rgba(232, 165, 75, 0.4);
}

.toggle-field input:checked + .toggle-track::after {
  transform: translateX(18px);
  background: var(--accent);
}

.toggle-copy strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 0.15rem;
}

.toggle-copy small {
  color: var(--text-dim);
  font-size: 0.8rem;
  line-height: 1.4;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-feedback {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  min-height: 1.25rem;
}

.form-feedback.success {
  color: var(--success);
}

.form-feedback.error {
  color: var(--error);
}

/* Telegram setup */

.telegram-setup-note {
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  border-color: rgba(62, 207, 142, 0.2);
  background: rgba(62, 207, 142, 0.06);
}

.telegram-setup-title {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.telegram-setup-steps {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.4rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.telegram-setup-steps code {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text);
}

.telegram-bot-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.telegram-bot-link:hover {
  text-decoration: underline;
}

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

.field-hint a:hover {
  text-decoration: underline;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #c47d24);
  color: #1a1208;
  box-shadow: 0 8px 28px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
}

.btn-danger {
  color: #f3a6a6;
  border-color: rgba(243, 166, 166, 0.35);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #2a9d62);
  color: #071a10;
  box-shadow: 0 8px 28px rgba(62, 207, 142, 0.28);
}

.btn-success:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-danger:hover:not(:disabled) {
  color: #ffd0d0;
  border-color: rgba(243, 166, 166, 0.55);
  background: rgba(243, 166, 166, 0.08);
}

/* Footer */

.site-footer {
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-link:hover {
  color: var(--accent);
}

/* Search / Filters page */

.filters-page .page-body {
  margin-bottom: 2rem;
}

.search-layout {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 960px) {
  .search-layout {
    grid-template-columns: minmax(280px, 320px) 1fr;
    align-items: start;
  }
}

.card-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(165deg, rgba(26, 34, 43, 0.92) 0%, rgba(12, 15, 18, 0.65) 100%);
  padding: 1.25rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

/* Profiles sidebar */

.profiles-sidebar {
  display: grid;
  gap: 1rem;
  align-content: start;
  position: sticky;
  top: 5.5rem;
}

.profiles-sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.profiles-sidebar-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.profiles-sidebar-meta {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.profiles-hint {
  margin: 0;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.76rem;
  color: var(--text-dim);
  line-height: 1.45;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.btn-icon {
  font-size: 1.1rem;
  line-height: 1;
  margin-right: 0.15rem;
}

.profile-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.profile-empty-state {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
  text-align: center;
  padding: 1.5rem 0.75rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
}

.profile-empty-icon {
  font-size: 1.5rem;
  color: var(--text-muted);
  opacity: 0.6;
}

.profile-empty-state p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.profile-empty-state small {
  font-size: 0.76rem;
  line-height: 1.4;
}

.profile-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.profile-item:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
}

.profile-item.is-selected {
  border-color: rgba(232, 165, 75, 0.5);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.profile-item-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--idle);
}

.profile-item-dot.is-active {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.profile-item-body {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.1rem;
}

.profile-item-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-item-summary {
  font-size: 0.72rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-badge {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.profile-badge.is-active {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(62, 207, 142, 0.25);
}

.profile-badge.is-seeded {
  color: var(--accent);
  background: rgba(99, 179, 237, 0.12);
  border-color: rgba(99, 179, 237, 0.25);
}

/* Filter editor */

.filters-editor {
  min-width: 0;
}

.ai-filter-row {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(232, 165, 75, 0.22);
  background: linear-gradient(135deg, rgba(232, 165, 75, 0.08), rgba(0, 0, 0, 0.2));
}

.ai-filter-head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.ai-filter-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #1a1208;
  background: linear-gradient(135deg, var(--accent), #c47d24);
}

.ai-filter-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
}

.ai-filter-desc {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.ai-filter-input-row {
  display: grid;
  gap: 0.65rem;
}

@media (min-width: 640px) {
  .ai-filter-input-row {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}

.ai-filter-feedback {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-dim);
  min-height: 1.2rem;
}

.ai-filter-feedback.is-success {
  color: var(--success);
}

.ai-filter-feedback.is-error {
  color: var(--error);
}

.search-filters {
  display: grid;
  gap: 1.25rem;
}

.filter-editor-header {
  display: grid;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 720px) {
  .filter-editor-header {
    grid-template-columns: 1fr auto;
    align-items: end;
    gap: 1.25rem;
  }
}

.filter-editor-title-wrap {
  min-width: 0;
}

.toggle-field-compact {
  margin: 0;
  align-self: end;
}

.field-input,
.field-select {
  width: 100%;
  padding: 0.78rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.32);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.field-input-lg {
  font-size: 1rem;
  font-weight: 500;
  padding: 0.85rem 1rem;
}

.field-input::placeholder {
  color: var(--text-dim);
}

.field-input:hover,
.field-select:hover {
  border-color: var(--border-strong);
  background: rgba(0, 0, 0, 0.38);
}

.field-input:focus,
.field-select:focus {
  outline: none;
  border-color: rgba(232, 165, 75, 0.55);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: rgba(0, 0, 0, 0.42);
}

.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 1rem;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.field-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.5rem;
  cursor: pointer;
}

.field-brand {
  position: relative;
}

.brand-combobox {
  position: relative;
}

.brand-combobox-trigger {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.78rem 2.5rem 0.78rem 0.95rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.32);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.brand-combobox-trigger::after {
  content: "";
  position: absolute;
  right: 1rem;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: translateY(-15%) rotate(45deg);
  pointer-events: none;
}

.brand-combobox-trigger:hover,
.brand-combobox-trigger:focus {
  outline: none;
  border-color: var(--border-strong);
  background: rgba(0, 0, 0, 0.38);
}

.brand-combobox-trigger[aria-expanded="true"] {
  border-color: rgba(232, 165, 75, 0.55);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: rgba(0, 0, 0, 0.42);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.brand-combobox.is-disabled .brand-combobox-trigger,
.brand-combobox-trigger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.brand-combobox-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-combobox-panel {
  position: absolute;
  z-index: 30;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: -1px;
  border: 1px solid rgba(232, 165, 75, 0.55);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: #141210;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.brand-combobox-panel.is-open {
  position: fixed;
  z-index: 1000;
  right: auto;
  margin-top: 0;
}

.brand-combobox-search-wrap {
  padding: 0.55rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.brand-combobox-search {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: calc(var(--radius-sm) - 2px);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.85rem;
}

.brand-combobox-search:focus {
  outline: none;
  border-color: rgba(232, 165, 75, 0.45);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.brand-combobox-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  max-height: min(28rem, 65vh);
  overflow-y: auto;
}

.brand-combobox-option {
  padding: 0.62rem 0.95rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.brand-combobox-option:hover,
.brand-combobox-option.is-highlighted {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.brand-combobox-option.is-selected {
  color: var(--accent);
  font-weight: 500;
}

.brand-combobox-empty {
  padding: 0.75rem 0.95rem;
  font-size: 0.82rem;
  color: var(--text-dim);
  cursor: default;
}

.as24-location-autocomplete {
  position: relative;
}

.as24-location-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.as24-location-query {
  width: 100%;
  padding-right: 2.65rem;
}

.as24-location-autocomplete.has-value .as24-location-query {
  padding-right: 2.85rem;
}

.as24-location-autocomplete.is-open .as24-location-query {
  border-color: rgba(232, 165, 75, 0.55);
  box-shadow: 0 0 0 3px var(--accent-soft);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.as24-location-query.is-committed {
  border-color: rgba(62, 207, 142, 0.35);
}

.as24-location-clear {
  position: absolute;
  top: 50%;
  right: 0.55rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.55rem;
  height: 1.55rem;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  cursor: pointer;
  transform: translateY(-50%);
  opacity: 0.72;
  transition:
    opacity 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.as24-location-clear svg {
  display: block;
  flex: 0 0 auto;
}

.as24-location-input-wrap:hover .as24-location-clear,
.as24-location-clear:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--text);
  transform: translateY(-50%) scale(1.04);
}

.as24-location-clear:focus {
  outline: none;
}

.as24-location-clear:focus-visible {
  opacity: 1;
  border-color: rgba(232, 165, 75, 0.45);
  box-shadow: 0 0 0 3px var(--accent-soft);
  color: var(--text);
}

.as24-location-clear:active {
  transform: translateY(-50%) scale(0.96);
  background: rgba(255, 255, 255, 0.14);
}

.as24-location-clear[hidden] {
  display: none;
}

.as24-location-panel {
  position: absolute;
  z-index: 40;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: -1px;
  overflow: hidden;
  border: 1px solid rgba(232, 165, 75, 0.55);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: rgba(0, 0, 0, 0.42);
  box-shadow:
    0 0 0 3px var(--accent-soft),
    0 16px 40px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(10px);
}

.as24-location-panel.is-open {
  position: fixed;
  z-index: 1000;
  right: auto;
  margin-top: 0;
}

.as24-location-suggestions {
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  max-height: 16.5rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 165, 75, 0.35) transparent;
}

.as24-location-suggestions::-webkit-scrollbar {
  width: 0.45rem;
}

.as24-location-suggestions::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(232, 165, 75, 0.28);
}

.as24-location-suggestions::-webkit-scrollbar-thumb:hover {
  background: rgba(232, 165, 75, 0.42);
}

.as24-location-suggestion {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin: 0;
  padding: 0.72rem 0.75rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.as24-location-suggestion + .as24-location-suggestion {
  margin-top: 0.15rem;
}

.as24-location-suggestion:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
}

.as24-location-suggestion.is-highlighted {
  background: var(--accent-soft);
  border-color: rgba(232, 165, 75, 0.22);
  box-shadow: inset 3px 0 0 var(--accent);
}

.as24-location-suggestion-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  margin-top: 0.05rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--accent);
}

.as24-location-suggestion.is-highlighted .as24-location-suggestion-icon {
  background: rgba(232, 165, 75, 0.16);
  border-color: rgba(232, 165, 75, 0.28);
}

.as24-location-suggestion-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1;
}

.as24-location-suggestion-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  min-width: 0;
}

.as24-location-suggestion-label {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.35;
  min-width: 0;
}

.as24-location-suggestion-postcode {
  flex: 0 0 auto;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid rgba(232, 165, 75, 0.22);
  background: rgba(232, 165, 75, 0.1);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.as24-location-suggestion-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.as24-location-match {
  padding: 0 0.1rem;
  border-radius: 0.15rem;
  background: rgba(232, 165, 75, 0.24);
  color: var(--text);
}

.as24-location-empty,
.as24-location-hint,
.as24-location-loading {
  margin: 0.15rem 0;
  padding: 0.85rem 0.95rem;
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: calc(var(--radius-sm) - 2px);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  cursor: default;
  font-size: 0.84rem;
  line-height: 1.45;
  text-align: center;
}

.as24-location-loading {
  position: relative;
  padding-left: 2.35rem;
  text-align: left;
}

.as24-location-loading::before {
  content: "";
  position: absolute;
  left: 0.95rem;
  top: 50%;
  width: 0.85rem;
  height: 0.85rem;
  margin-top: -0.42rem;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: as24-location-spin 0.7s linear infinite;
}

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

.as24-location-radius-field:not(.is-visible) {
  display: none;
}

.as24-location-radius-field.is-visible {
  animation: as24-radius-reveal 0.18s ease-out;
}

@keyframes as24-radius-reveal {
  from {
    opacity: 0;
    transform: translateY(-0.25rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.as24-location-city-field {
  position: relative;
  z-index: 2;
}

.alert-banner {
  margin: 0;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  line-height: 1.45;
  border: 1px solid var(--border);
}

.alert-banner-info {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
}

.alert-banner-active {
  color: #c8f0dd;
  background: var(--success-soft);
  border-color: rgba(62, 207, 142, 0.22);
}

.alert-banner-muted {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.02);
}

.filters-sections {
  display: grid;
  gap: 1rem;
  overflow: visible;
}

.filter-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
  overflow: visible;
}

.filter-section-head {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.filter-section-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
}

.filter-section-desc {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.filter-section-body {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

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

.filter-section-body .filter-group,
.filter-section-body .field-brand {
    grid-column: 1 / -1;
  }
}

/* Vehicle filter subsections */

.filter-section-body:has(> .vehicle-filters-root) {
  display: block;
  padding: 0.85rem;
}

.vehicle-filters-root {
  width: 100%;
}

.vehicle-filters-grid {
  display: grid;
  gap: 0.75rem;
}

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

  .vehicle-filter-card-wide {
    grid-column: 1 / -1;
  }
}

.vehicle-filter-card {
  margin: 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.vehicle-filter-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.vehicle-filter-card-intro {
  min-width: 0;
}

.vehicle-filter-card .filter-group-title {
  margin: 0;
  font-size: 0.86rem;
  letter-spacing: 0.01em;
}

.vehicle-filter-card .filter-group-hint {
  margin: 0.25rem 0 0;
  line-height: 1.4;
}

.vehicle-filter-card .chip-clear {
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.vehicle-filter-card .filter-options {
  gap: 0.45rem;
}

.vehicle-filter-card-wide .chip-grid {
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
}

.vehicle-filter-card-compact .filter-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(5.75rem, 1fr));
}

.vehicle-filter-card-compact .chip-option {
  justify-content: center;
  text-align: center;
  padding: 0.6rem 0.55rem;
  min-height: 2.35rem;
}

.vehicle-filter-card-compact .chip-label {
  font-size: 0.8rem;
}

.vehicle-filters-empty {
  margin: 0;
  padding: 0.5rem 0.25rem;
  font-size: 0.82rem;
  color: var(--text-dim);
  text-align: center;
}

.model-field-section {
  grid-column: 1 / -1;
  margin-top: 0.15rem;
}

.model-field-section .vehicle-filter-card {
  padding: 1.25rem 1.35rem 1.4rem;
  gap: 0.9rem;
}

.model-field-section .vehicle-filter-card-head {
  padding-bottom: 0.15rem;
}

.model-field-section .vehicle-filter-card .filter-options,
.model-field-section .vehicle-filter-card .chip-grid {
  padding: 0.2rem 0.15rem 0.1rem;
}

.model-field-section .field-model {
  padding: 1.25rem 1.35rem 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.025);
  gap: 0.65rem;
}

.model-field-section .field-model .filter-group-hint {
  margin: 0;
}

.filter-group {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 0.75rem;
}

.filter-group-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text);
  padding: 0;
  margin-bottom: 0.15rem;
}

.filter-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.filter-group-hint {
  margin: 0 0 0.5rem;
  font-size: 0.76rem;
  color: var(--text-dim);
}

.filter-marketplace-note {
  margin: 0.75rem 0 0;
  padding: 0.625rem 0.75rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-dim);
  background: rgba(59, 130, 246, 0.08);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

.marketplace-site-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.85rem 0 0;
  padding: 0;
  list-style: none;
}

.marketplace-site-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.8125rem;
}

.marketplace-site-item--error {
  border-color: rgba(248, 113, 113, 0.45);
}

.marketplace-site-label {
  font-weight: 600;
  color: var(--text-primary);
}

.marketplace-site-host {
  color: var(--text-dim);
  font-size: 0.75rem;
}

.listings-group-host {
  margin: 0.15rem 0 0;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.link-btn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.76rem;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-btn:hover {
  color: #f0bb6a;
}

.filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.5rem;
}

.chip-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  min-height: 2.5rem;
}

.chip-option:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.chip-option:has(input:checked) {
  border-color: rgba(232, 165, 75, 0.5);
  background: var(--accent-soft);
  color: var(--text);
}

.chip-option input {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--accent);
}

.chip-label {
  line-height: 1.3;
}

.filter-group-range .range-row {
  display: grid;
  gap: 0.75rem;
  align-items: end;
}

@media (min-width: 520px) {
  .filter-group-range .range-row {
    grid-template-columns: 1fr auto 1fr;
  }
}

.range-separator {
  display: none;
  color: var(--text-dim);
  font-size: 0.9rem;
  padding-bottom: 0.85rem;
  text-align: center;
}

@media (min-width: 520px) {
  .range-separator {
    display: block;
  }
}

.form-actions-bar {
  display: grid;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.search-filters.is-readonly .filters-sections,
.search-filters.is-readonly .filter-editor-header {
  pointer-events: none;
}

.search-filters.is-readonly .filter-editor-header .field-input:disabled,
.search-filters.is-readonly .toggle-field input:disabled + .toggle-track {
  opacity: 0.85;
}

.form-feedback.is-success {
  color: var(--success);
}

.form-feedback.is-error {
  color: var(--error);
}

/* Listings page */

.listings-page .page-body {
  margin-bottom: 2rem;
}

.listings-toolbar {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1rem;
  align-items: end;
}

.listings-filters {
  display: grid;
  gap: 0.85rem;
}

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

@media (min-width: 960px) {
  .listings-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.25rem;
  }
}

.listings-filter-field {
  margin: 0;
}

.listings-summary {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  align-self: center;
}

.listings-groups {
  display: grid;
  gap: 1.25rem;
}

.listings-group {
  display: grid;
  gap: 1rem;
}

.listings-group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.listings-group-title {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 500;
}

.listings-group-meta {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.listings-grid {
  display: grid;
  gap: 0.85rem;
}

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

.listings-empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-dim);
}

.listings-empty-state p {
  margin: 0;
  color: var(--text-muted);
}

.listings-empty-state small {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
}

.listings-empty {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.listing-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.listing-badge {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
}

.listing-badge-pinned {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(232, 165, 75, 0.25);
}

.listing-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}

.listing-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.15rem;
}

.listing-scraped {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.listing-detail-label {
  color: var(--text-dim);
}

/* Search results / listing cards */
.search-results {
  display: grid;
  gap: 1rem;
  min-height: 240px;
}

.search-results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.search-results-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 400;
}

.search-results-meta {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.search-results-grid {
  display: grid;
  gap: 0.85rem;
}

.search-results-empty {
  margin: 0;
}

.listing-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 0.85rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
}

.listing-thumb {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.listing-thumb-empty {
  border: 1px dashed var(--border);
}

.listing-body {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.listing-title {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.35;
}

.listing-price {
  margin: 0;
  font-weight: 600;
  color: var(--accent);
}

.listing-details {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.15rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.listing-link {
  font-size: 0.82rem;
  color: var(--text);
  text-decoration: none;
}

.listing-link:hover {
  color: var(--accent);
}

.profile-test-results {
  margin-top: 1rem;
}

.profile-test-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.profile-test-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.profile-test-summary {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.profile-test-feedback {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
}

.profile-test-feedback.is-info {
  color: var(--text-muted);
}

.profile-test-listings {
  display: grid;
  gap: 1.25rem;
}

.profile-test-group {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.listing-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.listing-meta {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* Login */

body.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-shell {
  width: min(420px, calc(100% - 2rem));
  position: relative;
  z-index: 1;
}

.login-card {
  padding: 2rem 1.75rem;
}

.login-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.login-title {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.1;
}

.login-desc {
  margin: 0 0 1.35rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.login-form {
  display: grid;
  gap: 1rem;
}

.login-feedback {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.login-feedback.is-error {
  color: var(--error);
  background: var(--error-soft);
}

.login-feedback.is-success {
  color: var(--success);
  background: var(--success-soft);
}

.nav-link-btn {
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
}

#logout-btn {
  color: var(--error);
  border: 1px solid rgba(240, 113, 120, 0.25);
}

#logout-btn:hover {
  color: #ffd0d0;
  background: var(--error-soft);
  border-color: rgba(240, 113, 120, 0.45);
}

.account-form {
  max-width: 420px;
}

.account-form .form-actions {
  margin-top: 0.25rem;
}
