:root {
  --bg: #0f1115; --panel: #181b22; --panel2: #20242d; --line: #2b303b;
  --text: #eef0f4; --muted: #9aa3b2; --accent: #f5b301; --accent-ink: #1a1400;
  --good: #2fbf71; --bad: #ef4b4b; --radius: 14px;
  --safe-top: env(safe-area-inset-top); --safe-bottom: env(safe-area-inset-bottom);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* labels/buttons set display, which would otherwise override hidden */
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
a { color: inherit; }
img { display: block; max-width: 100%; }
.muted { color: var(--muted); }

#nav { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: calc(10px + var(--safe-top)) 16px 10px; background: rgba(15,17,21,.92);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.nav-links { display: flex; gap: 16px; align-items: center; font-size: 15px; }
.nav-links a { text-decoration: none; color: var(--muted); }
.nav-links a:hover { color: var(--text); }

main { max-width: 1100px; margin: 0 auto; padding: 16px 16px calc(32px + var(--safe-bottom)); }
h1 { font-size: 24px; margin: 8px 0 16px; }
h2 { font-size: 18px; margin: 24px 0 12px; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tabs button { flex: 0 0 auto; }

.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; } }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  text-decoration: none; display: flex; flex-direction: column; transition: transform .12s; }
.card:active { transform: scale(.98); }
.thumb { position: relative; aspect-ratio: 3 / 4; background: var(--panel2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.badge { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.7); padding: 2px 8px; border-radius: 99px; font-size: 12px; }
.badge.good { background: var(--good); color: #04140b; font-weight: 600; }
.card-body { padding: 10px 12px 12px; display: grid; gap: 4px; }
.card-title { font-size: 14px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.card-time { font-size: 13px; color: var(--muted); }
.urgent { color: var(--bad) !important; font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }

button, .btn { appearance: none; border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  padding: 12px 16px; border-radius: 12px; font: inherit; font-weight: 600; cursor: pointer; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { color: var(--bad); }
button.active { background: var(--text); color: var(--bg); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--muted); font-weight: 400; font-size: 15px; }
button.small { padding: 6px 10px; min-height: 34px; font-size: 14px; }

label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
input, textarea, select { width: 100%; font: inherit; font-size: 16px; /* 16px stops iOS zoom */ color: var(--text);
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.form { display: grid; gap: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.error { color: var(--bad); font-size: 14px; min-height: 1em; }

/* Item page */
.item-layout { display: grid; gap: 20px; }
@media (min-width: 860px) { .item-layout { grid-template-columns: 1.1fr 1fr; align-items: start; } }
.gallery-main { aspect-ratio: 3 / 4; background: var(--panel2); border-radius: var(--radius); overflow: hidden; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; }
.gallery-strip { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; scroll-snap-type: x mandatory; }
.gallery-strip img { width: 64px; height: 84px; object-fit: cover; border-radius: 8px; border: 2px solid transparent; cursor: pointer; flex: 0 0 auto; }
.gallery-strip img.on { border-color: var(--accent); }
.price { font-size: 34px; font-weight: 800; letter-spacing: -.5px; }
.stats { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 14px; margin: 4px 0 12px; }
.status-line { padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 15px; margin-bottom: 12px; }
.status-line.good { background: rgba(47,191,113,.15); color: var(--good); }
.status-line.bad { background: rgba(239,75,75,.15); color: var(--bad); }
.bid-form { display: flex; gap: 8px; }
.bid-form input { flex: 1; }
.quick { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.history { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.history li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.desc { white-space: pre-wrap; color: #d6dae2; }
.flash { animation: flash .8s; }
@keyframes flash { from { color: var(--accent); transform: scale(1.04); } to { color: inherit; transform: none; } }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.95); z-index: 50; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 100%; max-height: 100%; touch-action: pinch-zoom; }

/* Admin uploader */
.capture-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.capture-btns .btn { padding: 18px 12px; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.preview { position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; background: var(--panel2); }
.preview img { width: 100%; height: 100%; object-fit: cover; }
.preview .cover { position: absolute; bottom: 4px; left: 4px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; }
.preview .x, .preview .mv { position: absolute; top: 4px; width: 30px; height: 30px; min-height: 0; padding: 0; border-radius: 99px; background: rgba(0,0,0,.65); border: 0; font-size: 15px; }
.preview .x { right: 4px; } .preview .mv { left: 4px; }
.preview.processing::after { content: 'Processing…'; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.5); font-size: 12px; }
.progress { height: 8px; background: var(--panel2); border-radius: 99px; overflow: hidden; display: none; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.admin-list { display: grid; gap: 10px; }
.admin-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.admin-row img { width: 56px; height: 74px; object-fit: cover; border-radius: 8px; }
.admin-row .t { font-weight: 600; font-size: 14px; }
.admin-row .s { font-size: 13px; color: var(--muted); }
.admin-row .actions { display: grid; gap: 6px; }

.toast { position: fixed; left: 50%; bottom: calc(20px + var(--safe-bottom)); transform: translate(-50%, 20px); opacity: 0;
  background: var(--panel2); border: 1px solid var(--line); padding: 12px 16px; border-radius: 12px; z-index: 100; transition: .25s; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.good { border-color: var(--good); } .toast.bad { border-color: var(--bad); }

.install { display: none; }

/* OCR panel */
.ocr { display: grid; gap: 8px; background: var(--panel2); border-radius: 12px; padding: 12px; }
.ocr-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ocr-status { font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; }
.ocr pre { white-space: pre-wrap; font-size: 12px; color: var(--muted); margin: 6px 0 0; }

.pw-hint { font-size: 13px; color: var(--muted); margin-top: -8px; }
.pw-hint.ok { color: var(--good); } .pw-hint.bad { color: var(--bad); }

/* Policy pages */
.doc h2 { margin-top: 26px; } .doc p, .doc li { color: #d6dae2; line-height: 1.6; } .doc a { color: var(--accent); }
.doc .lead { font-size: 17px; } .doc ul, .doc ol { padding-left: 22px; }
.site-footer { max-width: 1100px; margin: 0 auto; padding: 24px 16px calc(28px + var(--safe-bottom)); display: flex; flex-wrap: wrap; gap: 8px 18px;
  font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }
.site-footer a { color: var(--muted); }
/* Dialogs (in-page, replace browser prompts) */
.dlg { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.dlg .panel { width: min(460px, 100%); display: grid; gap: 12px; max-height: 90vh; overflow: auto; }
.dlg .btns { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text); }
.check input { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--panel2); }
.pill.good { background: rgba(47,191,113,.18); color: var(--good); } .pill.bad { background: rgba(239,75,75,.18); color: var(--bad); }
.pill.warn { background: rgba(245,179,1,.18); color: var(--accent); }
.claim { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; }
.claim .photos { display: flex; gap: 6px; flex-wrap: wrap; } .claim .photos img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }

/* Bell + inbox + push invite */
.bell { position: relative; font-size: 18px; text-decoration: none; line-height: 1; padding: 4px; }
.bell-count { position: absolute; top: -6px; right: -8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.notif { display: grid; grid-template-columns: 10px minmax(0,1fr); gap: 10px; padding: 12px; border-bottom: 1px solid var(--line); text-decoration: none; }
.notif .dot { width: 8px; height: 8px; border-radius: 99px; margin-top: 7px; background: transparent; }
.notif.unread .dot { background: var(--accent); } .notif.unread .nt { font-weight: 700; }
.notif .nb { color: var(--muted); font-size: 14px; } .notif .nd { color: var(--muted); font-size: 12px; margin-top: 2px; }
.push-invite { position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-bottom)); z-index: 70; max-width: 520px; margin: 0 auto;
  background: var(--panel2); border: 1px solid var(--accent); border-radius: 14px; padding: 12px 14px; display: grid; gap: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--text); font-size: 15px; }
.toggle input { width: 22px; height: 22px; }

/* Keep the top bar on one line on small phones */
.brand, .nav-links a, .nav-links button { white-space: nowrap; }
@media (max-width: 420px) { .nav-links { gap: 12px; font-size: 14px; } #nav { padding-left: 12px; padding-right: 12px; } .brand { font-size: 15px; } }
@media (max-width: 360px) { .brand span.brand-text { display: none; } }

/* Back office: section tabs under the nav, to-do cards */
.bo-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding: 8px 12px 0;
  border-bottom: 1px solid var(--line); background: var(--bg); -webkit-overflow-scrolling: touch; }
.bo-tabs::-webkit-scrollbar { display: none; }
.bo-tabs a { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 10px 12px; text-decoration: none;
  color: var(--muted); font-size: 15px; border-bottom: 2px solid transparent; white-space: nowrap; }
.bo-tabs a.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.bo-tabs a[href="/admin/new.html"] { color: var(--accent); }
.bo-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--panel2);
  color: var(--text); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.bo-count.alert { background: var(--bad); color: #fff; }
.todo { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.todo-card { display: grid; gap: 2px; padding: 14px; border-radius: var(--radius); background: var(--panel);
  border: 1px solid var(--line); text-decoration: none; }
.todo-card .todo-n { font-size: 28px; font-weight: 800; line-height: 1; }
.todo-card .todo-l { color: var(--muted); font-size: 14px; }
.todo-card.warn { border-color: var(--accent); } .todo-card.warn .todo-n { color: var(--accent); }
.todo-card.bad { border-color: var(--bad); } .todo-card.bad .todo-n { color: var(--bad); }
.todo-card.zero { opacity: .55; }
