:root {
  --ink: #14171b;
  --muted: #626b77;
  --line: #dce1e7;
  --paper: #ffffff;
  --soft: #f4f6f8;
  --brand: #c51f2f;
  --brand-dark: #8d1420;
  --gold: #d7a33d;
  --green: #23664f;
  --danger: #a32626;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--soft);
  font-family: "Raleway", Arial, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

.site-shell {
  max-width: 1200px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: 0 22px 70px rgba(20, 23, 27, 0.08);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-weight: 800;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.nav a {
  border: 1px solid transparent;
  padding: 9px 13px;
  font-size: 14px;
  font-weight: 800;
}

.nav a:hover,
.nav .active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  min-height: 500px;
  border-bottom: 1px solid var(--line);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(42px, 7vw, 78px) clamp(22px, 5vw, 64px);
}

.hero-media {
  min-height: 340px;
  background:
    linear-gradient(180deg, rgba(20, 23, 27, 0.1), rgba(20, 23, 27, 0.7)),
    url('/rs/images/garage.jpg') center / cover;
  display: flex;
  align-items: flex-end;
  padding: 28px;
  color: #fff;
}

.eyebrow {
  width: fit-content;
  margin: 0 0 18px;
  padding: 7px 11px;
  border-left: 4px solid var(--brand);
  background: #fff1f2;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 0.96;
  font-weight: 800;
}

.hero-copy p,
.section-head p,
.empty-state p,
.contact-band p {
  color: var(--muted);
  font-size: 18px;
}

.hero-copy p {
  max-width: 570px;
  margin: 24px 0 0;
}

.hero-actions,
.actions,
.admin-actions,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-actions {
  margin-top: 30px;
}

.button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 17px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.button.secondary,
.link-button.secondary {
  background: transparent;
  color: var(--ink);
}

.button.danger,
.link-button.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.hero-stat {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: rgba(255, 255, 255, 0.34);
}

.hero-stat span {
  display: block;
  padding: 16px 14px;
  background: rgba(0, 0, 0, 0.48);
  font-size: 13px;
}

.hero-stat strong {
  display: block;
  margin-bottom: 4px;
  font-size: 22px;
}

.section {
  padding: clamp(34px, 5vw, 64px) clamp(18px, 4vw, 48px);
}

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

.section-head h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 800;
}

.section-head p {
  max-width: 520px;
  margin: 0;
}

.filters {
  margin-bottom: 28px;
}

.filter {
  padding: 9px 13px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
}

.filter.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.search-panel {
  display: grid;
  gap: 16px;
  margin-bottom: 28px;
  padding: 18px;
  border: 1px solid var(--line);
  background: #fff;
}

.search-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.search-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.cars-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.car-card {
  border: 1px solid var(--line);
  background: #fff;
  overflow: hidden;
}

.car-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #e9edf2;
}

.car-content {
  padding: 18px;
}

.car-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.badge {
  color: var(--green);
}

.badge.sold {
  color: var(--brand);
}

.car-card h3 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 800;
}

.car-card p {
  min-height: 48px;
  margin: 0 0 16px;
  color: var(--muted);
}

.specs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.specs li {
  padding: 8px 10px;
  background: var(--soft);
  font-size: 13px;
  font-weight: 800;
}

.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.price {
  font-size: 22px;
  font-weight: 800;
}

.text-link {
  color: var(--brand);
  font-weight: 800;
}

.process,
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.process {
  background: var(--ink);
  color: #fff;
}

.step,
.stat-card {
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.step strong,
.stat-card strong {
  display: block;
  margin-bottom: 10px;
  color: var(--gold);
  font-size: 28px;
}

.step h3,
.stat-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.step p,
.stat-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
}

.contact-band {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  background: #fff7e8;
  border-top: 1px solid #efd8ab;
  border-bottom: 1px solid #efd8ab;
}

.contact-band h2 {
  margin: 0 0 8px;
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 800;
}

.empty-state {
  border: 1px dashed var(--line);
  padding: 32px;
  background: #fff;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.7fr);
  gap: 24px;
}

