:root {
  --bg: #0c0f0d;
  --bg-2: #11150f;
  --surface: rgba(255,255,255,0.04);
  --surface-2: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.10);
  --border-2: rgba(255,255,255,0.18);
  --accent: #17d96f;
  --accent-dark: #0eaa54;
  --text: #f3f6f2;
  --muted: #9aa39b;
  --dim: #6b756c;
  --yellow: #ffe66a;
  --blue: #2878ff;
  --radius: 16px;
  --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background:
    radial-gradient(60% 50% at 80% -5%, rgba(23,217,111,0.14), transparent 60%),
    radial-gradient(50% 40% at 0% 100%, rgba(40,120,255,0.10), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.container { width: min(100%, 1080px); margin: 0 auto; padding: 0 1.25rem; }

/* Header */
.shop-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(12,15,13,0.6);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.shop-header .inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: .6rem; font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; }
.brand .dot { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--accent-dark)); display: grid; place-items: center; color: #06140c; font-weight: 800; }
.brand small { color: var(--muted); font-weight: 500; font-family: var(--font-body); font-size: .8rem; }
.header-link { color: var(--muted); font-size: .9rem; transition: color .2s; }
.header-link:hover { color: var(--text); }

/* Hero */
.hero { padding: 3.5rem 0 1.5rem; text-align: center; }
.hero .eyebrow { color: var(--accent); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .8rem; }
.hero h1 { font-family: var(--font-display); font-size: clamp(1.9rem, 5vw, 3rem); line-height: 1.08; margin: .6rem 0; letter-spacing: -.02em; }
.hero p { color: var(--muted); max-width: 620px; margin: 0 auto; font-size: 1.05rem; }

/* Product grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.1rem; padding: 1.5rem 0 4rem; }
.card {
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex; flex-direction: column; gap: .85rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.05);
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-4px); border-color: var(--border-2); box-shadow: 0 18px 44px rgba(0,0,0,.35), 0 0 30px rgba(23,217,111,.06); }
.card .icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.4rem; background: rgba(23,217,111,.12); border: 1px solid rgba(23,217,111,.25); color: var(--accent); }
.card .ptype, .ptype { align-self: flex-start; font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: .15rem .6rem; }
.card h2 { font-family: var(--font-display); font-size: 1.3rem; }
.card .tagline { color: var(--muted); font-size: .92rem; }
.card .desc { color: var(--dim); font-size: .88rem; flex: 1; }
.card .price-row { display: flex; align-items: baseline; gap: .4rem; margin-top: .3rem; }
.card .price { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; }
.card .per { color: var(--muted); font-size: .85rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; font-weight: 600; font-size: .95rem; padding: .7rem 1.2rem; border-radius: 10px; border: 1px solid transparent; cursor: pointer; transition: .18s; font-family: var(--font-body); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #06140c; }
.btn-primary:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--border-2); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); display: none; place-items: center; z-index: 100; padding: 1rem; }
.modal-back.open { display: grid; }
.modal { width: min(100%, 440px); background: var(--bg-2); border: 1px solid var(--border-2); border-radius: var(--radius); padding: 1.6rem; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.modal h3 { font-family: var(--font-display); font-size: 1.3rem; margin-bottom: .3rem; }
.modal .sub { color: var(--muted); font-size: .9rem; margin-bottom: 1.1rem; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
input, textarea, select {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: .7rem .9rem; color: var(--text); font: inherit; outline: none; transition: border-color .18s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
.field { margin-bottom: 1rem; }
.err { color: #ff6b6b; font-size: .85rem; margin-top: .5rem; min-height: 1em; }

/* Order / chat page */
.order-wrap { padding: 2rem 0 4rem; display: grid; gap: 1.25rem; grid-template-columns: 320px 1fr; align-items: start; }
.panel { background: linear-gradient(160deg, var(--surface-2), var(--surface)); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem; }
.panel h3 { font-family: var(--font-display); margin-bottom: .8rem; font-size: 1.1rem; }
.kv { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.badge.awaiting_payment { background: rgba(255,230,106,.14); color: var(--yellow); border: 1px solid rgba(255,230,106,.3); }
.badge.paid { background: rgba(40,120,255,.14); color: #7fb0ff; border: 1px solid rgba(40,120,255,.3); }
.badge.delivered { background: rgba(23,217,111,.14); color: var(--accent); border: 1px solid rgba(23,217,111,.3); }
.badge.cancelled { background: rgba(255,107,107,.14); color: #ff8b8b; border: 1px solid rgba(255,107,107,.3); }
.pay-info { background: rgba(255,230,106,.07); border: 1px solid rgba(255,230,106,.22); border-radius: 12px; padding: 1rem; font-size: .9rem; white-space: pre-wrap; color: #f0e9c8; margin-top: 1rem; }

/* Chat */
.chat { display: flex; flex-direction: column; min-height: 460px; }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: .6rem; padding: .25rem; max-height: 56vh; overflow-y: auto; }
.msg { max-width: 78%; padding: .6rem .85rem; border-radius: 14px; font-size: .92rem; word-wrap: break-word; }
.msg .who { font-size: .72rem; color: var(--dim); margin-bottom: .15rem; }
.msg.buyer { align-self: flex-end; background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #06140c; border-bottom-right-radius: 4px; }
.msg.buyer .who { color: rgba(6,20,12,.6); }
.msg.seller { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-empty { color: var(--dim); text-align: center; padding: 2rem 1rem; font-size: .9rem; }
.chat-input { display: flex; gap: .5rem; margin-top: .9rem; }
.chat-input input { flex: 1; }
.muted-note { color: var(--dim); font-size: .82rem; margin-top: .6rem; }

/* Admin */
.admin-orders { width: 100%; border-collapse: collapse; font-size: .88rem; }
.admin-orders th, .admin-orders td { text-align: left; padding: .65rem .6rem; border-bottom: 1px solid var(--border); }
.admin-orders th { color: var(--muted); font-weight: 600; }
.admin-orders tr { cursor: pointer; }
.admin-orders tr:hover td { background: var(--surface); }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0; }
.claim-flag { color: var(--accent); font-weight: 600; }

/* Tabs */
.tabs { display: flex; gap: .4rem; border-bottom: 1px solid var(--border); margin-bottom: .5rem; }
.tab { background: none; border: none; color: var(--muted); font: inherit; font-weight: 600; padding: .7rem 1rem; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: .18s; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Admin product card */
.pcard { position: relative; }
.pcard.inactive { opacity: .55; }
.pcard .pcard-meta { display: flex; justify-content: space-between; align-items: center; font-size: .82rem; color: var(--dim); }
.pcard .owner-tag { color: var(--muted); font-size: .78rem; }
.tag-off { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .72rem; background: rgba(255,107,107,.14); color: #ff8b8b; border: 1px solid rgba(255,107,107,.3); }

/* Stats */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .9rem; }
.stat-card { background: linear-gradient(160deg, var(--surface-2), var(--surface)); border: 1px solid var(--border); border-radius: 14px; padding: 1.1rem 1.2rem; }
.stat-card .label { color: var(--muted); font-size: .82rem; }
.stat-card .value { font-family: var(--font-display); font-size: 1.7rem; font-weight: 700; margin-top: .3rem; }
.stat-card.accent .value { color: var(--accent); }
.stat-card.dim .value { color: var(--muted); font-size: 1.3rem; }

.footer { border-top: 1px solid var(--border); padding: 1.5rem 0; color: var(--dim); font-size: .85rem; text-align: center; }

@media (max-width: 760px) { .order-wrap { grid-template-columns: 1fr; } }
