/* ==========================================================================
   avtoscan.online — Профессиональный автомобильный терминал
   Чистый, современный дизайн без клише нейросетей
   ========================================================================== */

:root {
  --bg-app: #090d16;
  --bg-surface: #111b2d;
  --bg-card: #151f32;
  --bg-card-hover: #1a2740;
  --bg-input: #0c1423;
  --border-subtle: #1e293b;
  --border-medium: #50627c;
  --border-focus: #3b82f6;

  --text-primary: #f8fafc;
  --text-secondary: #b0bdd0;
  --text-muted: #9aa9be;
  --text-inverse: #0f172a;

  --accent-primary: #2863de;
  --accent-primary-hover: #2458c4;
  --accent-subtle: rgba(37, 99, 235, 0.12);

  --status-green: #10b981;
  --status-green-bg: rgba(16, 185, 129, 0.12);
  --status-green-border: rgba(16, 185, 129, 0.3);

  --status-yellow: #f59e0b;
  --status-yellow-bg: rgba(245, 158, 11, 0.12);
  --status-yellow-border: rgba(245, 158, 11, 0.3);

  --status-red: #ef4444;
  --status-red-bg: rgba(239, 68, 68, 0.12);
  --status-red-border: rgba(239, 68, 68, 0.3);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 16px;

  color-scheme: dark;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.25);
  --shadow-elevated: 0 12px 32px rgba(0, 0, 0, 0.4);
}

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

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ----------------- БАЗОВАЯ РАЗМЕТКА ----------------- */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 42px 28px 64px;
}

/* ----------------- ШАПКА И НАВИГАЦИЯ ----------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-app);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 28px;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* Бренд */
.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
  border: 0;
  background: none;
  flex-shrink: 0;
}

.brand-icon {
  display: grid;
  place-items: center;
  color: #73b9ff;
  width: 32px;
  height: 40px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

.brand-accent {
  color: #38bdf8;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

/* Навигационные табы */
.nav-sections {
  display: flex;
  align-items: stretch;
  gap: 22px;
  align-self: stretch;
}

.nav-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 12px 0;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font: 500 13px var(--font-family);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-tab:hover {
  color: var(--text-primary);
}

.nav-tab.active {
  color: #84bdff;
  border-bottom-color: #69aaff;
}

.nav-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--status-red);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
}

/* Блок пользователя */
.user-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-balance-widget {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 20px;
  padding: 4px 10px 4px 8px;
  font-size: 13px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.user-balance-widget[hidden] {
  display: none !important;
}

.user-balance-widget.empty-balance {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.25);
}

.user-balance-widget.empty-balance .balance-icon {
  background: rgba(239, 68, 68, 0.15);
  color: var(--status-red);
}

.balance-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.18);
  color: #60a5fa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.balance-number {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.btn-topup-link {
  background: transparent;
  border: none;
  color: #38bdf8;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s ease;
}

.btn-topup-link:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

.btn-auth-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--accent-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-auth-trigger:hover {
  background: var(--accent-primary-hover);
}

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

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 24px;
  padding: 4px 10px 4px 4px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-initial {
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s ease;
}

.btn-logout:hover {
  color: var(--status-red);
}

/* ----------------- КАРТОЧКА ПОИСКА И ФИЛЬТРОВ ----------------- */
.search-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 32px;
  margin-bottom: 36px;
}

