@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,800&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #f7f2e9;
  --panel: #fffdf8;
  --ink: #1d1b16;
  --muted: #6b6456;
  --line: #e6dccb;
  --green: #0f4c3a;
  --green-2: #16684f;
  --gold: #e8a317;
  --coral: #d9583b;
  --pp: #0070ba;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(29, 27, 22, .06), 0 8px 24px rgba(29, 27, 22, .06);
}
:root:not([data-theme="light"]) { color-scheme: light; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: 'Bricolage Grotesque', Inter, sans-serif; line-height: 1.1; margin: 0 0 .4em; }
h1 { font-size: clamp(30px, 5vw, 46px); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 24px; font-weight: 800; }
h3 { font-size: 18px; font-weight: 600; }
a { color: var(--green-2); }
img { max-width: 100%; display: block; }

/* top bar with a small wax-print dot motif */
.top {
  background: var(--green);
  color: #fff;
  position: sticky; top: 0; z-index: 10;
  background-image: radial-gradient(circle at 6px 6px, rgba(232,163,23,.35) 2.5px, transparent 3px);
  background-size: 22px 22px;
}
.top-inner { max-width: 1120px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 20px; color: #fff; text-decoration: none; display: flex; gap: 8px; align-items: center; }
.brand .dot { width: 22px; height: 22px; border-radius: 50%; background: var(--gold); box-shadow: inset -5px -5px 0 var(--coral); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.nav a { color: #f3ece0; text-decoration: none; font-weight: 500; font-size: 14px; padding: 6px 10px; border-radius: 999px; }
.nav a.on, .nav a:hover { background: rgba(255,255,255,.14); color: #fff; }

.mockbar { background: #fff3cd; color: #6b4e00; font-size: 13px; text-align: center; padding: 6px 12px; border-bottom: 1px solid #f0dc9a; }

main { max-width: 1120px; margin: 0 auto; padding: 28px 16px 80px; }
.lead { color: var(--muted); font-size: 18px; max-width: 620px; margin: 0 0 24px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 600; color: var(--coral); margin-bottom: 8px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; } }

label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
input[type=text], input[type=number], textarea, select {
  width: 100%; font: inherit; color: inherit; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--green-2); outline-offset: 1px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 15px Inter, sans-serif; border: 0; border-radius: 999px; padding: 12px 20px;
  cursor: pointer; text-decoration: none; transition: transform .05s ease, filter .15s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { filter: brightness(1.12); }
.btn-gold { background: var(--gold); color: #2a1d00; }
.btn-ghost { background: transparent; color: var(--green); border: 1.5px solid var(--green); }
.btn-pp { background: #ffc439; color: #111; }
.btn-wa { background: #1f9d55; color: #fff; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* photo drop zone */
.drop {
  border: 2px dashed #cdbfa6; border-radius: var(--radius); background: #fffaf0;
  min-height: 280px; display: grid; place-items: center; text-align: center; padding: 20px; cursor: pointer; position: relative; overflow: hidden;
}
.drop:hover { border-color: var(--green-2); }
.drop img { max-height: 340px; border-radius: 10px; }
.drop .big { font-size: 42px; }

.steps { display: flex; gap: 8px; margin: 0 0 18px; flex-wrap: wrap; }
.step { font-size: 13px; padding: 6px 12px; border-radius: 999px; background: #efe6d6; color: var(--muted); }
.step.on { background: var(--green); color: #fff; }
.step.done { background: #d8eadf; color: var(--green); }

.ai-note { background: #eef6f1; border: 1px solid #cfe5d8; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-top: 12px; }
.ai-note b { color: var(--green); }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: #efe6d6; color: #5b4a2b; }
.pill.ok { background: #d8eadf; color: var(--green); }
.pill.warn { background: #fde8cf; color: #8a4b00; }
.pill.agent { background: #e5e7ff; color: #3b3fb0; }

.spinner { width: 18px; height: 18px; border: 3px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.dark { border-color: rgba(15,76,58,.2); border-top-color: var(--green); }
@keyframes spin { to { transform: rotate(360deg); } }

/* product grid */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.pcard img { aspect-ratio: 1; object-fit: cover; width: 100%; background: #efe6d6; }
.pcard .body { padding: 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pcard .price { font-weight: 700; font-size: 18px; margin-top: auto; }
.seller { color: var(--muted); font-size: 13px; }

.success { text-align: center; }
.success img.qr { width: 200px; margin: 12px auto; border-radius: 8px; border: 1px solid var(--line); }
.linkbox { display: flex; gap: 8px; margin-top: 8px; }
.linkbox input { font-size: 14px; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 820px) { .kpis { grid-template-columns: 1fr 1fr; } }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.kpi .v { font-family: 'Bricolage Grotesque', sans-serif; font-size: 30px; font-weight: 800; }
.kpi .l { color: var(--muted); font-size: 13px; }

/* agent chat */
.chat { display: flex; flex-direction: column; height: min(70vh, 640px); }
.msgs { flex: 1; overflow-y: auto; padding: 4px 2px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.composer { display: flex; gap: 8px; margin-top: 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.chip { font-size: 13px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.trail { display: flex; flex-direction: column; gap: 10px; max-height: min(70vh, 640px); overflow-y: auto; }
.tstep { border-left: 3px solid var(--gold); padding: 6px 0 6px 12px; font-size: 14px; }
.tstep code { background: #f3ecdf; padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.checkout-card { border: 2px solid var(--pp); border-radius: 14px; padding: 14px; background: #f3f9ff; }

.feed { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.feed li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; justify-content: space-between; }

.err { background: #fde3dc; color: #8a2412; border-radius: 10px; padding: 10px 12px; margin-top: 12px; font-size: 14px; }
.hidden { display: none !important; }
footer { color: var(--muted); font-size: 13px; text-align: center; padding: 20px; }

/* ---------- trust badge ---------- */
.trust { display: flex; gap: 10px; align-items: flex-start; background: #eef6f1; border: 1px solid #cfe5d8; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-top: 14px; }
.trust .ic { font-size: 20px; line-height: 1; }
.trust b { color: var(--green); }

/* ---------- order timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 8px 0 0; position: relative; }
.timeline li { position: relative; padding: 0 0 18px 34px; }
.timeline li::before { content: ''; position: absolute; left: 10px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .dot { position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; background: #efe6d6; border: 2px solid var(--line); display: grid; place-items: center; font-size: 12px; color: #fff; }
.timeline li.done .dot { background: var(--green); border-color: var(--green); }
.timeline li.now .dot { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 0 5px rgba(232,163,23,.2); }
.timeline li.bad .dot { background: var(--coral); border-color: var(--coral); }
.timeline .t { font-weight: 600; }
.timeline .d { color: var(--muted); font-size: 13px; }

/* ---------- evidence compare ---------- */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0; }
.compare figure { margin: 0; }
.compare img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: #efe6d6; }
.compare figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; text-align: center; }
.verdict { border-radius: 14px; padding: 14px; margin-top: 8px; }
.verdict.release { background: #e3f3ea; border: 1px solid #b7dcc6; }
.verdict.hold { background: #fff4dc; border: 1px solid #f0d79a; }
.verdict.reject { background: #fde3dc; border: 1px solid #f1b8a8; }
.verdict h3 { margin: 0 0 4px; }
.verdict ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-top: 10px; }
.fact { background: rgba(255,255,255,.7); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.fact .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.fact .v { font-weight: 600; word-break: break-word; }

/* ---------- haggle ---------- */
.haggle { border: 2px solid var(--gold); border-radius: 14px; padding: 12px; background: #fffaf0; display: flex; flex-direction: column; gap: 8px; }
.haggle .hhead { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }
.hb { max-width: 88%; padding: 8px 12px; border-radius: 14px; font-size: 14px; animation: pop .25s ease; }
.hb .who { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; opacity: .75; }
.hb .amt { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; font-size: 18px; }
.hb.buyer { align-self: flex-end; background: #e5e7ff; color: #23266e; border-bottom-right-radius: 4px; }
.hb.seller { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.hb.accept { outline: 2px solid var(--green-2); }
.deal { text-align: center; font-weight: 700; color: var(--green); padding: 6px; border-top: 1px dashed var(--line); }
.deal s { color: var(--muted); font-weight: 400; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- dialog ---------- */
dialog.sheet { border: 0; border-radius: 18px; padding: 0; width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.25); background: var(--panel); color: var(--ink); }
dialog.sheet::backdrop { background: rgba(20, 18, 12, .45); }
dialog.sheet .inner { padding: 20px; overflow-y: auto; max-height: calc(100vh - 32px); }
dialog.sheet .x { float: right; background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.pill.held { background: #fff1c9; color: #7a5600; }
.pill.bad { background: #fde3dc; color: #8a2412; }
.kpi.accent { background: #fff7e3; border-color: #f2dca3; }
@media (max-width: 560px) { .compare { grid-template-columns: 1fr 1fr; gap: 8px; } .hb { max-width: 95%; } }
.pcard .pill { align-self: flex-start; }
.ag-cell .pill { line-height: 1.5; vertical-align: middle; }
.ag-cell { display: flex; align-items: center; }
