:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --ink: #1d1f22;
  --muted: #6b6f76;
  --line: #e3e1dc;
  --accent: #e8590c;
  --accent-ink: #ffffff;
  --accent-soft: #fff1e8;
  --ok: #2b8a3e;   --ok-soft: #e6f4ea;
  --warn: #b35c00; --warn-soft: #fff4dc;
  --bad: #c92a2a;  --bad-soft: #fdecec;
  --info: #1c6dd0; --info-soft: #e7f0fb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.05);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15161a; --surface: #1e2026; --ink: #ececee; --muted: #9a9ea6; --line: #30333b;
    --accent-soft: #3a2416; --ok-soft: #17301f; --warn-soft: #3a2c12; --bad-soft: #3a1a1a; --info-soft: #172a42;
    --ok: #69db7c; --warn: #ffc069; --bad: #ff8787; --info: #74c0fc;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.5; font-size: 16px; }
a { color: inherit; }
img { max-width: 100%; display: block; }
h1 { font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.2; margin: .2em 0 .4em; }
h2 { font-size: 1.25rem; margin: 1.6em 0 .5em; }
h3 { font-size: 1.05rem; margin: 0 0 .4em; }
code { background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.strong { font-weight: 600; text-decoration: none; }
.danger { color: var(--bad); }
.inline { display: inline; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* Top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; text-decoration: none; letter-spacing: -.01em; }
.brand-mark { background: var(--accent); color: #fff; border-radius: 7px; font-size: .8rem; padding: 5px 6px; }
.topnav { display: flex; gap: 4px 16px; align-items: center; flex-wrap: wrap; font-size: .95rem; }
.topnav a { text-decoration: none; color: var(--muted); padding: 4px 0; }
.topnav a:hover, .topnav a.on { color: var(--ink); }
.topnav a.on { box-shadow: inset 0 -2px var(--accent); }
.topnav a.btn { color: var(--accent-ink); }
.pill { background: var(--accent); color: #fff; border-radius: 99px; font-size: .75rem; padding: 0 7px; }
main { padding-top: 20px; padding-bottom: 48px; min-height: 70vh; }
.footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; justify-content: space-between; padding: 18px 16px; gap: 12px; flex-wrap: wrap; }

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--accent); color: var(--accent-ink);
  border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { filter: brightness(1.07); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface); }
.btn-danger { background: var(--bad); }
.btn-sm { padding: 5px 11px; font-size: .875rem; }
.btn.block { width: 100%; }
.btn.brand { background: var(--brand, var(--accent)); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; }
.linkish:hover { color: var(--ink); }
.linkish.danger { color: var(--bad); }