.search-card-header {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.filter-headline {
  max-width: 600px;
}

.filter-title {
  font-size: 28px;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.6px;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.filter-sub {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
}

.filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Сетка полей формы */
.filter-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 26px 20px;
}

.form-row {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.form-row.span-all {
  grid-column: 1 / -1;
}

.field-label {
  font-size: 13px;
  font-weight: 550;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.label-with-hint {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0 8px;
  min-height: 29px;
}

.field-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* Переключатель площадки */
.platform-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.platform-option {
  position: relative;
  cursor: pointer;
}

.platform-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.platform-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  min-height: 48px;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.platform-option input:checked + .platform-card {
  background: #172d4e;
  border-color: #72afff;
}

.platform-icon {
  flex-shrink: 0;
  display: block;
}

.platform-brand-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

/* Инпуты и селекты */
input[type="number"], select {
  width: 100%;
  height: 48px;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font: 500 16px var(--font-family);
  font-variant-numeric: tabular-nums;
  padding: 0 14px;
  caret-color: #84bdff;
  transition: border-color 0.15s ease;
}

input[type="number"]:focus, select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.select-wrapper {
  position: relative;
  width: 100%;
}

.select-wrapper select {
  appearance: none;
  padding-right: 36px;
  cursor: pointer;
}

.select-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-muted);
}

/* Быстрые чипы под инпутами */
.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font: 500 12px var(--font-family);
  min-height: 32px;
  padding: 4px 9px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.chip-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

/* Кнопка запуска сканера */
.action-container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

.btn-primary-scan {
  min-width: 260px;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 12px 24px;
  background: var(--accent-primary);
  color: #fff;
  border: 0;
  border-radius: var(--radius-md);
  font: 600 14px var(--font-family);
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary-scan:hover {
  background: var(--accent-primary-hover);
}

.btn-primary-scan:active {
  transform: scale(0.99);
}

.btn-primary-scan:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ----------------- ПРОГРЕСС СКАНЕРА ----------------- */
.search-progress {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.progress-status-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
}

.progress-counter {
  font-weight: 600;
  color: var(--text-primary);
}

/* ----------------- ПЛАШКА 24-ЧАСОВОГО КЭША ----------------- */
.cache-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.cache-notice-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cache-icon {
  font-size: 20px;
}

.cache-text {
  display: flex;
  flex-direction: column;
  font-size: 13px;
}

.cache-text strong {
  color: #93c5fd;
  font-weight: 600;
}

.cache-text span {
  color: var(--text-secondary);
  font-size: 12px;
}

.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-refresh:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-primary);
}

/* ----------------- ПАНЕЛЬ РЕЗУЛЬТАТОВ ----------------- */
.results-container {
  margin-top: 32px;
}

.results-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.results-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.results-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #ffffff;
}

.results-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 2px 10px;
}

.results-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-secondary-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-secondary-action:hover {
  background: var(--bg-card);
  border-color: var(--accent-primary);
}

