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

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #f5f5f5;
  color: #222;
}

/* ========== HEADER ========== */
.header {
  background: #1a1a2e;
  color: #fff;
  padding: 0 40px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-logo-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
}

.header-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.header-subtitle {
  font-size: 11px;
  color: #aaa;
  font-weight: 400;
}

.header-nav {
  display: flex;
  gap: 28px;
}

.header-nav a {
  color: #ccc;
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

.header-nav a:hover {
  color: #fff;
}

/* ========== HERO ========== */
.hero {
  background: #fff;
  padding: 70px 40px 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 80px;
  border-bottom: 1px solid #e0e0e0;
}

.hero-text h1 {
  font-size: 36px;
  font-weight: 900;
  line-height: 1.25;
  max-width: 420px;
  margin-bottom: 16px;
  color: #111;
}

.hero-text p {
  font-size: 15px;
  color: #555;
  max-width: 380px;
  line-height: 1.6;
}

.hero-search {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 360px;
}

.hero-search input {
  padding: 14px 18px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s;
  background: #fafafa;
  width: 100%;
}

#vinSearchWrap, #addressSearchWrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.phone-step input {
  width: 100%;
}

.hero-search input:focus {
  border-color: #1a1a2e;
  background: #fff;
}

.btn-primary {
  padding: 14px 28px;
  background: #1a1a2e;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover {
  background: #2d2d4e;
}

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

.btn-primary:disabled {
  background: #bbb;
  cursor: not-allowed;
}

/* Phone step */
.phone-step {
  display: none;
  flex-direction: column;
  gap: 10px;
  background: #f0f4ff;
  border: 1px solid #c0cdf7;
  border-radius: 10px;
  padding: 18px;
  margin-top: 4px;
}

.phone-step.visible {
  display: flex;
}

.phone-step p {
  font-size: 13px;
  color: #444;
}

.phone-step p strong {
  color: #1a1a2e;
}

/* ========== AUCTION STATUS ========== */
.auction-status-block {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 700;
  border: 2px solid transparent;
}

.auction-status-block.active {
  background: #eafff2;
  border-color: #27ae60;
  color: #1a7a42;
}

.auction-status-block.inactive {
  background: #fff0f0;
  border-color: #e74c3c;
  color: #c0392b;
}

.auction-status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.auction-status-block.active .auction-status-dot {
  background: #27ae60;
  box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.6);
  animation: pulse-green 1.5s infinite;
}

.auction-status-block.inactive .auction-status-dot {
  background: #e74c3c;
}

@keyframes pulse-green {
  0%   { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.6); }
  70%  { box-shadow: 0 0 0 10px rgba(39, 174, 96, 0); }
  100% { box-shadow: 0 0 0 0 rgba(39, 174, 96, 0); }
}

/* Admin toggle switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-switch {
  position: relative;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: #e74c3c;
  border-radius: 28px;
  cursor: pointer;
  transition: background 0.3s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 4px;
  top: 4px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: #27ae60;
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(24px);
}

.toggle-label {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

/* ========== RESULT SECTION ========== */
.result-section {
  max-width: 960px;
  margin: 40px auto;
  padding: 0 20px 60px;
  display: none;
}

.result-section.visible {
  display: block;
}

/* Car header card */
.car-header-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 22px;
  position: relative;
}

.car-brand-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 6px;
  background: #fff;
}

.car-brand-logo-placeholder {
  width: 64px;
  height: 64px;
  background: #1a1a2e;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  font-size: 22px;
}

.car-header-info h2 {
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 6px;
}

.car-header-meta {
  font-size: 14px;
  color: #555;
}

.car-header-meta span {
  margin-right: 20px;
}

.car-header-meta strong {
  color: #222;
}

.report-meta {
  position: absolute;
  top: 20px;
  right: 28px;
  font-size: 12px;
  color: #888;
  text-align: right;
}

/* Index cards row */
.index-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.index-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.autoindex-circle {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 4px solid #f0a500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.autoindex-circle .score {
  font-size: 22px;
  font-weight: 900;
  color: #f0a500;
  line-height: 1;
}

.autoindex-circle .max {
  font-size: 10px;
  color: #aaa;
}

.index-card p {
  font-size: 13px;
  color: #555;
  line-height: 1.5;
}

.index-card p a {
  color: #1a6ef0;
  font-size: 12px;
}

