:root {
  --text: #111827; --muted: #6b7280; --line: #e5e7eb; --bg: #f7f7f8; --accent: #111827; --brand: #4f46e5;
  --green: #059669; --amber: #b45309; --red: #dc2626;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif; color: var(--text); font-size: 15px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.2; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .grow { flex: 1; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.empty { text-align: center; padding: 60px 16px; color: var(--muted); }
.empty a { color: var(--brand); }

input, select, textarea { font: inherit; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 10px; background: #fff; width: 100%; color: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c7d2fe; border-color: var(--brand); }
.btn { display: inline-block; text-align: center; background: var(--accent); color: #fff; border: none; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: #374151; }
.btn:disabled { background: #d1d5db; color: #6b7280; cursor: not-allowed; }
.btn.big { padding: 14px 22px; font-size: 16px; }
.btn.full { width: 100%; }
.link { background: none; border: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; padding: 0; text-decoration: underline; }

/* header */
.top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.bar { display: flex; align-items: center; gap: 20px; height: 64px; }
.logo { font-weight: 800; font-size: 20px; white-space: nowrap; }
.cats { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.cats a { padding: 8px 14px; border-radius: 999px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.cats a:hover { color: var(--text); background: #f3f4f6; }
.cats a.on { background: var(--accent); color: #fff; }
.cart-btn { position: relative; background: #f3f4f6; border: none; border-radius: 999px; width: 46px; height: 46px; font-size: 20px; cursor: pointer; flex-shrink: 0; }
.cart-btn .count { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; border-radius: 999px; min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 5px; }

.hero { background: linear-gradient(135deg, #111827, var(--site, #312e81)); color: #fff; border-radius: 18px; padding: 44px 32px; margin: 24px 0; }
.hero h1 { font-size: 34px; }
.hero p { margin: 0; opacity: .85; font-size: 17px; }
.hero.small { background: #fff; color: var(--text); border-left: 6px solid var(--biz); padding: 24px 28px; }
.hero.small p { color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 20px 0; }
.filters select { width: auto; }
.filters input[type=search] { min-width: 220px; }
.seg { display: inline-flex; background: #e5e7eb; border-radius: 10px; padding: 3px; }
.seg button { border: none; background: none; padding: 7px 12px; border-radius: 8px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; text-transform: capitalize; }
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.chk { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; white-space: nowrap; }
.chk input { width: auto; }

/* product grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; margin-bottom: 40px; }
.card { background: #fff; border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 1px 3px rgba(0,0,0,.06); transition: box-shadow .15s, transform .15s; }
.card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.1); transform: translateY(-2px); }
.card .img { position: relative; aspect-ratio: 1; background: #f3f4f6 center/contain no-repeat; display: grid; place-items: center; }
.card.soldout .img { filter: grayscale(1); opacity: .6; }
.noimg { font-size: 44px; opacity: .4; }
.cond { position: absolute; top: 10px; left: 10px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; text-transform: capitalize; background: #dbeafe; color: #1d4ed8; }
.cond.used { background: #ede9fe; color: #6d28d9; }
.cond.refurbished { background: #d1fae5; color: #047857; }
.cond.inline { position: static; display: inline-block; margin-bottom: 10px; }
.soldout-tag { position: absolute; inset: auto 0 0 0; background: rgba(17,24,39,.85); color: #fff; text-align: center; font-weight: 700; padding: 6px; letter-spacing: 1px; text-transform: uppercase; font-size: 12px; }
.card .body { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.brand { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; min-height: 14px; }
.card .name { font-weight: 700; line-height: 1.3; }
.card .name:hover { text-decoration: underline; }
.attrs { font-size: 13px; color: var(--muted); min-height: 17px; }
.card .row { margin-top: auto; padding-top: 6px; }
.price { font-weight: 800; font-size: 18px; }
.price.big { font-size: 30px; margin: 6px 0; }
.stock { font-size: 13px; font-weight: 600; }
.stock.in { color: var(--green); } .stock.low { color: var(--amber); } .stock.out { color: var(--red); }

/* product page */
.back { display: inline-block; margin: 20px 0; color: var(--muted); font-weight: 600; }
.pp { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; background: #fff; border-radius: 18px; padding: 28px; margin-bottom: 40px; }
.pp-img { aspect-ratio: 1; background: #f3f4f6 center/contain no-repeat; border-radius: 14px; display: grid; place-items: center; }
.pp-info h1 { font-size: 28px; margin-top: 6px; }
.buy { display: flex; gap: 12px; margin: 20px 0; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.qty button { border: none; background: #f9fafb; width: 40px; height: 46px; font-size: 18px; cursor: pointer; }
.qty span { width: 40px; text-align: center; font-weight: 700; }
.qty.sm button { width: 30px; height: 30px; font-size: 15px; }
.qty.sm span { width: 30px; }
.specs { width: 100%; border-collapse: collapse; margin: 16px 0; }
.specs th, .specs td { text-align: left; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.specs th { color: var(--muted); font-weight: 500; width: 40%; }
.desc { white-space: pre-wrap; line-height: 1.6; color: #374151; }

/* drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50; display: flex; justify-content: flex-end; }
.drawer { width: 100%; max-width: 420px; background: #fff; height: 100%; display: flex; flex-direction: column; animation: slide .2s ease; }
@keyframes slide { from { transform: translateX(100%); } }
.drawer header { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer header h2 { margin: 0; font-size: 20px; }
.x { background: none; border: none; font-size: 20px; cursor: pointer; }
.lines { flex: 1; overflow-y: auto; padding: 8px 20px; }
.line { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.line.bad { background: #fef2f2; }
.line .thumb { width: 64px; height: 64px; border-radius: 10px; background: #f3f4f6 center/cover no-repeat; flex-shrink: 0; }
.line .name { font-weight: 600; }
.line .lt { text-align: right; font-weight: 700; }
.line .qty { margin-top: 6px; }
.warn { color: var(--red); font-size: 13px; font-weight: 600; }
.drawer footer { padding: 18px 20px; border-top: 1px solid var(--line); }
.total { font-size: 18px; margin-bottom: 12px; }

/* checkout */
.checkout { padding-bottom: 50px; }
.co-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: start; }
.panel { background: #fff; border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.panel h3 { margin: 8px 0 0; }
.panel label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.panel small { font-weight: 400; color: var(--muted); }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt { flex-direction: row !important; align-items: flex-start; border: 2px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; }
.opt.on { border-color: var(--brand); background: #eef2ff; }
.opt input { width: auto; margin-top: 3px; }
.opt div { display: flex; flex-direction: column; gap: 4px; }
.summary { position: sticky; top: 84px; }
.sline { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.sline.bad { color: var(--red); }
.sline.total { border-top: 2px solid var(--text); padding-top: 12px; font-size: 20px; font-weight: 800; }
.error { background: #fee2e2; color: #991b1b; padding: 10px 12px; border-radius: 10px; margin: 0; }
.thanks { max-width: 620px; margin: 30px auto; text-align: left; }
.thanks .tick { width: 60px; height: 60px; border-radius: 50%; background: #d1fae5; color: var(--green); font-size: 32px; display: grid; place-items: center; font-weight: 800; }
.part { border-top: 1px solid var(--line); padding-top: 8px; }

.foot { border-top: 1px solid var(--line); background: #fff; padding: 24px 0; color: #374151; font-size: 14px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 12px 20px; border-radius: 12px; z-index: 60; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.2); }

@media (max-width: 760px) {
  .bar { gap: 10px; height: auto; padding: 10px 16px; flex-wrap: wrap; }
  .cats { order: 3; flex-basis: 100%; }
  .logo { flex: 1; }
  .hero { padding: 28px 20px; } .hero h1 { font-size: 26px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card .body { padding: 10px; }
  .card .row { flex-direction: column; align-items: flex-start; gap: 2px; }
  .pp, .co-grid, .opts { grid-template-columns: 1fr; }
  .pp { padding: 16px; gap: 18px; }
  .summary { position: static; }
}

/* currency */
.alt { font-size: 12px; color: var(--muted); font-weight: 500; }
.alt-line { color: var(--muted); font-size: 14px; }
.cur { display: inline-flex; background: #f3f4f6; border-radius: 999px; padding: 3px; flex-shrink: 0; }
.cur button { border: none; background: none; padding: 6px 10px; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.cur button.on { background: var(--accent); color: #fff; }
.r { text-align: right; }

/* payments */
.pay-opts { display: flex; flex-direction: column; gap: 8px; }
.pay-opts .opt { align-items: center; gap: 12px; }
.pay-icon { font-size: 24px; }
.thanks .warn-tick { background: #fef3c7; color: var(--amber); }
.thanks .bad-tick { background: #fee2e2; color: var(--red); }
.thanks .link { margin-top: 4px; align-self: flex-start; }