.verdict-filter-group {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.verdict-filter-tab {
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.verdict-filter-tab:hover {
  color: var(--text-primary);
}

.verdict-filter-tab.active {
  background: var(--bg-card);
  color: #ffffff;
  border: 1px solid var(--border-medium);
}

/* ----------------- СЕТКА КАРТОЧЕК ----------------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 24px;
}

.car-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease;
}

.car-card:hover {
  border-color: var(--border-medium);
}

/* Медиа-блок карточки */
.card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #020617;
  overflow: hidden;
}

.car-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.car-card:hover .car-photo {
  transform: none;
}

.photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

/* Кнопка Избранного (Сердечко) */
.btn-fav-heart {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(9, 13, 22, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.btn-fav-heart:hover {
  transform: scale(1.1);
  background: rgba(9, 13, 22, 0.9);
}

.btn-fav-heart.is-favorited {
  color: var(--status-red);
}

.btn-fav-heart.is-favorited svg {
  fill: var(--status-red);
  stroke: var(--status-red);
}

/* Бейджи на фото */
.media-badges {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: none;
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  letter-spacing: 0.2px;
}

.badge-status.status-green {
  background: #08734f;
  color: #fff;
}

.badge-status.status-yellow {
  background: rgba(245, 158, 11, 0.92);
  color: #0f172a;
}

.badge-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.tag-margin {
  background: rgba(37, 99, 235, 0.9);
  color: #ffffff;
}

.tag-assessment {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
}

/* Тело карточки */
.card-content {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.title-row {
  margin-bottom: 8px;
}

.car-title {
  font-size: 18px;
  font-weight: 650;
  color: var(--text-primary);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.specs-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.spec-pill {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.pricing-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-variant-numeric: tabular-nums;
}

.price-main {
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.price-market-ref {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Вердикт и чек-лист */
.verdict-box {
  padding: 0;
  margin-bottom: 20px;
  flex: 1;
}

.verdict-summary {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.checklist-grid {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 1.35;
}

.checklist-item svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.checklist-item.pos {
  color: #34d399;
}

.checklist-item.risk {
  color: var(--text-secondary);
}

/* Блок обратной связи (лайк / дизлайк для дообучения) */
.card-feedback-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-subtle);
  gap: 8px;
}

.feedback-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.feedback-actions {
  display: flex;
  gap: 6px;
}

.btn-fb-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-fb-action:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.btn-fb-like:hover, .btn-fb-like.active-like {
  background: var(--status-green-bg);
  border-color: var(--status-green-border);
  color: #34d399;
}

.btn-fb-dislike:hover, .btn-fb-dislike.active-dislike {
  background: var(--status-red-bg);
  border-color: var(--status-red-border);
  color: #f87171;
}

/* Выпадающий блок причин ошибки */
.feedback-dislike-box {
  margin-top: 10px;
  padding: 10px;
  background: #0b1120;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  animation: modalFadeIn 0.15s ease-out;
}

.dislike-title {
  font-size: 11px;
  font-weight: 600;
  color: #93c5fd;
  margin-bottom: 8px;
}

.dislike-reasons-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.reason-tag-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 7px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.reason-tag-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--status-red-border);
  color: #fca5a5;
}

.feedback-custom-comment {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.custom-comment-input {
  flex: 1;
  height: 32px;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 11px;
  padding: 0 8px;
}

.btn-send-custom-comment {
  background: var(--accent-primary);
  border: none;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 0 10px;
  cursor: pointer;
}

.btn-send-custom-comment:hover {
  background: var(--accent-primary-hover);
}

.footer-export-link {
  color: #93c5fd !important;
  text-decoration: none;
  border-color: rgba(147, 197, 253, 0.3) !important;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.footer-export-link:hover {
  background: rgba(147, 197, 253, 0.1) !important;
  color: #ffffff !important;
}

/* Кнопка перехода */
.card-bottom {
  margin-top: auto;
}

.btn-open-listing {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-open-listing:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
}

/* ----------------- ВИДЫ: ИЗБРАННОЕ И СОХРАНЁННЫЕ ПОИСКИ ----------------- */
.view-panel {
  display: block;
}

.view-panel[hidden] {
  display: none !important;
}

.section-title-wrap {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.section-main-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: #ffffff;
  margin-bottom: 4px;
}

.section-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Сохранённые поиски */
.saved-scans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr));
  gap: 20px;
}

.saved-scan-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-card);
  transition: border-color 0.15s ease;
}

.saved-scan-card:hover {
  border-color: var(--border-medium);
}

.saved-scan-main {
  flex: 1;
}

.saved-scan-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.platform-mini-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.platform-mini-tag.drom {
  background: rgba(220, 38, 38, 0.15);
  color: #f87171;
}

.platform-mini-tag.avito {
  background: rgba(0, 170, 100, 0.15);
  color: #4ade80;
}

.platform-mini-tag.autoru {
  background: rgba(232, 72, 85, 0.15);
  color: #fb7185;
}

.date-mini-tag {
  font-size: 11px;
  color: var(--text-muted);
}

.saved-scan-name {
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 6px;
}

.saved-scan-params {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.saved-scan-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-run-scan {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-run-scan:hover {
  background: var(--accent-primary-hover);
}

.btn-del-scan {
  width: 34px;
  height: 34px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-del-scan:hover {
  color: var(--status-red);
  border-color: var(--status-red-border);
}

/* Пустые состояния */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  grid-column: 1 / -1;
  max-width: 540px;
  margin: 24px auto;
}

.empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--text-muted);
}

.empty-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
}

.empty-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.btn-return-search {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 18px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-return-search:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
}

/* ----------------- МОДАЛЬНОЕ ОКНО ВХОДА ----------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(5, 8, 14, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-window {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: 36px 28px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.6);
  text-align: center;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
}

.modal-close-btn:hover {
  color: #ffffff;
}

.modal-icon-badge {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  margin: 0 auto 16px;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 8px;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 24px;
}

.oauth-buttons-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 48px;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
  padding: 0 16px;
}

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

/* Кнопка Яндекс ID */
.btn-yandex {
  background: #000000;
  color: #ffffff;
  border: 1px solid #27272a;
}

.btn-yandex:hover {
  background: #18181b;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.yandex-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fc3f1d;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
}

/* Кнопка Google */
.btn-google {
  background: #ffffff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
}

.btn-google:hover {
  background: #f9fafb;
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.15);
}

.modal-notice {
  font-size: 11px;
  color: var(--text-muted);
}

/* ----------------- МОДАЛЬНОЕ ОКНО ОПЛАТЫ (ЮKASSA) ----------------- */
.payment-modal-window {
  max-width: 820px;
  padding: 32px 30px;
  text-align: left;
}

.payment-modal-window .modal-header {
  text-align: center;
  max-width: 560px;
  margin: 0 auto 26px;
}

.payment-badge {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.3);
  color: #60a5fa;
}

.pricing-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.pricing-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.pricing-card:hover {
  border-color: #72afff;
}

.pricing-card.featured {
  background: #172d4e;
  border: 1px solid #72afff;
}

.card-ribbon {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-primary);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 10px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.card-ribbon-subtle {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: #047857;
  color: #d1fae5;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 10px;
  border-radius: 12px;
}

