:root {
  --red: #ce0e2d;          /* Ferrari rosso corsa-ish */
  --red-bright: #ff2800;
  --bg: #0a0a0b;
  --bg-2: #0e0e10;
  --panel: #141416;
  --panel-2: #1b1b1f;
  --line: #29292f;
  --line-soft: #1f1f24;
  --text: #f4f4f6;
  --muted: #9a9aa6;
  --muted-2: #6e6e78;
  --yellow: #ffd34e;
  --radius: 12px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  --max: 1320px;
}

* { box-sizing: border-box; }

/* ---------- Login gate ---------- */
body.logged-out #appShell { display: none; }
body:not(.logged-out) #loginPage { display: none; }
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  background-image: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(206,14,45,0.12) 0%, transparent 70%);
}
.login-card {
  width: 100%; max-width: 380px; padding: 48px 36px 40px; text-align: center;
}
.login-logo {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin-bottom: 10px;
}
.login-logo .logo-shield { font-size: 36px; }
.login-logo .logo-word { font-family: 'Oswald', sans-serif; font-size: 32px; font-weight: 700; letter-spacing: 2px; color: var(--text); }
.login-logo .logo-sub { color: var(--muted); font-weight: 500; }
.login-tagline { color: var(--muted); font-size: 14px; margin: 0 0 32px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form .text-input { text-align: center; font-size: 15px; padding: 12px 16px; }
.login-form .search-btn { margin-top: 4px; padding: 12px; font-size: 15px; }
.login-footer { color: var(--muted-2); font-size: 12px; margin-top: 24px; }

/* The `hidden` attribute must always win over component `display` rules
   (e.g. .refresh-btn/.icon-btn set display, which otherwise overrides the
   UA [hidden]{display:none} and leaks admin-only controls to everyone). */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; }
a { color: inherit; text-decoration: none; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(10, 10, 11, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--max); margin: 0 auto; padding: 0 26px; height: 60px;
  display: flex; align-items: center; gap: 30px;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-shield { font-size: 22px; filter: drop-shadow(0 1px 4px rgba(255,40,0,.6)); }
.logo-word { font-family: 'Oswald', sans-serif; font-weight: 700; letter-spacing: 0.14em; font-size: 18px; }
.logo-sub { color: var(--red-bright); margin-left: 2px; }
.nav-links { display: flex; gap: 26px; margin-left: 10px; }
.nav-links a { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 4px 0; border-bottom: 2px solid transparent; }
.nav-links a:hover, .nav-links a.active { color: var(--text); border-color: var(--red); }
.nav-right { margin-left: auto; }
.nav-note { font-size: 12px; color: var(--muted-2); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); background: #08080a; }
/* F40-inspired graphic: Rosso Corsa glow + the F40's louvered rear-deck slats. */
.hero-bg {
  position: absolute; inset: 0; opacity: 1;
  background:
    repeating-linear-gradient(118deg, rgba(0,0,0,0.42) 0 7px, rgba(0,0,0,0) 7px 24px),
    radial-gradient(760px 420px at 86% 26%, #ff1430 0%, #9e0c20 36%, transparent 72%),
    linear-gradient(90deg, #08080a 32%, #1a0407 64%, #240409 100%);
}
.hero.cat-listing .hero-bg {
  background:
    repeating-linear-gradient(118deg, rgba(0,0,0,0.42) 0 7px, rgba(0,0,0,0) 7px 24px),
    radial-gradient(760px 420px at 86% 26%, #ff2438 0%, #7e0a1a 38%, transparent 74%),
    linear-gradient(90deg, #08080a 34%, #16060a 66%, #1d060c 100%);
}
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--bg) 14%, rgba(8,8,10,0.72) 44%, rgba(8,8,10,0.2) 70%, rgba(8,8,10,0.5) 100%);
}
.hero-mark {
  position: absolute; right: 26px; bottom: -22px; z-index: 1; pointer-events: none;
  font-family: 'Oswald', sans-serif; font-weight: 700; font-size: 132px; line-height: 1;
  letter-spacing: -4px; color: rgba(255,255,255,0.06); font-style: italic;
}
.hero-content {
  position: relative; max-width: var(--max); margin: 0 auto;
  padding: 26px 26px; display: flex; align-items: center; justify-content: space-between;
  gap: 30px; flex-wrap: wrap;
}
.hero-text { flex: 1 1 420px; min-width: 0; }
.hero-title {
  font-family: 'Oswald', sans-serif; font-weight: 700;
  font-size: clamp(26px, 3.4vw, 42px); line-height: 1.02; letter-spacing: -0.01em;
  text-transform: uppercase;
}
.hero-title span { color: var(--red-bright); }
.hero-sub { max-width: 560px; margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.hero-stats { display: flex; gap: 26px; margin-top: 0; flex-wrap: wrap; }
.hero-stats .hs { }
.hero-stats .hs .n { font-family: 'Oswald', sans-serif; font-size: 30px; font-weight: 700; line-height: 1; }
.hero-stats .hs .l { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted-2); margin-top: 5px; }

/* ---------- Search bar ---------- */
.searchbar {
  position: sticky; top: 60px; z-index: 30;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.searchbar-inner {
  max-width: var(--max); margin: 0 auto; padding: 14px 26px;
  display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
}
.field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 140px; min-width: 120px; }
.field label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted-2); font-weight: 600; }
.field-val, .field select {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 11px 12px; font-size: 14px; font-weight: 500; outline: none; height: 42px;
}
.field select { cursor: pointer; width: 100%; }
.field select:focus { border-color: var(--red); }
.field-val.locked { color: var(--muted); display: flex; align-items: center; }
.search-btn {
  flex: 0 0 auto; height: 42px; padding: 0 26px;
  background: var(--red); color: #fff; border: none; border-radius: 9px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  cursor: pointer; transition: background 0.15s;
}
.search-btn:hover { background: var(--red-bright); }

