:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --ink: #0f1b2d;
  --muted: #5b6b80;
  --line: #e2e8f0;
  --brand: #0b3b66;
  --brand-2: #135a9a;
  --accent: #f6a609;
  --accent-ink: #231600;
  --good: #15803d;
  --bad: #b91c1c;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 27, 45, .06), 0 4px 16px rgba(15, 27, 45, .06);
  --max: 1200px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.5; font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.1rem; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }

/* ── header */
.site-header { background: #fff; color: var(--ink); position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); box-shadow: 0 1px 8px rgba(15,27,45,.05); }
.site-header .wrap { display: flex; align-items: center; gap: 16px; height: 68px; }
.logo { display: flex; align-items: center; flex: none; }
.logo:hover { text-decoration: none; }
.logo-svg { height: 52px; width: auto; display: block; }
@media (max-width: 420px) { .logo-svg { height: 38px; } }
.nav { display: flex; gap: 4px; align-items: center; margin-left: auto; }
.nav a { color: var(--ink); padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: .95rem; }
.nav a:hover, .nav a.active { background: #eef3f9; color: var(--brand); text-decoration: none; }
.nav .btn { margin-left: 6px; }
.menu-btn { display: none; margin-left: auto; background: none; border: 0; color: var(--ink); font-size: 1.6rem; cursor: pointer; }
@media (max-width: 860px) {
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; top: 68px; left: 0; right: 0; background: #fff; border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: 8px 16px 16px; }
  .nav.open { display: flex; }
  .nav .btn { margin: 6px 0 0; }
}

/* ── buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 18px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important;
  background: var(--brand); color: #fff; transition: filter .15s;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: #eef2f7; filter: none; }
.btn.danger { background: transparent; border-color: #f3c2c2; color: var(--bad); }
.btn.sm { padding: 6px 12px; font-size: .875rem; border-radius: 8px; }
.btn.lg { padding: 14px 24px; font-size: 1.05rem; }
.btn.block { width: 100%; }

label { display: block; font-weight: 600; font-size: .875rem; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1px solid #cbd5e1; border-radius: 10px; padding: 10px 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-2); outline-offset: 0; border-color: var(--brand-2); }
textarea { min-height: 110px; resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 8px; align-items: flex-end; }
.row > .grow { flex: 1; }
.error { background: #fdecec; color: var(--bad); border: 1px solid #f5c2c2; padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; font-size: .9rem; }
.notice { background: #e8f1fb; color: var(--brand); border: 1px solid #c9dcf1; padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; font-size: .9rem; }

/* ── cards & layout */
main { min-height: calc(100vh - 68px - 180px); }
.section { padding: 40px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 24px; }
.narrow { max-width: 560px; margin: 0 auto; }
.medium { max-width: 820px; margin: 0 auto; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-title h1 { margin: 0; font-size: 1.8rem; }

/* ── hero */
.hero { background: linear-gradient(135deg, var(--brand) 0%, #0e4f86 100%); color: #fff; padding: 56px 0 64px; }
.hero p.lead { font-size: 1.15rem; color: #d3e2f1; max-width: 640px; margin: 0 0 24px; }
.hero-search { background: #fff; border-radius: 14px; padding: 12px; display: grid; grid-template-columns: 2fr 1.3fr 1.3fr auto; gap: 10px; max-width: 900px; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.hero-search input, .hero-search select { border-color: var(--line); }
@media (max-width: 760px) { .hero-search { grid-template-columns: 1fr; } }
.hero-badges { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 20px; color: #cfe0f1; font-size: .95rem; }

.sell-banner { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: center; background: #fff7e6; border: 1px solid #fde2a6; border-radius: 16px; padding: 28px; }
.sell-banner h2 { margin-bottom: 6px; }
@media (max-width: 760px) { .sell-banner { grid-template-columns: 1fr; } }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.step { padding: 20px; }
.step .num { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; margin-bottom: 10px; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }

/* ── listing cards */
.listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.lcard { overflow: hidden; display: flex; flex-direction: column; color: inherit; transition: transform .15s, box-shadow .15s; }
.lcard:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15,27,45,.12); text-decoration: none; }
.lcard .ph { aspect-ratio: 4 / 3; background: #e5ebf2; position: relative; }
.lcard .ph img { width: 100%; height: 100%; object-fit: cover; }
.lcard .ph .noimg { position: absolute; inset: 0; display: grid; place-items: center; color: #8a9ab0; font-size: .9rem; }
.lcard .body { padding: 14px 16px 16px; }
.lcard .title { font-weight: 700; margin: 0 0 2px; }
.lcard .price { font-size: 1.3rem; font-weight: 800; color: var(--brand); }
.lcard .meta { color: var(--muted); font-size: .875rem; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.badge.dealer { background: #e0ecfa; color: var(--brand); }
.badge.private { background: #e7f6ec; color: var(--good); }
.badge.sold { background: #fdecec; color: var(--bad); }
.badge.removed { background: #eee; color: #555; }
.lcard .ph .badge { position: absolute; top: 10px; left: 10px; }

/* ── browse */
.browse { display: grid; grid-template-columns: 270px 1fr; gap: 24px; align-items: start; }
.filters { padding: 18px; position: sticky; top: 80px; }
.filters h3 { margin-bottom: 12px; }
.results-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.results-bar select { width: auto; }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 24px; align-items: center; }
@media (max-width: 860px) { .browse { grid-template-columns: 1fr; } .filters { position: static; } }

/* ── listing detail */
.detail { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; align-items: start; }
.gallery .main { aspect-ratio: 4 / 3; background: #e5ebf2; border-radius: var(--radius); overflow: hidden; }
.gallery .main img { width: 100%; height: 100%; object-fit: cover; }
.gallery .thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.gallery .thumbs img { width: 88px; height: 66px; object-fit: cover; border-radius: 8px; cursor: pointer; opacity: .65; border: 2px solid transparent; flex: none; }
.gallery .thumbs img.on { opacity: 1; border-color: var(--brand-2); }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0; }
.specs div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.specs dt { font-size: .8rem; color: var(--muted); }
.specs dd { margin: 0; font-weight: 600; }
.side-sticky { position: sticky; top: 80px; }
.big-price { font-size: 2rem; font-weight: 800; color: var(--brand); margin: 4px 0 12px; }
.desc { white-space: pre-wrap; }
@media (max-width: 860px) { .detail { grid-template-columns: 1fr; } .side-sticky { position: static; } }

/* ── photo picker */
.photo-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.photo-picker .tile { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: #e5ebf2; }
.photo-picker .tile img { width: 100%; height: 100%; object-fit: cover; }
.photo-picker .tile button { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.65); color: #fff; border: 0; border-radius: 50%; width: 26px; height: 26px; cursor: pointer; font-size: 14px; line-height: 1; }
.photo-picker .tile .cover { position: absolute; left: 4px; bottom: 4px; background: var(--accent); color: var(--accent-ink); font-size: .7rem; font-weight: 700; padding: 2px 6px; border-radius: 6px; }
.photo-picker .add { border: 2px dashed #b8c4d4; border-radius: 10px; aspect-ratio: 4 / 3; display: grid; place-items: center; color: var(--muted); cursor: pointer; font-weight: 600; font-size: .9rem; text-align: center; padding: 6px; background: #fff; }
.photo-picker .add:hover { border-color: var(--brand-2); color: var(--brand-2); }

/* ── account type chooser */
.chooser { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.chooser label { border: 2px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; font-weight: 700; margin: 0; }
.chooser label span { display: block; font-weight: 400; color: var(--muted); font-size: .85rem; margin-top: 2px; }
.chooser input { display: none; }
.chooser label:has(input:checked) { border-color: var(--brand-2); background: #eef5fc; }

/* ── tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: #f3f7fb; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: #eef2f7; color: var(--ink); white-space: nowrap; }
.pill.new { background: #fff1d6; color: #8a5a00; }
.pill.contacted { background: #e0ecfa; color: var(--brand); }
.pill.offer_made { background: #ede4fb; color: #5b2ca0; }
.pill.accepted, .pill.purchased { background: #e7f6ec; color: var(--good); }
.pill.declined, .pill.closed { background: #eee; color: #555; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); text-decoration: none; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { padding: 14px 16px; }
.stat b { display: block; font-size: 1.6rem; }
@media (max-width: 700px) { .stat-row { grid-template-columns: 1fr 1fr; } }

.mylist { display: flex; flex-direction: column; gap: 12px; }
.myitem { display: grid; grid-template-columns: 120px 1fr auto; gap: 16px; align-items: center; padding: 12px; }
.myitem img, .myitem .noimg { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; background: #e5ebf2; }
.myitem .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) { .myitem { grid-template-columns: 90px 1fr; } .myitem img, .myitem .noimg { width: 90px; height: 68px; } .myitem .actions { grid-column: 1 / -1; justify-content: flex-start; } }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid #cbd5e1; border-top-color: var(--brand-2); border-radius: 50%; animation: spin .8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 50; box-shadow: var(--shadow); font-size: .95rem; max-width: calc(100% - 32px); }

/* ── footer */
.site-footer { background: #0a1a2c; color: #9fb1c6; padding: 36px 0; margin-top: 48px; font-size: .9rem; }
.site-footer .cols { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.site-footer a { color: #cfe0f1; }
.site-footer .links { display: flex; gap: 18px; flex-wrap: wrap; }

.prose { max-width: 760px; }
.prose h2 { margin-top: 1.4em; font-size: 1.25rem; }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { padding: 4px 0 4px 26px; position: relative; }
.check-list li::before { content: "✓"; position: absolute; left: 0; color: var(--good); font-weight: 800; }

.footer-badge { width: 44px; height: auto; margin-bottom: 8px; }