.guarantee-icon {
  width: 48px;
  height: 48px;
  background: #fff0f0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 24px;
}

/* Photos section */
.section-block {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 16px;
}

.section-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #111;
}

.section-title-icon {
  font-size: 20px;
}

.section-title.red {
  color: #c0392b;
}

.section-title.blue {
  color: #1a6ef0;
}

.section-title.orange {
  color: #e67e22;
}

.photos-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.car-photo {
  width: 180px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  background: #eee;
  transition: opacity 0.15s;
}
.car-photo:hover { opacity: 0.85; }

/* ===== LIGHTBOX ===== */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
#lb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.88);
}
#lb-img-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}
#lb-img {
  max-width: 85vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 6px;
  transition: transform 0.25s ease;
  display: block;
  transform-origin: center center;
  user-select: none;
}
#lb-close {
  position: fixed;
  top: 18px;
  right: 22px;
  z-index: 2;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 22px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
#lb-close:hover { background: rgba(255,255,255,0.3); }
#lb-prev, #lb-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 36px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
#lb-prev { left: 16px; }
#lb-next { right: 16px; }
#lb-prev:hover, #lb-next:hover { background: rgba(255,255,255,0.3); }
#lb-counter {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  color: rgba(255,255,255,0.75);
  font-size: 14px;
  background: rgba(0,0,0,0.4);
  padding: 4px 12px;
  border-radius: 20px;
}

.no-photo-placeholder {
  width: 180px;
  height: 120px;
  background: #f0f0f0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #bbb;
  font-size: 13px;
  border: 2px dashed #ddd;
}

/* Summary table */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 48px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  gap: 20px;
}

.summary-row:last-child {
  border-bottom: none;
}

.summary-label {
  color: #666;
  flex-shrink: 0;
}

.summary-value {
  color: #222;
  font-weight: 500;
  text-align: right;
}