.admin-panel {
  border: 1px solid var(--line);
  background: #fff;
  padding: 22px;
}

.admin-panel h2,
.admin-panel h3 {
  margin-top: 0;
}

.wizard-steps {
  counter-reset: step;
  display: grid;
  gap: 10px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.wizard-steps li {
  counter-increment: step;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

.wizard-steps li::before {
  content: counter(step);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-step {
  display: none;
}

.form-step.is-active {
  display: grid;
  gap: 16px;
}

.form-field {
  display: grid;
  gap: 7px;
}

.form-field.full {
  grid-column: 1 / -1;
}

.form-collapsible.full {
  grid-column: 1 / -1;
}

.form-collapsible {
  border: 1px solid var(--line);
  background: #fafafa;
}

.form-collapsible summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 800;
}

.form-collapsible summary::-webkit-details-marker {
  display: none;
}

.form-collapsible summary::after {
  content: "+";
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.form-collapsible[open] summary::after {
  content: "-";
}

.form-collapsible summary small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-collapsible-content {
  border-top: 1px solid var(--line);
  padding: 16px;
}

label {
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  padding: 12px 13px;
  background: #fff;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.message {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: #eef8f2;
  color: var(--green);
  font-weight: 800;
}

.message.error {
  background: #fff1f1;
  color: var(--danger);
}

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

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 8px;
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 0;
  border-bottom: 1px solid var(--line);
}

.detail-media {
  display: grid;
  grid-template-rows: 1fr auto;
  background: #e9edf2;
}

.gallery {
  position: relative;
  min-height: 520px;
  background: #111;
}

.gallery-main {
  width: 100%;
  height: 100%;
  min-height: 520px;
  object-fit: cover;
  display: block;
}

.gallery-control {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: rgba(0, 0, 0, 0.52);
  color: #fff;
  font-size: 24px;
  font-weight: 800;
  cursor: pointer;
}

.gallery-control.previous {
  left: 16px;
}

.gallery-control.next {
  right: 16px;
}

.gallery-count {
  position: absolute;
  left: 16px;
  bottom: 16px;
  padding: 7px 10px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-weight: 800;
}

.gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 6px;
  padding: 8px;
  background: #fff;
}

.gallery-thumbs button {
  border: 2px solid transparent;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.gallery-thumbs button.is-active {
  border-color: var(--brand);
}

.gallery-thumbs img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.detail-summary {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(32px, 5vw, 56px);
}

.detail-status {
  width: fit-content;
  margin: 22px 0 0;
  padding: 8px 12px;
  background: #eef8f2;
  color: var(--green);
  font-weight: 800;
}

.detail-status.sold {
  background: #fff1f1;
  color: var(--brand);
}

.detail-price {
  margin: 18px 0 0;
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 800;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 24px;
}

.detail-description {
  color: var(--muted);
  font-size: 18px;
}

.detail-list,
.detail-specs {
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-list {
  display: grid;
  gap: 10px;
}

.detail-list li {
  padding: 12px 14px;
  background: var(--soft);
  font-weight: 800;
}

.detail-specs {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.detail-specs li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  background: #fff;
}

.detail-specs span {
  color: var(--muted);
}

.footer {
  padding: 30px clamp(18px, 4vw, 48px);
  border-top: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  text-align: center;
}

.footer a {
  color: var(--ink);
  font-weight: 800;
}

@media (max-width: 900px) {
  .hero,
  .detail-hero,
  .detail-layout,
  .admin-layout,
  .contact-band {
    grid-template-columns: 1fr;
  }

  .gallery,
  .gallery-main {
    min-height: 320px;
  }

  .cars-grid,
  .search-grid,
  .process,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-head {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    justify-content: flex-start;
  }

  .hero-stat,
  .cars-grid,
  .search-grid,
  .process,
  .stats-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .admin-table,
  .admin-table tbody,
  .admin-table tr,
  .admin-table td {
    display: block;
    width: 100%;
  }

  .admin-table thead {
    display: none;
  }
}
