/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #1a1f2e;
  background: #f6f8fb;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.6em; }
h1 { font-size: clamp(1.8rem, 3vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 2.4vw, 2rem); }
h3 { font-size: 1.15rem; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.05s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover { background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%); }
.btn-ghost {
  background: transparent;
  color: #1d4ed8;
  border: 1.5px solid #1d4ed8;
}
.btn-ghost:hover { background: #eef2ff; }
.btn-lg { padding: 14px 24px; font-size: 1rem; }
.btn-xs { padding: 6px 10px; font-size: 0.8rem; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---------- Header ---------- */
.site-header {
  background: #fff;
  border-bottom: 1px solid #e5e9f1;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  gap: 16px;
}
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: block;
  object-fit: cover;
}
.logo-text { font-weight: 700; font-size: 1.1rem; }
.nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-link {
  padding: 8px 14px;
  border-radius: 8px;
  color: #41506b;
  font-weight: 500;
  font-size: 0.95rem;
}
.nav-link:hover { background: #f0f3f9; color: #1a1f2e; }
.nav-link.active { color: #1d4ed8; background: #eef2ff; }
.header-cta { padding: 10px 16px; }

.nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1.5px solid #dbe3f3;
  border-radius: 8px;
  background: transparent;
  color: #41506b;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.nav-toggle:hover { background: #f0f3f9; color: #1a1f2e; border-color: #c7d2fe; }
.nav-toggle svg { display: block; }
.nav-toggle .nav-toggle-icon-close { display: none; }
.nav-toggle.is-open .nav-toggle-icon-open { display: none; }
.nav-toggle.is-open .nav-toggle-icon-close { display: block; }

@media (max-width: 720px) {
  .header-inner { position: relative; gap: 8px; padding: 12px 16px; }
  .nav-toggle { display: inline-flex; }
  .header-cta { display: none; }
  .nav {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 12px;
    right: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px;
    background: #fff;
    border: 1px solid #e5e9f1;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
    z-index: 60;
  }
  .nav.is-open { display: flex; }
  .nav-link { padding: 12px 14px; font-size: 1rem; }
}

/* ---------- Auth (header slot) ---------- */
/* Тригер у хедері — кругла «pill» з аватаркою й іменем; клік веде у
   /profile. Інлайн-стилі в js/auth.js дублюють критичні правила, щоб
   аватар не «розривав» хедер навіть якщо CSS прийшов зі стейл-кешу. */
.auth-slot { display: inline-flex; align-items: center; min-height: 38px; }
.auth-signin { display: inline-flex; align-items: center; }
.auth-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1.5px solid #dbe3f3;
  border-radius: 999px;
  padding: 3px 12px 3px 4px;
  color: #1a1f2e;
  font-size: 0.9rem;
  font-weight: 500;
  height: 38px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.auth-trigger:hover { background: #f0f3f9; border-color: #c7d2fe; }
.auth-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #eef2ff;
  flex-shrink: 0;
  object-fit: cover;
  display: block;
}
.auth-avatar.auth-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1d4ed8, #06b6d4);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}
.auth-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 720px) {
  .auth-name { display: none; }
  .auth-trigger { padding: 3px; }
}

/* ---------- Profile page ---------- */
.profile-page { padding: 32px 20px 60px; max-width: 880px; margin: 0 auto; }
.profile-card {
  background: #fff;
  border: 1px solid #eef2f9;
  border-radius: 14px;
  padding: 28px;
  margin-top: 20px;
}
.profile-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eef2f9;
}
.profile-pic {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #eef2ff;
}
.profile-pic.profile-pic-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1d4ed8, #06b6d4);
  color: #fff;
  font-weight: 700;
  font-size: 1.5rem;
}
.profile-head-text { display: flex; flex-direction: column; gap: 4px; }
.profile-name { font-size: 1.15rem; font-weight: 700; color: #1a1f2e; }
.profile-email { color: #6b7591; font-size: 0.9rem; word-break: break-all; }
.profile-meta { color: #6b7591; font-size: 0.8rem; margin-top: 2px; }

.profile-form { padding-top: 22px; }
.profile-form .field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 16px;
}
@media (max-width: 540px) {
  .profile-form .field-row { grid-template-columns: 1fr; gap: 14px; margin-bottom: 0; }
}
.profile-form .field { margin-bottom: 16px; }
.profile-form input[type="text"],
.profile-form input[type="tel"],
.profile-form input[type="email"] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #dbe3f3;
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: inherit;
}
:root[data-theme="dark"] .profile-form input[type="text"],
:root[data-theme="dark"] .profile-form input[type="tel"],
:root[data-theme="dark"] .profile-form input[type="email"] {
  background: #0f172a; border-color: #334155; color: #f1f5f9;
}

/* Billing cards on /profile ---------------------------------------------- */
.profile-billing-card { padding: 22px 26px; margin-top: 16px; }
.profile-billing-card h3,
.profile-payments-card h3 {
  font-size: 1.05rem;
  margin: 0 0 12px;
}
.profile-billing-balance-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.profile-billing-balance-value { font-size: 1.6rem; font-weight: 800; color: #1d4ed8; }
.profile-billing-free { color: #15803d; font-size: 0.85rem; margin-top: 4px; }
.profile-billing-sub { font-size: 0.85rem; margin-top: 10px; padding-top: 10px; border-top: 1px solid #eef2f9; }

.profile-payments-card { padding: 22px 26px; margin-top: 16px; }
.profile-payments-wrap { overflow-x: auto; }
.profile-payments {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.profile-payments th, .profile-payments td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #eef2f9;
  vertical-align: middle;
}
.profile-payments th { color: #41506b; font-weight: 600; }
.profile-payments .profile-num { text-align: right; }
.profile-pay-status {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.profile-pay-status-ok      { background: #ecfdf5; color: #15803d; border: 1px solid #a7f3d0; }
.profile-pay-status-pending { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.profile-pay-status-fail    { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.profile-pay-status-muted   { background: #e2e8f0; color: #475569; border: 1px solid #cbd5e1; }

:root[data-theme="dark"] .profile-billing-balance-value { color: #93c5fd; }
:root[data-theme="dark"] .profile-billing-sub { border-top-color: #1f2937; }
:root[data-theme="dark"] .profile-payments th { color: #94a3b8; }
:root[data-theme="dark"] .profile-payments th,
:root[data-theme="dark"] .profile-payments td { border-bottom-color: #1f2937; }
:root[data-theme="dark"] .profile-pay-status-ok      { background: rgba(34,197,94,.15);  color: #86efac; border-color: #065f46; }
:root[data-theme="dark"] .profile-pay-status-pending { background: rgba(234,179,8,.15);  color: #fcd34d; border-color: #92400e; }
:root[data-theme="dark"] .profile-pay-status-fail    { background: rgba(239,68,68,.18);  color: #fca5a5; border-color: #b91c1c; }
:root[data-theme="dark"] .profile-pay-status-muted   { background: rgba(148,163,184,.15); color: #cbd5e1; border-color: #475569; }

.profile-form .field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: #41506b;
  margin-bottom: 6px;
}
.profile-form .field-hint {
  font-size: 0.78rem;
  color: #6b7591;
  margin-top: 6px;
}
.profile-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
}
.profile-status {
  font-size: 0.85rem;
  min-height: 1.2em;
}
.profile-status.success { color: #15803d; }
.profile-status.error { color: #b91c1c; }
.profile-status.loading { color: #1d4ed8; }
.profile-logout {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #eef2f9;
  display: flex;
  justify-content: flex-end;
}

/* ---------- Favorites page ---------- */
.favorites-page { padding: 32px 20px 60px; }
.fav-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  background: #fff;
  border: 1px solid #eef2f9;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.fav-filter-search,
.fav-filter-make,
.fav-filter-auction,
.fav-filter-status,
.fav-filter-sort {
  appearance: none;
  -webkit-appearance: none;
  background: #fff;
  border: 1px solid #d8dfeb;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.9rem;
  color: inherit;
  font-family: inherit;
  min-height: 36px;
  width: auto;
}
/* Розкладка: пошук грабує вдвічі більше вільного місця, селекти діляться
   рівномірно. min-width: 0 на всіх — щоб довге значення в селекті не
   "роздувало" його основу й не зривало рядок на наступну лінію. */
.fav-filter-search { flex: 2 1 200px; min-width: 0; }
.fav-filter-make,
.fav-filter-auction,
.fav-filter-status,
.fav-filter-sort { flex: 1 1 130px; min-width: 0; }
.fav-filter-make,
.fav-filter-auction,
.fav-filter-status,
.fav-filter-sort {
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
  text-overflow: ellipsis;
  overflow: hidden;
}
.fav-filter-search:focus,
.fav-filter-make:focus,
.fav-filter-auction:focus,
.fav-filter-status:focus,
.fav-filter-sort:focus {
  outline: 0;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.fav-filter-reset { flex: 0 0 auto; }
.fav-empty-row { text-align: center; padding: 28px 14px; }
/* Назва авто — основний CTA на рядку: «клікнеш — відкриваєш деталі».
   Робимо її явним лінком: синій акцент + dotted underline у звичному
   стані, solid underline на hover. Дублює функцію видаленої кнопки
   «Деталі». */
/* Сума «під ключ» — теж лінк, що відкриває калькулятор з цим лотом.
   Замінив окрему кнопку «Калькулятор». Видимий accent + dotted
   underline на самих цифрах. */
.fav-total-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  display: inline-block;
}
.fav-total-link strong {
  color: #1d4ed8;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.fav-total-link:hover strong {
  color: #1e40af;
  text-decoration-style: solid;
}
[data-theme="dark"] .fav-total-link strong { color: #60a5fa; }
[data-theme="dark"] .fav-total-link:hover strong { color: #93c5fd; }

.fav-title-link { color: inherit; text-decoration: none; cursor: pointer; }
.fav-title-link .fav-title {
  color: #1d4ed8;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.fav-title-link:hover .fav-title {
  color: #1e40af;
  text-decoration-style: solid;
}
.fav-report-title-link { color: inherit; text-decoration: none; border-bottom: 1px dashed currentColor; }
.fav-report-title-link:hover { color: #1d4ed8; }
.fav-summary {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  align-items: center;
  background: #fff;
  border: 1px solid #eef2f9;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 18px;
}
.fav-summary strong { color: #1a1f2e; }
.fav-refresh-btn { margin-left: auto; }
.fav-refresh-btn:disabled { opacity: 0.6; cursor: progress; }

/* Форма «Додати лот» — посилання/номер + кнопка. Стиль перегукується з
   .copart-import з калькулятора, щоб юзер відразу впізнав знайомий
   паттерн. Status-рядок під формою показує парс-помилку чи прогрес. */
.fav-add-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  background: #fff;
  border: 1px solid #eef2f9;
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 18px;
}
.fav-add-input {
  flex: 1;
  min-width: 240px;
  padding: 10px 14px;
  border: 1px solid #d8dfeb;
  border-radius: 10px;
  font-size: 0.95rem;
  background: #fff;
  color: #1a1f2e;
  font-family: inherit;
}
.fav-add-input:focus {
  outline: 0;
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}
.fav-add-btn:disabled { opacity: 0.6; cursor: progress; }
.fav-add-status { font-size: 0.85rem; flex-basis: 100%; }
.fav-add-status.err { color: #b91c1c; }
[data-theme="dark"] .fav-add-row { background: #0f172a; border-color: #1f2937; }
[data-theme="dark"] .fav-add-input { background: #0b1220; border-color: #334155; color: #e2e8f0; }
[data-theme="dark"] .fav-add-input:focus { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.22); }
[data-theme="dark"] .fav-add-status.err { color: #fca5a5; }
.fav-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  z-index: 9999;
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
}
.fav-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Refresh report (bulk-refresh) ---------- */
.fav-refresh-report {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px 20px;
  opacity: 0;
  transition: opacity 180ms ease;
}
.fav-refresh-report.is-visible { opacity: 1; }
.fav-refresh-report-card {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
/* Fullscreen toggle для звіту ремонту: коли в модалці багато
   запчастин — комфортніше редагувати у повноекранному режимі. */
.fav-refresh-report.is-fullscreen {
  padding: 12px;
  align-items: stretch;
}
.fav-refresh-report.is-fullscreen .fav-refresh-report-card {
  max-width: 1400px;
  max-height: calc(100vh - 24px);
  width: 100%;
  margin: 0 auto;
}
.fav-report-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #eef2f9;
}
.fav-report-head.is-success { background: #ecfdf5; color: #065f46; }
.fav-report-head.is-warning { background: #fef2f2; color: #991b1b; }
.fav-report-head-text strong { display: block; font-size: 1rem; }
.fav-report-head-text .muted { font-size: 0.85rem; }
.fav-report-close {
  background: transparent;
  border: 0;
  font-size: 24px;
  line-height: 1;
  color: inherit;
  cursor: pointer;
  padding: 0 4px;
}
.fav-report-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.fav-report-pdf-btn,
.fav-report-xlsx-btn {
  background: rgba(255, 255, 255, 0.55);
  color: inherit;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease;
}
.fav-report-pdf-btn:hover,
.fav-report-xlsx-btn:hover { background: rgba(255, 255, 255, 0.85); }
.fav-report-pdf-btn:disabled,
.fav-report-xlsx-btn:disabled { opacity: 0.6; cursor: progress; }
[data-theme="dark"] .fav-report-pdf-btn,
[data-theme="dark"] .fav-report-xlsx-btn {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .fav-report-pdf-btn:hover,
[data-theme="dark"] .fav-report-xlsx-btn:hover { background: rgba(15, 23, 42, 0.85); }
.fav-report-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  overflow-y: auto;
  flex: 1;
}
.fav-report-item {
  display: flex;
  gap: 12px;
  padding: 10px 18px;
  align-items: flex-start;
  border-bottom: 1px solid #f3f5fa;
}
.fav-report-item:last-child { border-bottom: 0; }
.fav-report-pill {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 999px;
  margin-top: 1px;
}
.fav-report-pill.pill-ok    { background: #bbf7d0; color: #065f46; }
.fav-report-pill.pill-muted { background: #e2e8f0; color: #475569; }
.fav-report-pill.pill-err   { background: #fecaca; color: #991b1b; }
.fav-report-pill.pill-warn  { background: #fde68a; color: #92400e; }
.fav-report-item.is-overtook { background: rgba(220, 38, 38, 0.08); }
.fav-report-pill.pill-warn.fav-report-overtook { background: #fecaca; color: #991b1b; }
.fav-report-overtook { margin-left: 6px; }
.fav-report-text { min-width: 0; flex: 1; }
.fav-report-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: #1a1f2e;
  word-break: break-word;
}
.fav-report-detail { font-size: 0.82rem; word-break: break-word; }

[data-theme="dark"] .fav-refresh-report-card { background: #0f172a; }
[data-theme="dark"] .fav-report-head { border-bottom-color: #1f2937; }
[data-theme="dark"] .fav-report-head.is-success { background: rgba(34,197,94,.15); color: #86efac; }
[data-theme="dark"] .fav-report-head.is-warning { background: rgba(239,68,68,.18); color: #fca5a5; }
[data-theme="dark"] .fav-report-item { border-bottom-color: #1f2937; }
[data-theme="dark"] .fav-report-title { color: #e2e8f0; }
[data-theme="dark"] .fav-report-pill.pill-muted { background: #1e293b; color: #94a3b8; }
[data-theme="dark"] .fav-report-pill.pill-warn { background: rgba(245, 158, 11, 0.22); color: #fcd34d; }
[data-theme="dark"] .fav-report-item.is-overtook { background: rgba(239, 68, 68, 0.14); }
[data-theme="dark"] .fav-report-pill.pill-warn.fav-report-overtook { background: rgba(239, 68, 68, 0.22); color: #fca5a5; }
.fav-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #eef2f9;
  border-radius: 12px;
  overflow: hidden;
}
.fav-table th, .fav-table td {
  text-align: left;
  padding: 12px 14px;
  vertical-align: middle;
  border-bottom: 1px solid #eef2f9;
}
.fav-table tbody tr:last-child td { border-bottom: 0; }
.fav-table thead th {
  background: #f6f8fb;
  font-weight: 600;
  font-size: 0.85rem;
  color: #41506b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  /* Дозволяємо текстам хідерів переноситись. Інакше .fav-num додає
     white-space: nowrap і довгі заголовки на кшталт «Макс. ставка»
     чи «Ремонт в Україні» розпирають колонку до своєї повної ширини,
     навіть якщо td має explicit `width: 100px`. */
  white-space: normal;
}
.fav-num { text-align: right; white-space: nowrap; width: 1%; }
.fav-table .fav-actions-cell { width: 1%; white-space: nowrap; }
/* Колонка «Ставка»: основна сума не переноситься (визначає ширину колонки),
   а Buy It Now-підказка йде з нового рядка і вільно переноситься всередині
   тієї ж ширини, не розширюючи стовпець. */
.fav-table .fav-bid-cell .fav-meta { white-space: normal; }
/* «Макс. ставка» колонка: фіксуємо ширину клітинки під сам інпут, а
   warning-підпис «Ставку перебито…» хай переноситься у нові рядки і
   НЕ розпирає колонку. Padding клітинки тут менший, бо інпут уже
   має власний border + padding. */
.fav-table .fav-maxbid-cell {
  width: 96px;
  min-width: 96px;
  max-width: 96px;
  white-space: normal;
  padding-left: 4px;
  padding-right: 4px;
}
/* Колонка «Ремонт в Україні»: тримає кнопку «Оцінити» АБО
   іконку-перерахувати + ціну, плюс meta «З ремонтом: $XX,XXX».
   Фіксуємо ширину під найбільшу суму + іконку, а meta-рядок
   дозволяємо переносити, щоб довгі числа не розпирали стовпець. */
.fav-table .fav-repair-cell {
  width: 120px;
  min-width: 120px;
  max-width: 120px;
  white-space: normal;
}
.fav-table .fav-repair-cell .fav-meta { white-space: normal; }
.fav-maxbid-input-wrap {
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid #d8dfeb;
  border-radius: 8px;
  padding: 0 6px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.fav-maxbid-input-wrap:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.fav-maxbid-input-wrap.is-overtaken { border-color: #dc2626; }
.fav-maxbid-input-wrap.is-overtaken:focus-within {
  border-color: #b91c1c;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18);
}
.fav-maxbid-overtaken {
  color: #b91c1c;
  margin-top: 4px;
  font-weight: 600;
  white-space: normal;
  word-wrap: break-word;
  text-align: right;
  font-size: 0.78rem;
  line-height: 1.3;
}
/* Червоний фон для всього рядка з перебитою ставкою — щоб ока йшла одразу
   до проблемного лоту в довгому списку. Subtle tint, читабельно. */
.fav-table tbody tr.is-overtaken-row { background: rgba(220, 38, 38, 0.06); }
.fav-table tbody tr.is-overtaken-row:hover { background: rgba(220, 38, 38, 0.10); }
:root[data-theme="dark"] .fav-maxbid-input-wrap.is-overtaken { border-color: #f87171; }
:root[data-theme="dark"] .fav-maxbid-overtaken { color: #fca5a5; }
:root[data-theme="dark"] .fav-table tbody tr.is-overtaken-row { background: rgba(239, 68, 68, 0.12); }
:root[data-theme="dark"] .fav-table tbody tr.is-overtaken-row:hover { background: rgba(239, 68, 68, 0.18); }
.fav-maxbid-prefix { color: #41506b; font-weight: 600; margin-right: 2px; }
/* Селектор зчеплений із .fav-maxbid-input-wrap, щоб перебивати
   глобальний `input[type="number"] { padding: 10px 12px }` (нижче в
   файлі). Без цього wrap-контейнер має 12px-padding праворуч і
   "10000" обрізається до "100(". */
.fav-maxbid-input-wrap .fav-maxbid-input {
  border: 0;
  outline: 0;
  background: transparent;
  padding: 6px 0;
  flex: 1;
  width: auto;
  min-width: 0;
  font-size: 0.95rem;
  text-align: right;
  color: inherit;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  border-radius: 0;
}
.fav-maxbid-input-wrap .fav-maxbid-input:focus { box-shadow: none; }
.fav-maxbid-input::-webkit-outer-spin-button,
.fav-maxbid-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.fav-photo-cell { width: 168px; min-width: 168px; }
.fav-photo-cell img,
.fav-photo-cell .fav-photo-placeholder {
  width: 160px;
  height: 120px;
  border-radius: 10px;
  object-fit: cover;
  background: #eef2ff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  color: #41506b;
  text-align: center;
  padding: 4px;
  border: 1px solid #d8dfeb;
  box-sizing: border-box;
}
@media (max-width: 1100px) {
  /* Звужений ресайз для wide-tablet діапазону: фото зменшуємо, але не
     до інфо-уявлення — все одно більше за оригінал. */
  .fav-photo-cell { width: 144px; min-width: 144px; }
  .fav-photo-cell img,
  .fav-photo-cell .fav-photo-placeholder { width: 136px; height: 102px; }
}
.fav-photo-cell img { border: 0; padding: 0; }
.fav-photo-link { display: inline-block; line-height: 0; }
.fav-photo-link img { display: block; padding: 0; }

/* Strip фото — на десктопі показуємо лише першу картинку (інші
   приховані), на мобільному (див. @media далі) — горизонтальна
   свайп-карусель з scroll-snap. */
.fav-photo-strip {
  width: 160px;
  height: 120px;
  border-radius: 10px;
  border: 1px solid #d8dfeb;
  overflow: hidden;
  background: #eef2ff;
  box-sizing: border-box;
  position: relative;
}
.fav-photo-strip img {
  width: 160px;
  height: 120px;
  object-fit: cover;
  display: none;
}
.fav-photo-strip img:first-child { display: block; }
.fav-photo-wrap { width: 100%; }
/* Стрілки + thumbs ховаємо за замовч. — вмикаємо лише на мобільному. */
.fav-photo-arrow,
.fav-photo-thumbs { display: none; }
@media (max-width: 1100px) {
  .fav-photo-strip { width: 136px; height: 102px; }
  .fav-photo-strip img { width: 136px; height: 102px; }
}
.fav-title { font-weight: 600; color: #1a1f2e; }
.fav-meta { font-size: 0.8rem; }

/* Колонка «Авто»: даємо їй пристойну ширину, інакше table-layout віддає
   останній доступний простір title-таблиці, а решта колонок із
   white-space:nowrap тягнуть її до 0. min-width гарантує, що "2023
   TESLA MODEL Y" поміститься в один рядок. */
.fav-table .fav-info-cell {
  min-width: 220px;
  width: 22%;
}
.fav-table .fav-info-cell .fav-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.fav-table .fav-info-cell .fav-meta {
  /* Лот #..., COPART, штат — теж в один рядок з ellipsis, не вертикальним
     стовпчиком слів. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 1080px) {
  .fav-table .fav-info-cell { min-width: 180px; width: auto; }
}
.fav-lotid-link { color: inherit; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
.fav-lotid-link:hover { color: #1d4ed8; text-decoration-style: solid; }
/* Лінк на номер лоту у хедері сторінки деталей. Той самий стиль, що
   й у favorites — dashed underline + accent на hover. */
.lot-external-link { color: inherit; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
.lot-external-link:hover { color: #1d4ed8; text-decoration-style: solid; }
[data-theme="dark"] .lot-external-link:hover { color: #93c5fd; }
.fav-actions { display: flex; gap: 6px; justify-content: flex-end; }
/* Іконкові кнопки в таблиці favorites: ↻ (оновити) у клітинці ставки і
   🗑 (видалити) у actions. Порожні квадрати 28×28 з іконкою всередині;
   accent на hover, окремий «-danger» варіант для видалення. */
.fav-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid #dbe3f3;
  background: transparent;
  color: #41506b;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.fav-icon-btn:hover { background: #eef2ff; border-color: #1d4ed8; color: #1d4ed8; }
.fav-icon-btn:disabled { opacity: 0.5; cursor: progress; }
.fav-icon-btn-danger:hover { background: #fee2e2; border-color: #dc2626; color: #dc2626; }
.fav-icon-btn.is-loading svg { animation: fav-spin 0.8s linear infinite; }
@keyframes fav-spin { to { transform: rotate(360deg); } }
[data-theme="dark"] .fav-icon-btn { border-color: #334155; color: #cbd5e1; }
[data-theme="dark"] .fav-icon-btn:hover { background: rgba(37,99,235,.18); border-color: #60a5fa; color: #93c5fd; }
[data-theme="dark"] .fav-icon-btn-danger:hover { background: rgba(239,68,68,.18); border-color: #f87171; color: #fca5a5; }
.fav-empty {
  background: #fff;
  border: 1px solid #eef2f9;
  border-radius: 12px;
  padding: 40px 24px;
  text-align: center;
}
.fav-empty p { margin: 0 0 12px; }
.fav-empty .btn { margin-top: 8px; }

/* ---------- Repair estimate cell + modal ---------- */
.fav-repair-cell { position: relative; }
.fav-repair-link {
  color: #1d4ed8;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.fav-repair-link:hover { text-decoration-style: solid; }
/* .fav-repair-recalc тепер використовує клас .fav-icon-btn, тож стилі
   приходять звідти. Окремих правил для recalc не потрібно. */
.fav-repair-loading {
  display: inline-block;
  font-size: 0.85rem;
  font-style: italic;
  padding: 4px 0;
}

.fav-repair-card { max-width: 760px; }
.fav-repair-body {
  padding: 14px 18px 18px;
  overflow-y: auto;
  flex: 1;
}
.fav-repair-body h4 {
  margin: 18px 0 8px;
  font-size: 0.95rem;
  color: #1a1f2e;
  border-bottom: 1px solid #eef2f9;
  padding-bottom: 4px;
}
.fav-repair-summary {
  margin: 0 0 10px;
  padding: 10px 12px;
  background: #f6f8fb;
  border-radius: 8px;
  font-size: 0.92rem;
  line-height: 1.45;
}
.fav-repair-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.fav-repair-table th, .fav-repair-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #f3f5fa;
  vertical-align: top;
  text-align: left;
}
.fav-repair-table th {
  background: #f6f8fb;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #41506b;
}
.fav-repair-table .fav-num { text-align: right; }
.fav-repair-table tr.fav-repair-total td { border-top: 2px solid #d8dfeb; padding-top: 10px; }
.fav-repair-table tr.fav-repair-grand td { background: #ecfdf5; color: #065f46; }
.fav-repair-photos-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}
.fav-repair-photos-head h4 { margin: 0; border: 0; padding: 0; }
.fav-repair-photo-actions { display: flex; gap: 6px; }

.fav-repair-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin: 8px 0 6px;
}
.fav-repair-photo {
  display: block;
  position: relative;
  line-height: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #eef2f9;
  background: #f6f8fb;
  transition: transform 120ms ease, border-color 120ms ease, opacity 120ms ease;
}
.fav-repair-photo:hover {
  transform: scale(1.02);
  border-color: #2563eb;
}
.fav-repair-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
[data-theme="dark"] .fav-repair-photo { background: #0f172a; border-color: #1f2937; }
[data-theme="dark"] .fav-repair-photo:hover { border-color: #60a5fa; }

/* Edit-режим: обрані з зеленою рамкою + кнопкою ×, доступні — приглушені + кнопкою + */
.fav-repair-photos-edit .fav-repair-photo.is-selected { border-color: #16a34a; border-width: 2px; }
.fav-repair-photos-edit .fav-repair-photo.is-available { opacity: 0.55; }
.fav-repair-photos-edit .fav-repair-photo.is-available:hover { opacity: 1; }
.fav-photo-remove, .fav-photo-add {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.fav-photo-remove { background: #ef4444; color: #fff; }
.fav-photo-remove:hover { background: #dc2626; }
.fav-photo-add { background: #16a34a; color: #fff; }
.fav-photo-add:hover { background: #15803d; }

.fav-photo-add-url {
  display: flex;
  gap: 6px;
  margin: 8px 0;
}
.fav-photo-url-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #d8dfeb;
  border-radius: 6px;
  font-size: 0.88rem;
  background: #fff;
  color: inherit;
}
.fav-photo-url-input:focus { outline: 0; border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15); }
[data-theme="dark"] .fav-photo-url-input { background: #0f172a; border-color: #334155; }
.fav-photo-edit-hint { margin: 4px 0 12px; }

/* Опційні роботи: чек-боксні рядки */
.fav-repair-optional td { vertical-align: top; }
.fav-opt-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.fav-opt-check { width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; }
.fav-repair-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
}
.fav-repair-badge-rec { background: #bbf7d0; color: #065f46; }
[data-theme="dark"] .fav-repair-badge { background: #1e293b; color: #94a3b8; }
[data-theme="dark"] .fav-repair-badge-rec { background: rgba(34,197,94,.18); color: #86efac; }

/* Фінальна таблиця тоталів — виділяємо її поверх інших */
.fav-repair-totals { margin-top: 12px; }

.fav-repair-assumptions {
  margin: 0;
  padding-left: 22px;
  font-size: 0.88rem;
  color: #41506b;
}
.fav-repair-assumptions li { margin-bottom: 4px; }
.fav-repair-disclaimer {
  margin: 14px 0 0;
  font-size: 0.82rem;
  font-style: italic;
}

[data-theme="dark"] .fav-repair-link { color: #93c5fd; }
/* dark-theme для recalc-іконки тепер через .fav-icon-btn, окреме правило не потрібне. */
[data-theme="dark"] .fav-repair-body h4 { color: #e2e8f0; border-bottom-color: #1f2937; }
[data-theme="dark"] .fav-repair-summary { background: #0f172a; color: #cbd5e1; }
[data-theme="dark"] .fav-repair-table th { background: #0f172a; color: #94a3b8; }
[data-theme="dark"] .fav-repair-table th, [data-theme="dark"] .fav-repair-table td { border-bottom-color: #1f2937; }
[data-theme="dark"] .fav-repair-table tr.fav-repair-grand td { background: rgba(34,197,94,.18); color: #86efac; }
[data-theme="dark"] .fav-repair-assumptions { color: #cbd5e1; }

@media (max-width: 720px) {
  /* Mobile favorites — карточкова верстка замість таблиці.
     Фото на всю ширину контейнера зверху (hero), дані під ним
     розкладаються в 2 колонки grid'ом, actions — внизу повної ширини. */
  .fav-table thead { display: none; }
  .fav-table, .fav-table tbody { display: block; width: 100%; }
  .fav-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 14px;
    row-gap: 10px;
    padding: 14px;
    border-bottom: 1px solid #eef2f9;
    align-items: start;
  }
  .fav-table td {
    display: block;
    padding: 0;
    border: 0;
    text-align: left;
    width: auto;
    min-width: 0;
    max-width: none;
  }
  .fav-num { text-align: left; }

  /* Photo: full-width hero (4:3), trim cell padding/width caps */
  .fav-table .fav-photo-cell {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    max-width: none;
    padding: 0;
  }
  .fav-photo-link { display: block; line-height: 0; width: 100%; }
  .fav-table .fav-photo-cell img,
  .fav-table .fav-photo-cell .fav-photo-placeholder {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    max-height: 280px;
    object-fit: cover;
    border-radius: 12px;
  }

  /* Strip фото на мобільному — горизонтальна свайп-карусель.
     Native touch-scroll + scroll-snap по картинці. Картинки не клікабельні
     (немає переходу на деталі); навігацію дає клікабельна назва лоту. */
  .fav-table .fav-photo-cell .fav-photo-strip {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    height: auto;
    border: 0;
    border-radius: 12px;
    background: transparent;
    /* iOS Safari: ховаємо scrollbar, лишаємо лише точечну індикацію через
       counter (за бажанням можна додати dots'и пізніше). */
    scrollbar-width: none;
  }
  .fav-table .fav-photo-cell .fav-photo-strip::-webkit-scrollbar { display: none; }
  .fav-table .fav-photo-cell .fav-photo-strip img {
    display: block;
    flex: 0 0 100%;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    max-height: 280px;
    object-fit: cover;
    scroll-snap-align: start;
    border-radius: 12px;
  }

  /* Напівпрозорі стрілки prev/next як у Copart — overlay'и над strip,
     підказують, що галерею можна крутити свайпом або кнопками. */
  .fav-photo-wrap { position: relative; }
  .fav-photo-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 0;
    background: rgba(15, 23, 42, 0.55);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    transition: background 0.15s ease;
  }
  .fav-photo-arrow:hover,
  .fav-photo-arrow:active { background: rgba(15, 23, 42, 0.85); }
  .fav-photo-arrow-prev { left: 8px; }
  .fav-photo-arrow-next { right: 8px; }
  /* Не показуємо стрілки, якщо в strip всього одне фото. */
  .fav-photo-strip[data-count="1"] + .fav-photo-thumbs,
  .fav-photo-strip[data-count="1"] .fav-photo-arrow { display: none; }

  /* Thumbs — рядок мініатюр під головним фото, на тій самій картці. */
  .fav-photo-thumbs {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    margin-top: 6px;
    padding-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .fav-photo-thumbs::-webkit-scrollbar { display: none; }
  .fav-photo-thumb {
    flex: 0 0 auto;
    width: 64px;
    aspect-ratio: 4 / 3;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    background: #eef2ff;
    cursor: pointer;
  }
  .fav-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  .fav-photo-thumb.is-active { border-color: #1d4ed8; }

  /* Title block: full width below photo, не обрізаємо ellipsis'ом */
  .fav-table .fav-info-cell {
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
  }
  .fav-table .fav-info-cell .fav-title { white-space: normal; }
  .fav-table .fav-info-cell .fav-meta { white-space: normal; }

  /* 2-column data cells: компактні мітки зверху, щоб картка читалася */
  .fav-table .fav-bid-cell::before,
  .fav-table .fav-auctionend-cell::before,
  .fav-table .fav-status-cell::before,
  .fav-table .fav-maxbid-cell::before,
  .fav-table .fav-total-cell::before,
  .fav-table .fav-repair-cell::before {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
  }
  .fav-table .fav-bid-cell::before { content: 'Ставка'; }
  .fav-table .fav-auctionend-cell::before { content: 'Дата'; }
  .fav-table .fav-status-cell::before { content: 'Статус'; }
  .fav-table .fav-maxbid-cell::before { content: 'Макс. ставка'; }
  .fav-table .fav-total-cell::before { content: 'В Україні'; }
  .fav-table .fav-repair-cell::before { content: 'Ремонт'; }

  /* Maxbid input: розпираємо на всю колонку, легше тапати на мобільному.
     Перебиваємо desktop-фікс (100px width) явно, бо тон специфічності
     там 0,2,1 — та сама, що й тут, але цей блок далі по файлу. */
  .fav-table .fav-maxbid-cell {
    padding: 0;
    width: auto;
    min-width: 0;
    max-width: none;
  }
  .fav-maxbid-input-wrap { width: 100%; }

  /* Actions: повна ширина, кнопки праворуч */
  .fav-table .fav-actions-cell { grid-column: 1 / -1; width: auto; }
  .fav-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
  }
}
:root[data-theme="dark"] .fav-table .fav-bid-cell::before,
:root[data-theme="dark"] .fav-table .fav-auctionend-cell::before,
:root[data-theme="dark"] .fav-table .fav-status-cell::before,
:root[data-theme="dark"] .fav-table .fav-maxbid-cell::before,
:root[data-theme="dark"] .fav-table .fav-total-cell::before,
:root[data-theme="dark"] .fav-table .fav-repair-cell::before {
  color: #94a3b8;
}

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(circle at 20% 0%, rgba(37, 99, 235, 0.18), transparent 50%),
    radial-gradient(circle at 90% 100%, rgba(6, 182, 212, 0.14), transparent 50%),
    linear-gradient(180deg, #f6f8fb 0%, #eef2f9 100%);
  padding: 60px 0 80px;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 48px;
  align-items: center;
}
.hero-content .badge {
  display: inline-block;
  background: #fff;
  color: #1d4ed8;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  border: 1px solid #dbe3f3;
  margin-bottom: 16px;
}
.hero h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  letter-spacing: -0.02em;
}
.hero .accent {
  background: linear-gradient(135deg, #1d4ed8, #06b6d4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .lead {
  font-size: 1.1rem;
  color: #41506b;
  max-width: 540px;
  margin-bottom: 28px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 32px; }
.hero-stats {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  border-top: 1px solid #dbe3f3;
  padding-top: 24px;
}
.hero-stats > div { display: flex; flex-direction: column; }
.hero-stats strong { font-size: 1.3rem; color: #1a1f2e; }
.hero-stats span { color: #6b7591; font-size: 0.9rem; }

.hero-card {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
  border: 1px solid #eef2f9;
}
.quick-search h3 { margin-bottom: 16px; }
.quick-search label,
.calc-form label,
.filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: #41506b;
  font-weight: 500;
  margin-bottom: 14px;
}
.quick-search input,
.quick-search select,
.calc-form input,
.calc-form select,
.filters input,
.filters select,
.profile-form input,
.profile-form select,
input[type="text"],
input[type="number"],
input[type="tel"],
input[type="email"],
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #dbe3f3;
  background: #fff;
  font-size: 0.95rem;
  color: #1a1f2e;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

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

/* ---------- Features ---------- */
.features { padding: 60px 0; }
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 24px;
}
.feature {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  border: 1px solid #eef2f9;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.feature:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08); }
.feature-num {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1d4ed8, #06b6d4);
  color: #fff;
  display: inline-flex;
  align-items: center; justify-content: center;
  font-weight: 700;
  margin-bottom: 12px;
}
.feature p { color: #6b7591; margin: 0; }

/* ---------- CTA strip ---------- */
.cta-strip {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #fff;
  padding: 50px 0;
  margin-top: 40px;
}
.cta-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.cta-inner h2 { color: #fff; margin-bottom: 6px; }
.cta-inner p { color: #cbd5e1; margin: 0; }

/* ---------- Footer ---------- */
.site-footer {
  background: #0f172a;
  color: #cbd5e1;
  padding: 40px 0 20px;
  margin-top: 60px;
}
.footer-inner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid #1e293b;
}
.footer-inner h4 { color: #fff; margin-bottom: 8px; }
.footer-inner a { display: block; padding: 4px 0; color: #cbd5e1; }
.footer-inner a:hover { color: #fff; }
.footer-inner .logo-text { color: #fff; }
.copyright { padding-top: 20px; color: #94a3b8; font-size: 0.9rem; }
.copyright a { color: #cbd5e1; }
.copyright a:hover { color: #fff; text-decoration: underline; }
.muted { color: #6b7591; }

/* ---------- Search page ---------- */
.search-page { padding: 32px 20px 60px; }
.search-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 28px;
  margin-top: 20px;
  align-items: flex-start;
}
.filters {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #eef2f9;
  padding: 22px;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
.filters h3 { margin-bottom: 16px; }
.filter-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }

.results-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.results-count { color: #41506b; font-weight: 500; }
.sort { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: #6b7591; }
.sort select { width: auto; padding: 6px 10px; }

.cars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.car-card {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid #eef2f9;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.car-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(15, 23, 42, 0.1); }
.car-image {
  position: relative;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #cbd5e1, #94a3b8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: 0.5px;
}
.car-image .auction-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #fff;
  color: #1a1f2e;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.5px;
}
.car-image .auction-tag.copart { background: #fbbf24; color: #1a1f2e; }
.car-image .auction-tag.iaai { background: #ef4444; color: #fff; }

.car-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.car-title { font-weight: 700; color: #1a1f2e; font-size: 1rem; }
.car-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: #f0f3f9;
  color: #41506b;
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 6px;
}
.chip.danger { background: #fee2e2; color: #b91c1c; }
.chip.success { background: #dcfce7; color: #15803d; }
.car-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed #eef2f9;
}
.car-price { font-weight: 700; color: #1d4ed8; font-size: 1.15rem; }
.car-end { color: #6b7591; font-size: 0.8rem; }

/* ---------- Status pill (favorites table) ---------- */
.status-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  white-space: nowrap;
}
.status-pill.status-ok    { background: #bbf7d0; color: #065f46; }
.status-pill.status-warn  { background: #fef3c7; color: #92400e; }
.status-pill.status-info  { background: #dbeafe; color: #1d4ed8; }
.status-pill.status-sold  { background: #fecaca; color: #991b1b; }
.status-pill.status-muted { background: #e2e8f0; color: #475569; }
[data-theme="dark"] .status-pill.status-ok    { background: rgba(34,197,94,.18);  color: #86efac; }
[data-theme="dark"] .status-pill.status-warn  { background: rgba(234,179,8,.18);  color: #fcd34d; }
[data-theme="dark"] .status-pill.status-info  { background: rgba(59,130,246,.20); color: #93c5fd; }
[data-theme="dark"] .status-pill.status-sold  { background: rgba(239,68,68,.20);  color: #fca5a5; }
[data-theme="dark"] .status-pill.status-muted { background: #1e293b;              color: #94a3b8; }

/* ---------- Auction-time countdown ---------- */
/* Підсвічуємо саме countdown ("через 5 дн.") червоним, щоб одразу було
   видно, скільки лишилося до старту торгів. Використовується у пошуку,
   деталях лоту, фейворитах. Завершені лоти переключають на muted —
   червоне для них вже не несе сенсу. */
.auction-time {
  color: #b91c1c;
  font-weight: 600;
}
.auction-time.is-finished {
  color: #6b7591;
  font-weight: 500;
}
[data-theme="dark"] .auction-time { color: #fca5a5; }
[data-theme="dark"] .auction-time.is-finished { color: #94a3b8; }

.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.pagination button {
  background: #fff;
  border: 1px solid #dbe3f3;
  border-radius: 8px;
  padding: 8px 12px;
  color: #41506b;
  font-weight: 500;
}
.pagination button.active { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 900px) {
  .search-layout { grid-template-columns: 1fr; }
  .filters { position: static; max-height: none; }
}

/* ---------- Calculator ---------- */
.calc-page { padding: 32px 20px 60px; }
.calc-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 28px;
  margin-top: 20px;
  align-items: flex-start;
}
.calc-form {
  background: #fff;
  border-radius: 14px;
  padding: 22px;
  border: 1px solid #eef2f9;
}
.calc-form fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 18px;
  border-bottom: 1px solid #eef2f9;
  padding-bottom: 14px;
}
.calc-form fieldset:last-of-type { border-bottom: 0; }
.calc-form legend { font-weight: 700; color: #1a1f2e; padding: 0 0 10px; }

.calc-form fieldset.copart-import {
  background: linear-gradient(135deg, #eef2ff 0%, #e0f2fe 100%);
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 18px;
}
.calc-form fieldset.copart-import legend {
  padding: 0 6px;
  color: #1d4ed8;
  font-size: 0.95rem;
}
.calc-form .copart-import-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.calc-form .copart-import-row input {
  flex: 1;
  min-width: 0;
}
.calc-form .copart-import-row .btn {
  flex-shrink: 0;
}
.calc-form .copart-import-status {
  margin: 8px 0 0;
  font-size: 0.85rem;
  min-height: 1.2em;
}
.calc-form .copart-import-status.error { color: #b91c1c; }
.calc-form .copart-import-status.success { color: #15803d; }
.calc-form .copart-import-status.loading { color: #1d4ed8; }

.calc-form label.field-invalid input,
.calc-form label.field-invalid select {
  border-color: #dc2626;
  background: #fef2f2;
}
.calc-form label.field-invalid input:focus,
.calc-form label.field-invalid select:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.15);
}
.calc-form label.field-invalid::after {
  content: attr(data-hint);
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: #b91c1c;
  font-weight: 500;
}

.calc-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 14px 16px;
  color: #991b1b;
}
.calc-error strong { display: block; margin-bottom: 6px; color: #7f1d1d; }
.calc-error ul { margin: 0; padding-left: 20px; }
.calc-error li { margin: 2px 0; }

.calc-form label.calc-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  color: #1a1f2e;
  cursor: pointer;
}
.calc-form label.calc-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  cursor: pointer;
}

.calc-result {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  border: 1px solid #eef2f9;
  position: sticky;
  top: 80px;
}
.calc-result h3 { margin-bottom: 12px; }
.calc-total {
  background: linear-gradient(135deg, #1d4ed8, #06b6d4);
  color: #fff;
  padding: 18px;
  border-radius: 12px;
  margin: 16px 0;
}
.calc-total .label { font-size: 0.85rem; opacity: 0.9; }
.calc-total .amount { font-size: 1.8rem; font-weight: 700; margin-top: 4px; }
.calc-total .amount-uah { font-size: 1rem; opacity: 0.9; margin-top: 4px; }

.calc-breakdown { display: flex; flex-direction: column; gap: 0; }
.calc-section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #6b7591;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-top: 14px;
  margin-bottom: 6px;
}
.calc-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed #eef2f9;
  font-size: 0.92rem;
}
.calc-row.total {
  font-weight: 700;
  color: #1a1f2e;
  border-bottom: 0;
  border-top: 2px solid #1a1f2e;
  margin-top: 8px;
  padding-top: 12px;
}
.calc-row .name { color: #41506b; }
.calc-row .value { color: #1a1f2e; font-weight: 600; }

.calc-info { margin-top: 50px; }
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 16px;
}
.info-grid > div {
  background: #fff;
  border-radius: 12px;
  padding: 18px;
  border: 1px solid #eef2f9;
}
.info-grid h4 { margin-bottom: 6px; }
.info-grid p { color: #6b7591; margin: 0; }

@media (max-width: 900px) {
  .calc-layout { grid-template-columns: 1fr; }
  .calc-result { position: static; }
}

/* Sticky price bar — only on mobile, only after first valid calculation. */
.calc-sticky-bar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  width: 100%;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom)) 18px;
  background: linear-gradient(135deg, #1d4ed8, #06b6d4);
  color: #fff;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.18);
  align-items: center;
  gap: 14px;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.calc-sticky-bar[hidden] { display: none !important; }
.calc-sticky-bar-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.85;
  flex: 0 0 auto;
}
.calc-sticky-bar-prices {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
}
.calc-sticky-bar-uah {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.calc-sticky-bar-usd {
  font-size: 0.82rem;
  opacity: 0.85;
  margin-top: 2px;
}
.calc-sticky-bar-chevron {
  flex: 0 0 auto;
  opacity: 0.9;
}
.calc-sticky-bar:active { filter: brightness(0.95); }

@media (max-width: 900px) {
  .calc-sticky-bar:not([hidden]) { display: flex; }
  /* Reserve space so the last form fields and footer aren't hidden under the bar. */
  body.has-sticky-price { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
}

/* ---------- Info-buttons & help modal ---------- */
.calc-form label .lbl-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: transparent;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  flex: 0 0 auto;
}
.info-btn:hover { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }

.info-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.info-modal[aria-hidden="false"] { display: flex; }
.info-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}
.info-modal-card {
  position: relative;
  background: #fff;
  border-radius: 14px;
  max-width: 720px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px 28px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  border: 1px solid #eef2f9;
}
.info-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: #475569;
  cursor: pointer;
  border-radius: 8px;
}
.info-modal-close:hover { background: #f0f3f9; color: #1a1f2e; }
.info-modal-body h3 {
  margin: 0 0 12px;
  font-size: 1.15rem;
  color: #1a1f2e;
}
.info-modal-body p { color: #41506b; margin: 0 0 12px; line-height: 1.5; }
.info-modal-body code,
.info-modal-body pre {
  background: #f1f5f9;
  border-radius: 6px;
  padding: 2px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88rem;
  color: #1e293b;
}
.info-modal-body pre {
  padding: 10px 12px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 12px;
}
.info-modal-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 14px;
  font-size: 0.92rem;
}
.info-modal-body th,
.info-modal-body td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid #eef2f9;
}
.info-modal-body th {
  font-weight: 600;
  color: #1a1f2e;
  background: #f8fafc;
}
.info-modal-body td.num { text-align: right; font-variant-numeric: tabular-nums; }
.info-modal-link { margin: 16px 0 0; font-size: 0.85rem; }
.info-modal-link a { color: #1d4ed8; text-decoration: underline; }

@media (max-width: 600px) {
  .info-modal-card { padding: 24px 20px 18px; }
}

/* Dark theme */
:root[data-theme="dark"] .info-btn { border-color: #475569; color: #94a3b8; }
:root[data-theme="dark"] .info-btn:hover { background: #2563eb; color: #fff; border-color: #2563eb; }
:root[data-theme="dark"] .info-modal-card { background: #111827; border-color: #1f2937; }
:root[data-theme="dark"] .info-modal-close { color: #94a3b8; }
:root[data-theme="dark"] .info-modal-close:hover { background: #1f2937; color: #f1f5f9; }
:root[data-theme="dark"] .info-modal-body h3 { color: #f1f5f9; }
:root[data-theme="dark"] .info-modal-body p { color: #cbd5e1; }
:root[data-theme="dark"] .info-modal-body code,
:root[data-theme="dark"] .info-modal-body pre { background: #1f2937; color: #e2e8f0; }
:root[data-theme="dark"] .info-modal-body th { background: #1f2937; color: #f1f5f9; }
:root[data-theme="dark"] .info-modal-body th,
:root[data-theme="dark"] .info-modal-body td { border-bottom-color: #1f2937; }
:root[data-theme="dark"] .info-modal-body td { color: #e2e8f0; }
:root[data-theme="dark"] .info-modal-link a { color: #93c5fd; }

/* ---------- FAQ page ---------- */
.faq-page { padding: 32px 20px 60px; max-width: 920px; }
.faq-page h1 { margin-bottom: 6px; }
.faq-page > .muted { margin-bottom: 28px; max-width: 760px; }

.faq-toc {
  background: #fff;
  border: 1px solid #eef2f9;
  border-radius: 14px;
  padding: 18px 22px;
  margin-bottom: 24px;
}
.faq-toc h3 { margin: 0 0 10px; font-size: 1rem; color: #1a1f2e; }
.faq-toc ol {
  margin: 0;
  padding-left: 20px;
  columns: 2;
  column-gap: 24px;
}
.faq-toc li { margin-bottom: 4px; break-inside: avoid; }
.faq-toc a { color: #1d4ed8; }
.faq-toc a:hover { text-decoration: underline; }

.faq-list details {
  background: #fff;
  border: 1px solid #eef2f9;
  border-radius: 14px;
  padding: 0;
  margin-bottom: 12px;
  overflow: hidden;
  scroll-margin-top: 80px;
}
.faq-list details[open] { border-color: #c7d2fe; box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04); }
.faq-list summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 22px;
  font-weight: 600;
  color: #1a1f2e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after {
  content: '+';
  font-size: 1.4rem;
  font-weight: 400;
  color: #6b7591;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  transition: transform 0.2s ease;
}
.faq-list details[open] summary::after { content: '−'; }
.faq-list summary:hover { background: #f8fafc; }
.faq-list details[open] summary { border-bottom: 1px solid #eef2f9; }
.faq-list details > *:not(summary) {
  padding: 14px 22px;
}
.faq-list details > p,
.faq-list details > ul,
.faq-list details > ol,
.faq-list details > pre,
.faq-list details > table,
.faq-list details > h4 {
  margin-left: 22px;
  margin-right: 22px;
  padding-left: 0;
  padding-right: 0;
}
.faq-list details > p:first-of-type { padding-top: 14px; }
.faq-list details > p:last-of-type,
.faq-list details > ul:last-of-type,
.faq-list details > pre:last-of-type,
.faq-list details > table:last-of-type { padding-bottom: 18px; }
.faq-list details h4 {
  font-size: 1rem;
  margin: 14px 0 10px 22px;
  color: #1a1f2e;
}
.faq-list details p { color: #41506b; line-height: 1.55; }
.faq-list details ul,
.faq-list details ol { color: #41506b; line-height: 1.55; padding-left: 40px; }
.faq-list details li { margin-bottom: 4px; }
.faq-list details code,
.faq-list details pre {
  background: #f1f5f9;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88rem;
  color: #1e293b;
}
.faq-list details code { padding: 2px 6px; }
.faq-list details pre {
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-word;
}
.faq-list details table {
  width: calc(100% - 44px);
  border-collapse: collapse;
  font-size: 0.92rem;
}
.faq-list details th,
.faq-list details td {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 1px solid #eef2f9;
}
.faq-list details th {
  font-weight: 600;
  color: #1a1f2e;
  background: #f8fafc;
}

.faq-cta {
  margin-top: 32px;
  padding: 20px 24px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 14px;
  color: #1e293b;
}
.faq-cta a { color: #1d4ed8; font-weight: 600; }
.faq-cta a:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .faq-page { padding: 24px 14px 48px; }
  .faq-page h1 { font-size: 1.4rem; line-height: 1.25; }
  .faq-page > .muted { margin-bottom: 20px; font-size: 0.92rem; }
  .faq-toc { padding: 14px 16px; }
  .faq-toc ol { columns: 1; padding-left: 18px; }
  .faq-list summary { padding: 14px 16px; font-size: 0.95rem; gap: 10px; }
  .faq-list details > *:not(summary) { padding: 12px 16px; }
  .faq-list details > p,
  .faq-list details > ul,
  .faq-list details > ol,
  .faq-list details > pre,
  .faq-list details > table,
  .faq-list details > h4 {
    margin-left: 16px;
    margin-right: 16px;
  }
  .faq-list details ul,
  .faq-list details ol { padding-left: 24px; }
  .faq-list details h4 { margin-left: 16px; }
  .faq-list details > table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: calc(100% - 32px);
    font-size: 0.85rem;
    white-space: nowrap;
  }
  .faq-list details th,
  .faq-list details td { padding: 6px 8px; }
  .faq-list details pre { font-size: 0.8rem; padding: 10px 12px; }
  .faq-cta { padding: 16px 18px; margin-top: 24px; font-size: 0.92rem; }
}

:root[data-theme="dark"] .faq-toc { background: #111827; border-color: #1f2937; }
:root[data-theme="dark"] .faq-toc h3 { color: #f1f5f9; }
:root[data-theme="dark"] .faq-toc a { color: #93c5fd; }
:root[data-theme="dark"] .faq-list details { background: #111827; border-color: #1f2937; }
:root[data-theme="dark"] .faq-list details[open] { border-color: #1d4ed8; }
:root[data-theme="dark"] .faq-list summary { color: #f1f5f9; }
:root[data-theme="dark"] .faq-list summary:hover { background: #1f2937; }
:root[data-theme="dark"] .faq-list details[open] summary { border-bottom-color: #1f2937; }
:root[data-theme="dark"] .faq-list details h4 { color: #f1f5f9; }
:root[data-theme="dark"] .faq-list details p,
:root[data-theme="dark"] .faq-list details ul,
:root[data-theme="dark"] .faq-list details ol { color: #cbd5e1; }
:root[data-theme="dark"] .faq-list details code,
:root[data-theme="dark"] .faq-list details pre { background: #1f2937; color: #e2e8f0; }
:root[data-theme="dark"] .faq-list details th { background: #1f2937; color: #f1f5f9; }
:root[data-theme="dark"] .faq-list details th,
:root[data-theme="dark"] .faq-list details td { border-bottom-color: #1f2937; color: #e2e8f0; }
:root[data-theme="dark"] .faq-cta { background: rgba(30, 58, 138, 0.25); border-color: #1e3a8a; color: #e2e8f0; }
:root[data-theme="dark"] .faq-cta a { color: #93c5fd; }

/* ---------- Car detail page ---------- */
.car-page { padding: 28px 20px 60px; }
.car-detail-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 28px;
  align-items: flex-start;
}
.car-gallery {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #eef2f9;
  overflow: hidden;
}
.car-gallery .main-image {
  aspect-ratio: 16/10;
  max-height: 520px;
  background: linear-gradient(135deg, #cbd5e1, #475569);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: 1px;
}
@media (max-width: 900px) {
  .car-gallery .main-image { max-height: 420px; }
}
@media (max-width: 640px) {
  .car-gallery .main-image { max-height: 300px; aspect-ratio: 4/3; }
}
.car-thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
}
.car-thumbs > div {
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, #94a3b8, #64748b);
  border-radius: 6px;
}
/* Desktop: 5-колонковий грід як на Copart, з вертикальним скролом якщо
   фото більше ніж ~2 ряди. Висоту обмежуємо, щоб блок не виштовхував
   решту сторінки вниз. */
.car-thumbs-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 6px;
  max-height: 280px;
  overflow-y: auto;
  scroll-behavior: smooth;
}
.car-thumbs-strip .gallery-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  background: #cbd5e1;
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease;
}
.car-thumbs-strip .gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.car-thumbs-strip .gallery-thumb:hover { transform: translateY(-1px); }
.car-thumbs-strip .gallery-thumb.is-active {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 1px #1d4ed8;
}

/* Грід-колонки .car-detail-layout не повинні розпухати під ширину thumb
   strip'у. min-width:0 — стандартний фікс grid/flex bloat'у, без нього
   контент із intrinsic-width (картинки) тягне колонку шире за 1.4fr. */
.car-detail-layout > div { min-width: 0; }
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 120ms ease;
}
.gallery-nav:hover { background: rgba(15, 23, 42, 0.85); }
.gallery-prev { left: 12px; }
.gallery-next { right: 12px; }
.gallery-counter {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 3;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}
.gallery-zoom-btn {
  position: absolute;
  bottom: 12px;
  left: 78px;          /* робимо місце зліва під HD-toggle */
  z-index: 3;
  background: rgba(15, 23, 42, 0.7);
  color: #fff;
  border: none;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 120ms ease;
}
.gallery-zoom-btn:hover { background: rgba(15, 23, 42, 0.9); }
.gallery-hd-toggle {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.95);
  color: #1a1f2e;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  padding: 4px 8px 4px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  transition: background 120ms ease, transform 120ms ease;
}
.gallery-hd-toggle:hover { transform: translateY(-1px); }
.gallery-hd-toggle .gallery-hd-pill {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #d1d5db;
  transition: background 120ms ease;
}
.gallery-hd-toggle .gallery-hd-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.2);
}
.gallery-hd-toggle.is-on .gallery-hd-pill { background: #1d4ed8; }
.gallery-hd-toggle.is-on .gallery-hd-dot { background: #fff; box-shadow: none; }
.gallery-hd-toggle.is-off .gallery-hd-pill::after {
  content: "✕";
  color: #6b7280;
  font-size: 12px;
  font-weight: 700;
}
.gallery-hd-toggle.is-off .gallery-hd-dot { display: none; }
.gallery-video-stub {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 1.2rem;
  background: linear-gradient(135deg, #0f172a, #1e293b);
}
.gallery-video-stub .play-icon {
  font-size: 1.6rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.18);
}
.car-thumbs-strip .gallery-thumb-video {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #475569, #1e293b);
  color: #fff;
  font-size: 1rem;
}
@media (max-width: 900px) {
  /* Tablet: 4 колонки, нижча max-height. */
  .car-thumbs-strip { grid-template-columns: repeat(4, 1fr); max-height: 240px; }
}
@media (max-width: 640px) {
  /* Мобільний: горизонтальна свайп-карусель замість гріда. Native
     touch-scroll + scroll-snap по картинці — звичний UX на телефоні. */
  .car-thumbs-strip {
    display: flex;
    flex-wrap: nowrap;
    grid-template-columns: none;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .car-thumbs-strip .gallery-thumb {
    flex: 0 0 auto;
    width: 88px;
    aspect-ratio: 4/3;
    scroll-snap-align: start;
  }
  .gallery-nav { width: 32px; height: 32px; font-size: 22px; }
  .gallery-zoom-btn { font-size: 11px; padding: 5px 10px; }
}
.car-summary {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #eef2f9;
  padding: 22px;
}
.car-summary h1 { font-size: 1.5rem; margin-bottom: 6px; }
.car-summary .price-block {
  background: linear-gradient(135deg, #1d4ed8, #06b6d4);
  color: #fff;
  padding: 16px;
  border-radius: 12px;
  margin: 14px 0;
}
.car-summary .price-block .label { font-size: 0.8rem; opacity: 0.9; }
.car-summary .price-block .price { font-size: 1.8rem; font-weight: 700; }

/* Хто продає (insurance / dealer / rental / ...): рядок під price-block.
   Pill ліворуч — основний сигнал, далі muted-name з повним ім'ям продавця. */
.car-seller-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 4px;
  font-size: 0.9rem;
}
.car-seller-label { color: #41506b; font-weight: 500; }
.car-seller-name { font-weight: 500; }
[data-theme="dark"] .car-seller-label { color: #94a3b8; }

/* Inline favorites-card на сторінці лоту: показуємо макс. ставку, статус,
   refresh / remove icons і блок ремонту, коли лот уже у користувача в
   улюблених. Дублює сутність /favorites рядка в компактному форматі. */
.fav-inline-card {
  margin-top: 8px;
  background: #f8faff;
  border: 1px solid #dbe3f3;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fav-inline-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.fav-inline-title { font-weight: 700; font-size: 0.95rem; color: #1a1f2e; }
.fav-inline-head-actions { display: inline-flex; align-items: center; gap: 8px; }
.fav-inline-meta { font-size: 0.78rem; }
.fav-inline-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fav-inline-row.fav-inline-repair {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.fav-inline-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7591;
  font-weight: 600;
}
.fav-inline-repair-info {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.fav-inline-repair-link {
  color: #1d4ed8;
  text-decoration: none;
  border-bottom: 1px dashed #93c5fd;
}
.fav-inline-repair-link:hover { color: #1e3a8a; border-bottom-style: solid; }
:root[data-theme="dark"] .fav-inline-repair-link { color: #93c5fd; border-bottom-color: #1d4ed8; }
:root[data-theme="dark"] .fav-inline-repair-link:hover { color: #dbeafe; }
[data-theme="dark"] .fav-inline-card {
  background: #0f172a;
  border-color: #1f2937;
}
[data-theme="dark"] .fav-inline-title { color: #e2e8f0; }
[data-theme="dark"] .fav-inline-label { color: #94a3b8; }

.spec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin: 14px 0;
}
.spec-grid > div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed #eef2f9; font-size: 0.92rem; }
.spec-grid .label { color: #6b7591; }
.spec-grid .value { color: #1a1f2e; font-weight: 600; }

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

/* ---------- Empty / error states ---------- */
.empty {
  background: #fff;
  border: 1px dashed #dbe3f3;
  border-radius: 14px;
  padding: 50px 20px;
  text-align: center;
  color: #6b7591;
}

/* ---------- Language switcher ---------- */
.lang-slot { display: inline-flex; flex-shrink: 0; }
.lang-switch {
  display: inline-flex;
  border: 1.5px solid #dbe3f3;
  border-radius: 10px;
  overflow: hidden;
  height: 38px;
}
.lang-btn {
  background: transparent;
  border: 0;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #41506b;
  cursor: pointer;
  min-width: 38px;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.lang-flag {
  display: inline-block;
  font-size: 1.1rem;
  line-height: 1;
  /* Color-emoji потрібно явно — інакше у деяких темах рендериться
     monochrome (особливо з system-ui). */
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
  filter: none;
}
.lang-btn:hover:not(.is-active) { background: #f0f3f9; color: #1a1f2e; }
.lang-btn.is-active { background: #2563eb; color: #fff; }
.lang-btn + .lang-btn { border-left: 1px solid #dbe3f3; }
.lang-btn.is-active + .lang-btn,
.lang-btn + .lang-btn.is-active { border-left-color: transparent; }
:root[data-theme="dark"] .lang-switch { border-color: #334155; }
:root[data-theme="dark"] .lang-btn { color: #cbd5e1; }
:root[data-theme="dark"] .lang-btn:hover:not(.is-active) { background: #1f2937; color: #f1f5f9; }
:root[data-theme="dark"] .lang-btn.is-active { background: #2563eb; color: #fff; }
:root[data-theme="dark"] .lang-btn + .lang-btn { border-left-color: #334155; }

/* ---------- Theme toggle ---------- */
.theme-toggle {
  background: transparent;
  border: 1.5px solid #dbe3f3;
  border-radius: 10px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #41506b;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover { background: #f0f3f9; color: #1a1f2e; border-color: #c7d2fe; }
.theme-toggle svg { display: block; }
.theme-toggle .theme-toggle-icon-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-toggle-icon-light { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-toggle-icon-dark { display: block; }

/* ---------- Dark theme ---------- */
:root[data-theme="dark"] body { color: #e2e8f0; background: #0b1220; }
:root[data-theme="dark"] h1,
:root[data-theme="dark"] h2,
:root[data-theme="dark"] h3,
:root[data-theme="dark"] h4 { color: #f1f5f9; }
:root[data-theme="dark"] .muted { color: #94a3b8; }

:root[data-theme="dark"] .site-header { background: #111827; border-bottom-color: #1f2937; }
:root[data-theme="dark"] .nav-link { color: #cbd5e1; }
:root[data-theme="dark"] .nav-link:hover { background: #1f2937; color: #f1f5f9; }
:root[data-theme="dark"] .nav-link.active { color: #93c5fd; background: rgba(30, 58, 138, 0.35); }
:root[data-theme="dark"] .nav-toggle { border-color: #334155; color: #cbd5e1; }
:root[data-theme="dark"] .nav-toggle:hover { background: #1f2937; color: #f1f5f9; border-color: #475569; }
@media (max-width: 720px) {
  :root[data-theme="dark"] .nav {
    background: #111827;
    border-color: #1f2937;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] .auth-trigger { color: #e2e8f0; border-color: #334155; }
:root[data-theme="dark"] .auth-trigger:hover { background: #1f2937; border-color: #475569; }

:root[data-theme="dark"] .profile-card { background: #111827; border-color: #1f2937; }
:root[data-theme="dark"] .profile-head { border-bottom-color: #1f2937; }
:root[data-theme="dark"] .profile-name { color: #f1f5f9; }
:root[data-theme="dark"] .profile-email,
:root[data-theme="dark"] .profile-meta,
:root[data-theme="dark"] .profile-form .field-hint { color: #94a3b8; }
:root[data-theme="dark"] .profile-form .field-label { color: #cbd5e1; }
:root[data-theme="dark"] .profile-logout { border-top-color: #1f2937; }

:root[data-theme="dark"] .fav-summary,
:root[data-theme="dark"] .fav-table,
:root[data-theme="dark"] .fav-empty { background: #111827; border-color: #1f2937; }
:root[data-theme="dark"] .fav-table th, :root[data-theme="dark"] .fav-table td { border-bottom-color: #1f2937; }
:root[data-theme="dark"] .fav-table thead th { background: #0f172a; color: #94a3b8; }
:root[data-theme="dark"] .fav-summary strong, :root[data-theme="dark"] .fav-title { color: #f1f5f9; }
:root[data-theme="dark"] .fav-photo-cell img,
:root[data-theme="dark"] .fav-photo-cell .fav-photo-placeholder { background: #1f2937; color: #cbd5e1; border-color: #334155; }
:root[data-theme="dark"] .fav-maxbid-input-wrap { background: #0f172a; border-color: #334155; }
:root[data-theme="dark"] .fav-maxbid-input-wrap:focus-within { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18); }
:root[data-theme="dark"] .fav-maxbid-prefix { color: #94a3b8; }
:root[data-theme="dark"] .fav-maxbid-input { color: #f1f5f9; }
:root[data-theme="dark"] .fav-filters { background: #111827; border-color: #1f2937; }
:root[data-theme="dark"] .fav-filter-search,
:root[data-theme="dark"] .fav-filter-make,
:root[data-theme="dark"] .fav-filter-auction,
:root[data-theme="dark"] .fav-filter-status,
:root[data-theme="dark"] .fav-filter-sort { background-color: #0f172a; border-color: #334155; color: #f1f5f9; }
:root[data-theme="dark"] .fav-filter-search:focus,
:root[data-theme="dark"] .fav-filter-make:focus,
:root[data-theme="dark"] .fav-filter-auction:focus,
:root[data-theme="dark"] .fav-filter-status:focus,
:root[data-theme="dark"] .fav-filter-sort:focus { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(96,165,250,0.18); }
:root[data-theme="dark"] .fav-title-link .fav-title { color: #60a5fa; }
:root[data-theme="dark"] .fav-title-link:hover .fav-title { color: #93c5fd; }
:root[data-theme="dark"] .fav-report-title-link:hover { color: #93c5fd; }

:root[data-theme="dark"] .btn-ghost { color: #93c5fd; border-color: #3b82f6; }
:root[data-theme="dark"] .btn-ghost:hover { background: rgba(30, 58, 138, 0.35); }

:root[data-theme="dark"] .theme-toggle { border-color: #334155; color: #cbd5e1; }
:root[data-theme="dark"] .theme-toggle:hover { background: #1f2937; color: #f1f5f9; border-color: #475569; }

:root[data-theme="dark"] .hero {
  background:
    radial-gradient(circle at 20% 0%, rgba(37, 99, 235, 0.28), transparent 50%),
    radial-gradient(circle at 90% 100%, rgba(6, 182, 212, 0.18), transparent 50%),
    linear-gradient(180deg, #0b1220 0%, #111827 100%);
}
:root[data-theme="dark"] .hero-content .badge {
  background: #111827;
  color: #93c5fd;
  border-color: #1e3a8a;
}
:root[data-theme="dark"] .hero .lead { color: #cbd5e1; }
:root[data-theme="dark"] .hero-stats { border-top-color: #1f2937; }
:root[data-theme="dark"] .hero-stats strong { color: #f1f5f9; }
:root[data-theme="dark"] .hero-stats span { color: #94a3b8; }
:root[data-theme="dark"] .hero-card {
  background: #111827;
  border-color: #1f2937;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

:root[data-theme="dark"] .quick-search label,
:root[data-theme="dark"] .calc-form label,
:root[data-theme="dark"] .filters label { color: #cbd5e1; }
:root[data-theme="dark"] .quick-search input,
:root[data-theme="dark"] .quick-search select,
:root[data-theme="dark"] .calc-form input,
:root[data-theme="dark"] .calc-form select,
:root[data-theme="dark"] .filters input,
:root[data-theme="dark"] .filters select,
:root[data-theme="dark"] .profile-form input,
:root[data-theme="dark"] .profile-form select,
:root[data-theme="dark"] input[type="text"],
:root[data-theme="dark"] input[type="number"],
:root[data-theme="dark"] input[type="tel"],
:root[data-theme="dark"] input[type="email"],
:root[data-theme="dark"] select {
  background: #1f2937;
  color: #e2e8f0;
  border-color: #334155;
}
:root[data-theme="dark"] input::placeholder { color: #64748b; }
:root[data-theme="dark"] input:focus,
:root[data-theme="dark"] select:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.18);
}

:root[data-theme="dark"] .feature { background: #111827; border-color: #1f2937; }
:root[data-theme="dark"] .feature:hover { box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5); }
:root[data-theme="dark"] .feature p { color: #94a3b8; }

:root[data-theme="dark"] .filters { background: #111827; border-color: #1f2937; }
:root[data-theme="dark"] .results-count { color: #cbd5e1; }
:root[data-theme="dark"] .sort { color: #94a3b8; }

:root[data-theme="dark"] .car-card { background: #111827; border-color: #1f2937; }
:root[data-theme="dark"] .car-card:hover { box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5); }
:root[data-theme="dark"] .car-image { background: linear-gradient(135deg, #334155, #1e293b); }
:root[data-theme="dark"] .car-image .auction-tag { background: #e5e7eb; color: #1a1f2e; }
:root[data-theme="dark"] .car-title { color: #f1f5f9; }
:root[data-theme="dark"] .chip { background: #1f2937; color: #cbd5e1; }
:root[data-theme="dark"] .chip.danger { background: rgba(127, 29, 29, 0.55); color: #fecaca; }
:root[data-theme="dark"] .chip.success { background: rgba(20, 83, 45, 0.55); color: #bbf7d0; }
:root[data-theme="dark"] .car-price-row { border-top-color: #1f2937; }
:root[data-theme="dark"] .car-price { color: #93c5fd; }
:root[data-theme="dark"] .car-end { color: #94a3b8; }

:root[data-theme="dark"] .pagination button {
  background: #111827;
  border-color: #334155;
  color: #cbd5e1;
}
:root[data-theme="dark"] .pagination button.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

:root[data-theme="dark"] .calc-form { background: #111827; border-color: #1f2937; }
:root[data-theme="dark"] .calc-form fieldset { border-bottom-color: #1f2937; }
:root[data-theme="dark"] .calc-form legend { color: #f1f5f9; }
:root[data-theme="dark"] .calc-form fieldset.copart-import {
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.4) 0%, rgba(7, 89, 133, 0.4) 100%);
  border-color: #1e40af;
}
:root[data-theme="dark"] .calc-form fieldset.copart-import legend { color: #93c5fd; }
:root[data-theme="dark"] .calc-form .copart-import-status.error { color: #fca5a5; }
:root[data-theme="dark"] .calc-form .copart-import-status.success { color: #86efac; }
:root[data-theme="dark"] .calc-form .copart-import-status.loading { color: #93c5fd; }
:root[data-theme="dark"] .calc-form label.field-invalid input,
:root[data-theme="dark"] .calc-form label.field-invalid select {
  background: rgba(127, 29, 29, 0.25);
  border-color: #ef4444;
}
:root[data-theme="dark"] .calc-form label.field-invalid::after { color: #fca5a5; }
:root[data-theme="dark"] .calc-error {
  background: rgba(127, 29, 29, 0.25);
  border-color: #7f1d1d;
  color: #fca5a5;
}
:root[data-theme="dark"] .calc-error strong { color: #fee2e2; }
:root[data-theme="dark"] .calc-form label.calc-checkbox { color: #e2e8f0; }

:root[data-theme="dark"] .calc-result { background: #111827; border-color: #1f2937; }
:root[data-theme="dark"] .calc-section-title { color: #94a3b8; }
:root[data-theme="dark"] .calc-row { border-bottom-color: #1f2937; }
:root[data-theme="dark"] .calc-row .name { color: #cbd5e1; }
:root[data-theme="dark"] .calc-row .value { color: #f1f5f9; }
:root[data-theme="dark"] .calc-row.total { color: #f1f5f9; border-top-color: #475569; }

:root[data-theme="dark"] .info-grid > div { background: #111827; border-color: #1f2937; }
:root[data-theme="dark"] .info-grid p { color: #94a3b8; }

:root[data-theme="dark"] .car-gallery { background: #111827; border-color: #1f2937; }
:root[data-theme="dark"] .car-gallery .main-image { background: linear-gradient(135deg, #334155, #0f172a); }
:root[data-theme="dark"] .car-thumbs > div { background: linear-gradient(135deg, #475569, #1e293b); }
:root[data-theme="dark"] .car-thumbs-strip .gallery-thumb { background: #1e293b; }
:root[data-theme="dark"] .car-thumbs-strip .gallery-thumb.is-active { border-color: #60a5fa; }
:root[data-theme="dark"] .car-summary { background: #111827; border-color: #1f2937; }
:root[data-theme="dark"] .spec-grid > div { border-bottom-color: #1f2937; }
:root[data-theme="dark"] .spec-grid .label { color: #94a3b8; }
:root[data-theme="dark"] .spec-grid .value { color: #f1f5f9; }

:root[data-theme="dark"] .empty {
  background: #111827;
  border-color: #334155;
  color: #94a3b8;
}

:root[data-theme="dark"] .site-footer { background: #060914; border-top: 1px solid #1f2937; }
:root[data-theme="dark"] .footer-inner { border-bottom-color: #1f2937; }

/* ---------- Billing page ---------- */
.billing-page { padding: 32px 20px 60px; max-width: 880px; margin: 0 auto; }
.billing-card { padding: 22px 26px; }
.billing-balance-grid {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.billing-balance-label { color: #6b7591; font-size: 0.85rem; }
.billing-balance-value { font-size: 2.2rem; font-weight: 800; color: #1d4ed8; line-height: 1.1; }
.billing-balance-free { color: #15803d; font-size: 0.85rem; margin-top: 4px; }
.billing-sub {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #eef2f9;
}
.billing-sub-title { font-size: 0.95rem; }

.billing-section { margin-top: 28px; }
.billing-section h2 { font-size: 1.15rem; margin-bottom: 12px; }
.billing-products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.billing-product {
  background: #fff;
  border: 1px solid #eef2f9;
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.billing-product-head { display: flex; flex-direction: column; gap: 2px; }
.billing-product-label { font-weight: 600; }
.billing-product-price { font-size: 1.1rem; color: #1a1f2e; }
.billing-product-meta { font-size: 0.85rem; }
.billing-product .billing-buy-btn { margin-top: 6px; }

.billing-history-wrap { overflow-x: auto; }
.billing-history {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.billing-history th, .billing-history td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #eef2f9;
  vertical-align: top;
}
.billing-history th { color: #41506b; font-weight: 600; }
.billing-tx-pos { color: #15803d; font-weight: 600; }
.billing-tx-neg { color: #b91c1c; font-weight: 600; }
.billing-tx-report-link {
  color: #1d4ed8;
  text-decoration: none;
  border-bottom: 1px dashed #93c5fd;
}
.billing-tx-report-link:hover { color: #1e3a8a; border-bottom-style: solid; }
:root[data-theme="dark"] .billing-tx-report-link { color: #93c5fd; border-bottom-color: #1d4ed8; }
:root[data-theme="dark"] .billing-tx-report-link:hover { color: #dbeafe; }

/* Repair-estimate edit mode --------------------------------------------- */
.re-edited-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e0e7ff;
  color: #1e3a8a;
  font-size: 0.72rem;
  font-weight: 600;
  vertical-align: 1px;
}
.re-edit-row td { vertical-align: middle; padding: 4px 6px; }
/* Tag-prefixed selectors підвищують специфічність до 0,1,1 — інакше
   глобальне `input[type="number"] { width:100%; padding:10px 12px }`
   (вище в файлі) перебиває їх і інпут зіщулюється до 26px у вузькій
   колонці «Ціна», обрізаючи значення. */
input.re-edit-name, input.re-edit-source,
input.re-edit-other-name {
  width: 100%;
  padding: 5px 7px;
  border: 1px solid #dbe3f3;
  border-radius: 6px;
  font: inherit;
  min-width: 0;
}
input.re-edit-qty, input.re-edit-price,
input.re-edit-other-price, input.re-edit-section {
  width: 110px;
  min-width: 90px;
  padding: 5px 7px;
  border: 1px solid #dbe3f3;
  border-radius: 6px;
  font: inherit;
  text-align: right;
}
/* Quantity може лишитися компактнішою — qty у нас цілі ≤ 99 */
input.re-edit-qty { width: 70px; min-width: 60px; }
.re-edit-delete {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}
.re-edit-delete:hover { background: #fecaca; }
.re-edit-add-row td { padding: 8px 6px; text-align: left; }
.re-edit-add-part, .re-edit-add-other { font-size: 0.85rem; }

.re-history-overlay { z-index: 10010; }
.re-history-list { list-style: none; margin: 0; padding: 0; }
.re-history-list li {
  padding: 10px 0;
  border-bottom: 1px solid #eef2f9;
}
.re-history-list li:last-child { border-bottom: none; }
.re-history-meta { font-size: 0.95rem; }
.re-history-notes { font-size: 0.85rem; margin-top: 4px; }

:root[data-theme="dark"] .re-edited-badge { background: #1e3a8a; color: #dbeafe; }
:root[data-theme="dark"] input.re-edit-name,
:root[data-theme="dark"] input.re-edit-source,
:root[data-theme="dark"] input.re-edit-other-name,
:root[data-theme="dark"] input.re-edit-qty,
:root[data-theme="dark"] input.re-edit-price,
:root[data-theme="dark"] input.re-edit-other-price,
:root[data-theme="dark"] input.re-edit-section {
  background: #0f172a; color: #f1f5f9; border-color: #334155;
}
:root[data-theme="dark"] .re-edit-delete { background: #450a0a; color: #fecaca; border-color: #7f1d1d; }
:root[data-theme="dark"] .re-history-list li { border-bottom-color: #1f2937; }

/* Repair page ----------------------------------------------------------- */
.repair-page { padding: 32px 20px 60px; max-width: 1180px; margin: 0 auto; }
.repair-add-row {
  background: #fff;
  border: 1px solid #eef2f9;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.repair-add-row .field-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #41506b;
}
.repair-add-row-inputs { display: flex; gap: 10px; flex-wrap: wrap; }
.repair-add-input {
  flex: 1 1 280px;
  min-width: 240px;
  padding: 10px 12px;
  border: 1px solid #dbe3f3;
  border-radius: 8px;
  font: inherit;
}
.repair-add-status { font-size: 0.85rem; min-height: 1em; }
.repair-add-status.err { color: #b91c1c; }

.repair-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  flex-wrap: wrap;
}
.repair-toolbar-actions { display: flex; gap: 8px; }

.repair-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.repair-card {
  background: #fff;
  border: 1px solid #eef2f9;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.repair-card:hover {
  border-color: #bae6fd;
  box-shadow: 0 6px 20px rgba(29, 78, 216, 0.08);
}
:root[data-theme="dark"] .repair-card:hover {
  border-color: #1d4ed8;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
.repair-card-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #eef2ff;
}
.repair-card-photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7591;
  font-weight: 600;
  background: linear-gradient(135deg, #1d4ed8, #06b6d4);
  color: #fff;
  font-size: 0.95rem;
  text-align: center;
  padding: 16px;
}
.repair-card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.repair-card-title {
  font-weight: 700;
  font-size: 1rem;
  color: #1a1f2e;
  text-decoration: none;
  line-height: 1.3;
}
.repair-card-title:hover { color: #1d4ed8; }
.repair-card-meta { font-size: 0.82rem; line-height: 1.3; }
.repair-card-meta a { color: inherit; }
.repair-card-total { font-size: 1.05rem; margin: 4px 0 2px; }
.repair-card-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.repair-amount-link {
  color: #1d4ed8;
  text-decoration: none;
  border-bottom: 1px dashed #93c5fd;
  background: transparent;
  border-left: none; border-right: none; border-top: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
}
.repair-amount-link:hover { color: #1e3a8a; border-bottom-style: solid; }
.repair-amount-link:disabled { opacity: 0.6; cursor: wait; }
:root[data-theme="dark"] .repair-amount-link { color: #93c5fd; border-bottom-color: #1d4ed8; }
:root[data-theme="dark"] .repair-amount-link:hover { color: #dbeafe; }

/* Per-card data rows: bid + auctionEnd + status, then maxBid + total. */
.repair-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px 14px;
  padding: 10px 0;
  border-top: 1px solid #eef2f9;
  margin-top: 8px;
}
.repair-row-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.repair-row-label {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.repair-row-refresh {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: transparent; border: 1px solid #dbe3f3; border-radius: 6px;
  color: inherit; cursor: pointer; font-size: 12px; line-height: 1;
  vertical-align: -3px; margin-right: 4px;
}
.repair-row-refresh:hover { background: #eef2ff; }
.repair-row-refresh:disabled { opacity: 0.6; cursor: wait; }

.repair-maxbid-wrap {
  display: inline-flex; align-items: center;
  border: 1px solid #dbe3f3; border-radius: 6px;
  padding: 0 6px;
  background: #fff;
  max-width: 140px;
}
.repair-maxbid-wrap.is-overtaken { border-color: #fca5a5; background: #fef2f2; }
.repair-maxbid-prefix { color: #6b7591; font-weight: 600; padding-right: 4px; }
.repair-maxbid-input {
  flex: 1 1 auto;
  border: none; outline: none; background: transparent;
  padding: 5px 0; width: 100%;
  font: inherit; text-align: right;
}

.repair-total-cell .repair-total-link {
  display: inline-block;
  text-decoration: none;
  color: #1d4ed8;
}
.repair-total-cell .repair-total-link:hover { text-decoration: underline; }
.repair-total-cell strong { font-size: 1.05rem; }

:root[data-theme="dark"] .repair-row { border-top-color: #1f2937; }
:root[data-theme="dark"] .repair-row-refresh { border-color: #334155; }
:root[data-theme="dark"] .repair-row-refresh:hover { background: #1e293b; }
:root[data-theme="dark"] .repair-maxbid-wrap { background: #0f172a; border-color: #334155; }
:root[data-theme="dark"] .repair-maxbid-wrap.is-overtaken { background: #450a0a; border-color: #b91c1c; }
:root[data-theme="dark"] .repair-total-cell .repair-total-link { color: #93c5fd; }

:root[data-theme="dark"] .repair-add-row,
:root[data-theme="dark"] .repair-card { background: #111827; border-color: #1f2937; }
:root[data-theme="dark"] .repair-card-title { color: #f1f5f9; }
:root[data-theme="dark"] .repair-card-title:hover { color: #93c5fd; }
:root[data-theme="dark"] .repair-add-row .field-label { color: #94a3b8; }
:root[data-theme="dark"] .repair-add-input { background: #0f172a; color: #f1f5f9; border-color: #334155; }

/* Favorites: credits balance banner ------------------------------------- */
.fav-credits-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 0.92rem;
  min-height: 44px;
}
.fav-credits-banner.is-loading { background: transparent; border-color: transparent; }
.fav-credits-banner.is-empty   { background: #fef2f2; border-color: #fca5a5; }
.fav-credits-banner.is-ok      { background: #ecfdf5; border-color: #a7f3d0; }
.fav-credits-text { flex: 1 1 auto; line-height: 1.4; }
.fav-credits-label { color: #6b7591; }
.fav-credits-balance { font-weight: 700; }
.fav-credits-pill {
  display: inline-block;
  padding: 1px 8px;
  margin-left: 6px;
  border-radius: 999px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #15803d;
  font-size: 0.78rem;
  font-weight: 600;
  vertical-align: 1px;
}
.fav-credits-sub-wrap { flex: 0 0 auto; }
.fav-credits-sub { font-size: 0.85rem; }
.fav-credits-sub-warn { color: #b45309; font-weight: 600; }
.fav-credits-actions { flex: 0 0 auto; }

:root[data-theme="dark"] .fav-credits-banner { background: #0c2a3f; border-color: #155e75; color: #f1f5f9; }
:root[data-theme="dark"] .fav-credits-banner.is-empty { background: #450a0a; border-color: #b91c1c; color: #fecaca; }
:root[data-theme="dark"] .fav-credits-banner.is-ok    { background: #064e3b; border-color: #065f46; color: #d1fae5; }
:root[data-theme="dark"] .fav-credits-label { color: #94a3b8; }
:root[data-theme="dark"] .fav-credits-pill  { background: #064e3b; border-color: #065f46; color: #d1fae5; }
:root[data-theme="dark"] .fav-credits-sub-warn { color: #fbbf24; }

.billing-renewal-banner {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.billing-renewal-banner-urgent {
  background: #fee2e2;
  border-color: #fca5a5;
}
.billing-renewal-text { flex: 1; min-width: 240px; line-height: 1.4; }
.billing-renewal-banner .billing-buy-btn { white-space: nowrap; }
:root[data-theme="dark"] .billing-renewal-banner {
  background: #422006;
  border-color: #92400e;
  color: #fef3c7;
}
:root[data-theme="dark"] .billing-renewal-banner-urgent {
  background: #450a0a;
  border-color: #b91c1c;
  color: #fecaca;
}

.billing-poll-banner {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.95rem;
}
.billing-poll-banner.billing-poll-success { background: #ecfdf5; border-color: #a7f3d0; }
.billing-poll-banner.billing-poll-fail    { background: #fef2f2; border-color: #fecaca; }

:root[data-theme="dark"] .billing-product {
  background: #111827;
  border-color: #1f2937;
}
:root[data-theme="dark"] .billing-product-price { color: #f1f5f9; }
:root[data-theme="dark"] .billing-balance-value { color: #93c5fd; }
:root[data-theme="dark"] .billing-history th { color: #94a3b8; }
:root[data-theme="dark"] .billing-history th,
:root[data-theme="dark"] .billing-history td { border-bottom-color: #1f2937; }
:root[data-theme="dark"] .billing-sub { border-top-color: #1f2937; }
:root[data-theme="dark"] .billing-poll-banner { background: #1e293b; border-color: #334155; }
:root[data-theme="dark"] .billing-poll-banner.billing-poll-success { background: #064e3b; border-color: #065f46; }
:root[data-theme="dark"] .billing-poll-banner.billing-poll-fail    { background: #7f1d1d; border-color: #b91c1c; }