.summary-value.green { color: #27ae60; }
.summary-value.red { color: #e74c3c; }
.summary-value.orange { color: #e67e22; }
.summary-value.blue { color: #1a6ef0; }

/* Tech specs table */
.specs-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 40px;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #f5f5f5;
  font-size: 14px;
}

.spec-label { color: #666; flex: 1 1 auto; }
.spec-value { color: #222; font-weight: 500; flex: 0 0 auto; text-align: right; white-space: nowrap; }

/* Ownership table */
.ownership-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ownership-table th {
  text-align: left;
  padding: 10px 12px;
  background: #f8f8f8;
  color: #555;
  font-weight: 600;
  border-bottom: 2px solid #e0e0e0;
}

.ownership-table td {
  padding: 12px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: top;
}

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

/* DTP section */
.dtp-card {
  background: #fff8f0;
  border: 1px solid #f5d5b0;
  border-radius: 8px;
  padding: 16px 20px;
  margin-top: 12px;
}

.dtp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
  font-size: 14px;
}

.dtp-row {
  display: flex;
  gap: 8px;
}

.dtp-label { color: #888; min-width: 90px; }
.dtp-val { color: #222; font-weight: 500; }
.dtp-val.link { color: #1a6ef0; }

/* Fines section */
.fines-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 40px;
  font-size: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.fine-item {
  background: #f9f9f9;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
  font-size: 14px;
}

.fine-item-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 20px;
  margin-bottom: 8px;
}

.fine-label { color: #888; font-size: 13px; }
.fine-val { color: #222; }
.fine-val.paid { color: #27ae60; }

/* Recall table */
.recall-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.recall-table th {
  text-align: left;
  padding: 10px 12px;
  background: #f8f8f8;
  color: #555;
  border-bottom: 2px solid #e0e0e0;
  font-weight: 600;
}

.recall-table td {
  padding: 12px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: top;
  line-height: 1.5;
}

/* Pledge info */
.pledge-card {
  background: #f9f9f9;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
  font-size: 14px;
}

.pledge-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
}

.pledge-row { display: flex; gap: 10px; }
.pledge-label { color: #888; min-width: 140px; }
.pledge-val { color: #222; font-weight: 500; }
.pledge-val.excluded { color: #27ae60; }

/* OSAGO */
.osago-card {
  font-size: 14px;
}

.osago-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
}

.osago-row { display: flex; gap: 10px; margin-bottom: 6px; }
.osago-label { color: #888; min-width: 140px; }
.osago-val { color: #222; font-weight: 500; }
.osago-val.active { color: #27ae60; }

/* Market value */
.market-value-block {
  font-size: 14px;
}

.market-range {
  font-size: 15px;
  color: #222;
  margin-bottom: 6px;
}

.market-avg {
  font-size: 18px;
  font-weight: 800;
  color: #1a1a2e;
}

/* Info box */
.info-box {
  background: #f8f8f8;
  border: 1px dashed #ddd;
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 13px;
  color: #666;
  margin-top: 14px;
  line-height: 1.6;
}

.info-box a { color: #1a6ef0; }

/* Loading spinner */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.85);
  z-index: 999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

.loading-overlay.visible {
  display: flex;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 5px solid #e0e0e0;
  border-top-color: #1a1a2e;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 15px;
  color: #444;
  font-weight: 500;
}

/* Alert */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-top: 8px;
  display: none;
}

.alert.visible { display: block; }
.alert.error { background: #ffeaea; border: 1px solid #f5c6c6; color: #c0392b; }
.alert.success { background: #eafff0; border: 1px solid #c6f0d5; color: #1e8449; }

/* ========== ADMIN ========== */
.admin-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a2e;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 48px 44px;
  width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card h1 {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 6px;
  color: #1a1a2e;
}

.login-card p {
  font-size: 13px;
  color: #888;
  margin-bottom: 28px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #1a1a2e;
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.admin-layout {
  display: none;
  min-height: 100vh;
  background: #f0f2f5;
}

.admin-layout.visible {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: 64px 1fr;
}

.admin-topbar {
  grid-column: 1 / -1;
  background: #1a1a2e;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.admin-topbar h1 {
  font-size: 17px;
  font-weight: 800;
}

.admin-topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: #ccc;
}

.btn-logout {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: none;
  padding: 7px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.btn-logout:hover { background: rgba(255,255,255,0.2); }

.admin-sidebar {
  background: #fff;
  border-right: 1px solid #e0e0e0;
  padding: 24px 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: #555;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: #f0f4ff;
  color: #1a1a2e;
}

.sidebar-nav a .nav-icon { font-size: 18px; }

.sidebar-section {
  font-size: 11px;
  font-weight: 700;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 20px 24px 6px;
}

.admin-content {
  padding: 28px 32px;
  overflow-y: auto;
}

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

.page-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: #1a1a2e;
}

.btn-success {
  background: #27ae60;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-success:hover { background: #219a52; }

.btn-danger {
  background: #e74c3c;
  color: #fff;
  border: none;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

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

.btn-edit {
  background: #3498db;
  color: #fff;
  border: none;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.btn-edit:hover { background: #2980b9; }

/* Stats cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px 22px;
  border: 1px solid #e0e0e0;
}

.stat-card .stat-label {
  font-size: 12px;
  color: #888;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 900;
  color: #1a1a2e;
}

/* Cars table */
.table-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  overflow: hidden;
}

.table-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table-card th {
  padding: 14px 16px;
  text-align: left;
  background: #f8f8f8;
  color: #555;
  font-weight: 700;
  border-bottom: 2px solid #e0e0e0;
  font-size: 13px;
}

.table-card td {
  padding: 13px 16px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}

.table-card tr:last-child td { border-bottom: none; }
.table-card tr:hover td { background: #fafafa; }

.vin-code {
  font-family: monospace;
  background: #f5f5f5;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 13px;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}

.modal-overlay.visible {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 16px;
  padding: 32px 36px;
  width: 100%;
  max-width: 720px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  position: relative;
}

.modal h3 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 24px;
  color: #1a1a2e;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #888;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a2e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 20px 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e0e0e0;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.btn-secondary {
  background: #f0f0f0;
  color: #555;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

/* Status badge */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge.green { background: #eafff0; color: #1e8449; }
.badge.red { background: #ffeaea; color: #c0392b; }
.badge.blue { background: #e8f0fe; color: #1a6ef0; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #aaa;
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ========== TABLET ========== */
@media (max-width: 900px) {
  .hero { gap: 40px; padding: 50px 28px 60px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ========== MOBILE ========== */
@media (max-width: 768px) {

  /* Header */
  .header {
    padding: 0 16px;
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    gap: 0;
  }

  .header-brand {
    gap: 10px;
    padding: 10px 0;
  }

  .header-logo-img {
    width: 36px;
    height: 36px;
  }

  .header-title { font-size: 14px; }
  .header-subtitle { display: none; }

  .header-nav {
    display: flex;
    width: 100%;
    gap: 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 8px 0;
  }

  .header-nav a {
    flex: 1;
    text-align: center;
    font-size: 13px;
    padding: 4px 0;
  }

  /* Hero */
  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 28px;
    padding: 32px 16px 40px;
  }

  .hero-text h1 {
    font-size: 26px;
  }

  .hero-text p {
    font-size: 14px;
  }

  .hero-search {
    min-width: auto;
    width: 100%;
  }

  .hero-search input {
    font-size: 16px; /* предотвращает зум на iOS */
  }

  /* Result section */
  .result-section {
    padding: 0 12px 40px;
    margin-top: 20px;
  }

  /* Car header card */
  .car-header-card {
    flex-wrap: wrap;
    padding: 16px;
    gap: 12px;
  }

  .car-header-info h2 {
    font-size: 18px;
  }

  .car-header-meta {
    font-size: 12px;
  }

  .car-header-meta span {
    display: block;
    margin-right: 0;
    margin-bottom: 2px;
  }

  .report-meta {
    position: static;
    font-size: 11px;
    width: 100%;
    text-align: left;
    color: #aaa;
  }

  /* Index cards */
  .index-cards { grid-template-columns: 1fr; }

  /* Section blocks */
  .section-block {
    padding: 16px;
  }

  .section-title {
    font-size: 15px;
  }

  /* Summary */
  .summary-grid { grid-template-columns: 1fr; }

  .summary-row {
    font-size: 13px;
  }

  /* Specs */
  .specs-table { grid-template-columns: 1fr; }

  /* Tables */
  .ownership-table {
    font-size: 12px;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .recall-table {
    font-size: 12px;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* DTP */
  .dtp-grid {
    grid-template-columns: 1fr;
  }

  /* Fines */
  .fines-summary {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .fine-item-header {
    grid-template-columns: 1fr;
  }

  /* Pledge / OSAGO grids */
  .pledge-grid,
  .osago-grid {
    grid-template-columns: 1fr;
  }

  /* Photos */
  .car-photo,
  .no-photo-placeholder {
    width: 140px;
    height: 94px;
  }

  /* Auction status */
  .auction-status-block {
    font-size: 14px;
    padding: 12px 16px;
  }

  /* Stats */
  .stats-grid { grid-template-columns: 1fr 1fr; }

  /* Admin layout */
  .admin-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 56px 1fr;
    overflow: hidden;
  }

  .admin-sidebar { display: none; }

  .admin-content {
    padding: 16px;
    padding-bottom: 76px;
    min-width: 0;
    overflow-y: auto;
  }

  .admin-topbar {
    padding: 0 12px;
    height: 56px;
  }

  .admin-topbar h1 {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
  }

  #adminUserLabel { display: none; }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
  }

  .page-header h2 { font-size: 18px; }

  /* Show bottom nav only when logged in */
  .admin-layout.visible ~ .admin-bottom-nav { display: flex; }

  /* Tables: scrollable container */
  .table-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
  }

  .table-card th, .table-card td {
    padding: 10px 8px;
    font-size: 12px;
    white-space: nowrap;
  }

  /* Cars table: скрываем всё кроме Марка/Модель и Действия */
  #page-cars .table-card th:nth-child(1),
  #page-cars .table-card td:nth-child(1),
  #page-cars .table-card th:nth-child(3),
  #page-cars .table-card td:nth-child(3),
  #page-cars .table-card th:nth-child(4),
  #page-cars .table-card td:nth-child(4),
  #page-cars .table-card th:nth-child(5),
  #page-cars .table-card td:nth-child(5),
  #page-cars .table-card th:nth-child(6),
  #page-cars .table-card td:nth-child(6),
  #page-cars .table-card th:nth-child(7),
  #page-cars .table-card td:nth-child(7),
  #page-cars .table-card th:nth-child(8),
  #page-cars .table-card td:nth-child(8) { display: none; }

  /* Admins table: скрываем Добавлен */
  #page-admins .table-card th:nth-child(3),
  #page-admins .table-card td:nth-child(3) { display: none; }

  /* Tickets table: скрываем Дата и Статус */
  #page-tickets .table-card th:nth-child(1),
  #page-tickets .table-card td:nth-child(1),
  #page-tickets .table-card th:nth-child(5),
  #page-tickets .table-card td:nth-child(5) { display: none; }

  /* Actions column — стек кнопок */
  .table-card td:last-child {
    display: flex !important;
    flex-direction: column;
    gap: 4px !important;
  }

  /* Showcase on mobile — карточки почти на всю ширину */
  .showcase-section { padding: 28px 16px; }

  .sc-card {
    width: calc(80vw - 32px);
    min-width: 180px;
    max-width: 320px;
  }

  .sc-img-wrap { height: 160px; }

  /* Auction page on mobile */
  .auction-page { padding: 20px 16px; }
  .auction-page-hd { margin-bottom: 20px; }
  .auction-page-hd h1 { font-size: 20px; }
  .auction-grid { grid-template-columns: 1fr; gap: 16px; }
  .auction-card-img { height: 200px; }
  .auction-card-body { padding: 14px 16px 18px; }
  .auction-card-title { font-size: 16px; }
  .auction-card-price { font-size: 18px; }

  /* Table horizontal scroll */
  .table-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Modal */
  .modal-overlay {
    padding: 16px;
    align-items: flex-start;
  }

  .modal {
    padding: 20px 16px;
  }

  .form-row { grid-template-columns: 1fr; }

  /* Login card */
  .login-card {
    width: 100%;
    padding: 32px 24px;
  }
}

/* ========== AUCTION PAGE ========== */
.auction-page {
  display: none;
  background: #f5f5f5;
  min-height: calc(100vh - 64px);
  padding: 40px;
}

.auction-page.visible { display: block; }

.auction-page-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.auction-page-hd {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 36px;
}

.auction-page-hd h1 {
  font-size: 28px;
  font-weight: 900;
  color: #1a1a2e;
}

.auction-back-btn {
  background: #fff;
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 8px 18px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  transition: all 0.2s;
}

.auction-back-btn:hover {
  background: #1a1a2e;
  color: #fff;
  border-color: #1a1a2e;
}

.auction-block { margin-bottom: 48px; }

.auction-block-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid #e0e0e0;
}

.auction-block-heading span { font-size: 26px; }

.auction-block-heading h2 {
  font-size: 22px;
  font-weight: 800;
  color: #1a1a2e;
}

.auction-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 1024px) {
  .auction-grid { grid-template-columns: repeat(2, 1fr); }
}

.auction-card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 3px 16px rgba(0,0,0,0.09);
  transition: transform 0.2s, box-shadow 0.2s;
}

.auction-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.15);
}

.auction-card-img {
  position: relative;
  height: 240px;
  background: #eee;
}

.auction-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.auction-card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(26,26,46,0.88);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
}

.auction-card-body { padding: 18px 20px 22px; }

.auction-card-title {
  font-size: 18px;
  font-weight: 800;
  color: #1a1a2e;
  margin-bottom: 6px;
}

.auction-card-meta {
  font-size: 14px;
  color: #888;
  margin-bottom: 8px;
}

.auction-card-price {
  font-size: 22px;
  font-weight: 900;
  color: #27ae60;
}

/* ========== SHOWCASE SECTION ========== */
.showcase-section {
  background: #f5f5f5;
  padding: 48px 40px;
  border-bottom: 1px solid #e0e0e0;
}

.showcase-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.showcase-block {}

.showcase-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.showcase-heading h2 {
  font-size: 20px;
  font-weight: 800;
  color: #1a1a2e;
}

.showcase-label {
  background: #1a1a2e;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.showcase-carousel {
  display: flex;
  align-items: center;
  gap: 8px;
}

.showcase-rail {
  flex: 1;
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 4px 2px 8px;
}

.showcase-rail::-webkit-scrollbar { display: none; }

.showcase-arrow {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #ddd;
  background: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
  transition: background 0.2s, border-color 0.2s;
}

.showcase-arrow:hover {
  background: #1a1a2e;
  border-color: #1a1a2e;
  color: #fff;
}

/* Cards */
.sc-card {
  flex-shrink: 0;
  width: 220px;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  transition: transform 0.2s, box-shadow 0.2s;
}

.sc-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.13);
}

.sc-img-wrap {
  position: relative;
  height: 160px;
  background: #eee;
}

.sc-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sc-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(26,26,46,0.85);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.sc-body {
  padding: 12px 14px 14px;
}

.sc-title {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 4px;
}

.sc-meta {
  font-size: 12px;
  color: #888;
  margin-bottom: 6px;
}

.sc-price {
  font-size: 15px;
  font-weight: 800;
  color: #27ae60;
}

/* Admin showcase grid */
.showcase-admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.showcase-tab {
  padding: 8px 20px;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
}

.showcase-tab.active {
  background: #1a1a2e;
  color: #fff;
  border-color: #1a1a2e;
}

.showcase-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.sc-admin-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.sc-admin-card img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
}

.sc-admin-card-body {
  padding: 10px 12px;
}

.sc-admin-card-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 2px;
}

.sc-admin-card-meta {
  font-size: 11px;
  color: #888;
  margin-bottom: 4px;
}

.sc-admin-card-price {
  font-size: 13px;
  font-weight: 700;
  color: #27ae60;
  margin-bottom: 8px;
}

/* ========== BOTTOM NAV (mobile admin) ========== */
.admin-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #e0e0e0;
  z-index: 150;
  height: 60px;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
}

.admin-bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #999;
  text-decoration: none;
  font-size: 10px;
  gap: 3px;
  transition: color 0.15s, background 0.15s;
  position: relative;
}

.admin-bottom-nav a.active {
  color: #1a1a2e;
  background: #f0f4ff;
}

.admin-bottom-nav a .nav-icon { font-size: 20px; }

/* ========== TICKET NOTIFICATION ========== */
.ticket-notify {
  position: fixed;
  top: 80px;
  right: 24px;
  background: #1a1a2e;
  color: #fff;
  padding: 14px 18px 14px 16px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 9999;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
  cursor: pointer;
  border-left: 4px solid #27ae60;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.3s ease;
  max-width: 280px;
}

.ticket-notify-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #aaa;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  padding: 0 0 0 8px;
}

@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}

/* ========== DYNAMIC FORM ROWS ========== */
.btn-add-row {
  background: #f0f4ff;
  border: 2px dashed #4a6cf7;
  color: #4a6cf7;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin: 8px 0 16px;
  transition: background .2s;
}
.btn-add-row:hover { background: #dce6ff; }

.dynamic-row {
  background: #f8f9fc;
  border: 1px solid #e0e4ef;
  border-radius: 10px;
  padding: 14px 14px 10px;
  margin-bottom: 10px;
  position: relative;
}
.dynamic-row .form-row { margin-bottom: 8px; }
.dynamic-row .btn-remove-row {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: #e74c3c;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}
.dynamic-row .form-group label { font-size: 12px; color: #888; margin-bottom: 4px; }
.dynamic-row .form-group input,
.dynamic-row .form-group select,
.dynamic-row .form-group textarea {
  font-size: 13px;
  padding: 7px 10px;
}

/* Photo preview */
.photo-preview-item {
  position: relative;
  width: 90px;
  height: 90px;
}
.photo-preview-item img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #ddd;
}
.photo-preview-item .btn-remove-photo {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  cursor: pointer;
  line-height: 20px;
  text-align: center;
  padding: 0;
}

/* ========== SUPPORT MODAL ========== */
.support-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.support-overlay.visible {
  display: flex;
}
.support-modal {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 480px;
  position: relative;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}
.support-modal h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.support-modal p {
  color: #666;
  font-size: 14px;
  margin-bottom: 20px;
}
.support-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #666;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.support-close:hover { background: #f0f0f0; }
.support-form-group {
  margin-bottom: 14px;
}
.support-form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #333;
}
.support-form-group input,
.support-form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  resize: vertical;
  box-sizing: border-box;
}
.support-form-group input:focus,
.support-form-group textarea:focus {
  border-color: #1a1a2e;
}
.support-modal .alert {
  margin-bottom: 12px;
}
.support-modal .btn-primary {
  width: 100%;
}

/* ========== TICKET BADGE ========== */
.ticket-badge {
  background: #e74c3c;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: middle;
}
.ticket-new td {
  background: #fffbea;
}

/* ========== SEARCH TYPE TOGGLE ========== */
.search-type-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.type-btn {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: #f5f5f5;
  color: #555;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.type-btn.active {
  background: #1a1a2e;
  color: #fff;
  border-color: #1a1a2e;
}

.type-btn:not(.active):hover {
  border-color: #1a1a2e;
  color: #1a1a2e;
}

/* ========== REALTY RATING ========== */
.realty-rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #4caf50;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  padding: 3px 10px;
  margin-right: 8px;
}
