:root {
  --navy: #123f7a; --navy-d: #09264b; --orange: #ff8a00; --orange-d: #ef5a24; --green: #06c755; --ok: #249b57;
  --bg: #f6f7fb; --card: #fff; --text: #1b2b44; --muted: #5d6d86; --line: rgba(18, 63, 122, .12); --r: 12px;
  --shadow: 0 2px 10px rgba(18, 63, 122, .08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Sarabun", system-ui, sans-serif; color: var(--text); background: var(--bg); font-size: 16px; }
a { color: var(--navy); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, b.title { font-family: "Prompt", sans-serif; }
.wrap { width: min(1240px, calc(100% - 24px)); margin: 0 auto; }
.muted { color: var(--muted); }
.pad { padding: 24px 0; }
.lnk { border: 0; background: none; color: var(--navy); text-decoration: underline; }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: #fff; border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy-d); min-width: 0; flex: none; }
.brand img { border-radius: 8px; }
.brand b { display: block; font-family: "Prompt"; font-size: 1.05rem; }
.brand small { display: block; color: var(--muted); font-size: .78rem; }
.search { flex: 1; min-width: 0; }
.search input { width: 100%; border: 2px solid var(--line); border-radius: 999px; padding: 10px 16px; background: #f6f7fb; font-size: 1rem; }
.search input:focus { outline: none; border-color: var(--orange); background: #fff; }
.hd-link { flex: none; color: var(--navy); font-weight: 600; text-decoration: none; font-size: .92rem; }
.cart-btn { position: relative; flex: none; border: 0; background: var(--orange-d); color: #fff; border-radius: 999px; padding: 9px 16px; font-weight: 600; }
.cart-btn #cartCount { position: absolute; top: -6px; right: -6px; background: var(--navy-d); color: #fff; font-size: .72rem; min-width: 22px; height: 22px; border-radius: 11px; display: grid; place-items: center; padding: 0 5px; border: 2px solid #fff; }
@media (max-width: 760px) {
  .top-in { flex-wrap: wrap; }
  .brand small, .hd-link, .cart-lbl { display: none; }
  .search { order: 3; flex-basis: 100%; }
  .brand { flex: 1; }
}

/* categories: chips on phones, sidebar on wide screens */
.cats { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 10px; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 90%, transparent); mask-image: linear-gradient(90deg, #000 90%, transparent); }
.cats::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 999px; padding: 6px 12px; font-size: .9rem; }
.chip small { color: var(--muted); margin-left: 2px; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip.on small { color: #cfe0f7; }
.layout { display: block; }
.side { display: none; }
@media (min-width: 960px) {
  .cats { display: none; }
  .layout { display: grid; grid-template-columns: 230px 1fr; gap: 22px; align-items: start; }
  .side { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 84px; margin-top: 16px; background: #fff; border-radius: var(--r); padding: 12px; box-shadow: var(--shadow); }
  .side .side-h { font-family: "Prompt"; padding: 4px 8px 8px; color: var(--navy-d); }
  .side .chip { border: 0; border-radius: 8px; text-align: left; padding: 9px 10px; display: flex; justify-content: space-between; }
  .side .chip:hover { background: #eef3fb; }
  .side .chip.on { background: var(--navy); }
}

/* builder banner */
.announce { margin: 12px 0 0; padding: 10px 14px; border-radius: var(--r); background: #fff1dc; border: 1px solid #ffd59a; }
.build { display: flex; align-items: center; gap: 12px; margin: 12px 0 0; padding: 9px 14px; border-radius: var(--r); text-decoration: none; color: #fff;
  background: linear-gradient(110deg, var(--navy) 0%, var(--navy-d) 65%, #7a3a1f 120%); box-shadow: var(--shadow); }
.build .bi { font-size: 1.3rem; }
.build b { font-family: "Prompt"; font-size: .98rem; margin-right: 8px; }
.build span span { font-size: .84rem; opacity: .9; }
.build .go { margin-left: auto; flex: none; background: var(--orange); color: #fff; border-radius: 999px; padding: 5px 14px; font-weight: 700; font-size: .9rem; }
@media (max-width: 560px) { .build span span { display: none; } }
@media (max-width: 760px) { .hd-link { display: inline; font-size: .85rem; } }

/* product grid */
.res { margin: 14px 0 0; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; padding: 6px 0 18px; }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr 1fr; gap: 10px; } }
.grid h2.cat { grid-column: 1 / -1; font-size: 1.15rem; color: var(--navy-d); margin-top: 14px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.grid h2.cat small { font-family: "Sarabun"; font-weight: 400; font-size: .88rem; color: var(--muted); }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; border: 1px solid transparent; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--orange); transform: translateY(-2px); }
.thumb { aspect-ratio: 1; background: #fff; display: grid; place-items: center; overflow: hidden; cursor: pointer; border-bottom: 1px solid #f0f2f6; }
.thumb img { width: 88%; height: 88%; object-fit: contain; }
.thumb svg { width: 56%; height: 56%; }
.card .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.card .nm { font-family: "Prompt"; font-weight: 600; font-size: 1rem; line-height: 1.3; color: var(--navy-d); cursor: pointer; }
.card .sub { font-size: .8rem; color: var(--muted); min-height: 1.1em; }
.sizes { display: flex; flex-wrap: wrap; gap: 4px; }
.sz { border: 1px solid var(--line); background: #f6f7fb; border-radius: 6px; padding: 2px 7px; font-size: .8rem; color: var(--navy-d); }
.sz:hover { border-color: var(--orange); background: #fff; }
.price { font-family: "Prompt"; color: var(--orange-d); font-weight: 700; font-size: 1.12rem; margin-top: auto; }
.price small { color: var(--muted); font-weight: 500; font-size: .75rem; }
.price.big { font-size: 1.5rem; margin: 6px 0 4px; }
.add { border: 0; border-radius: 8px; padding: 9px; background: var(--orange); color: #fff; font-weight: 700; text-align: center; text-decoration: none; font-size: .95rem; }
.add.ghost { background: #fff; color: var(--navy); border: 1.5px solid var(--navy); }
.add:hover { filter: brightness(1.05); }
.tag { display: inline-block; font-size: .75rem; border-radius: 6px; padding: 2px 7px; background: #eaf4ff; color: var(--navy); }
.tag.out { background: #fde8e8; color: #b42318; }
.tag.low { background: #fff1dc; color: #a15c00; }

.help { background: #fff; border-radius: var(--r); padding: 16px; margin: 8px 0 18px; box-shadow: var(--shadow); }
.help h2 { font-size: 1.1rem; margin-bottom: 8px; }
.help ol { padding-left: 20px; margin-bottom: 8px; line-height: 1.7; }
.foot { border-top: 1px solid var(--line); padding: 18px 0 90px; font-size: .92rem; line-height: 1.7; background: #fff; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 999px; padding: 10px 18px; background: var(--orange); color: #fff; font-weight: 700; text-decoration: none; }
.btn.navy { background: var(--navy); }
.btn.line { background: var(--green); }
.btn.ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }

/* sticky cart bar */
.cartbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--navy-d); color: #fff; padding: 10px max(12px, calc((100% - 1240px) / 2)) calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(0,0,0,.15); }
.cartbar b { font-family: "Prompt"; font-size: 1.1rem; }

/* sheet / product detail */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-bg { position: absolute; inset: 0; background: rgba(9, 38, 75, .5); }
.sheet-box { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: min(920px, 100%); max-height: 94vh; overflow: auto; background: #fff; border-radius: 16px 16px 0 0; padding: 18px 18px 0; }
@media (min-width: 700px) { .sheet-box { bottom: auto; top: 4vh; border-radius: 16px; max-height: 92vh; } }
.x { position: sticky; top: 0; float: right; border: 0; background: #eef2f8; border-radius: 50%; width: 36px; height: 36px; z-index: 3; font-size: 1rem; }
.pd { display: grid; gap: 18px; }
@media (min-width: 700px) { .pd { grid-template-columns: 1fr 1.1fr; } }
.pd-img { aspect-ratio: 1; background: #fff; border: 1px solid #eef1f6; border-radius: var(--r); display: grid; place-items: center; overflow: hidden; }
.pd-img img { width: 92%; height: 92%; object-fit: contain; }
.pd-img svg { width: 45%; }
.thumbs { display: flex; gap: 6px; overflow-x: auto; margin-top: 8px; }
.thumbs img { width: 56px; height: 56px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.credit { font-size: .72rem; color: var(--muted); margin-top: 6px; }
.sheet h3 { font-size: 1.3rem; line-height: 1.3; margin: 6px 0 2px; color: var(--navy-d); }
.sheet .sub { font-size: .82rem; color: var(--muted); }
.lbl { font-weight: 600; margin-top: 10px; font-size: .92rem; }
.vchips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.vchips .chip { font-weight: 700; display: grid; text-align: center; padding: 6px 12px; border-radius: 10px; }
.vchips .chip small { font-weight: 500; font-size: .72rem; margin: 0; }
.kvs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.kv { display: grid; background: #f6f7fb; border-radius: 8px; padding: 5px 10px; font-weight: 600; font-size: .9rem; }
.kv small { color: var(--muted); font-weight: 400; font-size: .72rem; }
.lead { margin: 10px 0 4px; line-height: 1.55; }
.pts { padding-left: 18px; line-height: 1.65; font-size: .93rem; margin-bottom: 8px; }
.spec-d { margin: 16px 0 0; border-top: 1px solid var(--line); padding-top: 10px; }
.spec-d summary { font-family: "Prompt"; font-weight: 600; cursor: pointer; }
.specs { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: .92rem; }
.specs td { border-bottom: 1px solid var(--line); padding: 6px 4px; vertical-align: top; }
.specs td:first-child { color: var(--muted); width: 40%; }
.buy { position: sticky; bottom: 0; display: flex; gap: 10px; align-items: center; justify-content: flex-end; background: #fff; border-top: 1px solid var(--line); padding: 12px 0 calc(14px + env(safe-area-inset-bottom)); margin-top: 12px; }
.buy .btn { flex: 1; max-width: 320px; padding: 12px 18px; font-size: 1.02rem; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; flex: none; }
.qty button { border: 0; background: #f3f6fb; width: 38px; height: 38px; font-size: 1.1rem; }
.qty input { width: 46px; text-align: center; border: 0; height: 38px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.sp { justify-content: space-between; }
.desc { white-space: pre-line; line-height: 1.6; margin: 8px 0; }

/* cart, checkout, order */
.ci { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ci .t { width: 56px; height: 56px; border-radius: 8px; background: #fff; border: 1px solid #eef1f6; display: grid; place-items: center; overflow: hidden; }
.ci .t img { width: 100%; height: 100%; object-fit: contain; }
.ci .t svg { width: 70%; }
.ci .n { font-size: .9rem; line-height: 1.3; }
.ci .del { border: 0; background: none; color: #b42318; font-size: .85rem; }
.sum { margin: 12px 0; line-height: 1.9; }
.sum .tot { font-family: "Prompt"; font-size: 1.25rem; color: var(--orange-d); }
.f { display: grid; gap: 4px; margin-bottom: 10px; }
.f label { font-size: .88rem; color: var(--muted); }
.f input, .f textarea, .f select { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #fff; width: 100%; }
.hp { position: absolute; left: -5000px; }
.qr { display: grid; place-items: center; padding: 10px; }
.qr img, .qr canvas { width: 220px !important; height: 220px !important; }
.ok-box { text-align: center; padding-bottom: 18px; }
.ok-box .no { font-family: "Prompt"; font-size: 1.3rem; color: var(--navy-d); }
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; background: #eaf4ff; color: var(--navy); font-weight: 600; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--navy-d); color: #fff; padding: 10px 18px; border-radius: 999px; z-index: 60; font-size: .92rem; box-shadow: var(--shadow); }
#sheetBody > h3:first-child, #sheetBody > form, #sheetBody > .ci:last-of-type { margin-bottom: 4px; }
#sheetBody { padding-bottom: 18px; }

.cartbar[hidden] { display: none; }