/* ---------- Sources strip ---------- */
.sources-strip {
  max-width: var(--max); margin: 0 auto; padding: 12px 26px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  color: var(--muted); font-size: 12.5px; border-bottom: 1px solid var(--line-soft);
}
.strip-label { color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; }
.strip-item { font-weight: 600; color: var(--text); }
.strip-dot { color: var(--muted-2); }
.strip-grow { flex: 1; }
.strip-count { color: var(--muted); }
.strip-count b { color: var(--red-bright); }

/* ---------- Layout ---------- */
.layout {
  max-width: var(--max); margin: 22px auto 0; padding: 0 26px;
  display: grid; grid-template-columns: 248px 1fr; gap: 22px; align-items: start;
}
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 18px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text); }
.link-btn { background: none; border: none; color: var(--red-bright); font-size: 12px; font-weight: 600; cursor: pointer; }

.filters { position: sticky; top: 70px; max-height: calc(100vh - 84px); overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
.filters::-webkit-scrollbar { width: 8px; }
.filters::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }

.filter-group { padding: 14px 0; border-top: 1px solid var(--line-soft); }
.filter-group:first-of-type { border-top: none; padding-top: 0; }
.filter-group h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted-2); margin-bottom: 10px; font-weight: 600; }
.text-input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 10px 12px; font-size: 13.5px; outline: none;
}
.text-input:focus { border-color: var(--red); }
.chips { display: flex; flex-direction: column; gap: 8px; }
.chip-toggle {
  text-align: left; background: var(--bg-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 9px; padding: 9px 12px; font-size: 13px; font-weight: 500; cursor: pointer;
}
.chip-toggle:hover { color: var(--text); }
.chip-toggle.active { background: rgba(206,14,45,0.14); border-color: var(--red); color: #fff; }
.model-head { display: flex; gap: 12px; margin-bottom: 8px; }
.model-checks { max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding-right: 4px; }
.model-checks .mcheck { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; padding: 4px 6px; border-radius: 7px; }
.model-checks .mcheck:hover { background: rgba(255,255,255,0.04); }
.model-checks .mcheck input { accent-color: var(--red); cursor: pointer; }
.model-checks .mcheck .mn { margin-left: auto; color: var(--muted-2); font-size: 11px; }

/* ---------- Results ---------- */
.results-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.results-head h2 { font-family: 'Oswald', sans-serif; font-size: 22px; letter-spacing: 0.02em; display: flex; align-items: center; gap: 10px; }
.count-pill { font-family: 'Inter'; font-size: 12px; font-weight: 700; background: var(--red); color: #fff; padding: 2px 9px; border-radius: 999px; }
.results-sub { font-size: 12.5px; color: var(--muted-2); }

.result-list { display: flex; flex-direction: column; gap: 12px; }
.result {
  display: grid; grid-template-columns: 188px 1fr auto; gap: 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.result:hover { border-color: var(--red); transform: translateY(-2px); box-shadow: var(--shadow); }
/* Thumbnail fills the full card height (no gap below the photo); the 188px column
   width + cover keeps it ~4:3. Card height is driven by content but the image
   always matches it, so the card is never taller than its thumbnail. */
.result-img { position: relative; background: #000; height: 100%; min-height: 138px; }
.result-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.result-img .noimg { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted-2); font-size: 12px; }
/* card image carousel */
.card-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 50%; border: none; background: rgba(0,0,0,0.5); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .15s; display: flex; align-items: center; justify-content: center; z-index: 3; padding: 0; }
.result-img:hover .card-arrow { opacity: 1; }
.card-arrow.prev { left: 6px; }
.card-arrow.next { right: 6px; }
.card-arrow:hover { background: rgba(0,0,0,0.78); }
.card-imgcount { position: absolute; bottom: 6px; right: 8px; background: rgba(0,0,0,0.55); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 999px; z-index: 3; }
@media (hover: none) { .card-arrow { opacity: .85; } }
/* special-series badge */
.special-badge { display: inline-block; font-size: 10px; font-weight: 700; background: #3a2d12; color: #e8b54a; border: 1px solid #5a4416; border-radius: 999px; padding: 1px 7px; vertical-align: middle; white-space: nowrap; }
.result-flag {
  position: absolute; top: 9px; left: 9px; background: rgba(0,0,0,.72); border: 1px solid var(--line);
  padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
}
.result-info { padding: 12px 0; display: flex; flex-direction: column; gap: 5px; min-width: 0; justify-content: center; }
.result-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.result-grade { color: var(--muted); font-size: 13px; }
.result-specs { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; }
.spec { font-size: 12px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); padding: 3px 9px; border-radius: 7px; }
.result-tags { display: flex; gap: 7px; flex-wrap: wrap; }
.tag { font-size: 11px; color: var(--muted-2); }
.tag.blue { color: #6cb7ff; }

.result-right { padding: 12px 16px 12px 0; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 6px; text-align: right; }
.result-price { font-family: 'Oswald', sans-serif; font-size: 24px; font-weight: 700; color: #fff; white-space: nowrap; }
.result-price small { font-size: 11px; color: var(--muted); font-weight: 600; font-family: 'Inter'; }
.result-price.ask { font-size: 15px; color: var(--muted); }
.result-loc { font-size: 12px; color: var(--muted-2); }
.view-btn {
  background: transparent; border: 1px solid var(--red); color: var(--red-bright);
  border-radius: 8px; padding: 8px 14px; font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer; white-space: nowrap;
}
.view-btn:hover { background: var(--red); color: #fff; }

.empty { text-align: center; color: var(--muted); padding: 50px 20px; }

/* ---------- Insights ---------- */
.insight-big { padding: 4px 0 14px; border-bottom: 1px solid var(--line-soft); margin-bottom: 14px; }
.insight-big .n { font-family: 'Oswald', sans-serif; font-size: 32px; font-weight: 700; color: #fff; }
.insight-big .l { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted-2); margin-top: 3px; }
.insight-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; font-size: 13px; }
.insight-row .k { color: var(--muted); }
.insight-row .v { font-weight: 600; }
.bar { height: 6px; border-radius: 4px; background: var(--panel-2); overflow: hidden; margin-top: 6px; }
.bar > span { display: block; height: 100%; background: var(--red); }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.quick button {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 7px 12px; font-size: 12.5px; cursor: pointer;
}
.quick button:hover { border-color: var(--red); color: #fff; }

/* ---------- Footer ---------- */
.foot {
  max-width: var(--max); margin: 34px auto; padding: 22px 26px 50px;
  color: var(--muted-2); font-size: 12.5px; border-top: 1px solid var(--line);
  display: flex; gap: 10px; flex-wrap: wrap;
}
.foot .dot { opacity: 0.5; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.75); backdrop-filter: blur(3px); }
.modal-card { position: relative; z-index: 1; width: min(760px, 100%); max-height: 90vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.modal-close { position: absolute; top: 12px; right: 14px; z-index: 3; background: rgba(0,0,0,.55); color: #fff; border: 1px solid var(--line); width: 34px; height: 34px; border-radius: 50%; font-size: 20px; cursor: pointer; line-height: 1; }
.modal-gallery { position: relative; }
.modal-hero { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: #000; display: block; }
.modal-thumbs { display: flex; gap: 6px; padding: 8px; overflow-x: auto; background: var(--bg-2); }
.modal-thumbs img { width: 78px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); cursor: pointer; flex: 0 0 auto; opacity: 0.65; }
.modal-thumbs img:hover, .modal-thumbs img.active { opacity: 1; border-color: var(--red); }
.modal-inner { padding: 20px 24px 26px; }
.modal-source { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.modal-inner h2 { font-family: 'Oswald', sans-serif; font-size: 26px; margin: 0 0 4px; }
.modal-inner .sub { color: var(--muted); margin: 0 0 18px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.detail-grid div { background: var(--panel); padding: 12px 14px; }
.detail-grid .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-2); }
.detail-grid .v { font-size: 15px; font-weight: 600; margin-top: 3px; }
.modal-price { margin: 18px 0 0; font-family: 'Oswald', sans-serif; font-size: 28px; font-weight: 700; }
.modal-price small { font-size: 13px; color: var(--muted); font-weight: 600; font-family: 'Inter'; }
.modal-link { display: inline-block; margin-top: 16px; color: var(--red-bright); font-weight: 600; font-size: 14px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 14px; }
.modal-link:hover { border-color: var(--red); }
.modal-link.disabled { color: var(--muted); font-weight: 500; cursor: default; }
.modal-link.disabled:hover { border-color: var(--line); }

/* ---------- Status badges, card affordances ---------- */
.status-badge { position: absolute; top: 9px; right: 9px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.status-available { background: #0e3b1e; color: #5fe39a; border: 1px solid #1c6b39; }
.status-sold { background: #3b0e12; color: #ff8a93; border: 1px solid #6b1c23; }
.status-listing_unavailable, .status-incomplete, .status-delisted, .status-na { background: #2a2a31; color: var(--muted); border: 1px solid var(--line); }
.status-ended { background: #2a230e; color: #e3c45f; border: 1px solid #6b5a1c; }
.status-upcoming { background: #0e2433; color: #5fb8e3; border: 1px solid #1c4d6b; }
.auction-line { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.auction-line .alabel { color: var(--muted-2); text-transform: uppercase; font-size: 10px; letter-spacing: .06em; }
.auction-line.ended { color: #e3c45f; }
.auction-line .countdown { color: var(--text); font-weight: 600; }
.auction-line .countdown.ended { color: #e3c45f; }
.result.dim .result-img { opacity: .6; }

.card-actions { display: flex; gap: 6px; }
.mini-btn { background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.mini-btn:hover { color: #fff; border-color: var(--red); }
.mini-btn.fav.on { color: var(--yellow); border-color: var(--yellow); }
.mini-btn .cnt { font-size: 11px; margin-left: 2px; }
.copied-toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #0e3b1e; color: #b6f3cf; border: 1px solid #1c6b39; padding: 9px 16px; border-radius: 10px; font-size: 13px; z-index: 80; }
.countdown { font-size: 12px; font-weight: 700; color: var(--yellow); }
.countdown.ended { color: var(--muted-2); }
.last-refreshed { font-size: 11px; color: var(--muted-2); }

/* ---------- Pager ---------- */
.pager { display: flex; gap: 6px; justify-content: center; margin: 26px 0 4px; flex-wrap: wrap; }
.pager button { background: var(--panel); border: 1px solid var(--line); color: var(--muted); min-width: 38px; height: 38px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 600; }
.pager button:hover:not(:disabled) { color: #fff; border-color: var(--red); }
.pager button.active { background: var(--red); color: #fff; border-color: var(--red); }
.pager button:disabled { opacity: .4; cursor: default; }

/* ---------- Loading skeletons ---------- */
.skeleton { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); height: 132px; overflow: hidden; position: relative; }
.skeleton::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.04), transparent); animation: shimmer 1.2s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ---------- Lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }
.lb-img { max-width: 92vw; max-height: 86vh; object-fit: contain; border-radius: 6px; }
.lb-close { position: absolute; top: 18px; right: 22px; background: none; border: none; color: #fff; font-size: 34px; cursor: pointer; line-height: 1; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.5); border: 1px solid var(--line); color: #fff; width: 50px; height: 64px; border-radius: 10px; font-size: 34px; cursor: pointer; }
.lb-prev { left: 18px; } .lb-next { right: 18px; }
.lb-nav:hover { background: var(--red); }
.lb-counter { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 14px; background: rgba(0,0,0,.5); padding: 5px 12px; border-radius: 999px; }

/* ---------- Auth + nav buttons ---------- */
.ghost-btn { background: transparent; border: 1px solid var(--line); color: var(--text); padding: 7px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer; }
.ghost-btn:hover { border-color: var(--red); }
.icon-btn { position: relative; background: transparent; border: none; color: var(--text); font-size: 18px; cursor: pointer; }
.badge-count { position: absolute; top: -6px; right: -8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; padding: 0 3px; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.refresh-btn { display: inline-flex; align-items: center; gap: 6px; }
.refresh-btn .refresh-ic { display: inline-block; font-size: 15px; line-height: 1; }
.refresh-btn.busy { opacity: .8; cursor: progress; border-color: var(--red); }
.refresh-btn.busy .refresh-ic { animation: spin 0.9s linear infinite; }
.refresh-btn:disabled { cursor: progress; }
@keyframes spin { to { transform: rotate(360deg); } }
.nav-note.err { color: var(--red); }
.nav-note.busy { color: var(--red); font-weight: 600; animation: blink 1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

/* Domain tabs (Auctions vs Dealer Listings) */
.domain-tabs { display: flex; gap: 8px; justify-content: center; padding: 10px 16px; background: var(--bg, #0c0c10); border-bottom: 1px solid rgba(255,255,255,0.06); position: sticky; top: 0; z-index: 40; }
.dtab { font-family: 'Oswald', sans-serif; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; padding: 8px 18px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.14); background: transparent; color: var(--muted-2, #9aa); cursor: pointer; transition: all .15s; }
.dtab:hover { color: #fff; border-color: rgba(255,255,255,0.3); }
.dtab.active { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
/* per-domain filter visibility */
body.cat-listing .auction-only { display: none !important; }
body:not(.cat-listing) .listing-only { display: none !important; }
/* listing card extras */
.result-via { font-size: 11px; color: var(--muted-2, #8a8a93); margin-top: 2px; }
.result-via .poa { color: #d9a441; font-weight: 600; }
.appear-pill { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 999px; background: rgba(255,255,255,0.08); color: #cfcfd6; margin-left: 6px; }
.price-alt { font-size: 11px; color: #8a8a93; }
.dealer-line { font-size: 12px; color: #b9b9c2; margin-top: 4px; }
.dealer-line .ctry { opacity: .8; }
.status-forsale { background: #123524; color: #57d98a; }
.status-offmarket { background: #2a2a30; color: #b0b0b8; }

/* Admin settings — scrape sources */
.settings-card { width: min(680px, 100%); max-height: 86vh; display: flex; flex-direction: column; }
.settings-inner { padding: 22px 24px; overflow-y: auto; }
.settings-inner h2 { font-family: 'Oswald', sans-serif; }
.settings-inner .sub { color: var(--muted); font-size: 13px; margin: 4px 0 16px; }
.add-source { display: grid; grid-template-columns: 1.3fr 1.6fr 0.9fr 70px auto; gap: 8px; margin-bottom: 18px; }
.add-source .ctry-in { text-transform: uppercase; }
.add-source .text-input { padding: 8px 10px; }
.add-source .search-btn { padding: 8px 14px; }
.src-group { margin-bottom: 16px; }
.src-group h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted-2); margin: 0 0 8px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.src-group h4.src-ghead { display: flex; align-items: center; gap: 8px; }
.src-group h4.src-ghead .c-refresh { width: 24px; height: 24px; font-size: 12px; }
.src-group h4.src-ghead .c-when { font-size: 11px; color: var(--muted-2); margin-left: auto; text-transform: none; letter-spacing: 0; }
.src-count { opacity: .6; }
.src-country { margin: 0 0 6px; }
.src-country-head { display: flex; align-items: center; gap: 8px; padding: 7px 0 4px; margin-top: 6px; }
.src-country-head .cc { font-size: 12px; font-weight: 700; color: var(--text); letter-spacing: .02em; }
.src-country-head .c-refresh { width: 24px; height: 24px; font-size: 12px; }
.src-country-head .c-when { font-size: 11px; color: var(--muted-2); margin-left: auto; }
.c-when.blink, .src-when.blink { animation: blink 1s ease-in-out infinite; color: var(--red-bright); }
.src-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.src-row.off { opacity: .5; }
.src-main { flex: 1; min-width: 0; }
.src-name { color: var(--text); font-weight: 600; font-size: 14px; text-decoration: none; }
.src-name:hover { color: var(--red-bright); text-decoration: underline; }
.src-meta { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.src-badge { font-size: 10px; padding: 1px 7px; border-radius: 999px; }
.src-badge.live { background: #123524; color: #57d98a; }
.src-badge.pending { background: #2e2a1a; color: #d9a441; }
.src-badge.custom { background: #1d2740; color: #6ea8fe; }
.src-listed { font-size: 11px; color: var(--muted-2); }
/* toggle switch */
.src-toggle { position: relative; display: inline-block; width: 38px; height: 20px; flex: none; }
.src-toggle input { opacity: 0; width: 0; height: 0; }
.src-sw { position: absolute; inset: 0; background: #3a3a42; border-radius: 999px; cursor: pointer; transition: .15s; }
.src-sw::before { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; }
.src-toggle input:checked + .src-sw { background: var(--red); }
.src-toggle input:checked + .src-sw::before { transform: translateX(18px); }
/* multi-line refresh report notifications */
.notif-item.report { white-space: pre-line; font-size: 12.5px; line-height: 1.5; cursor: default; }
/* settings sub-tabs */
.set-tabs { display: flex; gap: 6px; margin: 6px 0 14px; border-bottom: 1px solid var(--line); }
.set-tab { background: none; border: none; border-bottom: 2px solid transparent; color: var(--muted-2); font-weight: 600; font-size: 13px; padding: 8px 12px; cursor: pointer; }
.set-tab.active { color: var(--text); border-bottom-color: var(--red); }
#modelScrapeList { max-height: 46vh; overflow-y: auto; }

/* thin site rows */
.src-row { padding: 5px 0; gap: 9px; }
.src-name-wrap { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.src-num { font-size: 10px; font-weight: 700; background: var(--red); color: #fff; border-radius: 999px; padding: 0 5px; min-width: 15px; height: 15px; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.src-num.zero { background: #34343c; color: #8a8a93; }
.src-badge.ready { background: #123524; color: #57d98a; }
.src-del { color: var(--muted-2); }
.src-refresh { color: var(--muted-2); }
.src-refresh:hover { color: var(--red-bright); }
.src-refresh.busy { animation: spin 0.9s linear infinite; pointer-events: none; }
.src-when { font-size: 10px; color: var(--muted-2); white-space: nowrap; }
.src-when.blink { color: var(--red); font-weight: 600; animation: blink 1s ease-in-out infinite; }
.health-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.health-dot.green { background: #3fcf6b; }
.health-dot.yellow { background: #e6c34d; }
.health-dot.red { background: #e0566a; }
.health-dot.grey { background: #6b6b76; }
/* models with body-style columns */
.mscrape-head { display: flex; justify-content: space-between; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); padding: 0 2px 4px; border-bottom: 1px solid var(--line); }
.mscrape-cols { display: inline-flex; gap: 16px; width: 96px; justify-content: space-around; }
.mscrape-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 2px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.mscrape-row.off { opacity: .5; }
.mcheck.wide { flex: 1; display: flex; align-items: center; gap: 8px; cursor: pointer; min-width: 0; }
.mscrape-row .mcheck .mn { margin-left: auto; padding-right: 12px; color: var(--muted-2); font-size: 11px; }
.mscrape-cols input { width: 16px; height: 16px; accent-color: var(--red); }
/* users */
.add-user { grid-template-columns: 1.2fr 1.2fr auto auto; }
.usr-admin { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; }
/* original-currency price line */
.orig-price { font-size: 11.5px; color: var(--muted-2); margin-top: 1px; font-weight: 500; }
/* detail appearances / alternatives */
.price-alt-list { font-size: 12px; color: var(--muted); margin-top: 8px; }
.modal-description { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.modal-description h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); margin: 0 0 6px; }
.modal-description p { font-size: 13px; line-height: 1.6; color: var(--text-2); margin: 0; white-space: pre-line; max-height: 200px; overflow-y: auto; }
.modal-appears { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.modal-appears h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); margin: 0 0 6px; }
.appear-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; }
.appear-row a { color: var(--red-bright); text-decoration: none; flex: 1; }
.appear-row a:hover { text-decoration: underline; }
.auth-card { width: min(380px, 100%); }
.auth-inner { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.auth-inner h2 { font-family: 'Oswald', sans-serif; }
.auth-inner .sub { color: var(--muted); margin: 0; font-size: 13px; }
.auth-inner .text-input { padding: 12px 14px; }
.auth-err { color: #ff8a93; font-size: 13px; min-height: 16px; }
.search-btn.full { width: 100%; }

/* ---------- Comments (Phase 7) ---------- */
.comments { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
.comments h3 { font-size: 14px; margin-bottom: 12px; }
.comment { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.comment .meta { font-size: 12px; color: var(--muted-2); display: flex; gap: 8px; align-items: center; }
.comment .who { color: var(--text); font-weight: 600; }
.comment .body { font-size: 14px; margin-top: 4px; white-space: pre-wrap; }
.comment .body .mention { color: var(--red-bright); font-weight: 600; }
.comment.removed .body { color: var(--muted-2); font-style: italic; }
.comment-actions { display: flex; gap: 10px; margin-top: 4px; }
.comment-actions button { background: none; border: none; color: var(--muted-2); font-size: 12px; cursor: pointer; }
.comment-actions button:hover { color: var(--red-bright); }
.comment-box { position: relative; margin-top: 12px; }
.comment-box textarea { width: 100%; background: var(--bg-2); border: 1px solid var(--line); color: var(--text); border-radius: 9px; padding: 10px 12px; font-size: 14px; resize: vertical; min-height: 60px; font-family: inherit; }
.mention-menu { position: absolute; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; max-height: 160px; overflow: auto; z-index: 5; min-width: 160px; }
.mention-menu div { padding: 8px 12px; cursor: pointer; font-size: 13px; }
.mention-menu div:hover, .mention-menu div.active { background: var(--red); color: #fff; }

/* ---------- Notifications panel ---------- */
.notif-panel { position: fixed; top: 60px; right: 12px; width: min(380px, 94vw); max-height: 70vh; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); z-index: 45; }
.notif-panel[hidden] { display: none; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-head button { background: none; border: none; color: var(--red-bright); font-size: 12px; cursor: pointer; }
.notif-item { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; font-size: 13px; }
.notif-item:hover { background: var(--panel-2); }
.notif-item.unread { border-left: 3px solid var(--red); }
.notif-item .t { color: var(--muted-2); font-size: 11px; margin-top: 3px; }
.drawer-toggle { display: none; background: var(--panel); border: 1px solid var(--line); color: var(--text); padding: 7px 12px; border-radius: 9px; font-size: 13px; cursor: pointer; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .insights { position: static; order: 3; }
  .drawer-toggle { display: inline-block; }
  .filters {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50; width: 300px; max-width: 86vw;
    background: var(--bg-2); border-right: 1px solid var(--line); padding: 16px; overflow: auto;
    transform: translateX(-105%); transition: transform .22s ease;
  }
  body.drawer-open .filters { transform: translateX(0); box-shadow: var(--shadow); }
  body.drawer-open::after { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 49; }
}
@media (max-width: 620px) {
  /* --- header: collapse labels to icons so the bar never overflows --- */
  .nav-links { display: none; }
  .nav-inner { padding: 0 14px; gap: 12px; height: 56px; }
  .nav-right { gap: 8px; }
  .refresh-btn .refresh-lbl, .btn-lbl, .nav-note { display: none; }   /* icon/short-text only */
  .ghost-btn { padding: 7px 11px; }
  .logo-word { font-size: 16px; }
  .logo-sub { display: none; }

  /* --- tighten side padding (26px wastes ~52px on a phone) --- */
  .searchbar { top: 56px; }
  .searchbar-inner { padding: 12px 14px; gap: 10px; }
  .field { flex: 1 1 calc(50% - 5px); min-width: 0; }
  .search-btn { flex: 1 0 100%; }            /* full-width on its own row */
  .sources-strip { padding: 10px 14px; gap: 10px; }
  .layout { padding: 0 14px; margin-top: 16px; }
  .foot { padding: 18px 14px 40px; }

  /* --- hero: smaller, less vertical bulk --- */
  .hero-content { padding: 22px 14px 26px; }
  .hero-mark { font-size: 92px; right: 10px; bottom: -14px; }
  .hero-stats { gap: 18px; }

  /* --- result cards --- */
  .result { grid-template-columns: 116px 1fr; }
  .result-img { min-height: 116px; }
  .result-info { padding: 12px 12px 8px 0; }
  .result-title { font-size: 16px; }
  .result-right {
    grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap;
    align-items: center; justify-content: space-between; gap: 10px;
    padding: 0 14px 14px; text-align: left;
  }
  .detail-grid { grid-template-columns: 1fr; }
}
