:root {
  --bg:           #f0f0f8;
  --card:         #ffffff;
  --ink:          #0f0f1a;
  --muted:        #64648a;
  --faint:        #9898b0;
  --primary:      #5b5bd6;
  --primary-dim:  #eeeeff;
  --ok:           #16a34a;
  --ok-dim:       #dcfce7;
  --warn:         #b45309;
  --warn-dim:     #fef3c7;
  --line:         #e4e4f0;
  --radius:       16px;
  --shadow:       0 4px 24px rgba(20, 20, 60, .08);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ──────────────────────────────────────────────── */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 28px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(20, 20, 60, .06);
}

.brand {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.5px;
}
.brand span { color: var(--primary); }

.topbar-tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--primary-dim);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 20px;
}

/* ── Main ────────────────────────────────────────────────── */
main {
  flex: 1;
  max-width: 980px;
  margin: 0 auto;
  width: 100%;
  padding: 32px 20px 64px;
}

/* ── Loading ─────────────────────────────────────────────── */
.loading {
  display: flex;
  justify-content: center;
  padding: 80px 0;
}
.loading::after {
  content: '';
  width: 36px;
  height: 36px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Two-column listing layout ───────────────────────────── */
.listing {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

/* ── Gallery ─────────────────────────────────────────────── */
.gallery-wrap {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: sticky;
  top: 82px;
}

.gallery-main {
  background: #f6f6fb;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform .25s ease;
  cursor: zoom-in;
}
.gallery-main img:hover { transform: scale(1.03); }

.gallery-no-photo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--faint);
  font-size: 13px;
}
.gallery-no-photo svg { opacity: .25; }

.gallery-thumbs {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #f6f6fb;
  border-top: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.gallery-thumbs::-webkit-scrollbar { display: none; }

.gallery-thumbs img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  flex: 0 0 auto;
  border: 2px solid transparent;
  opacity: .6;
  transition: border-color .15s, opacity .15s;
}
.gallery-thumbs img.active,
.gallery-thumbs img:hover {
  border-color: var(--primary);
  opacity: 1;
}

/* ── Details column ──────────────────────────────────────── */
.details {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.d-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 22px;
}

.listing-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.3px;
  margin-bottom: 10px;
}

.listing-price {
  font-size: 30px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -.5px;
  line-height: 1;
  margin-bottom: 14px;
}
.listing-price small {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}

.trust-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 20px;
  background: var(--primary-dim);
  color: var(--primary);
}
.badge.ok   { background: var(--ok-dim);   color: var(--ok); }
.badge.warn { background: var(--warn-dim); color: var(--warn); }

/* ── Section label ───────────────────────────────────────── */
.sec-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: var(--faint);
  margin-bottom: 14px;
}

/* ── Facts grid ──────────────────────────────────────────── */
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; }
.fact-label {
  font-size: 10.5px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 3px;
}
.fact-value { font-size: 14px; font-weight: 600; }

/* ── Description ─────────────────────────────────────────── */
.desc {
  font-size: 14px;
  line-height: 1.7;
  color: #3a3a5c;
  white-space: pre-wrap;
}

/* ── Actions ─────────────────────────────────────────────── */
.actions { display: flex; flex-direction: column; gap: 10px; }

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 15px 20px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  width: 100%;
}
.btn-primary:hover { opacity: .88; transform: translateY(-1px); }

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

.btn-share {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn-share:hover {
  background: var(--primary-dim);
  border-color: var(--primary);
  color: var(--primary);
}

/* ── Error / message card ────────────────────────────────── */
.err-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 56px 28px;
  text-align: center;
  max-width: 480px;
  margin: 0 auto;
}
.err-card p { color: var(--muted); margin-bottom: 20px; font-size: 15px; }
.err-card .btn-primary { width: auto; display: inline-flex; }

/* ── Footer ──────────────────────────────────────────────── */
footer {
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 36px 28px 28px;
  margin-top: auto;
}

.foot-inner {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.foot-brand {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.4px;
  margin-bottom: 8px;
}
.foot-brand span { color: var(--primary); }

.foot-line {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 3px;
}
.foot-line a { color: var(--primary); text-decoration: none; }
.foot-line a:hover { text-decoration: underline; }

.foot-section-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: var(--faint);
  margin-bottom: 12px;
}

.foot-contact a {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  margin-bottom: 8px;
}
.foot-contact a:hover { text-decoration: underline; }

.foot-legal {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  font-size: 11.5px;
  color: var(--faint);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 660px) {
  .listing {
    grid-template-columns: 1fr;
  }
  .gallery-wrap { position: static; }
  .facts { grid-template-columns: 1fr; }
  .foot-inner { grid-template-columns: 1fr; }
  .foot-contact { border-top: 1px solid var(--line); padding-top: 18px; }
  .listing-price { font-size: 26px; }
  .topbar-tag { display: none; }
}