.form label, .filters label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 14px; }
input, select, textarea { display: block; width: 100%; margin-top: 5px; font: inherit; font-weight: 400; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
label.check input { width: auto; margin: 0; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; }
.counter { display: block; text-align: right; font-weight: 400; font-size: .8rem; color: var(--muted); }
.counter.over { color: var(--warn); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.triple { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.hp { position: absolute; left: -9999px; }
details { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; background: var(--surface); }
summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: 10px; }

/* Flash */
.flash { border-radius: 8px; padding: 11px 14px; margin: 0 0 16px; background: var(--info-soft); }
.flash-success { background: var(--ok-soft); }
.flash-warning { background: var(--warn-soft); }
.flash-error { background: var(--bad-soft); }
.flash.small { padding: 7px 10px; font-size: .85rem; }
.flash.as-link { display: block; text-decoration: none; }

/* Public: hero + browse */
.hero { background: linear-gradient(135deg, #2b2d33, #3d3f47); color: #fff; border-radius: 14px; padding: clamp(24px, 5vw, 48px); margin-bottom: 24px; }
.hero h1 { margin-top: 0; }
.hero p { color: #d5d6da; margin: 0 0 18px; }
.searchbar { display: flex; gap: 8px; max-width: 640px; }
.searchbar input { margin: 0; border: 0; padding: 12px 14px; }
.browse { display: grid; grid-template-columns: 230px 1fr; gap: 28px; align-items: start; }
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; position: sticky; top: 76px; }
.filters .clear { display: block; margin-top: 10px; font-size: .9rem; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.card { background: var(--surface); border-radius: var(--radius); overflow: hidden; text-decoration: none; box-shadow: var(--shadow); transition: transform .12s; display: flex; flex-direction: column; }
.card:hover { transform: translateY(-2px); }
.card-img { position: relative; aspect-ratio: 4 / 3; background: var(--line); }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 12px 14px 14px; }
.card-price { font-weight: 800; font-size: 1.15rem; }
.card-price small { font-weight: 600; color: var(--muted); font-size: .75rem; }
.card-title { font-weight: 600; line-height: 1.3; margin: 2px 0 4px; }
.card-meta { color: var(--muted); font-size: .85rem; }
.noimg { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); font-size: .9rem; aspect-ratio: 4/3; background: var(--line); border-radius: inherit; }
.noimg.sm { width: 56px; height: 42px; aspect-ratio: auto; border-radius: 6px; }
.tag { position: absolute; left: 10px; top: 10px; background: rgba(0,0,0,.72); color: #fff; font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 99px; }
.tag-new { background: var(--ok); color: #fff; }
.tag-refurbished { background: var(--info); color: #fff; }
.tag.static { position: static; display: inline-block; }
.sold-ribbon { position: absolute; right: 10px; top: 10px; background: var(--bad); color: #fff; font-weight: 800; font-size: .8rem; padding: 3px 10px; border-radius: 4px; letter-spacing: .05em; }
.sold-ribbon.big { font-size: 1.1rem; padding: 6px 14px; }
.empty { text-align: center; padding: 48px 16px; background: var(--surface); border-radius: var(--radius); border: 1px dashed var(--line); }
.section-h { margin-top: 40px; }

/* Public: detail */
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); }
.adminbar { background: var(--accent-soft); border-radius: 8px; padding: 8px 14px; margin-bottom: 14px; display: flex; gap: 16px; font-size: .9rem; }
.detail { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 32px; }
.gallery-main { position: relative; background: var(--surface); border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.thumbs button { flex: 0 0 76px; height: 58px; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; cursor: pointer; background: none; }
.thumbs button.on { border-color: var(--accent); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.info .price { font-size: 2rem; font-weight: 800; margin-bottom: 16px; }
.info .price small { font-size: 1rem; color: var(--muted); font-weight: 600; }
.specs { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px; margin: 0 0 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; font-weight: 600; }
.cta { display: flex; gap: 10px; flex-wrap: wrap; }
.desc, .contact { grid-column: 1 / 2; }
.prose { white-space: pre-wrap; }
.contact .form { background: var(--surface); padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); }

/* Admin */
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.pagehead h1 { margin-bottom: 0; }
.pagehead p { margin: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.tabs > a { padding: 8px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs > a.on { color: var(--ink); border-color: var(--accent); font-weight: 600; }
.tab-search { margin-left: auto; padding-bottom: 6px; }
.tab-search input { margin: 0; padding: 6px 10px; width: 220px; }
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.thumbcell img { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; }
.actions { white-space: nowrap; font-size: .9rem; }
.actions > * { margin-right: 10px; }
.status { font-size: .8rem; font-weight: 700; text-transform: capitalize; padding: 2px 9px; border-radius: 99px; background: var(--line); }
.status-active { background: var(--ok-soft); color: var(--ok); }
.status-sold { background: var(--bad-soft); color: var(--bad); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--line); color: var(--muted); white-space: nowrap; text-align: center; }
.chip-posted, .chip-via_feed { background: var(--ok-soft); color: var(--ok); }
.chip-needs_update { background: var(--warn-soft); color: var(--warn); }
.chip-needs_removal, .chip-error { background: var(--bad-soft); color: var(--bad); }
.chip-removed { background: var(--line); color: var(--muted); text-decoration: line-through; }
.legend { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }

.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.editor-side { position: sticky; top: 76px; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.photo-item { position: relative; }
.photo-item img, .photo-grid > img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.photo-item .cover { position: absolute; top: 4px; left: 4px; background: var(--accent); color: #fff; font-size: .7rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; display: none; }
.photo-item:first-child .cover { display: block; }
.sortable .photo-item { cursor: grab; }
.sortable .photo-item.dragging { opacity: .4; }
.photo-item.is-new img { outline: 2px dashed var(--accent); outline-offset: -2px; }
.photo-actions { display: flex; justify-content: space-between; gap: 2px; margin-top: 3px; }
.photo-actions button { flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 5px; color: var(--ink); font-size: .75rem; padding: 3px 0; cursor: pointer; }
.photo-actions button:hover { border-color: var(--accent); }
.photo-actions button.danger { color: var(--bad); }
.photo-item:first-child [data-move="-1"], .photo-item:last-child [data-move="1"] { visibility: hidden; }
.sortable:empty { display: none; }
.drop { position: relative; border: 2px dashed var(--line); border-radius: 8px; padding: 22px 10px; text-align: center; color: var(--muted); cursor: pointer; margin: 0 !important; }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--ink); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.danger-zone { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }

.platforms { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.platform { background: var(--surface); border-radius: var(--radius); padding: 16px; border-top: 4px solid var(--brand); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.platform p { margin: 0; }
.platform-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.platform-head h3 { margin: 0; }
.kind { font-size: .8rem; font-weight: 600; color: var(--muted); }
.kind-api, .kind-feed { color: var(--ok); }
.platform .row { margin-top: auto; padding-top: 8px; }
.copyrow { display: flex; gap: 6px; align-items: stretch; }
.copyrow input, .copyrow textarea { margin: 0; font-size: .9rem; }
.copyrow.tall { align-items: flex-start; }

.assist { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps > li { counter-increment: step; position: relative; padding: 0 0 26px 46px; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }
.steps > li > div, .steps > li > form, .steps > li > .btn { margin-top: 10px; }
.photo-strip { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.photo-strip a { position: relative; width: 96px; }
.photo-strip a.dim { opacity: .35; }
.photo-strip img { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; }
.photo-strip span { position: absolute; bottom: 3px; right: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: .7rem; padding: 0 5px; border-radius: 3px; }
.field-copy { margin-top: 12px; }
.field-copy > label { font-weight: 600; font-size: .9rem; }
.field-copy > p { margin: 3px 0 0; }
.tips ul { padding-left: 18px; margin: 0; font-size: .9rem; }
.tips li { margin-bottom: 8px; }

.queue { margin-bottom: 28px; }
.queue h2 { margin-bottom: 0; }
.queue-list { list-style: none; padding: 0; margin: 10px 0 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.queue-list li { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.queue-list li:last-child { border-bottom: 0; }

.inquiries { display: grid; gap: 12px; max-width: 760px; }
.inquiry { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; border-left: 4px solid transparent; box-shadow: var(--shadow); }
.inquiry.unread { border-left-color: var(--accent); }
.inquiry-head { display: flex; justify-content: space-between; }
.inquiry p { margin: 4px 0; }
.narrow { max-width: 380px; margin: 40px auto; }

@media (max-width: 900px) {
  .topbar { position: static; }
  .browse, .detail, .editor, .assist { grid-template-columns: 1fr; }
  .filters, .editor-side { position: static; }
  .desc, .contact { grid-column: auto; }
  .tab-search { margin-left: 0; width: 100%; }
  .tab-search input { width: 100%; }
}
@media (max-width: 560px) {
  .pair, .triple { grid-template-columns: 1fr; gap: 0; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card-body { padding: 8px 10px 10px; }
  .card-price { font-size: 1rem; }
  .card-title { font-size: .9rem; }
  .searchbar .btn { padding: 9px 12px; }
  .topnav { font-size: .9rem; }
}
kbd { font: inherit; font-size: .8em; font-weight: 600; padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); }
.helper-box { border-left: 4px solid var(--brand, var(--accent)); margin-bottom: 22px; }
.helper-box h3 { margin-bottom: 2px; }
.helper-box p { margin: 4px 0 10px; }
.helper-on { display: none; }
html[data-bizquip-helper] .helper-on { display: block; }
html[data-bizquip-helper] .helper-off { display: none; }
.helper-on-inline { display: none; }
html[data-bizquip-helper] .helper-on-inline { display: inline; }
.narrow-form { max-width: 760px; }

/* Inbox */
.pf { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; color: #fff; background: #6b6f76; white-space: nowrap; }
.pf.big { font-size: .85rem; padding: 4px 12px; }
.pf-website { background: var(--accent); }
.pf-craigslist { background: #5a1f8f; }
.pf-ebay { background: #0064d2; }
.pf-facebook { background: #1877f2; }
.pf-offerup { background: #00a87e; }
.pf-nextdoor { background: #6aa300; }
.pf-email { background: #495057; }
.pf-phone { background: #2b8a3e; }
.lead-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.lead-stat { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; text-decoration: none; }
.lead-stat.on { border-color: var(--accent); }
.lead-stat strong { font-size: 1.15rem; }
.convo-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.convo-list li { border-bottom: 1px solid var(--line); }
.convo-list li:last-child { border-bottom: 0; }
.convo-list a { display: flex; gap: 12px; align-items: center; padding: 12px 14px; text-decoration: none; }
.convo-list li.unread { box-shadow: inset 4px 0 var(--accent); }
.convo-list li.unread strong { font-weight: 800; }
.convo-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.convo-top, .convo-snippet { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.status-replied { background: var(--info-soft); color: var(--info); }
.convo { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.msg-out { align-self: flex-end; background: var(--accent-soft); border-color: transparent; }
.msg-head { margin-bottom: 4px; }
.reply-box { background: var(--surface); padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); }
.reply-elsewhere p { margin: 0 0 10px; }
.delete-convo { margin-top: 12px; }
@media (max-width: 900px) { .convo { grid-template-columns: 1fr; } .msg { max-width: 100%; } }
@media (max-width: 560px) { .convo-list a { flex-wrap: wrap; } .convo-meta { flex-direction: row; } }
.btn[disabled] { opacity: .45; cursor: not-allowed; filter: none; }
