:root {
  --bg: #0b0c0d;
  --surface: #18191b;
  --surface-2: #212325;
  --border: #2c2f32;
  --text: #f2f3f4;
  --muted: #9aa1a6;
  --accent: #f4c430;
  --accent-dark: #d9a91f;
  --red: #cf142b;
  --green: #2fae66;
  --green-dark: #1f8a4c;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #111315;
  border-bottom: 2px solid var(--accent);
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none !important;
}
.brand-logo { height: 48px; width: auto; }

.nav { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.nav a { color: #e6e8ea; }
.nav a:hover { color: var(--accent); }
.nav .btn-ghost { color: #e6e8ea !important; border-color: #3a3d40; }
.nav .btn-ghost:hover { background: #1c1f21; }
.nav .btn { background: var(--accent); color: #16201a !important; }
.nav .btn:hover { background: var(--accent-dark); }

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 60px;
  min-height: 70vh;
}

.foot {
  background: #111315;
  border-top: 2px solid var(--accent);
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.foot-links { display: flex; gap: 14px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }
.foot-links a { color: #e6e8ea; }
.foot-links a:hover { color: var(--accent); }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #16201a !important;
  border: none;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none !important;
}
.btn:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--text) !important; border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { background: var(--red); color: #fff !important; }
.btn-danger:hover { background: #9d0f19; }
.btn-block { display: block; width: 100%; text-align: center; }

.prose { max-width: 740px; margin: 0 auto; }
.prose h1 { font-size: 28px; margin-bottom: 4px; }
.prose h2 { font-size: 19px; margin-top: 32px; color: var(--accent); }
.prose p, .prose li { color: var(--text); }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.legal-meta { color: var(--muted); font-size: 13px; margin-top: 0; }

.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1a1c1e 0%, #0e0f10 70%);
  border: 1px solid var(--border);
  color: #fff;
  border-radius: var(--radius);
  padding: 40px 24px 64px;
}
.hero-mark {
  position: absolute;
  right: -10px;
  bottom: -10px;
  width: 220px;
  height: 220px;
  color: var(--accent);
  opacity: 0.16;
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 560px; }
.hero-inner h1 { margin: 0 0 8px; font-size: 28px; }
.hero-inner h1 .accent { color: var(--accent); }
.hero-inner p { margin: 0; color: #c7cace; }

.search-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  margin: -34px 0 24px;
  position: relative;
  z-index: 2;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}
.search-card form { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; align-items: end; }
.search-card label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.search-card input, .search-card select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
  background: var(--surface-2); color: var(--text);
}
.search-card input::placeholder { color: #6a7075; }
.search-card .filters-actions { display: flex; gap: 8px; grid-column: 1 / -1; justify-content: flex-end; margin-top: 4px; }
.btn-search { background: var(--accent); color: #16201a !important; }
.btn-search:hover { background: var(--accent-dark); }

@media (max-width: 640px) {
  .hero { padding: 28px 18px 56px; }
  .search-card .filters-actions { justify-content: stretch; }
  .search-card .filters-actions .btn { flex: 1; text-align: center; }
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .1s ease, border-color .1s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card a.card-link { color: inherit; text-decoration: none; display: block; }
.card-photo { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #26282a; }
.card-body { padding: 12px; }
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 8px; color: var(--text); }
.card-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.meta-item { display: inline-flex; align-items: center; gap: 4px; }
.meta-item svg { width: 13px; height: 13px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.card-price { font-size: 18px; font-weight: 800; color: var(--accent); }
.badge-sold {
  position: absolute; background: var(--red); color: #fff; font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px; margin: 8px;
}
.card-photo-wrap { position: relative; }

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

.detail {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
}
@media (max-width: 800px) { .detail { grid-template-columns: 1fr; } }

.gallery-main { border-radius: var(--radius); overflow: hidden; margin-bottom: 8px; background: #26282a; aspect-ratio: 4/3; }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.gallery-thumbs img { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; border: 2px solid transparent; cursor: pointer; }
.gallery-thumbs img.on { border-color: var(--accent); }

.detail-side {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  align-self: start;
}
.detail-price { font-size: 28px; font-weight: 800; color: var(--accent); }
.detail-title { font-size: 20px; font-weight: 700; margin: 4px 0 12px; color: var(--text); }
.spec-list { list-style: none; padding: 0; margin: 16px 0; }
.spec-list li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.spec-list li span:first-child { color: var(--muted); }
.seller-box { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.seller-name { font-weight: 700; }

.desc { white-space: pre-wrap; line-height: 1.6; margin-top: 16px; }

form.stack { display: flex; flex-direction: column; gap: 12px; max-width: 480px; }
form.stack.wide { max-width: 720px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit;
  background: var(--surface-2); color: var(--text);
}
.field input::placeholder, .field textarea::placeholder { color: #6a7075; }
.field textarea { resize: vertical; min-height: 90px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }

.auth-card {
  max-width: 420px;
  margin: 20px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.auth-card h1 { margin-top: 0; font-size: 22px; color: var(--text); }
.oauth-row { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: #fff;
  color: #1f1f1f !important;
  border: 1px solid #dadce0;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none !important;
  box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08);
}
.btn-google:hover { background: #f8f9fa; box-shadow: 0 1px 3px rgba(60, 64, 67, 0.18); }
.btn-google svg { flex: none; }
.divider { text-align: center; color: var(--muted); font-size: 12px; margin: 14px 0; }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 14px; }
.alert-error { background: #3a1414; color: #ff9c9c; border: 1px solid #6b2323; }
.alert-ok { background: #133020; color: #7fe3ab; border: 1px solid #1f6b45; }

table.mylist { width: 100%; border-collapse: collapse; margin-top: 12px; }
table.mylist th, table.mylist td { text-align: left; padding: 10px; border-bottom: 1px solid var(--border); font-size: 14px; }
table.mylist img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; }
.status-pill { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status-active { background: #133020; color: #7fe3ab; }
.status-sold { background: #3a1414; color: #ff9c9c; }
.status-inactive { background: var(--surface-2); color: var(--muted); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions form { display: inline; }

.page-title { font-size: 22px; font-weight: 800; margin-bottom: 16px; color: var(--text); }

.msg-list { display: flex; flex-direction: column; gap: 12px; max-width: 720px; }
.msg-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.msg-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 6px; }
.msg-buyer { font-weight: 700; color: var(--text); }
.msg-date { color: var(--muted); font-size: 12px; margin-left: 8px; }
.msg-listing { font-size: 13px; color: var(--accent); font-weight: 600; }
.msg-body { margin: 0 0 10px; white-space: pre-wrap; }
.msg-actions { display: flex; gap: 8px; flex-wrap: wrap; }
