:root {
  --bg: #f6f7f9; --card: #fff; --ink: #18212b; --muted: #687482; --line: #e3e7ec; --brand: #1f3a5f; --accent: #e8590c;
  --ok: #2b8a3e; --bad: #c92a2a; --radius: 12px;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--ink); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
main.wrap { flex: 1; padding-top: 20px; padding-bottom: 48px; }
h1 { font-size: 26px; line-height: 1.25; margin: 0 0 12px; }
h2 { font-size: 19px; margin: 24px 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* header */
.top { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 10; }
.top-in { display: flex; align-items: center; gap: 14px; height: 60px; }
.logo { color: #fff; text-decoration: none; font-weight: 800; font-size: 20px; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.search { flex: 1; min-width: 0; }
.search input { width: 100%; border: 0; border-radius: 999px; padding: 8px 14px; background: rgba(255,255,255,.95); color: var(--ink); }
.top-nav { display: flex; align-items: center; gap: 6px; }
.icon-link, .lang { color: #fff; text-decoration: none; background: rgba(255,255,255,.12); border: 0; border-radius: 999px; padding: 7px 12px; cursor: pointer; white-space: nowrap; font-size: 14px; position: relative; }
.icon-link:hover, .lang:hover { background: rgba(255,255,255,.22); }
#cart-count { background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 6px; margin-left: 4px; }
.notice { background: #fff4e6; color: #7a3e00; text-align: center; padding: 8px 16px; font-size: 14px; }
@media (max-width: 640px) {
  .top-in { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; }
  .search { order: 3; flex-basis: 100%; }
  .logo { max-width: none; flex: 1; }
}

/* hero + filters */
.hero { background: linear-gradient(120deg, var(--brand), #2f5d8a); color: #fff; border-radius: var(--radius); padding: 28px 24px; margin-bottom: 18px; }
.hero h1 { margin: 0 0 6px; }
.hero p { margin: 0; opacity: .9; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-size: 14px; }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.bar select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: var(--card); }

/* product grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
@media (max-width: 480px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit; display: flex; flex-direction: column; border: 1px solid var(--line); transition: box-shadow .15s, transform .15s; }
.card:hover { box-shadow: 0 6px 20px rgba(20,30,50,.10); transform: translateY(-2px); }
.card .ph { aspect-ratio: 1; background: #eef1f4 center/cover no-repeat; }
.card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card .name { font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.price { font-weight: 800; color: var(--accent); font-size: 17px; }
.price small { font-weight: 500; color: var(--muted); font-size: 12px; }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: #e7f5ff; color: #1864ab; }
.tag.out { background: #fff5f5; color: var(--bad); }
.empty { text-align: center; padding: 60px 16px; color: var(--muted); }

/* product page */
.pd { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
@media (max-width: 820px) { .pd { grid-template-columns: minmax(0, 1fr); gap: 16px; } }
.gallery .main { aspect-ratio: 1; background: #eef1f4 center/contain no-repeat; border-radius: var(--radius); border: 1px solid var(--line); cursor: zoom-in; }
.gallery .strip { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.gallery .strip span { flex: 0 0 64px; height: 64px; border-radius: 8px; background: #eef1f4 center/cover; border: 2px solid transparent; cursor: pointer; }
.gallery .strip span.on { border-color: var(--brand); }
.buy { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; align-self: start; }
.buy .price { font-size: 26px; }
.opt { margin: 16px 0 0; }
.opt > b { display: block; font-size: 14px; margin-bottom: 8px; }
.skus { display: flex; flex-wrap: wrap; gap: 8px; }
.sku { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 10px; cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 14px; }
.sku img { width: 28px; height: 28px; border-radius: 4px; object-fit: cover; }
.sku.on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.sku:disabled { opacity: .45; cursor: not-allowed; text-decoration: line-through; }
.qty { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.qty button { border: 0; background: #f1f3f5; width: 36px; cursor: pointer; font-size: 18px; }
.qty input { width: 64px; border: 0; text-align: center; padding: 8px 0; -moz-appearance: textfield; }
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.info { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.info dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.info dt { color: var(--muted); }
.info dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* buttons + forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 18px; cursor: pointer; text-decoration: none; color: var(--ink); font-weight: 600; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.dark { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.link { border: 0; background: none; color: var(--brand); padding: 4px 6px; font-weight: 500; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.narrow { max-width: 460px; margin: 0 auto; }
.form label { display: block; margin-bottom: 12px; font-size: 14px; }
.form label > span { display: block; margin-bottom: 4px; color: var(--muted); }
.form input, .form textarea, .form select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff; }
.form textarea { min-height: 80px; resize: vertical; }
.error { color: var(--bad); font-size: 14px; min-height: 1.2em; margin: 4px 0 8px; }
.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; background: #e7f5ff; color: #1864ab; font-size: 14px; }
.alert.warn { background: #fff4e6; color: #7a3e00; }
.alert.ok { background: #ebfbee; color: #1b5e20; }

/* cart / orders */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
@media (max-width: 820px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.lines { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.line { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); align-items: center; }
.line:last-child { border-bottom: 0; }
.line .ph { width: 72px; height: 72px; border-radius: 8px; background: #eef1f4 center/cover; }
.line .meta { min-width: 0; }
.line .meta a { color: inherit; text-decoration: none; font-weight: 600; }
.line .end { text-align: right; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
@media (max-width: 480px) { .line { grid-template-columns: 56px minmax(0, 1fr); } .line .ph { width: 56px; height: 56px; } .line .end { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; } }
.sum { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; position: sticky; top: 76px; }
.sum div { display: flex; justify-content: space-between; margin-bottom: 8px; }
.sum .total { font-size: 18px; font-weight: 800; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
.orders { display: flex; flex-direction: column; gap: 10px; }
.order { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: inherit; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.order:hover { border-color: var(--brand); }
.status { display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 999px; background: #f1f3f5; color: var(--ink); font-weight: 600; }
.status.submitted { background: #fff4e6; color: #a34a00; }
.status.ordered, .status.shipped, .status.intl { background: #e7f5ff; color: #1864ab; }
.status.received, .status.done { background: #ebfbee; color: #1b5e20; }
.status.cancelled { background: #fff5f5; color: var(--bad); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: 6px; }
.bank { white-space: pre-wrap; font-family: ui-monospace, Consolas, monospace; background: #f8f9fa; border: 1px dashed var(--line); border-radius: 8px; padding: 12px; overflow-wrap: anywhere; }
.steps { display: flex; gap: 6px; margin: 12px 0 18px; flex-wrap: wrap; }
.steps span { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: #f1f3f5; color: var(--muted); }
.steps span.on { background: var(--brand); color: #fff; }

/* misc */
.foot { background: #fff; border-top: 1px solid var(--line); padding: 20px 0 76px; color: var(--muted); font-size: 14px; }
@media (max-width: 400px) { .icon-link, .lang { padding: 6px 9px; font-size: 13px; } .logo { font-size: 18px; } }
.foot .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wa { position: fixed; right: 16px; bottom: 16px; background: #25d366; color: #fff; text-decoration: none; padding: 10px 16px; border-radius: 999px; font-weight: 700; box-shadow: 0 4px 14px rgba(0,0,0,.18); z-index: 20; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #212529; color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 50; max-width: calc(100% - 32px); }
.zoom { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 60; display: flex; align-items: center; justify-content: center; cursor: zoom-out; padding: 16px; }
.zoom img { max-height: 100%; object-fit: contain; }
.crumb { font-size: 14px; margin-bottom: 12px; }
.crumb a { text-decoration: none; }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }
