@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ============================================
   ДИЗАЙН-СИСТЕМА
   ============================================ */
:root {
  --primary: #2D6A4F;
  --primary-dark: #235C41;
  --primary-light: #E8F3EE;
  --text-primary: #1A1A1A;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --border: #E5E7EB;
  --border-strong: #D1D5DB;
  --background: #FFFFFF;
  --background-soft: #F9FAFB;
  --background-section: #F4F6F8;
  --danger: #DC2626;
  --danger-light: #FEE2E2;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --success: #10B981;
  --success-light: #D1FAE5;
  --dark: #1A1A2E;
  --dark-2: #16213E;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08);

  /* Единый easing проекта (task 21) — cubic-bezier(0.4,0,0.2,1) */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --transition: all 150ms var(--ease);
  --transition-slow: all 250ms var(--ease);
}

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

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
}

/* GLOBAL overflow guard — prevents horizontal scroll on any page */
html { overflow-x: hidden; }
img, video, iframe, svg { max-width: 100%; }

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
  width: 100%;
}

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

a:hover { color: var(--primary); }

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

h1, h2, h3, h4 { line-height: 1.2; }
h1 { font-size: 48px; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 32px; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 20px; font-weight: 600; }
h4 { font-size: 16px; font-weight: 600; }

.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-primary-c { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }

.label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
  width: 100%;
}

.container-wide {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px;
  width: 100%;
}

/* ============================================
   FADE IN ANIMATION
   ============================================ */
main {
  animation: fadeIn 300ms ease forwards;
}

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

/* ============================================
   HEADER
   ============================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--background);
  border-bottom: 1px solid var(--border);
  height: 72px;
  display: flex;
  align-items: center;
}

.site-header .container-wide {
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  display: grid;
  place-items: center;
  color: white;
}

.logo-mark svg { width: 18px; height: 18px; }

.logo-text .green { color: var(--primary); }

.nav-links {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.nav-links a {
  padding: 8px 14px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 15px;
  color: var(--text-primary);
  transition: var(--transition);
}

.nav-links a:hover {
  background: var(--background-soft);
}

.header-search {
  flex: 1;
  max-width: 460px;
  display: flex;
  align-items: center;
  background: var(--background-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 4px 4px 16px;
  transition: var(--transition);
}

.header-search:focus-within {
  border-color: var(--primary);
  background: var(--background);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.header-search svg { color: var(--text-muted); margin-right: 8px; }

.header-search input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 0;
  outline: none;
  font-size: 14px;
}

.header-search button {
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 999px;
  transition: var(--transition);
}

.header-search button:hover { background: var(--primary-dark); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  margin-left: auto;
}

.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  transition: var(--transition);
}

.icon-btn:hover {
  background: var(--background-soft);
  color: var(--text-primary);
}

.icon-btn .badge {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 600;
  display: grid;
  place-items: center;
  border: 2px solid var(--background);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFB088, #FF7A45);
  color: white;
  font-weight: 600;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: var(--transition);
}

.avatar:hover { transform: scale(1.05); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition);
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-card-hover);
}

.btn-outline {
  background: var(--background);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-outline:hover {
  background: var(--background-soft);
  border-color: var(--border-strong);
}

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

.btn-ghost:hover {
  background: var(--background-soft);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #059669;
}

.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 15px; }
.btn-block { width: 100%; }

/* tactile press feedback (task 21) — scale-down on click */
.btn:active { transform: scale(0.96); }
.btn-primary:active { transform: translateY(0) scale(0.96); box-shadow: var(--shadow-card); }

/* ============================================
   FORMS
   ============================================ */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--background);
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  transition: var(--transition);
  outline: none;
  color: var(--text-primary);
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.input::placeholder, .textarea::placeholder { color: var(--text-muted); }

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

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

/* fancy floating label-style "stacked" field */
.field-stacked {
  border: 1px solid var(--border);
  background: var(--background);
  padding: 10px 14px;
  border-radius: var(--radius);
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}

.field-stacked:hover { border-color: var(--border-strong); }

.field-stacked:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.field-stacked .field-label {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
  text-transform: uppercase;
}

.field-stacked .input,
.field-stacked select,
.field-stacked input {
  border: none;
  padding: 0;
  height: 22px;
  font-weight: 500;
  background: transparent;
}

.field-stacked select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  cursor: pointer;
}

.field-stacked .input:focus,
.field-stacked select:focus { box-shadow: none; }

.field-stacked.with-arrow::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  width: 10px;
  height: 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  pointer-events: none;
}

/* checkbox */
.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
}

.checkbox input { display: none; }

.checkbox .box {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background: var(--background);
  display: grid;
  place-items: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.checkbox .box svg {
  opacity: 0;
  color: white;
  transition: var(--transition);
}

.checkbox input:checked + .box {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox input:checked + .box svg { opacity: 1; }

.checkbox:hover .box { border-color: var(--primary); }

/* toggle switch */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 14px;
}

.toggle input { display: none; }

.toggle .track {
  width: 36px;
  height: 20px;
  background: var(--border-strong);
  border-radius: 999px;
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
}

.toggle .track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input:checked + .track {
  background: var(--primary);
}

.toggle input:checked + .track::after {
  transform: translateX(16px);
}

/* ============================================
   BADGES
   ============================================ */
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-below { background: var(--primary-light); color: var(--primary); }
.badge-market { background: var(--warning-light); color: #B45309; }
.badge-above { background: var(--danger-light); color: var(--danger); }

.badge-success { background: var(--success-light); color: #047857; }
.badge-warning { background: var(--warning-light); color: #B45309; }
.badge-neutral { background: var(--background-section); color: var(--text-secondary); }
.badge-danger { background: var(--danger-light); color: var(--danger); }

.badge-feature {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  background: var(--background-soft);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.badge-owner { background: #EEF9F4; color: #166534; border-color: #BBF7D0; }
.badge-dealer { background: #EFF6FF; color: #1D4ED8; border-color: #BFDBFE; }
.badge-nodmg  { background: var(--success-light); color: #065F46; border-color: #A7F3D0; }
.badge-pts    { background: #F5F3FF; color: #6D28D9; border-color: #DDD6FE; }
.badge-km     { background: #FFF7ED; color: #C2410C; border-color: #FED7AA; }

/* Views + likes stat row — used on listing cards and the car page */
.card-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}
.card-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  line-height: 1;
}
.card-stat svg { opacity: 0.75; flex-shrink: 0; }
.card-stat .stat-num { font-weight: 600; color: var(--text-secondary); }

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: var(--transition-slow);
}

.card-clean {
  background: var(--background);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  transition: var(--transition-slow);
  overflow: hidden;
}

.card-clean:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-radius: var(--radius-lg);
}
.card-clean:active { transform: translateY(-1px) scale(0.995); }

/* Photo placeholder — striped grey block */
.photo-placeholder {
  background: repeating-linear-gradient(
    135deg,
    #EEF0F2 0,
    #EEF0F2 12px,
    #E5E8EB 12px,
    #E5E8EB 24px
  );
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 13px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  letter-spacing: -0.01em;
  position: relative;
  overflow: hidden;
}

.photo-placeholder::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0.4), rgba(255,255,255,0));
  pointer-events: none;
}

/* Listing card (vertical, used on home page "fresh listings") */
.listing-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.listing-card .photo-placeholder {
  aspect-ratio: 16 / 11;
  position: relative;
}

.listing-card .photo-placeholder .badge-pill {
  position: absolute;
  top: 12px;
  left: 12px;
}

.listing-card .info {
  padding: 16px;
}

.listing-card .title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
}

.listing-card .specs {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.listing-card .price {
  font-weight: 700;
  font-size: 19px;
}

.listing-card .location {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Compact seller block used inside listing cards (home, search, similar) */
.card-seller {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.card-seller .card-seller-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
  overflow: hidden;
}
.card-seller .card-seller-avatar.dealer {
  background: linear-gradient(135deg, #2563EB, #1E40AF);
}
.card-seller .card-seller-avatar.private {
  background: linear-gradient(135deg, #FFB088, #FF7A45);
}
.card-seller .card-seller-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-seller .card-seller-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.card-seller .card-seller-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-seller .card-seller-type {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}
.card-seller .card-seller-type.dealer { color: #2563EB; }

/* Search results card variant — seller block sits below specs in left col */
.result-card .card-seller {
  margin-top: 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* Header avatar with image */
.avatar.avatar-img { overflow: hidden; padding: 0; }
.avatar.avatar-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
  margin-top: 80px;
  border-top: 1px solid var(--border);
  padding: 56px 0 32px;
  background: var(--background);
}

.site-footer .container-wide {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr 1.2fr;
  gap: 40px;
}

.footer-brand-name {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 8px;
}

.footer-brand-sub {
  font-size: 13px;
  color: var(--text-secondary);
}

.footer-col h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-weight: 600;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-col li a {
  font-size: 14px;
  color: var(--text-primary);
}

.store-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.store-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--dark);
  color: white;
  border-radius: var(--radius);
  font-size: 13px;
  transition: var(--transition);
}

.store-btn:hover { background: #000; color: white; }

.footer-bottom-wrap {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 20px 40px;
}
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  gap: 24px;
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 1400px;
  margin: 0 auto;
}
.footer-bottom .links {
  display: flex;
  gap: 24px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
  margin-top: 32px;
}

.pagination button, .pagination span {
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  cursor: pointer;
}

.pagination button:hover { background: var(--background-soft); color: var(--text-primary); }
.pagination button.active { background: var(--primary); color: white; }

/* ============================================
   BREADCRUMBS
   ============================================ */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.breadcrumbs a:hover { color: var(--primary); }

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

.breadcrumbs .current { color: var(--text-primary); }

/* ============================================
   HOMEPAGE
   ============================================ */
.hero {
  padding: 56px 0 40px;
  position: relative;
  overflow: hidden;
  background-color: #f5faf7;
  background-image: radial-gradient(rgba(45,106,79,0.055) 1px, transparent 1px);
  background-size: 26px 26px;
}
.hero::before,
.hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
.hero::before {
  width: 650px;
  height: 650px;
  background: radial-gradient(circle, rgba(45,106,79,0.10) 0%, transparent 68%);
  top: -220px;
  right: -80px;
  animation: heroFloat 9s ease-in-out infinite alternate;
}
.hero::after {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(16,185,129,0.07) 0%, transparent 68%);
  bottom: -160px;
  left: 5%;
  animation: heroFloat 11s ease-in-out infinite alternate-reverse;
}
.hero .container-wide { position: relative; z-index: 1; }
@keyframes heroFloat {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(28px, -22px) scale(1.13); }
}

.hero-eyebrow {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.hero h1 {
  margin-bottom: 32px;
}

.search-panel {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px;
  box-shadow: var(--shadow-card);
}

.search-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.search-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 14px;
  color: var(--text-secondary);
  position: relative;
  transition: var(--transition);
  cursor: pointer;
  background: none;
}

.search-tab .count {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  background: var(--background-soft);
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--text-secondary);
}

.search-tab.active {
  color: var(--primary);
}

.search-tab.active::after {
  content: '';
  position: absolute;
  bottom: -13px;
  left: 14px;
  right: 14px;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}

.search-tab.active .count {
  background: var(--primary-light);
  color: var(--primary);
}

.search-filters {
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.search-filters .row-2 {
  grid-template-columns: repeat(4, 1fr);
}

.range-field {
  display: flex;
  gap: 4px;
}

.range-field .field-stacked {
  flex: 1;
}

.search-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
}

.search-panel-footer .center-info {
  color: var(--text-secondary);
  font-size: 14px;
}

.search-panel-footer .center-info b {
  color: var(--text-primary);
  font-weight: 600;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-top: 32px;
}

.stat-card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  transition: var(--transition-slow);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
}

.stat-card .number {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-card .number .green { color: var(--primary); }

.stat-card .label-text {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.stat-card.online {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-card.online .top {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 16px;
}

.stat-card.online .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-light);
}

/* ============================================
   POPULAR BRANDS
   ============================================ */
.section {
  padding: 48px 0 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-head h2 {
  font-size: 28px;
}

.section-head .link {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
}

.section-head .link:hover { color: var(--primary); }

.brands-row {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 12px;
}

.brand-card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-slow);
}

.brand-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--primary-light);
}

.brand-logo-box {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: var(--radius);
  background: var(--background-section);
  display: grid;
  place-items: center;
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  overflow: hidden;
}
.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
}
.brand-logo-fallback {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.brand-card .name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.brand-card .count {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}

/* Brand-model table */
.brand-models {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px;
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.brand-models-col h4 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}

.brand-models-col h4 .count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}

.brand-models-col ul {
  list-style: none;
}

.brand-models-col li {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}

.brand-models-col li:hover { color: var(--primary); }

.brand-models-col li .count {
  color: var(--text-muted);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
}

/* Fresh listings */
.fresh-listings {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* AI banner */
.ai-banner {
  margin-top: 56px;
  background: linear-gradient(135deg, #1A1A2E 0%, #16213E 100%);
  border-radius: var(--radius-lg);
  padding: 40px 48px;
  color: white;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: center;
  overflow: hidden;
  position: relative;
}

.ai-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 100% at 50% 50%, rgba(45, 106, 79, 0.28), transparent 75%),
    radial-gradient(ellipse 60% 80% at 85% 30%, rgba(45, 106, 79, 0.18), transparent 60%),
    radial-gradient(ellipse 60% 80% at 15% 70%, rgba(45, 106, 79, 0.14), transparent 60%);
  pointer-events: none;
}

.ai-banner .ai-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(45, 106, 79, 0.25);
  color: #6BCF99;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 16px;
}

.ai-banner h2 {
  font-size: 28px;
  margin-bottom: 12px;
}

.ai-banner p {
  color: rgba(255,255,255,0.7);
  margin-bottom: 20px;
  max-width: 520px;
}

.ai-banner .features {
  display: flex;
  gap: 8px;
}

.ai-banner .features span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
}

.ai-banner .cta {
  position: relative;
  z-index: 1;
}

/* ============================================
   PLATFORM / ABOUT SECTION (home)
   ============================================ */
.platform-section {
  margin-top: 56px;
  padding: 56px 0;
  background: var(--background-section);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.platform-head {
  max-width: 640px;
  margin-bottom: 36px;
}

.platform-eyebrow {
  display: inline-block;
  color: var(--primary);
  background: var(--primary-light);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.platform-head h2 {
  font-size: 30px;
  margin-bottom: 10px;
}

.platform-head p {
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.55;
}

.platform-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.platform-card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  box-shadow: var(--shadow-card);
  transition: var(--transition-slow);
}

.platform-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--primary);
}

.platform-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  margin-bottom: 18px;
}

.platform-card h3 {
  font-size: 17px;
  margin-bottom: 8px;
}

.platform-card p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.55;
}

.platform-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.platform-trust span {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
}

/* ============================================
   SEARCH PAGE
   ============================================ */
.search-page {
  padding: 24px 0 48px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
}

.search-page-header {
  padding-top: 24px;
}

.filters-sidebar {
  position: sticky;
  top: 96px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
}

.filters-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.filters-head h3 { font-size: 18px; }

.filters-head .reset {
  color: var(--primary);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
}

.filter-section {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
}

.filter-section:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.filter-section .filter-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.filter-section .checkboxes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.filter-section .range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.results-head h2 { font-size: 22px; }

.results-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  cursor: pointer;
  transition: var(--transition-slow);
}

.result-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
  border-radius: var(--radius-lg);
}
.result-card:active { transform: translateY(0) scale(0.996); }

.result-card .photo {
  /* width — фиксирована grid-колонкой (340px), height — растягивается */
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 220px;
  align-self: stretch;
  background: repeating-linear-gradient(135deg, #EEF0F2 0, #EEF0F2 12px, #E5E8EB 12px, #E5E8EB 24px);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  overflow: hidden;
  flex-shrink: 0;
}

.result-card .body {
  padding: 24px 32px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* Top row: technical info on the left, price on the right */
.result-card .body-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
}

.result-card .body-main { min-width: 0; flex: 1 1 auto; }

.result-card .title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.3;
}

.result-card .specs {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.result-card .location {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 0;
}

/* Status / verification tabs — span the full card width, evenly distributed */
.result-card .meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}
.result-card .meta-row .badge-feature {
  flex: 1 1 auto;
  justify-content: center;
}

/* Bottom row: seller info on the left, Save action on the right */
.result-card .body-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.result-card .body-foot .card-seller { min-width: 0; }

.result-card .price {
  font-size: 22px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
}

.save-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--background);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.save-btn:hover { color: var(--primary); border-color: var(--primary-light); }
.save-btn.saved { color: var(--primary); border-color: var(--primary); background: var(--primary-light); }
.save-btn .heart-filled { display: none; }
.save-btn.saved .heart-outline { display: none; }
.save-btn.saved .heart-filled { display: inline; }

/* ============================================
   CAR PAGE
   ============================================ */
.car-page {
  padding: 24px 0 48px;
}

.car-head {
  margin-bottom: 24px;
}

.car-head h1 {
  font-size: 36px;
  margin-bottom: 8px;
}

.car-head .subtitle {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
}
.car-head-stats .card-stats { margin: 0; }
.car-head-stats { display: inline-flex; }

.car-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 32px;
}

.gallery .main-photo {
  aspect-ratio: 16/9;
  border-radius: var(--radius-md);
  position: relative;
}

.gallery .main-photo .nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.95);
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-card-hover);
  cursor: pointer;
  transition: var(--transition);
}

.gallery .main-photo .nav:hover { background: white; transform: translateY(-50%) scale(1.05); }
.gallery .main-photo .nav.left { left: 16px; }
.gallery .main-photo .nav.right { right: 16px; }

.thumbs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.thumb {
  aspect-ratio: 4/3;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  background: repeating-linear-gradient(135deg, #EEF0F2 0, #EEF0F2 12px, #E5E8EB 12px, #E5E8EB 24px);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
}

.thumb.active { border-color: var(--primary); }

.price-panel {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  position: sticky;
  top: 96px;
}

.price-panel .price {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.price-panel .old-price {
  font-size: 14px;
  color: var(--text-secondary);
  text-decoration: line-through;
  margin-bottom: 18px;
}

.price-panel .actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.price-panel .toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.price-panel .seller {
  display: flex;
  align-items: center;
  gap: 12px;
}

.price-panel .seller .avatar { width: 40px; height: 40px; }

.price-panel .seller .name {
  font-weight: 600;
  margin-bottom: 4px;
}

.price-panel .seller .meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.specs-block {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 24px;
}

.specs-block h3 { margin-bottom: 18px; }

.specs-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px 24px;
}

.spec {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.spec .lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 500;
}

.spec .val {
  font-size: 15px;
  font-weight: 600;
}

/* Analytics */
.analytics-block {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 24px;
}

.analytics-block .head {
  margin-bottom: 18px;
}

.analytics-block .head h3 { margin-bottom: 4px; }

.analytics-block .head p { color: var(--text-secondary); font-size: 14px; }

.price-chart {
  background: var(--background-soft);
  border-radius: var(--radius);
  padding: 8px 8px 2px;
  margin-bottom: 16px;
}

.price-chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.analytics-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.kpi {
  background: var(--background-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.kpi .lbl { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.kpi .val { font-size: 18px; font-weight: 700; }

/* History block */
.history-block {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 24px;
}

.history-block h3 { margin-bottom: 18px; }

.history-rows {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
}

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--background-soft);
  border-radius: var(--radius);
}

.history-row .left {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
}

.history-row .check {
  color: var(--success);
}

.history-row .check.warn {
  color: var(--warning);
}

.timeline {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  position: relative;
  padding: 0 24px;
  margin-bottom: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 24px;
  right: 24px;
  height: 1px;
  background: var(--border);
}

.timeline-point {
  position: relative;
  text-align: center;
}

.timeline-point .dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--background);
  border: 2px solid var(--border);
  margin: 0 auto 12px;
  position: relative;
  z-index: 1;
}

.timeline-point.active .dot {
  background: var(--primary);
  border-color: var(--primary);
}

.timeline-point .year {
  font-weight: 700;
  margin-bottom: 2px;
}

.timeline-point .ev {
  font-size: 13px;
  color: var(--text-secondary);
}

.mileage-chart {
  margin-bottom: 16px;
}

.mileage-chart .head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 12px;
}

.mileage-bars {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  height: 100px;
  align-items: end;
}

.mileage-bar {
  background: var(--primary-light);
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: var(--transition);
}

.mileage-bar:hover { background: #BFE0CF; }
.mileage-bar.anomaly { background: #FDE68A; }
.mileage-bar.anomaly:hover { background: #FCD34D; }
.mileage-bar.anomaly .year-label { color: #B45309; font-weight: 600; }

.mileage-bar .year-label {
  position: absolute;
  bottom: -22px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.history-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-weight: 500;
  font-size: 14px;
  margin-top: 20px;
}

/* AI block on car page */
.ai-card {
  margin-top: 24px;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-card .left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ai-card .icon-box {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--primary);
  display: grid;
  place-items: center;
  color: white;
}

.ai-card h3 { font-size: 18px; }

.description-block {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 24px;
}

.description-block h3 { margin-bottom: 12px; }
.description-block p { color: var(--text-secondary); line-height: 1.6; }
.description-block .desc-paragraph { display: block; color: var(--text-secondary); line-height: 1.6; }
.description-block .desc-paragraph + .desc-paragraph { margin-top: 12px; }

.similar-block { margin-top: 40px; }
.similar-block h2 { margin-bottom: 20px; font-size: 24px; }
.similar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* ============================================
   REGISTER PAGE
   ============================================ */
.register-page {
  padding: 60px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.register-page .container { max-width: 480px; }

.register-head {
  text-align: center;
  margin-bottom: 32px;
}

.register-head h1 { font-size: 36px; margin-bottom: 8px; }
.register-head p { color: var(--text-secondary); }

.register-card {
  width: 100%;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-card);
}

.progress-bar {
  margin-bottom: 24px;
}

.progress-bar .top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.progress-bar .top .pct { color: var(--primary); }

.progress-bar .track {
  width: 100%;
  height: 6px;
  background: var(--background-section);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 300ms ease;
}

.step { display: none; animation: fadeIn 280ms var(--ease-out); }
.step.active { display: block; }

.step-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
}

.step-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.role-choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.role-card {
  display: flex;
  align-items: center;
  gap: 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 18px;
  cursor: pointer;
  transition: var(--transition);
  background: var(--background);
}

.role-card:hover { border-color: var(--border-strong); }
.role-card.selected { border-color: var(--primary); background: var(--primary-light); }

.role-card .icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--background-section);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 22px;
}

.role-card .info {
  flex: 1;
}

.role-card .name {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px;
}

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

.role-card .check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.role-card.selected .check {
  background: var(--primary);
  border-color: var(--primary);
}

.role-card .check svg {
  opacity: 0;
  color: white;
}

.role-card.selected .check svg { opacity: 1; }

.register-form { display: flex; flex-direction: column; gap: 16px; }

.register-card .back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 12px;
}

.register-card .back-link:hover { color: var(--primary); }

.checkbox-row {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-secondary);
  margin: 4px 0 4px;
}

.checkbox-row a { color: var(--primary); }

.register-card .submit {
  margin-top: 8px;
  width: 100%;
}

.register-card .bottom-link {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.register-card .bottom-link a { color: var(--primary); font-weight: 500; }

/* ============================================
   FAVORITES PAGE
   ============================================ */
.fav-page { padding: 32px 0 48px; }

.fav-page .page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.fav-page .page-head h1 { font-size: 32px; }

.fav-page .page-head .meta {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 400;
  margin-left: 8px;
}

/* Sort field on /favorites — same look as search-filters */
.fav-page .page-head .fav-sort {
  width: 260px;
  min-height: 58px;
  box-sizing: border-box;
  padding: 9px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-shrink: 0;
}
.fav-page .page-head .fav-sort .field-label {
  font-size: 11px;
  line-height: 1.2;
  margin-bottom: 4px;
}
.fav-page .page-head .fav-sort select {
  height: 22px;
  font-size: 14px;
  line-height: 22px;
  font-weight: 500;
}

.fav-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fav-card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: grid;
  grid-template-columns: 200px 1fr auto;
  overflow: hidden;
  transition: var(--transition-slow);
}

.fav-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
  border-radius: var(--radius-lg);
}

.fav-card.removing {
  opacity: 0;
  transform: translateX(40px);
}

.fav-card .photo {
  aspect-ratio: 5/3;
  background: repeating-linear-gradient(135deg, #EEF0F2 0, #EEF0F2 12px, #E5E8EB 12px, #E5E8EB 24px);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
}

.fav-card .body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.fav-card .title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.fav-card .specs { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.fav-card .location { font-size: 13px; color: var(--text-secondary); }
.fav-card .toggle-row { margin-top: 8px; }

.fav-card .right {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  min-width: 220px;
}

.fav-card .price { font-size: 20px; font-weight: 700; }

.fav-card .change-badge {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.fav-card .change-badge.down { background: var(--primary-light); color: var(--primary); }
.fav-card .change-badge.up { background: var(--danger-light); color: var(--danger); }
.fav-card .change-badge.none { background: var(--background-section); color: var(--text-secondary); }

.fav-card .delete {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--background);
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.fav-card .delete:hover {
  color: var(--danger);
  border-color: var(--danger-light);
  background: var(--danger-light);
}

.empty-state {
  margin-top: 32px;
  text-align: center;
  padding: 48px 24px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.empty-state .icon-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--background-section);
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
}

.empty-state h3 { margin-bottom: 6px; font-size: 18px; }
.empty-state p { color: var(--text-secondary); margin-bottom: 16px; }

/* ============================================
   CABINET PAGE
   ============================================ */
.cabinet-page {
  padding: 32px 0 48px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
}

.cabinet-sidebar {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  position: sticky;
  top: 96px;
  height: fit-content;
}

.cabinet-sidebar .user {
  text-align: center;
  padding: 0 8px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.cabinet-sidebar .user .avatar {
  width: 56px;
  height: 56px;
  margin: 0 auto 10px;
  font-size: 20px;
}

.cabinet-sidebar .user .name { font-weight: 600; margin-bottom: 2px; }
.cabinet-sidebar .user .sub { font-size: 13px; color: var(--text-secondary); }

.cabinet-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cabinet-menu .item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.cabinet-menu .item:hover { background: var(--background-soft); }
.cabinet-menu .item.active { background: var(--primary-light); color: var(--primary); }
.cabinet-menu .item .count {
  margin-left: auto;
  background: var(--background-section);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 999px;
}
.cabinet-menu .item.active .count {
  background: var(--primary);
  color: white;
}

.cabinet-content { display: flex; flex-direction: column; gap: 24px; }

.cabinet-content .page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.cabinet-content .page-head h1 { font-size: 28px; }

.cab-section .page-head + .tabs { margin-top: 20px; }

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.tab {
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
  transition: var(--transition);
  cursor: pointer;
}

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

.tab.active { color: var(--primary); }

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}

.cabinet-listings {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cabinet-card {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: grid;
  grid-template-columns: 200px 1fr auto;
  overflow: hidden;
  align-items: stretch;
}

.cabinet-card .photo {
  aspect-ratio: 5/3;
  background: repeating-linear-gradient(135deg, #EEF0F2 0, #EEF0F2 12px, #E5E8EB 12px, #E5E8EB 24px);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
}

.cabinet-card .body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.cabinet-card .title { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.cabinet-card .specs { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.cabinet-card .price { font-size: 18px; font-weight: 700; }

.cabinet-card .right {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  min-width: 200px;
}

.cabinet-card .stats {
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  gap: 10px;
}

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

.payments-block {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 8px;
}

.payments-block h3 { margin-bottom: 16px; }

.payments-table {
  width: 100%;
  border-collapse: collapse;
}

.payments-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 600;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.payments-table td {
  padding: 14px 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

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

.payments-table .receipt {
  color: var(--primary);
  font-weight: 500;
  cursor: pointer;
}

/* ============================================
   NEW LISTING PAGE
   ============================================ */
.new-listing-page { padding: 32px 0 48px; }

.new-listing-page h1 { margin-bottom: 24px; font-size: 32px; }

.steps-progress {
  display: flex;
  align-items: center;
  margin-bottom: 32px;
  max-width: 720px;
}

.steps-progress .step-node {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.steps-progress .step-node .circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--background-section);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14px;
  display: grid;
  place-items: center;
  transition: var(--transition);
}

.steps-progress .step-node.done .circle {
  background: var(--primary);
  color: white;
}

.steps-progress .step-node.active .circle {
  background: var(--primary);
  color: white;
}

.steps-progress .step-node .label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.steps-progress .step-node.active .label,
.steps-progress .step-node.done .label {
  color: var(--text-primary);
}

.steps-progress .connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 16px;
  border-radius: 1px;
  transition: var(--transition);
}

.steps-progress .connector.done { background: var(--primary); }

.steps-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 920px;
}

.step-card {
  background: var(--background);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  transition: var(--transition);
  position: relative;
}

/* Non-active steps appear muted and cannot be interacted with — they unlock
 * sequentially as the user completes previous steps. */
.step-card:not(.active) {
  opacity: 0.45;
  pointer-events: none;
  user-select: none;
  filter: grayscale(0.5);
}

.step-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
  opacity: 1;
  pointer-events: auto;
  filter: none;
}

.step-card .step-tag {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 8px;
}

.step-card h3 { font-size: 18px; margin-bottom: 16px; }
.step-card .sub { font-size: 13px; color: var(--text-secondary); margin-bottom: 14px; margin-top: -10px; }

.step-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* NEW LISTING — unified field size (same as home search filters) */
.step-fields > .custom-select,
.step-fields > .field-stacked,
.step-card > .field-stacked {
  min-height: 58px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 9px 14px;
}
.step-fields > .custom-select { padding: 0; }
.step-fields > .custom-select .custom-select-trigger {
  padding: 9px 36px 9px 14px;
  flex: 1;
  justify-content: center;
}
.step-fields > .field-stacked .field-label,
.step-fields > .custom-select .field-label-small,
.step-card > .field-stacked .field-label {
  font-size: 11px;
  line-height: 1.2;
  margin-bottom: 4px;
  letter-spacing: 0.04em;
}
.step-fields > .field-stacked input,
.step-card > .field-stacked input.price-input {
  height: 22px;
  font-size: 14px;
  line-height: 22px;
  font-weight: 500;
}
.step-fields > .custom-select .custom-select-value {
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
}

.step-card .actions {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  gap: 8px;
}

.step-card .actions .btn { flex: 1; }
.step-card .actions.right { justify-content: flex-end; }
.step-card .actions.right .btn { flex: 0 1 auto; }

.upload-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  background: var(--background-soft);
  cursor: pointer;
  transition: var(--transition);
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-zone .cloud {
  color: var(--text-secondary);
  margin-bottom: 8px;
}

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

.upload-zone .link {
  color: var(--primary);
  font-weight: 500;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.photo-tile {
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: repeating-linear-gradient(135deg, #EEF0F2 0, #EEF0F2 8px, #E5E8EB 8px, #E5E8EB 16px);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  position: relative;
  border: 2px solid transparent;
}

.photo-tile.main {
  border-color: var(--primary);
}

.photo-tile.main::after {
  content: 'Главное';
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: 'Inter';
}

.price-input {
  font-size: 26px;
  font-weight: 800;
  padding: 16px 14px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  margin-bottom: 12px;
  outline: none;
}

.price-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.recommended-price {
  background: var(--primary-light);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.recommended-price .head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}

.recommended-price .range {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

.recommended-price .sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ============================================
   ADMIN PAGE
   ============================================ */
.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  position: relative;
}

/* Mobile-only admin chrome — hidden on desktop */
.admin-mobile-burger {
  display: none;
  position: fixed;
  top: 10px;
  left: 12px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: var(--dark);
  color: white;
  border: none;
  border-radius: 10px;
  z-index: 1201;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}
.admin-mobile-brand {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  align-items: center;
  justify-content: center;
  background: var(--dark);
  color: white;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  z-index: 1199;
  padding-left: 56px;
  padding-right: 12px;
}
.admin-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.admin-sidebar-close {
  display: none;
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.admin-sidebar-close:hover { background: rgba(255,255,255,0.15); }

.admin-sidebar {
  background: var(--dark);
  color: rgba(255,255,255,0.85);
  padding: 24px 16px;
  height: 100vh;
  position: sticky;
  top: 0;
}

.admin-sidebar .brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: white;
  padding: 8px 12px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 16px;
}

.admin-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-menu .item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
}

.admin-menu .item:hover {
  background: rgba(255,255,255,0.05);
  color: white;
}

.admin-menu .item.active {
  background: rgba(45, 106, 79, 0.2);
  color: #6BCF99;
}

.admin-menu .item .count {
  margin-left: auto;
  background: rgba(255,255,255,0.08);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
}

.admin-menu .item.active .count {
  background: var(--primary);
  color: white;
}

.admin-content {
  padding: 32px 40px 48px;
  background: var(--background-soft);
  min-height: 100vh;
}

.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.admin-head h1 { font-size: 28px; margin-bottom: 4px; }
.admin-head .sub { color: var(--text-secondary); font-size: 14px; }

.admin-badge {
  background: var(--dark);
  color: white;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.admin-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.admin-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.admin-kpi {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  transition: var(--transition-slow);
}

.admin-kpi:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-strong);
}

.admin-kpi .lbl {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.admin-kpi .val {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.admin-kpi .delta {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
}

.admin-kpi .delta.up { background: var(--success-light); color: #047857; }
.admin-kpi .delta.down { background: var(--danger-light); color: var(--danger); }
.admin-kpi .delta.neutral { background: var(--background-section); color: var(--text-secondary); }

.admin-block {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
}

.admin-block .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.admin-block h3 { font-size: 18px; }

.activity-chart {
  width: 100%;
  height: 200px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 12px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.admin-table tr {
  transition: var(--transition);
}

.admin-table tr.removing { opacity: 0; transform: translateX(20px); }

.admin-table .row-actions { display: flex; gap: 8px; }

.admin-table .tiny-photo {
  width: 52px;
  height: 36px;
  border-radius: 4px;
  background: repeating-linear-gradient(135deg, #EEF0F2 0, #EEF0F2 6px, #E5E8EB 6px, #E5E8EB 12px);
  display: grid;
  place-items: center;
  font-size: 9px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

.search-input-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--background-soft);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 999px;
  width: 280px;
}

.search-input-box svg { color: var(--text-muted); }

.search-input-box input {
  background: transparent;
  border: none;
  outline: none;
  flex: 1;
  font-size: 14px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.status-active { background: var(--success-light); color: #047857; }
.status-blocked { background: var(--danger-light); color: var(--danger); }

/* ============================================
   ADMIN: moderation cards (replaces the old narrow table)
   ============================================ */
.mod-cards { display: flex; flex-direction: column; gap: 18px; }
.mod-empty { text-align: center; color: var(--text-secondary); padding: 32px 16px; background: var(--background-soft); border-radius: var(--radius-md); }

.mod-card {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--background);
  transition: opacity 220ms ease, transform 220ms ease;
}
.mod-card.removing { opacity: 0; transform: translateX(20px); }

.mod-card-photos { display: flex; flex-direction: column; gap: 8px; }
.mod-cover {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  background: var(--background-section);
  object-fit: cover;
  display: block;
}
.mod-cover-empty {
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 13px;
}
.mod-thumbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.mod-thumb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  object-fit: cover;
  background: var(--background-section);
  display: block;
}
.mod-thumb-more {
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.mod-card-body { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mod-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.mod-card-title { font-weight: 700; font-size: 17px; margin-bottom: 4px; }
.mod-card-meta { font-size: 13px; color: var(--text-secondary); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mod-card-meta b { color: var(--text-primary); font-weight: 600; }
.mod-card-price { font-weight: 700; font-size: 20px; white-space: nowrap; }

.mod-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px 18px;
  background: var(--background-soft);
  padding: 12px 14px;
  border-radius: var(--radius);
}
.mod-fact { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mod-fact-k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); font-weight: 600; }
.mod-fact-v { font-size: 13px; color: var(--text-primary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mod-card-desc .mod-desc-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  background: var(--background-soft);
  padding: 10px 14px;
  border-radius: var(--radius);
  max-height: 140px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.mod-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 768px) {
  .mod-card { grid-template-columns: 1fr; }
  .mod-card-grid { grid-template-columns: 1fr 1fr; }
}
.status-moderation { background: var(--warning-light); color: #B45309; }
.status-removed { background: var(--background-section); color: var(--text-secondary); }

.user-row-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--background-section);
  color: var(--text-secondary);
  font-weight: 600;
  display: inline-grid;
  place-items: center;
  margin-right: 10px;
  font-size: 13px;
}

.dealer-tag {
  background: var(--dark);
  color: white;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

.private-tag {
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

.buyer-tag {
  background: var(--background-section);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}

/* ============================================
   UTILITIES
   ============================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.w-full { width: 100%; }
.text-center { text-align: center; }

/* ============================================
   П2: HEADER AUTOCOMPLETE
   ============================================ */
.header-search-wrap {
  position: relative;
  flex: 1;
  max-width: 460px;
}
.header-search-wrap .header-search {
  max-width: 100%;
  width: 100%;
}
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  display: none;
  transform-origin: top center;
  animation: cmDropIn 180ms var(--ease);
}
.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--background-soft); }
.autocomplete-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--background-section);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  flex-shrink: 0;
}
.autocomplete-title { font-size: 14px; font-weight: 500; }
.autocomplete-sub { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }
.autocomplete-price { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--primary); flex-shrink: 0; }

/* ============================================
   П1: AI ASSESSMENT ANIMATION
   ============================================ */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.ai-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  vertical-align: -2px;
}
.ai-result {
  margin-top: 16px;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.ai-verdict {
  padding: 20px 24px;
  border-radius: var(--radius-md);
}
.verdict-good { background: var(--primary-light); border: 1px solid rgba(45,106,79,0.2); }
.verdict-warn { background: var(--warning-light); border: 1px solid rgba(245,158,11,0.2); }
.verdict-bad  { background: var(--danger-light);  border: 1px solid rgba(220,38,38,0.2); }
.verdict-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}
.verdict-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
}
.verdict-good .verdict-icon { background: var(--primary); color: white; }
.verdict-warn .verdict-icon { background: var(--warning); color: white; }
.verdict-bad  .verdict-icon { background: var(--danger);  color: white; }
.verdict-title { font-size: 17px; font-weight: 600; margin-bottom: 3px; }
.verdict-desc  { font-size: 14px; color: var(--text-secondary); }
.ai-list { margin-top: 12px; }
.ai-list-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.ai-list-item { font-size: 14px; padding: 3px 0; }
.verdict-footnote {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(0,0,0,0.08);
  font-size: 12px;
  color: var(--text-secondary);
}

/* ============================================
   П7: REPORT MODAL
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.52);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  overflow-y: auto;
  animation: cmOverlayIn 200ms var(--ease);
}
.modal-content {
  background: var(--background);
  border-radius: var(--radius-lg);
  max-width: 920px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.22);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
  overflow: hidden;
  animation: cmModalIn 300ms var(--ease-out);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--background);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-head h2 { font-size: 20px; }
.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--background-section);
  color: var(--text-secondary);
  font-size: 18px;
  display: grid;
  place-items: center;
  transition: var(--transition);
  line-height: 1;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--border); color: var(--text-primary); }
.modal-body {
  padding: 20px 24px 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Report summary strip */
.report-summary {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 2px;
}
.rsumm-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 12px 6px;
  border-radius: 10px;
  text-align: center;
  border: 1px solid transparent;
}
.rsumm-item.ok  { background: rgba(34,197,94,0.07);  border-color: rgba(34,197,94,0.15); }
.rsumm-item.warn{ background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.18); }
.rsumm-icon { font-size: 18px; line-height: 1; }
.rsumm-label { font-size: 11px; font-weight: 500; line-height: 1.3; }
.rsumm-item.ok   .rsumm-label { color: #16A34A; }
.rsumm-item.warn .rsumm-label { color: #B45309; }

/* Report 2-column grid */
.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.report-section { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.report-section-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
}
.report-head-ok   { background: rgba(34,197,94,0.06); }
.report-head-warn { background: rgba(245,158,11,0.07); }
.report-head-neutral { background: var(--background-soft); }
.report-icon { font-size: 14px; line-height: 1; }
.report-section-head h4 { font-size: 13px; font-weight: 600; margin: 0; flex: 1; }
.report-status {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}
.report-status.ok   { background: rgba(34,197,94,0.14);  color: #16A34A; }
.report-status.warn { background: rgba(245,158,11,0.14); color: #B45309; }
.report-rows { display: flex; flex-direction: column; }
.report-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 14px;
  border-bottom: 1px solid var(--border);
}
.report-row:last-child { border-bottom: none; }
.report-key { font-size: 12px; color: var(--text-secondary); }
.report-val-wrap { display: flex; align-items: center; gap: 6px; }
.report-val { font-size: 12px; font-weight: 500; }
.row-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.row-dot.ok   { background: #22C55E; }
.row-dot.warn { background: #F59E0B; }

/* ============================================
   П4: CUSTOM SELECT
   ============================================ */
.custom-select {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  transition: var(--transition);
  cursor: pointer;
  user-select: none;
}
.custom-select:hover { border-color: var(--border-strong); }
.custom-select.open {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.custom-select-trigger {
  padding: 10px 36px 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
}
.custom-select-trigger::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 6px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  transition: transform 200ms ease;
}
.custom-select.open .custom-select-trigger::after {
  transform: translateY(-50%) rotate(180deg);
}
.field-label-small {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1;
}
.custom-select-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}
.custom-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: none;
  max-height: 220px;
  overflow-y: auto;
}
.custom-select.open .custom-select-dropdown { display: block; transform-origin: top center; animation: cmDropIn 160ms var(--ease); }
.custom-select-option {
  padding: 9px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
}
.custom-select-option:hover { background: var(--background-soft); }
.custom-select-option.selected { color: var(--primary); font-weight: 500; background: var(--primary-light); }

/* ============================================
   П10: SEARCH RESULTS
   ============================================ */
.empty-results {
  text-align: center;
  padding: 48px 24px;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
}
.results-list { transition: opacity 300ms ease; }

/* ============================================
   П9: ADMIN CATALOG STATUS BADGES
   ============================================ */
.catalog-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.catalog-active     { background: var(--success-light); color: #047857; }
.catalog-moderation { background: var(--warning-light); color: #B45309; }
.catalog-removed    { background: var(--background-section); color: var(--text-secondary); }
.admin-edit-modal .modal-content { max-width: 480px; }
.admin-edit-modal .modal-body { display: flex; flex-direction: column; gap: 14px; padding: 24px 28px; }
.font-mono { font-family: 'JetBrains Mono', monospace; }

/* ============================================
   v3-1: EXPANDED AI ASSESSMENT
   ============================================ */
.ai-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(0,0,0,0.08);
}
.ai-section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}
.ai-checks { display: flex; flex-direction: column; gap: 8px; }
.ai-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.45;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.5);
}
.ai-check.warn { background: rgba(245,158,11,0.08); }
.ai-check.ok   { background: rgba(45,106,79,0.06); }
.ai-check-icon { flex-shrink: 0; font-size: 14px; line-height: 1.45; }
.ai-check-text { flex: 1; color: var(--text-primary); }
.ai-recommendations {
  margin: 0;
  padding-left: 22px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
}
.ai-recommendations li { padding: 2px 0; }

/* ============================================
   v3-3: MAIN PAGE TABS (better animation)
   ============================================ */
.search-tabs { display: flex; gap: 6px; margin-bottom: 18px; border-bottom: 2px solid var(--border); }
.search-tab {
  padding: 12px 18px 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  transition: color 200ms ease;
  cursor: pointer;
  background: none;
  border: none;
}
.search-tab .count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--background-soft);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
}
.search-tab:hover { color: var(--text-primary); }
.search-tab.active { color: var(--text-primary); font-weight: 600; }
.search-tab.active .count { background: var(--primary-light); color: var(--primary); }
.search-tab.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}

.search-filters,
.fresh-listings,
.brands-row,
.brand-models {
  transition: opacity 250ms ease;
}

/* HOME — единый размер всех инпутов в .search-filters (custom-select + field-stacked) */
.search-filters > .custom-select,
.search-filters > .field-stacked {
  min-height: 58px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.search-filters > .custom-select .custom-select-trigger {
  padding: 9px 36px 9px 14px;
  flex: 1;
  justify-content: center;
}
.search-filters > .field-stacked {
  padding: 9px 14px;
}
.search-filters > .field-stacked .field-label,
.search-filters > .custom-select .field-label-small {
  font-size: 11px;
  line-height: 1.2;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  font-weight: 500;
}
.search-filters > .field-stacked input {
  height: 22px;
  font-size: 14px;
  line-height: 22px;
  font-weight: 500;
  color: var(--text-primary);
}
.search-filters > .custom-select .custom-select-value {
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
}

/* ============================================
   v3-7: PRICE-ALERTS PAGE (reuses .fav-card)
   ============================================ */
.alerts-page { padding: 32px 0 48px; }
.alerts-page .page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.alerts-page .page-head h1 { font-size: 32px; }
.alerts-page .page-head .meta {
  color: var(--text-secondary);
  font-size: 16px;
  margin-left: 8px;
}

/* ============================================
   v3-9: NEW-LISTING FORM (validation states)
   ============================================ */
/* Suppress browser-native :invalid styling on form inputs.
 * Firefox and Chrome add subtle red borders/shadows on inputs with
 * min/max/maxlength/pattern constraints even when not flagged with
 * the `required` attribute — which made the year/mileage/VIN fields
 * look erroneous during normal data entry. We rely on JS validation. */
.new-listing-page input,
.new-listing-page textarea,
.new-listing-page select {
  box-shadow: none;
}
.new-listing-page input:invalid,
.new-listing-page input:user-invalid,
.new-listing-page textarea:invalid,
.new-listing-page select:invalid {
  box-shadow: none;
  outline: none;
  border-color: inherit;
}
.field-error {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(220,38,38,0.1) !important;
}
.field-error-msg {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--danger);
}
.photo-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: repeating-linear-gradient(135deg, #EEF0F2 0, #EEF0F2 10px, #E5E8EB 10px, #E5E8EB 20px);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.photo-thumb.main::before {
  content: 'ГЛАВНОЕ';
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 8px;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 600;
  border-radius: 4px;
  font-family: 'Inter', sans-serif;
}
.photo-thumb .remove-photo {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: white;
  display: grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.photo-thumb .remove-photo:hover { background: var(--danger); }

/* ============================================
   v3-5: AUTO PHOTOS from /cars/{id}/photos/
   Image overlays the striped placeholder when present;
   removes itself via onerror when not. Badges stay on top.
   ============================================ */
.photo-placeholder { position: relative; overflow: hidden; }
.photo-placeholder .card-photo,
.fav-card .photo .card-photo,
.result-card .photo .card-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  display: block;
}
/* PRICE BADGE — premium look, pinned top-left of card photo */
.photo-placeholder .badge-pill,
.fav-card .photo .badge-pill,
.result-card .photo .badge-pill,
.main-photo .badge-pill {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 3;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.18), 0 0 0 1px rgba(255,255,255,0.35) inset;
  white-space: nowrap;
}
.photo-placeholder .badge-pill.badge-below,
.fav-card .photo .badge-pill.badge-below,
.result-card .photo .badge-pill.badge-below,
.main-photo .badge-pill.badge-below {
  background: linear-gradient(135deg, rgba(45,106,79,0.96), rgba(27,67,50,0.96));
  color: #fff;
  box-shadow: 0 6px 18px rgba(45,106,79,0.45), 0 0 24px rgba(45,106,79,0.25), 0 0 0 1px rgba(255,255,255,0.18) inset;
}
.photo-placeholder .badge-pill.badge-market,
.fav-card .photo .badge-pill.badge-market,
.result-card .photo .badge-pill.badge-market,
.main-photo .badge-pill.badge-market {
  background: linear-gradient(135deg, rgba(245,158,11,0.96), rgba(180,83,9,0.96));
  color: #fff;
  box-shadow: 0 6px 18px rgba(180,83,9,0.4), 0 0 24px rgba(245,158,11,0.22), 0 0 0 1px rgba(255,255,255,0.18) inset;
}
.photo-placeholder .badge-pill.badge-above,
.fav-card .photo .badge-pill.badge-above,
.result-card .photo .badge-pill.badge-above,
.main-photo .badge-pill.badge-above {
  background: linear-gradient(135deg, rgba(220,38,38,0.96), rgba(153,27,27,0.96));
  color: #fff;
  box-shadow: 0 6px 18px rgba(220,38,38,0.42), 0 0 24px rgba(220,38,38,0.25), 0 0 0 1px rgba(255,255,255,0.18) inset;
}
.photo-placeholder > span,
.fav-card .photo > span,
.result-card .photo > span {
  position: relative;
  z-index: 0;
}
.fav-card .photo,
.result-card .photo { position: relative; overflow: hidden; }

/* car page gallery + thumbs */
.main-photo .car-main-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}
.main-photo .nav { z-index: 3; }
.main-photo > span { z-index: 0; position: relative; }
.thumb { position: relative; overflow: hidden; }
.thumb .thumb-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tiny-photo { position: relative; overflow: hidden; }
.tiny-photo .card-photo { font-size: 0; }

/* ============================================
   v3-2 P7: car page analytics layout fix
   ============================================ */
.analytics-block .head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.analytics-block .head h3 { margin: 0; }
.analytics-block .head p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ============================================
   v3-2 P11/P12/P13: COMPACT HORIZONTAL CARDS (120x90 photos)
   max-height removed — right column needs space for price + buttons
   ============================================ */
.fav-card {
  grid-template-columns: 140px 1fr auto !important;
  min-height: 110px;
  align-items: stretch;
}
.fav-card .photo {
  width: 120px;
  height: 90px;
  margin: 10px;
  border-radius: 8px;
  aspect-ratio: auto !important;
  align-self: center;
}
.fav-card .body { padding: 12px 16px; font-size: 13px; gap: 4px; display: flex; flex-direction: column; justify-content: center; }
.fav-card .body .title { font-size: 15px; margin-bottom: 2px; }
.fav-card .body .specs,
.fav-card .body .location { font-size: 12px; }
.fav-card .body .toggle-row { margin-top: 4px; }
.fav-card .right { padding: 12px 16px; min-width: 200px; gap: 6px; align-items: flex-end; }
.fav-card .right .price { font-size: 18px; }
.fav-card .change-badge { font-size: 11px; padding: 2px 8px; }

/* Cabinet card */
.cabinet-card {
  display: grid;
  grid-template-columns: 140px 1fr auto !important;
  align-items: stretch;
  min-height: 110px;
}
.cabinet-card .photo {
  width: 120px;
  height: 90px;
  margin: 10px;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  background: repeating-linear-gradient(135deg, #EEF0F2 0, #EEF0F2 12px, #E5E8EB 12px, #E5E8EB 24px);
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
}
.cabinet-card .photo .card-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}
.cabinet-card .body { padding: 10px 16px; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.cabinet-card .body .title { font-size: 15px; font-weight: 600; }
.cabinet-card .body .specs { font-size: 12px; color: var(--text-secondary); }
.cabinet-card .body .price { font-size: 16px; font-weight: 700; }
.cabinet-card .right {
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 4px;
}
.cabinet-card .right .stats { display: flex; gap: 12px; font-size: 12px; color: var(--text-secondary); }
.cabinet-card .right .actions { display: flex; gap: 6px; }
.cabinet-card .right .actions .btn { padding: 4px 10px; font-size: 12px; }
/* ── Inline listing editor (cabinet) ── */
.cabinet-card.cabinet-card-edit {
  display: block !important;          /* override the 140px/1fr/auto grid */
  grid-template-columns: none !important;
  min-height: 0;
  padding: 20px;
}
.cabinet-card-edit .edit-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.cabinet-card-edit .edit-photo {
  flex: 0 0 116px;
  width: 116px;
  height: 80px;
  margin: 0;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  background: repeating-linear-gradient(135deg, #EEF0F2 0, #EEF0F2 12px, #E5E8EB 12px, #E5E8EB 24px);
}
.cabinet-card-edit .edit-photo .card-photo {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.cabinet-card-edit .edit-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 4px;
}
.cabinet-card-edit .edit-title { font-size: 17px; font-weight: 700; line-height: 1.25; }

.cabinet-card-edit .edit-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.cabinet-card-edit .edit-form .span-all { grid-column: 1 / -1; }

.cabinet-card-edit .field-stacked { min-height: 0; cursor: text; }
.cabinet-card-edit .field-stacked.with-arrow { cursor: pointer; }
.cabinet-card-edit .field-stacked input,
.cabinet-card-edit .field-stacked select,
.cabinet-card-edit .field-stacked textarea {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-primary);
}
.cabinet-card-edit .field-stacked input,
.cabinet-card-edit .field-stacked select { height: 24px; }
.cabinet-card-edit .field-stacked textarea {
  resize: vertical;
  min-height: 64px;
  line-height: 1.5;
  font-family: inherit;
}
.cabinet-card-edit .edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

@media (max-width: 768px) {
  .cabinet-card.cabinet-card-edit { padding: 16px !important; }
  .cabinet-card-edit .edit-form { grid-template-columns: 1fr 1fr !important; }
  .cabinet-card-edit .edit-form .field-stacked:nth-child(2),  /* Цена */
  .cabinet-card-edit .edit-form .span-all { grid-column: 1 / -1 !important; }
  .cabinet-card-edit .edit-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* ============================================
   v3-2 P5: TOAST notification (bottom-right)
   ============================================ */
.cm-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--primary);
  color: white;
  padding: 14px 22px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  z-index: 2000;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 250ms ease, transform 250ms ease;
}
.cm-toast.visible { opacity: 1; transform: translateY(0); }

/* Toast variant used to prompt anonymous users — wider and contains a CTA */
.cm-auth-toast {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: min(540px, calc(100vw - 32px));
}
.cm-auth-toast .btn {
  background: white;
  color: var(--primary);
  border: none;
  font-weight: 600;
  white-space: nowrap;
}
.cm-auth-toast .btn:hover { background: var(--background-soft); color: var(--primary-dark); }

/* Auth-required empty state on /favorites and /price-alerts */
.empty-state.auth-required-state {
  padding: 40px 24px;
  max-width: 520px;
  margin: 32px auto;
}
.empty-state.auth-required-state p {
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

/* ============================================
   v3-2 P1: search-page filters sidebar fix
   ============================================ */
.filters-sidebar {
  width: 280px;
  flex-shrink: 0;
  overflow: visible;
  max-height: none;       /* let sidebar grow with content */
  box-sizing: border-box;
}
.filters-sidebar .custom-select {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}
.filters-sidebar .custom-select-dropdown { z-index: 250; }
.filters-sidebar .field-stacked input { min-width: 0; }  /* allow shrink */

/* Vertical range (price stacks "От" above "До") */
.filter-section .range.range-vertical {
  grid-template-columns: 1fr;
}

/* ============================================
   v3-2 P14: unify .badge-pill across pages
   ============================================ */
.badge-pill {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  padding: 4px 12px;
  letter-spacing: 0;
  display: inline-flex;
  align-items: center;
  line-height: 1.4;
}

/* ============================================
   v3-2 P4: ensure new-listing inputs are clickable
   ============================================ */
.new-listing-page .field-stacked input[type="text"],
.new-listing-page .field-stacked input[type="number"] {
  cursor: text;
  pointer-events: auto;
  width: 100%;
}
.new-listing-page .field-stacked:not(.custom-select) { cursor: text; }

/* ============================================
   v3-2 P6: brand-model row hover
   ============================================ */
.brand-model-row { transition: background 150ms ease; padding: 6px 8px; border-radius: 6px; }
.brand-model-row:hover { background: var(--primary-light); color: var(--primary); }

/* ============================================
   Info pages (about, help, press, terms, privacy, cookies)
   ============================================ */
.info-page {
  max-width: 800px;
  padding-top: 32px;
  padding-bottom: 80px;
}
.info-page h1 {
  margin-bottom: 32px;
}
.info-content h2 {
  font-size: 18px;
  font-weight: 700;
  margin-top: 32px;
  margin-bottom: 12px;
  color: var(--text-primary);
}
.info-content h3 {
  font-size: 15px;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 8px;
}
.info-content p {
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 12px;
}
.info-content ul {
  padding-left: 20px;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 16px;
}
.info-content ul li {
  margin-bottom: 6px;
}
.info-content a {
  color: var(--primary);
  text-decoration: underline;
}
.info-updated {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.press-item {
  border-left: 3px solid var(--primary-light);
  padding: 12px 0 12px 16px;
  margin-bottom: 24px;
}
.press-item h3 {
  font-size: 16px;
  margin-top: 4px;
  margin-bottom: 6px;
  color: var(--text-primary);
}
.press-date {
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* ============================================
   CAR PAGE GRID — NEW SECTION STRUCTURE
   ============================================ */

.car-gallery-section {
  grid-column: 1;
  grid-row: 1;
}

.price-panel {
  grid-column: 2;
  grid-row: 1 / 4;
  align-self: start;
}

.car-ai-wrap {
  grid-column: 1;
  grid-row: 2;
}

.car-details-section {
  grid-column: 1;
  grid-row: 3;
}

.car-details-section .specs-block { margin-top: 0; }
.car-ai-wrap .ai-card { margin-top: 0; }

/* AI card — premium dark style */
.ai-card {
  background: linear-gradient(135deg, #1A1A2E 0%, #1B3A2A 100%);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: white;
  position: relative;
  overflow: hidden;
}

.ai-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 65% 50%, rgba(45,106,79,0.45) 0%, transparent 65%);
  pointer-events: none;
}

.ai-card-left { flex: 1; min-width: 0; position: relative; }

.ai-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(45,106,79,0.35);
  color: #7ECFA0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
}

.ai-card h3 {
  font-size: 17px;
  font-weight: 700;
  color: white;
  margin: 0 0 6px;
  line-height: 1.3;
}

.ai-card-desc {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  margin: 0;
  line-height: 1.5;
}

.ai-card .btn-primary {
  position: relative;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--primary);
  border-color: var(--primary);
}

/* ============================================
   MOBILE ADAPTATION (≤ 768 px and ≤ 480 px)
   ============================================ */

/* Hamburger button — always rendered, only visible on mobile */
.mobile-menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--background-section);
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  flex-shrink: 0;
  transition: background 0.15s;
}
.mobile-menu-toggle:hover { background: var(--border); }
.mobile-menu-toggle svg { display: block; }

/* Overlay for mobile menu */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1099;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.mobile-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* Mobile drawer — slides from right when burger is tapped (hidden on desktop) */
.mobile-drawer {
  display: none;
  flex-direction: column;
  position: fixed;
  top: 0;
  right: 0;
  width: 88vw;
  max-width: 320px;
  height: 100dvh;
  background: var(--background);
  z-index: 1100;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  box-shadow: -2px 0 16px rgba(0,0,0,0.18);
  will-change: transform;
}
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.mobile-drawer-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.mobile-drawer-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--background-soft);
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
}
.mobile-drawer-close:hover { background: var(--border); color: var(--text-primary); }
.mobile-drawer-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.mobile-drawer-search svg { color: var(--text-muted); flex-shrink: 0; }
.mobile-drawer-search input {
  flex: 1;
  border: none;
  background: var(--background-soft);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  min-width: 0;
}
.mobile-drawer-nav {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  flex: 1;
}
.mobile-drawer-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 12px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.15s;
}
.mobile-drawer-item svg { color: var(--text-secondary); flex-shrink: 0; }
.mobile-drawer-item:hover {
  background: var(--background-soft);
  color: var(--text-primary);
}
.mobile-drawer-foot {
  display: flex;
  flex-direction: column;
  padding: 16px 24px 24px;
  border-top: 1px solid var(--border);
  gap: 10px;
}
.mobile-drawer-link {
  color: var(--text-secondary);
  font-size: 13px;
}
.mobile-drawer-link:hover { color: var(--primary); }

/* Search filter toggle button — hidden on desktop */
.filter-toggle-btn {
  display: none;
}

/* Filter overlay — hidden on desktop */
.filter-overlay {
  display: none;
}

/* Filters close button — hidden on desktop */
.filters-close-btn {
  display: none;
}

@media (max-width: 768px) {
  /* === Containers === */
  .container,
  .container-wide { padding-left: 16px !important; padding-right: 16px !important; }

  /* === Header === */
  .site-header .container-wide {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 16px !important;
  }
  .site-header .logo { flex: 1 1 auto; min-width: 0; }
  .nav-links,
  .header-search-wrap { display: none; }
  .header-actions { gap: 8px; }
  /* Mobile header: declutter (price-alerts lives in the drawer) but keep the
     profile avatar visible per request 22.2 */
  .header-actions .btn-primary,
  .header-actions .icon-btn-alerts { display: none; }
  .header-actions .avatar {
    display: grid;
    width: 36px;
    height: 36px;
    font-size: 15px;
  }
  .mobile-menu-toggle { display: inline-flex; }
  .mobile-overlay { display: block; }
  .mobile-drawer { display: flex; }

  /* Mobile drawer (slides in from the right) — replaces old fullscreen menu */

  /* === Hero === */
  .hero { padding-top: 40px; padding-bottom: 40px; }
  .hero h1 { font-size: 28px !important; line-height: 1.2; }
  .hero-eyebrow { font-size: 12px; }
  .search-panel { padding: 14px; }
  .search-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .search-tab { white-space: nowrap; flex-shrink: 0; }
  .search-filters {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  .search-filters > * { min-width: 0 !important; }
  .search-filters > [style*="grid-column"] { grid-column: 1 / -1 !important; }
  /* Унификация: на mobile все поля одной высоты, шрифт 16px (anti-iOS-zoom) */
  .search-filters > .custom-select,
  .search-filters > .field-stacked { min-height: 60px !important; }
  .search-filters > .field-stacked input {
    min-height: 0 !important;
    height: 24px !important;
    font-size: 16px !important;
    line-height: 24px !important;
    padding: 0 !important;
  }
  .search-filters > .custom-select .custom-select-value { font-size: 16px !important; line-height: 24px !important; }
  .search-filters > .custom-select .custom-select-trigger { min-height: 0 !important; padding: 8px 36px 8px 14px !important; }
  .search-panel-footer {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  .search-panel-footer .btn { width: 100%; }
  .stats-row { grid-template-columns: 1fr 1fr !important; gap: 10px; }
  .stats-row .number { font-size: 22px; }

  /* === Brand cards === */
  .brands-row { grid-template-columns: repeat(3, 1fr) !important; gap: 8px !important; }
  .brand-card { padding: 14px 8px !important; cursor: pointer; }
  .brand-card.active {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px var(--primary-light) !important;
  }
  /* Hide the desktop "all brands' models" section on mobile — replaced by expand panel */
  .brand-models { display: none !important; }

  /* === Fresh listings + similar === */
  .fresh-listings { grid-template-columns: 1fr !important; }
  .similar-grid { grid-template-columns: 1fr 1fr !important; }

  /* === Generic sections === */
  .section { padding: 32px 0; }
  .section-head { flex-wrap: wrap; gap: 8px; }
  h1 { font-size: 26px !important; }
  h2 { font-size: 22px !important; }

  /* === AI banner === */
  .ai-banner { grid-template-columns: 1fr !important; padding: 22px !important; }
  .ai-banner .cta { width: 100%; }
  .ai-banner .btn-lg { width: 100%; justify-content: center; }

  /* === Platform / about section === */
  .platform-section { margin-top: 40px; padding: 40px 0; }
  .platform-grid { grid-template-columns: 1fr 1fr !important; gap: 14px; }
  .platform-head h2 { font-size: 24px; }

  /* === Search page — filter toggle button === */
  .search-page { grid-template-columns: 1fr !important; gap: 0 !important; }
  .filters-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 88% !important;
    max-width: 320px !important;
    height: 100dvh !important;
    z-index: 1000 !important;
    border-radius: 0 20px 20px 0 !important;
    border-left: none !important;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow-y: auto !important;
    max-height: none !important;
    padding-top: 16px !important;
    will-change: transform;
  }
  .filters-sidebar.open {
    transform: translateX(0);
    pointer-events: auto !important;
  }
  .filter-overlay {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0,0,0,0.5);
    z-index: 299;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .filter-overlay.active {
    opacity: 1;
    pointer-events: all;
    /* When sidebar is open, overlay only covers the content area (right of sidebar, below header)
       so that clicks on sidebar and header (incl. burger menu) still work */
    left: min(88vw, 320px);
    top: 72px;
  }
  .filter-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    margin-bottom: 14px;
    width: fit-content;
    transition: var(--transition);
  }
  .filter-toggle-btn:hover { border-color: var(--border-strong); }
  .filter-active-count {
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: grid;
    place-items: center;
  }
  .filters-head { position: relative; }
  .filters-head-right {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .filters-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    background: var(--background-soft);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    flex-shrink: 0;
  }
  .filters-close-btn:hover { background: var(--border); color: var(--text-primary); }

  .results-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .pagination { flex-wrap: wrap; gap: 4px; justify-content: center; }
  .result-card { grid-template-columns: 1fr !important; }
  .result-card .photo {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 16/10 !important;
  }
  .result-card .body { padding: 18px !important; flex-direction: column !important; gap: 12px !important; }
  /* Premium price badge — крупнее на мобильном */
  .photo-placeholder .badge-pill,
  .fav-card .photo .badge-pill,
  .result-card .photo .badge-pill,
  .main-photo .badge-pill {
    top: 12px !important;
    left: 12px !important;
    padding: 9px 16px !important;
    font-size: 14px !important;
    border-radius: 999px;
  }
  .result-card .right-col { align-items: flex-start !important; }

  /* === Car page — flex column with order === */
  .car-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }
  .car-gallery-section { order: 1; }
  .price-panel {
    order: 2;
    position: static !important;
    grid-column: unset !important;
    grid-row: unset !important;
    padding: 18px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .car-ai-wrap { order: 3; }
  .car-details-section { order: 4; }

  .gallery .main-photo { aspect-ratio: 4/3 !important; }
  .thumbs { grid-template-columns: repeat(4, 1fr) !important; }
  .specs-block { margin-top: 0 !important; padding: 14px 16px !important; }
  .specs-block h3 { margin-bottom: 10px !important; font-size: 16px !important; }
  /* Compact 2-column table layout — label left, value right, separators between rows */
  .specs-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0 !important;
    border-top: 1px solid var(--border) !important;
    border-left: 1px solid var(--border) !important;
    border-radius: 8px !important;
    overflow: hidden !important;
  }
  .spec {
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 9px 10px !important;
    border-right: 1px solid var(--border) !important;
    border-bottom: 1px solid var(--border) !important;
    min-width: 0 !important;
  }
  .spec .lbl {
    font-size: 11px !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    color: var(--text-secondary) !important;
    font-weight: 400 !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
  }
  .spec .val {
    font-size: 12.5px !important;
    text-align: right !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    min-width: 0 !important;
  }
  .history-rows { grid-template-columns: 1fr !important; }
  .analytics-kpis { grid-template-columns: 1fr 1fr !important; }
  .car-head h1 { font-size: 22px !important; }
  .car-head .subtitle { flex-wrap: wrap; gap: 6px; }
  .timeline { padding: 0 8px !important; }
  .timeline-point .year { font-size: 14px; }
  .timeline-point .ev { font-size: 11px; }

  /* AI card on mobile — stack vertically */
  .ai-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px !important;
  }
  .ai-card .btn-primary { width: 100%; justify-content: center; }

  /* === Favorites / Alerts === */
  .fav-card { grid-template-columns: 1fr !important; }
  .fav-card .photo { width: 100% !important; height: 180px !important; margin: 0 !important; border-radius: 0 !important; }
  .fav-card .body { padding: 14px 16px 4px !important; }
  .fav-card .right { align-items: flex-start !important; padding: 4px 16px 14px !important; }

  /* === Sort selector compact === */
  .results-head { gap: 8px !important; }
  .results-head h2 { font-size: 18px !important; }
  .results-head .with-arrow { min-width: 0 !important; max-width: 280px; }

  /* === Cabinet === */
  .cabinet-page { grid-template-columns: 1fr !important; gap: 16px !important; overflow-x: hidden; }
  .cabinet-sidebar { position: static !important; }
  .cabinet-sidebar .user { text-align: center; padding: 16px 0 !important; }
  .cabinet-menu { display: flex; flex-wrap: wrap; gap: 6px; }
  .cabinet-menu .item { flex: 1 1 calc(50% - 3px); justify-content: flex-start; padding: 10px 12px !important; font-size: 13px; }
  .cabinet-content { overflow-x: hidden; min-width: 0; }
  .cabinet-content .page-head { flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 28px; }
  .cabinet-content .page-head .btn { width: 100%; justify-content: center; padding: 14px 16px; }
  .cab-section .page-head + .tabs { margin-top: 28px; }
  /* /favorites — сортировка не должна торчать справа огромным блоком: стек */
  .fav-page .page-head { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 20px; }
  .fav-page .page-head h1 { font-size: 24px; }
  .fav-page .page-head .fav-sort { width: 100%; min-height: 54px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .tab { padding: 12px 14px; }
  .tab { white-space: nowrap; flex-shrink: 0; }
  .cabinet-card { grid-template-columns: 1fr !important; }
  .cabinet-card .photo { width: 100% !important; height: 180px !important; margin: 0 !important; border-radius: 12px 12px 0 0 !important; }
  .cabinet-card .body { padding: 12px 16px !important; min-width: 0; }
  .cabinet-card .body .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cabinet-card .right { align-items: flex-start !important; padding: 0 16px 14px !important; flex-direction: row !important; flex-wrap: wrap !important; gap: 8px !important; }
  .cabinet-card .right .btn { flex: 1 1 auto; text-align: center; justify-content: center; }
  .payments-block { overflow-x: auto; }
  .payments-table { font-size: 12px; width: 100%; border-collapse: collapse; }
  .payments-table th, .payments-table td { padding: 8px 6px; white-space: nowrap; }

  /* === Admin === */
  .admin-layout {
    grid-template-columns: 1fr !important;
    padding-top: 56px;
    min-height: 100dvh;
  }
  .admin-mobile-burger { display: inline-flex !important; }
  .admin-mobile-brand { display: flex !important; }
  .admin-sidebar {
    display: flex !important;
    flex-direction: column;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 84vw !important;
    max-width: 280px !important;
    height: 100dvh !important;
    z-index: 1200 !important;
    transform: translateX(-100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 16px rgba(0,0,0,0.2);
    overflow-y: auto;
    padding-top: 56px !important;
    will-change: transform;
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-sidebar-close { display: flex !important; }
  .admin-mobile-overlay { display: block; }
  .admin-mobile-overlay.active { opacity: 1; pointer-events: all; }
  .admin-content {
    padding: 18px 16px 32px !important;
    min-height: calc(100dvh - 56px) !important;
  }
  .admin-head { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 18px !important; }
  .admin-head h1 { font-size: 22px !important; }
  .admin-kpis { grid-template-columns: 1fr 1fr !important; gap: 12px !important; margin-bottom: 18px !important; }
  .admin-kpi { padding: 14px !important; }
  .admin-kpi .val { font-size: 22px !important; }
  .admin-kpi .lbl { font-size: 12px !important; margin-bottom: 6px !important; }
  .admin-kpi .delta { font-size: 11px !important; padding: 2px 8px !important; }

  /* Chart — компактнее на мобильном */
  .activity-chart { height: 150px !important; }

  /* Admin tables — horizontal scroll instead of squeezing into broken layout */
  .admin-block { padding: 16px !important; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 14px; }
  .admin-block .head { flex-direction: column; align-items: stretch !important; gap: 10px; margin-bottom: 14px !important; }
  .admin-block .head h3 { font-size: 16px !important; }
  .admin-block h2 { font-size: 17px !important; }
  .admin-block .search-input-box { width: 100%; }
  .admin-block .search-input-box input { width: 100% !important; min-width: 0; }
  .admin-table { font-size: 12.5px; min-width: 560px; }
  .admin-table th, .admin-table td { padding: 10px 8px; white-space: nowrap; }
  .admin-edit-modal .modal-content { max-width: 100% !important; }

  /* Admin toolbar / filters */
  .admin-toolbar,
  .admin-filters { flex-wrap: wrap !important; gap: 8px !important; }
  .admin-toolbar > *,
  .admin-filters > * { flex: 1 1 auto !important; min-width: 0 !important; }
  .admin-search { width: 100% !important; }
  .admin-search input { width: 100% !important; }

  /* Moderation cards already adapt — tighten padding */
  .mod-card { padding: 16px !important; }
  .mod-card-actions .btn { flex: 1 1 calc(50% - 4px); justify-content: center; }

  /* === New listing === */
  .new-listing-page h1 { font-size: 22px !important; }
  .steps-progress {
    gap: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .step-node { flex-shrink: 0; }
  .step-node .label { font-size: 11px; }
  .connector { flex-shrink: 0; }
  .steps-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
  .step-card { padding: 18px 16px !important; }
  /* Mobile: hide non-active steps entirely — true step-by-step flow */
  .step-card:not(.active) { display: none !important; }
  .step-fields { grid-template-columns: 1fr !important; gap: 12px !important; }
  .step-fields > * { grid-column: 1 !important; }
  .step-fields > [style*="grid-column"] { grid-column: 1 !important; }
  /* Unified field height on mobile (matches home search-filters) */
  .step-fields > .custom-select,
  .step-fields > .field-stacked,
  .step-card > .field-stacked { min-height: 60px !important; padding: 8px 14px !important; }
  .step-fields > .custom-select { padding: 0 !important; }
  .step-fields > .custom-select .custom-select-trigger { min-height: 60px !important; padding: 8px 36px 8px 14px !important; }
  .step-fields > .field-stacked input,
  .step-card > .field-stacked input.price-input {
    min-height: 0 !important;
    height: 24px !important;
    font-size: 16px !important;
    line-height: 24px !important;
    padding: 0 !important;
  }
  .step-fields > .custom-select .custom-select-value { font-size: 16px !important; line-height: 24px !important; }
  .photo-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
  .upload-zone { padding: 22px 16px !important; }
  .step-card .actions { flex-direction: column; gap: 10px; }
  .step-card .actions .btn,
  .step-card .actions.right .btn { width: 100% !important; flex: 1 1 100% !important; justify-content: center; }

  /* === Register === */
  .register-page { padding-top: 24px; padding-bottom: 24px; }
  .register-card { padding: 20px !important; }

  /* === Info pages === */
  .info-page h1 { font-size: 24px !important; }
  .info-content { font-size: 14px; }

  /* === Footer === */
  .site-footer { padding: 32px 0 16px; }
  .site-footer .container-wide {
    grid-template-columns: 1fr 1fr !important;
    gap: 20px !important;
  }
  .site-footer .footer-brand-name { font-size: 18px; }
  .footer-bottom-wrap { margin-top: 24px; }
  .footer-bottom {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  .footer-bottom .links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }

  /* === Modals === */
  .modal-overlay { padding: 12px !important; }
  .modal-content { max-height: calc(100vh - 24px); }
  .modal-head { padding: 16px 18px !important; }
  .modal-head h2 { font-size: 17px !important; }
  .modal-body { padding: 16px !important; }
  .report-summary { grid-template-columns: 1fr 1fr !important; }
  .report-grid { grid-template-columns: 1fr !important; }
  .rsumm-label { font-size: 10px; }
}

@media (max-width: 480px) {
  .brands-row { grid-template-columns: repeat(2, 1fr) !important; }
  .stats-row { grid-template-columns: 1fr !important; }
  .platform-grid { grid-template-columns: 1fr !important; }
  /* Keep 2-column compact specs even on smaller screens */
  .similar-grid { grid-template-columns: 1fr !important; }
  .report-summary { grid-template-columns: 1fr !important; }
  .admin-kpis { grid-template-columns: 1fr !important; }
  .site-footer .container-wide { grid-template-columns: 1fr !important; }
  .cabinet-menu .item { flex: 1 1 100%; }
  .hero h1 { font-size: 24px !important; }
  .timeline { grid-template-columns: 1fr !important; }
  .timeline::before { display: none; }
  .timeline-point { padding: 6px 0; text-align: left; display: flex; align-items: center; gap: 10px; }
  .timeline-point .dot { margin: 0; }
  .photo-grid { grid-template-columns: 1fr !important; }
  .thumbs { grid-template-columns: repeat(3, 1fr) !important; }
  .ai-card h3 { font-size: 15px !important; }
}

/* ============================================
   PRICE BADGE ON PHOTO — overlay with shimmer
   ============================================ */
#price-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 4;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 11px;
  padding: 5px 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

#price-badge.badge-below {
  background: rgba(45,106,79,0.88);
  color: #fff;
}
#price-badge.badge-above {
  background: rgba(220,38,38,0.88);
  color: #fff;
}
#price-badge.badge-market {
  background: rgba(180,83,9,0.88);
  color: #fff;
}

#price-badge::after {
  content: '';
  position: absolute;
  top: 0;
  left: -80%;
  width: 45%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.45), transparent);
  animation: badge-shimmer-sweep 3.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes badge-shimmer-sweep {
  0%   { left: -80%; opacity: 0; }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { left: 130%; opacity: 0; }
}

/* ============================================
   BRAND EXPAND PANEL — mobile accordion under brands-row
   ============================================ */
.brand-expand-panel {
  display: none;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-top: 12px;
  overflow: hidden;
  animation: brand-expand-in 0.25s ease;
}
.brand-expand-panel.open { display: block; }

@keyframes brand-expand-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.brand-expand-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--background-soft);
}
.brand-expand-title { font-weight: 700; font-size: 15px; }
.brand-expand-all { color: var(--primary); font-weight: 500; font-size: 13px; }
.brand-expand-list { list-style: none; padding: 4px 0; margin: 0; }
.brand-expand-list li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--background-soft);
}
.brand-expand-list li:last-child a { border-bottom: none; }
.brand-expand-list li a:hover { background: var(--background-soft); color: var(--primary); }
.brand-expand-list li a .count { color: var(--text-muted); font-size: 12px; }

/* Show only on mobile — desktop uses .brand-models below */
@media (min-width: 769px) {
  .brand-expand-panel { display: none !important; }
}

/* ============================================
   FEATURES (КОМПЛЕКТАЦИЯ) — car details list
   ============================================ */
.features-block {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 24px;
}

.features-block h3 { margin-bottom: 16px; }

.features-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
}

.features-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-primary);
  padding: 6px 0;
}

.features-list li::before {
  content: '';
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-light);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232D6A4F' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
  background-size: 12px;
  background-position: center;
  background-repeat: no-repeat;
}

@media (max-width: 768px) {
  .features-block { padding: 16px !important; }
  .features-list { grid-template-columns: 1fr !important; gap: 4px !important; }
  .features-list li { font-size: 13px; padding: 5px 0; }
}

/* ============================================
   ADMIN TABLET BREAKPOINT (769–900 px)
   Mobile admin drawer also fires on small tablets
   to keep navigation usable.
   ============================================ */
@media (min-width: 769px) and (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr !important;
    padding-top: 56px;
  }
  .admin-mobile-burger { display: inline-flex !important; }
  .admin-mobile-brand { display: flex !important; }
  .admin-mobile-overlay { display: block; }
  .admin-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 280px !important;
    height: 100dvh !important;
    z-index: 1200 !important;
    transform: translateX(-100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 2px 0 16px rgba(0,0,0,0.2);
    overflow-y: auto;
    padding-top: 56px !important;
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-sidebar-close { display: flex !important; }
  .admin-content { padding: 20px 24px 40px !important; }
}

/* ============================================
   GLOBAL TAP TARGETS — minimum 40px on mobile
   ============================================ */
@media (max-width: 768px) {
  .btn { min-height: 42px; }
  .btn-sm { min-height: 36px; }
  input[type="text"], input[type="email"], input[type="tel"],
  input[type="password"], input[type="number"], select, textarea {
    min-height: 44px;
    font-size: 16px; /* prevent iOS zoom on focus */
  }
  .custom-select-trigger { min-height: 48px; }
  /* Prevent iOS double-tap zoom on interactive elements */
  button, a, .item, .tab { touch-action: manipulation; }

  /* Защита от horizontal overflow на всех страницах */
  main, section, .container, .container-wide, header, footer { max-width: 100%; overflow-x: clip; }
  .container-wide, .container { padding-left: 16px; padding-right: 16px; }
  /* Любые таблицы заворачиваем в скролл-контейнер */
  table { max-width: 100%; }
  /* Hero, AI banner, footer — не выходят */
  .hero, .ai-banner, .site-footer, .site-header { max-width: 100%; }
}

/* ============================================
   DEMO WELCOME POPUP
   ============================================ */
.cm-welcome-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 160ms ease-out;
  overflow-y: auto;
}
.cm-welcome-overlay.visible { opacity: 1; }
.cm-welcome-card {
  position: relative;
  background: var(--background);
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
  padding: 36px 32px 28px;
  max-width: 480px;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
  transform: scale(0.97);
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
.cm-welcome-overlay.visible .cm-welcome-card {
  transform: scale(1);
}
.cm-welcome-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--background-soft);
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 200ms ease, color 200ms ease;
}
.cm-welcome-close:hover { background: var(--border); color: var(--text-primary); }
.cm-welcome-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.cm-welcome-card h2 {
  font-size: 22px;
  line-height: 1.3;
  margin: 0 0 16px;
  color: var(--text-primary);
}
.cm-welcome-card p {
  margin: 0 0 10px;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.5;
}
.cm-welcome-card p:last-of-type { margin-bottom: 22px; }
.cm-welcome-cta {
  width: 100%;
  justify-content: center;
  padding: 14px 16px;
  font-size: 15px;
}
@media (max-width: 480px) {
  .cm-welcome-card { padding: 28px 20px 22px; border-radius: 16px; }
  .cm-welcome-card h2 { font-size: 18px; }
  .cm-welcome-card p { font-size: 14px; }
}

/* ============================================
   DEMO PRESENTATION — login card, animation, toast, badge
   ============================================ */
.cm-demo-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  z-index: 10001;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0;
  transition: opacity 180ms ease-out;
}
.cm-demo-overlay.visible { opacity: 1; }
.cm-demo-card {
  position: relative;
  background: var(--background);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
  padding: 34px 32px 26px;
  max-width: 420px; width: 100%;
  box-sizing: border-box; text-align: center;
  transform: scale(0.96) translateY(6px);
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}
.cm-demo-overlay.visible .cm-demo-card { transform: scale(1) translateY(0); }
.cm-demo-close {
  position: absolute; top: 14px; right: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--background-soft); border: none;
  display: grid; place-items: center; cursor: pointer;
  color: var(--text-secondary); transition: background 200ms ease, color 200ms ease;
}
.cm-demo-close:hover { background: var(--border); color: var(--text-primary); }
.cm-demo-card[data-state="loading"] .cm-demo-close,
.cm-demo-card[data-state="success"] .cm-demo-close { opacity: 0; pointer-events: none; }

.cm-demo-tag {
  display: inline-block;
  background: var(--primary-light); color: var(--primary);
  font-size: 10px; font-weight: 800; letter-spacing: 0.12em;
  padding: 5px 12px; border-radius: 999px; margin-bottom: 18px;
}

/* avatar with animated ring + success check */
.cm-demo-avatar {
  position: relative;
  width: 96px; height: 96px; margin: 0 auto 16px;
  border-radius: 50%; overflow: visible;
}
.cm-demo-avatar img {
  width: 96px; height: 96px; border-radius: 50%;
  object-fit: cover; display: block;
  box-shadow: 0 6px 20px rgba(0,0,0,0.14);
}
.cm-demo-avatar.no-img::before {
  content: attr(data-initial);
  display: grid; place-items: center;
  width: 96px; height: 96px; border-radius: 50%;
  background: linear-gradient(135deg, #3f8a68, #2d6a4f);
  color: #fff; font-size: 38px; font-weight: 700;
  box-shadow: 0 6px 20px rgba(0,0,0,0.14);
}
.cm-demo-ring {
  position: absolute; inset: -7px;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--primary);
  border-right-color: var(--primary);
  opacity: 0;
  transition: opacity 200ms ease;
}
.cm-demo-card[data-state="loading"] .cm-demo-ring { opacity: 1; animation: cmDemoSpin 0.8s linear infinite; }
.cm-demo-card[data-state="loading"] .cm-demo-avatar img,
.cm-demo-card[data-state="loading"] .cm-demo-avatar.no-img::before { animation: cmDemoPulse 1.1s ease-in-out infinite; }
@keyframes cmDemoSpin { to { transform: rotate(360deg); } }
@keyframes cmDemoPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(0.94); } }

.cm-demo-check {
  position: absolute; right: -4px; bottom: -4px;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--success); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(16,185,129,0.5);
  transform: scale(0); transition: transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cm-demo-card[data-state="success"] .cm-demo-check { transform: scale(1); }
.cm-demo-card[data-state="success"] .cm-demo-avatar img,
.cm-demo-card[data-state="success"] .cm-demo-avatar.no-img::before {
  box-shadow: 0 0 0 4px var(--success-light), 0 6px 20px rgba(0,0,0,0.14);
  transition: box-shadow 300ms ease;
}

.cm-demo-name { font-size: 21px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.cm-demo-status {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--text-secondary); margin-bottom: 16px;
}
.cm-demo-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success); box-shadow: 0 0 0 3px var(--success-light);
}

/* text swaps per state */
.cm-demo-text { margin: 0 0 20px; font-size: 14px; line-height: 1.5; color: var(--text-secondary); display: none; }
.cm-demo-card[data-state="prompt"]  .cm-demo-text[data-for="prompt"],
.cm-demo-card[data-state="loading"] .cm-demo-text[data-for="loading"],
.cm-demo-card[data-state="success"] .cm-demo-text[data-for="success"] { display: block; }
.cm-demo-card[data-state="success"] .cm-demo-text { color: var(--primary); font-weight: 600; }

.cm-demo-actions { display: flex; gap: 10px; }
.cm-demo-actions .btn { flex: 1; justify-content: center; padding: 12px 16px; }
.cm-demo-card[data-state="loading"] .cm-demo-actions,
.cm-demo-card[data-state="success"] .cm-demo-actions { display: none; }

/* demo-mode toast (richer than default) */
.cm-demo-toast {
  display: flex; align-items: center; gap: 12px;
  background: var(--dark); padding: 14px 18px; max-width: 340px;
  z-index: 10002;   /* выше оверлея формы входа (10001), чтобы тост оставался виден */
}
.cm-demo-toast-ic {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,0.12); color: #fff; display: grid; place-items: center;
}
.cm-demo-toast-txt { display: flex; flex-direction: column; line-height: 1.3; }
.cm-demo-toast-txt b { font-size: 14px; font-weight: 700; }
.cm-demo-toast-txt span { font-size: 12px; opacity: 0.8; font-weight: 400; }
.cm-toast-error { background: var(--danger); }

/* persistent "Демо-режим" indicator */
.cm-demo-badge {
  position: fixed; left: 18px; bottom: 18px; z-index: 1900;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--dark); color: #fff;
  font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
  padding: 9px 14px; border-radius: 999px; border: none; cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.22);
  opacity: 0.92; transition: opacity 200ms ease, transform 200ms ease;
}
.cm-demo-badge:hover { opacity: 1; transform: translateY(-2px); }
.cm-demo-badge-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 0 0 rgba(16,185,129,0.6); animation: cmDemoBadgePulse 2s ease-out infinite;
}
@keyframes cmDemoBadgePulse {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

@media (max-width: 480px) {
  .cm-demo-card { padding: 28px 22px 22px; border-radius: 18px; }
  .cm-demo-actions { flex-direction: column-reverse; }
  .cm-demo-badge { left: 12px; bottom: 12px; padding: 8px 12px; }
  .cm-demo-toast { max-width: calc(100vw - 32px); }
}
@media (prefers-reduced-motion: reduce) {
  .cm-demo-card[data-state="loading"] .cm-demo-ring { animation-duration: 1.4s; }
  .cm-demo-card[data-state="loading"] .cm-demo-avatar img,
  .cm-demo-card[data-state="loading"] .cm-demo-avatar.no-img::before { animation: none; }
  .cm-demo-badge-dot { animation: none; }
}

/* ============================================
   REPORT PURCHASE MODAL
   ============================================ */
.purchase-modal { padding: 4px 0 8px; }
.purchase-hero {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 22px;
  align-items: center;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}
.purchase-photo {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 12px;
  overflow: hidden;
  background: repeating-linear-gradient(135deg, #EEF0F2 0, #EEF0F2 12px, #E5E8EB 12px, #E5E8EB 24px);
  position: relative;
}
.purchase-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.purchase-tag {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.purchase-info h3 {
  font-size: 22px;
  line-height: 1.25;
  margin: 0 0 10px;
  color: var(--text-primary);
}
.purchase-lead {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}
.purchase-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
  margin-bottom: 22px;
}
.purchase-features > div {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-primary);
}
.purchase-bullet {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  box-shadow: 0 0 0 4px var(--primary-light);
}
.purchase-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(45,106,79,0.06), rgba(45,106,79,0.02));
  border: 1px solid var(--primary-light);
  border-radius: 14px;
  margin-bottom: 12px;
}
.purchase-price { display: flex; flex-direction: column; gap: 2px; }
.purchase-price .lbl { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; }
.purchase-price .val { font-size: 24px; font-weight: 700; color: var(--text-primary); }
.purchase-cta { padding: 14px 28px; font-size: 15px; min-width: 180px; justify-content: center; }
.purchase-note {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

.purchase-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  min-height: 280px;
}
.purchase-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: purchase-spin 0.9s linear infinite;
  margin-bottom: 22px;
}
@keyframes purchase-spin { to { transform: rotate(360deg); } }
.purchase-loading h3 { font-size: 20px; margin: 0 0 10px; color: var(--text-primary); }
.purchase-loading-step {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0;
  min-height: 22px;
  transition: opacity 200ms ease;
}

@media (max-width: 768px) {
  .purchase-hero { grid-template-columns: 1fr; gap: 14px; padding-bottom: 16px; margin-bottom: 16px; }
  .purchase-photo { aspect-ratio: 16/10; }
  .purchase-info h3 { font-size: 18px; }
  .purchase-features { grid-template-columns: 1fr; gap: 10px; margin-bottom: 16px; }
  .purchase-footer { flex-direction: column; align-items: stretch; padding: 14px 16px; gap: 12px; }
  .purchase-price { flex-direction: row; align-items: baseline; justify-content: space-between; }
  .purchase-cta { width: 100%; min-width: 0; }
  .purchase-loading { padding: 40px 20px; min-height: 220px; }
}

/* ============================================
   PAGE TRANSITIONS
   ============================================ */
/* NOTE: transform на body ломает position:fixed у потомков (welcome popup, lightbox, modals).
 * Поэтому используем только opacity. */
body.page-enter { opacity: 0; }
body.page-enter.page-enter-active {
  opacity: 1;
  transition: opacity 280ms cubic-bezier(0.22, 1, 0.36, 1);
}
body.page-leaving {
  opacity: 0;
  transition: opacity 220ms cubic-bezier(0.4, 0, 0.6, 1);
  pointer-events: none;
}

#cm-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 99999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms ease;
  background: transparent;
}
#cm-progress-bar.active { opacity: 1; }
#cm-progress-bar .cm-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #4ABE85, var(--primary));
  background-size: 200% 100%;
  box-shadow: 0 0 12px rgba(45, 106, 79, 0.7), 0 0 4px rgba(45, 106, 79, 0.5);
  border-radius: 0 3px 3px 0;
  transition: width 240ms cubic-bezier(0.4, 0, 0.2, 1);
  animation: cm-progress-shimmer 1.4s linear infinite;
}
#cm-progress-bar.active .cm-progress-fill { width: 75%; }
#cm-progress-bar.finishing .cm-progress-fill { width: 100%; transition: width 180ms ease-out; }
@keyframes cm-progress-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================
   21: VISUAL HARMONIZATION — общие keyframes и появление контента
   Единый easing var(--ease) = cubic-bezier(0.4, 0, 0.2, 1)
   ============================================ */
html { scroll-behavior: smooth; }

@keyframes cmCardIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
@keyframes cmDropIn {
  from { opacity: 0; transform: translateY(-6px) scaleY(0.98); }
  to   { opacity: 1; transform: none; }
}
@keyframes cmOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes cmModalIn {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

/* Появление карточек в списках: fade-in + slide-up со стаггером.
   fill-mode backwards (не forwards) — чтобы после анимации :hover-transform работал. */
.listing-card,
.result-card,
.fav-card,
.admin-kpi {
  animation: cmCardIn 420ms var(--ease) backwards;
}
.listing-card:nth-child(1),  .result-card:nth-child(1),  .fav-card:nth-child(1),  .admin-kpi:nth-child(1)  { animation-delay: 0ms; }
.listing-card:nth-child(2),  .result-card:nth-child(2),  .fav-card:nth-child(2),  .admin-kpi:nth-child(2)  { animation-delay: 50ms; }
.listing-card:nth-child(3),  .result-card:nth-child(3),  .fav-card:nth-child(3),  .admin-kpi:nth-child(3)  { animation-delay: 100ms; }
.listing-card:nth-child(4),  .result-card:nth-child(4),  .fav-card:nth-child(4),  .admin-kpi:nth-child(4)  { animation-delay: 150ms; }
.listing-card:nth-child(5),  .result-card:nth-child(5),  .fav-card:nth-child(5)  { animation-delay: 200ms; }
.listing-card:nth-child(6),  .result-card:nth-child(6),  .fav-card:nth-child(6)  { animation-delay: 250ms; }
.listing-card:nth-child(7),  .result-card:nth-child(7),  .fav-card:nth-child(7)  { animation-delay: 300ms; }
.listing-card:nth-child(n+8), .result-card:nth-child(n+8), .fav-card:nth-child(n+8) { animation-delay: 340ms; }

/* Dashboard-блоки админки появляются плавно при загрузке */
.admin-block { animation: cmCardIn 460ms var(--ease) backwards; }

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  body.page-enter, body.page-enter.page-enter-active, body.page-leaving {
    transform: none !important;
    transition: opacity 120ms linear !important;
  }
  #cm-progress-bar .cm-progress-fill { animation: none; }
}

/* ============================================
   PHOTO LIGHTBOX (fullscreen gallery)
   ============================================ */
.zoom-btn {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: none;
  z-index: 5;
  transition: background 200ms ease, transform 200ms ease, box-shadow 200ms ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.zoom-btn:hover {
  background: rgba(15, 23, 42, 0.92);
  transform: scale(1.06);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
}
.main-photo { cursor: zoom-in; }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(8, 11, 18, 0.94);
  z-index: 11000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 220ms ease;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.lightbox.open {
  display: flex;
  opacity: 1;
}
.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 11005;
  transition: background 200ms ease;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 11005;
  transition: background 200ms ease, transform 200ms ease;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.22); }
.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }
.lightbox-stage {
  width: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 80px 16px;
  box-sizing: border-box;
}
#lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.lightbox-counter {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  margin: 8px 0 12px;
}
.lightbox-thumbs {
  display: flex;
  gap: 8px;
  padding: 12px 20px 20px;
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: thin;
  flex-shrink: 0;
}
.lightbox-thumb {
  width: 88px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  border: 2px solid transparent;
  opacity: 0.55;
  transition: opacity 200ms ease, border-color 200ms ease, transform 200ms ease;
  background: #1a1d27;
}
.lightbox-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lightbox-thumb:hover { opacity: 0.85; }
.lightbox-thumb.active {
  border-color: var(--primary);
  opacity: 1;
  transform: scale(1.05);
}

@media (max-width: 768px) {
  .zoom-btn { width: 38px; height: 38px; right: 12px; bottom: 12px; border-radius: 10px; }
  .lightbox-close { top: 12px; right: 12px; width: 40px; height: 40px; }
  .lightbox-nav { width: 44px; height: 44px; }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
  .lightbox-stage { padding: 48px 12px 8px; }
  .lightbox-thumbs { padding: 8px 12px 14px; gap: 6px; }
  .lightbox-thumb { width: 64px; height: 44px; }
  .lightbox-counter { font-size: 12px; margin: 6px 0 8px; }
}