.pricing-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

.pkg-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
}

.pkg-scans {
  font-size: 13px;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
}

.pkg-price-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}

.pkg-price-val {
  font-size: 26px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.pkg-price-unit {
  font-size: 12px;
  color: var(--text-muted);
}

.pkg-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 20px;
  flex: 1;
}

.btn-buy-package {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-buy-package:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.btn-buy-featured {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-buy-featured:hover {
  background: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
}

.btn-buy-package:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.payment-security-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.security-methods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.method-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 3px 8px;
}

.security-note {
  font-size: 12px;
  color: var(--text-muted);
}

@media (max-width: 720px) {
  .pricing-cards-grid {
    grid-template-columns: 1fr;
  }
  .payment-modal-window {
    padding: 24px 16px;
  }
}

/* ----------------- TOAST УВЕДОМЛЕНИЯ ----------------- */
.toast-shelf {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0f172a;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
  animation: toastSlideIn 0.25s ease-out;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-item.fade-out {
  opacity: 0;
  transform: translateY(10px);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-primary);
}

.toast-success .toast-indicator {
  background: var(--status-green);
}

.toast-error .toast-indicator {
  background: var(--status-red);
}

.toast-message {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

/* ----------------- ПОДВАЛ ----------------- */
.app-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 24px 28px;
  margin-top: auto;
}

.footer-inner {
  max-width: 1144px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

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

.footer-name {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

.footer-copy {
  font-size: 12px;
  color: var(--text-muted);
}

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

.footer-legal-link {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-legal-link:hover {
  color: #8cc4ff;
  text-decoration: underline;
}

.footer-legal-divider {
  font-size: 10px;
  color: var(--border-medium);
}

.footer-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-tag {
  font-size: 11px;
  color: var(--text-muted);
  padding: 3px 0;
}

/* Shared interaction states and search guidance */
[hidden] { display: none !important; }
::selection { background: #315b94; color: #fff; }
:focus-visible { outline: 2px solid #8cc4ff; outline-offset: 4px; }
a { text-underline-offset: 4px; }
svg { flex-shrink: 0; }
.skip-link { position: fixed; top: 8px; left: 12px; transform: translateY(-160%); z-index: 2000; background: var(--accent-primary); color: white; padding: 12px 18px; border-radius: 8px; }
.skip-link:focus { transform: none; }
.tag-pill::before { content: ''; width: 10px; height: 6px; border-bottom: 1.5px solid #9aa9be; border-left: 1.5px solid #9aa9be; transform: rotate(-45deg); margin-top: -3px; }
.platform-field, .region-field { grid-column: span 2; }
.region-field select { min-height: 72px; font-size: 14px; }
.platform-option input:focus-visible + .platform-card { outline: 2px solid #8cc4ff; outline-offset: 4px; }
.platform-option:hover .platform-card { border-color: #8cc4ff; }
.search-action-note { color: var(--text-muted); font-size: 12px; line-height: 1.6; }
.link-inline-tariffs {
  background: none;
  border: none;
  color: #38bdf8;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}
.link-inline-tariffs:hover { color: #7dd3fc; }
.note-separator { margin: 0 5px; color: var(--text-muted); opacity: 0.6; }
.nav-tab-tariffs { color: #93c5fd; }
.nav-tab-tariffs:hover { color: #bfdbfe; }
.search-welcome { display: grid; grid-template-columns: 1fr 1.15fr; gap: 60px; padding: 0 32px; }
.welcome-copy h2 { font-size: 21px; font-weight: 600; letter-spacing: -0.3px; margin-bottom: 10px; }
.welcome-copy p { color: var(--text-muted); max-width: 39ch; line-height: 1.75; font-size: 13px; }
.search-steps { display: flex; flex-direction: column; gap: 18px; counter-reset: search-step; list-style: none; }
.search-steps li { display: grid; grid-template-columns: 28px 1fr; column-gap: 12px; counter-increment: search-step; }
.search-steps li::before { content: counter(search-step); grid-row: span 2; font-size: 12px; color: var(--text-muted); width: 26px; height: 26px; border: 1px solid var(--border-medium); border-radius: 50%; display: grid; place-items: center; }
.search-steps strong { font-size: 13px; font-weight: 550; }
.search-steps span { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.results-container { scroll-margin-top: 104px; }
.btn-logout, .btn-del-scan, .btn-fav-heart { min-width: 44px; min-height: 44px; }
.btn-secondary-action, .btn-refresh, .verdict-filter-tab, .btn-return-search, .btn-run-scan, .btn-buy-package, .btn-auth-trigger { min-height: 44px; }
.btn-fb-action, .reason-tag-btn { min-height: 36px; }
.results-actions, .verdict-filter-group, .saved-scan-card { flex-wrap: wrap; }
.car-card, .saved-scan-main, .card-content { overflow-wrap: anywhere; }
.cards-grid > .loading-state, .cards-grid > .error-state, .saved-scans-grid > .loading-state, .saved-scans-grid > .error-state { grid-column: 1 / -1; padding: 24px; color: var(--text-secondary); }
.footer-links { gap: 8px 20px; }
.footer-export-link { text-decoration: underline; }
.badge-status.status-red { background: #a52636; color: white; }
.toast-shelf { max-width: calc(100vw - 32px); }
.toast-message { overflow-wrap: anywhere; }
@media (max-width: 1100px) {
  .header-inner { flex-wrap: wrap; gap: 0 20px; padding-top: 16px; }
  .nav-sections { order: 3; width: 100%; margin-top: 10px; min-height: 50px; }
  .user-block { margin-left: auto; }
}
@media (max-width: 900px) {
  .main-content { padding-top: 28px; }
  .filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .platform-field, .region-field { grid-column: 1 / -1; }
  .region-field select { min-height: 48px; }
  .search-card { padding: 26px; }
  .search-welcome { gap: 30px; padding: 0 26px; }
  .results-header-bar { align-items: flex-start; flex-direction: column; gap: 16px; }
}
@media (max-width: 600px) {
  .header-inner { padding: 14px 20px 0; gap: 12px; }
  .brand-subtitle { display: none; }
  .brand-block { gap: 6px; }
  .brand-title { font-size: 16px; }
  .brand-icon { width: 26px; height: 30px; }
  .nav-sections { gap: 20px; margin-top: 0; justify-content: space-between; }
  .nav-tab { gap: 5px; font-size: 12px; }
  .nav-tab svg { display: none; }
  .nav-counter { padding: 1px 4px; }
  .user-block { gap: 8px; flex-wrap: wrap; }
  .user-name { display: none; }
  .user-pill { gap: 2px; }
  .user-balance-widget { padding: 6px 8px; gap: 6px; }
  .main-content { padding: 24px 16px 40px; }
  .search-card { padding: 22px 18px; margin-bottom: 28px; }
  .filter-title { font-size: 24px; }
  .filter-sub { font-size: 13px; }
  .search-card-header { gap: 16px; padding-bottom: 20px; margin-bottom: 22px; }
  .filter-tags { gap: 8px 16px; }
  .tag-pill { font-size: 11px; }
  .filter-form { gap: 22px 14px; }
  .platform-switch { gap: 10px; }
  .platform-card { gap: 4px; padding: 12px; }
  .platform-name { display: none; }
  .field-label { font-size: 12px; }
  .field-hint { font-size: 10px; }
  .chip-btn { min-height: 40px; padding: 4px; font-size: 11px; }
  .quick-chips { gap: 2px; }
  input[type="number"], select { padding-left: 10px; }
  .action-container { flex-direction: column; align-items: stretch; gap: 12px; padding-top: 20px; }
  .btn-primary-scan { min-width: 0; width: 100%; order: -1; }
  .search-action-note { text-align: center; font-size: 11px; }
  .search-welcome { grid-template-columns: 1fr; gap: 24px; padding: 0 18px; }
  .cards-grid, .saved-scans-grid { grid-template-columns: 1fr; }
  .verdict-filter-group { width: 100%; gap: 4px; }
  .verdict-filter-tab { padding: 8px; font-size: 11px; }
  .results-actions { width: 100%; gap: 12px; }
  .cache-notice { align-items: flex-start; flex-direction: column; gap: 12px; }
  .modal-backdrop { padding: 12px; }
  .modal-window { padding: 32px 22px 24px; max-height: calc(100dvh - 24px); }
  .payment-modal-window { padding: 32px 18px 24px; }
  .pricing-card { padding: 20px; }
  .pricing-cards-grid { gap: 22px; }
  .app-footer { padding: 24px; }
  .footer-links { gap: 8px 16px; }
  .footer-copy { max-width: 40ch; }
  .section-main-title { font-size: 22px; }
}
@media (max-width: 370px) {
  .filter-form { grid-template-columns: minmax(0, 1fr); }
  .nav-sections { gap: 10px; }
  .header-inner { padding-left: 16px; padding-right: 16px; }
  .nav-tab { font-size: 11px; }
  .user-block { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
