:root {
  --bg: #FAF6EE;
  --surface: #FFFFFF;
  --surface-2: #F3ECDF;
  --ink: #2B2620;
  --ink-2: #5E554A;
  --muted: #8A7F72;
  --line: #E4DACA;
  --green: #2F5D3A;
  --green-dark: #234A2C;
  --green-soft: #E3EDE2;
  --saddle: #8B5A2B;
  --saddle-soft: #F4E7D7;
  --gold: #C9962B;
  --red: #B23A30;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(43,38,32,.06), 0 4px 14px rgba(43,38,32,.06);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; padding-top: 28px; padding-bottom: 60px; outline: none; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.wrap { max-width: 1200px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.loading { padding: 80px 0; text-align: center; color: var(--muted); }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; gap: 20px; height: 68px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); font-family: var(--serif); font-size: 1.4rem; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo img { border-radius: 10px; object-fit: cover; box-shadow: 0 0 0 1px rgba(43,38,32,.12); }
.logo strong { color: var(--green); }
.logo span { color: var(--green); font-weight: 700; }
.logo.small { font-size: 1.15rem; margin-bottom: 8px; }
.header-search { flex: 1; max-width: 460px; display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.header-search input { flex: 1; border: 0; background: transparent; padding: 10px 16px; font: inherit; min-width: 0; }
.header-search input:focus { outline: none; }
.header-search:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.header-search button { border: 0; background: transparent; color: var(--ink-2); padding: 0 14px; cursor: pointer; }
.main-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.main-nav a { color: var(--ink-2); padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: .95rem; position: relative; }
.main-nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.main-nav a.active { color: var(--green); }
.main-nav .btn { margin-left: 6px; color: #fff; }
.main-nav .btn:hover { color: #fff; background: var(--green-dark); }
.badge-count { background: var(--red); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 999px; padding: 1px 6px; margin-left: 4px; vertical-align: 1px; }
.menu-toggle { display: none; background: none; border: 0; color: var(--ink); cursor: pointer; margin-left: auto; padding: 6px; }

@media (max-width: 860px) {
  .header-inner { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
  .header-search { order: 3; flex-basis: 100%; max-width: none; }
  .menu-toggle { display: block; }
  .main-nav { display: none; order: 4; flex-basis: 100%; flex-direction: column; align-items: stretch; margin: 0; }
  .main-nav.open { display: flex; }
  .main-nav .btn { margin: 4px 0 0; text-align: center; }
}

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--green); color: #fff; border: 1px solid var(--green); padding: 10px 18px; border-radius: 10px; font: 600 .95rem var(--sans); cursor: pointer; text-decoration: none; transition: background .15s; }
.btn:hover { background: var(--green-dark); text-decoration: none; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.danger { background: var(--surface); color: var(--red); border-color: #E7C3BF; }
.btn.danger:hover { background: #FBECEA; }
.btn.small { padding: 6px 12px; font-size: .85rem; border-radius: 8px; }
.btn.block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--green); font: inherit; cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; color: var(--ink); }
.hint { font-weight: 400; color: var(--muted); font-size: .82rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
textarea { min-height: 140px; resize: vertical; }
.field { margin-bottom: 18px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 640px) { .row, .row-3 { grid-template-columns: 1fr; gap: 0; } }
.error-box { background: #FBECEA; color: var(--red); border: 1px solid #EBC7C2; padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-size: .92rem; }
.note-box { background: var(--saddle-soft); border: 1px solid #E8D3B8; padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: .92rem; }

/* Cards / panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 20px; }
.narrow { max-width: 460px; margin: 20px auto; }
.medium { max-width: 820px; margin: 0 auto; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 40px 0 16px; }
.section-head h2 { margin: 0; }

/* Hero */
.hero { background: linear-gradient(135deg, var(--green) 0%, #3E7149 100%); color: #fff; border-radius: 18px; padding: 52px 44px; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; right: -60px; bottom: -80px; width: 340px; height: 340px; border: 46px solid rgba(243,227,195,.13); border-bottom-color: transparent; border-radius: 50%; transform: rotate(180deg); }
.hero h1 { font-size: clamp(1.7rem, 3.2vw, 2.4rem); color: #fff; }
@media (min-width: 1000px) { .hero h1 { white-space: nowrap; } }
.hero p { font-size: 1.1rem; max-width: 560px; opacity: .92; }
.hero-search { display: flex; gap: 8px; max-width: 580px; margin-top: 22px; position: relative; z-index: 1; }
.hero-search input { flex: 1; padding: 14px 16px; border-radius: 12px; border: 0; font-size: 1rem; }
.hero-search .btn { background: var(--gold); border-color: var(--gold); padding: 0 22px; color: #2B2620; }
.hero-search .btn:hover { background: #B8862A; }
.hero-actions { margin-top: 18px; display: flex; gap: 16px; flex-wrap: wrap; font-size: .95rem; position: relative; z-index: 1; }
.hero-actions a { color: #F3E3C3; font-weight: 600; }
@media (max-width: 640px) { .hero { padding: 34px 22px; } .hero-search { flex-direction: column; } .hero-search .btn { padding: 12px; } }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.cat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 14px; color: var(--ink); transition: transform .15s, box-shadow .15s; }
.cat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; border-color: #D5C7B1; }
.cat-tile .ico { font-size: 1.7rem; }
.cat-tile h3 { margin: 8px 0 4px; font-size: .95rem; line-height: 1.25; overflow-wrap: normal; hyphens: none; }
.cat-tile p { margin: 0; font-size: .82rem; color: var(--muted); }

/* Listing grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } .card .body { padding: 10px; } .card .title { font-size: .9rem; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; position: relative; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.card .thumb { aspect-ratio: 4 / 3; background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card .title { font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .price { font-family: var(--serif); font-weight: 700; color: var(--saddle); font-size: 1.1rem; }
.card .meta { font-size: .8rem; color: var(--muted); margin-top: auto; }
.ribbon { position: absolute; top: 10px; left: 10px; background: var(--gold); color: #2B2620; font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 6px; letter-spacing: .03em; text-transform: uppercase; }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--green-soft); color: var(--green-dark); }
.tag.trade, .tag.sale_trade { background: #E6EAF5; color: #34477A; }
.tag.wanted { background: var(--saddle-soft); color: var(--saddle); }
.tag.service { background: #EFE6F4; color: #66407A; }
.tag.announcement { background: #FBE9D9; color: #9A4A12; }
.tag.offers { background: #E4F1F1; color: #22605F; }
.tag.artist { background: #F7E4EC; color: #8A2E57; }
.tag.status-active { background: var(--green-soft); color: var(--green-dark); }
.tag.status-pending_payment { background: #FFF2D6; color: #8A5B00; }
.tag.status-sold { background: #E6EAF5; color: #34477A; }
.tag.status-expired, .tag.status-removed { background: #EEE; color: #666; }
.placeholder-shoe { width: 56px; opacity: .35; }

.empty { text-align: center; padding: 50px 20px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty h3 { color: var(--ink); }

/* Browse */
.browse { display: grid; grid-template-columns: 250px 1fr; gap: 26px; align-items: start; }
.filters { position: sticky; top: 88px; }
.filters .panel { padding: 18px; }
.filters .field { margin-bottom: 14px; }
.filters select, .filters input { padding: 8px 10px; font-size: .9rem; }
.browse-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.browse-top select { width: auto; padding: 8px 10px; }
.filter-toggle { display: none; }
@media (max-width: 860px) {
  .browse { grid-template-columns: 1fr; }
  .filters { position: static; display: none; }
  .filters.open { display: block; }
  .filter-toggle { display: inline-flex; }
}
.pager { display: flex; justify-content: center; gap: 8px; margin-top: 28px; align-items: center; }

/* Listing detail */
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--ink-2); }
.detail { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 30px; align-items: start; }
@media (max-width: 900px) { .detail { grid-template-columns: 1fr; } }
.gallery .main-img { background: var(--surface-2); border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); cursor: zoom-in; }
.gallery .main-img img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.thumbs button { width: 72px; height: 56px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--surface-2); }
.thumbs button.on { border-color: var(--green); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.detail-price { font-family: var(--serif); font-size: 2rem; color: var(--saddle); font-weight: 700; margin: 4px 0 2px; }
.specs { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: .93rem; }
.specs th { text-align: left; color: var(--muted); font-weight: 500; padding: 7px 12px 7px 0; width: 38%; vertical-align: top; }
.specs td { padding: 7px 0; }
.specs tr + tr { border-top: 1px solid var(--line); }
.description { white-space: pre-wrap; word-wrap: break-word; }
.seller-box { display: flex; gap: 14px; align-items: center; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--saddle-soft); color: var(--saddle); display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: var(--serif); font-size: 1.2rem; flex-shrink: 0; }
.lightbox { position: fixed; inset: 0; background: rgba(20,17,14,.9); display: flex; align-items: center; justify-content: center; z-index: 100; cursor: zoom-out; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* Photo uploader */
.photo-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.photo-slot { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot .x { position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; font-size: 15px; line-height: 1; }
.photo-slot .cover-label { position: absolute; bottom: 5px; left: 5px; background: var(--green); color: #fff; font-size: .68rem; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.photo-slot .make-cover { position: absolute; bottom: 5px; left: 5px; background: rgba(255,255,255,.9); border: 0; font-size: .68rem; padding: 2px 6px; border-radius: 4px; cursor: pointer; }
.add-photo { aspect-ratio: 1; border: 2px dashed #CDBFA8; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); cursor: pointer; font-size: .85rem; text-align: center; background: var(--bg); }
.add-photo:hover { border-color: var(--green); color: var(--green); }
.add-photo span { font-size: 1.8rem; line-height: 1; }

/* Plans */
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 640px) { .plans { grid-template-columns: 1fr; } }
.plan { border: 2px solid var(--line); border-radius: 14px; padding: 22px; background: var(--surface); display: flex; flex-direction: column; }
.plan.featured { border-color: var(--gold); position: relative; }
.plan.featured::before { content: 'Most visible'; position: absolute; top: -12px; left: 20px; background: var(--gold); color: #2B2620; font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 6px; text-transform: uppercase; }
.plan .amount { font-family: var(--serif); font-size: 2.2rem; font-weight: 700; color: var(--ink); }
.plan .amount small { font-size: .9rem; color: var(--muted); font-family: var(--sans); font-weight: 400; }
.plan ul { padding-left: 18px; margin: 12px 0 20px; color: var(--ink-2); flex: 1; }
.plan li { margin-bottom: 4px; }

/* Dashboard rows */
.my-row { display: grid; grid-template-columns: 88px 1fr auto; gap: 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.my-row:first-child { border-top: 0; }
.my-row .mini-thumb { width: 88px; height: 66px; border-radius: 8px; overflow: hidden; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.my-row .mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.my-row .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 700px) { .my-row { grid-template-columns: 70px 1fr; } .my-row .mini-thumb { width: 70px; height: 54px; } .my-row .actions { grid-column: 1 / -1; justify-content: flex-start; } }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; padding: 10px 14px; font: 500 .95rem var(--sans); color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--green); border-color: var(--green); }

/* Messages */
.convo { display: flex; gap: 14px; padding: 14px 4px; border-top: 1px solid var(--line); color: var(--ink); align-items: center; }
.convo:first-child { border-top: 0; }
.convo:hover { background: var(--bg); text-decoration: none; }
.convo .info { flex: 1; min-width: 0; }
.convo .preview { color: var(--muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo.unread .who { font-weight: 700; }
.thread { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; max-height: 60vh; overflow-y: auto; padding: 4px; }
.bubble { max-width: 78%; padding: 10px 14px; border-radius: 14px; background: var(--surface-2); white-space: pre-wrap; word-wrap: break-word; }
.bubble.mine { align-self: flex-end; background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.bubble.theirs { align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble time { display: block; font-size: .72rem; opacity: .7; margin-top: 4px; }

/* Static pages */
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.6em; }
.prose li { margin-bottom: .4em; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 700px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-family: var(--serif); font-size: 1.7rem; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: 9px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 500; border-top: 0; }
.table-wrap { overflow-x: auto; }

/* Footer & toast */
.site-footer { background: var(--surface); border-top: 1px solid var(--line); padding: 34px 0 20px; margin-top: 40px; }
.footer-inner { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; }
.footer-inner p { max-width: 340px; font-size: .9rem; }
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-start; }
.footer-links a { color: var(--ink-2); font-size: .92rem; }
.copyright { color: var(--muted); font-size: .8rem; margin-top: 22px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(120px); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px; font-size: .92rem; transition: transform .25s, opacity .25s, visibility .25s; z-index: 200; max-width: calc(100% - 32px); opacity: 0; visibility: hidden; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; }
.toast.err { background: var(--red); }
