:root {
  --blue: #0A84E0; --yellow: #FFC400; --navy: #0B2742;
  --bg: #F3F6FA; --card: #fff; --line: #E1E7EF; --text: #14202E; --muted: #627286;
  --red: #D92D20; --green: #12805C; --radius: 12px;
  --shadow: 0 1px 2px rgba(11,39,66,.06), 0 4px 14px rgba(11,39,66,.06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.3; text-wrap: balance; }
h1 { font-size: 26px; font-weight: 800; } h2 { font-size: 21px; font-weight: 700; } h3 { font-size: 16.5px; font-weight: 700; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); } .center { text-align: center; } .r { text-align: right; }
.hide-sm { display: inline-flex; }
.loading, .empty { text-align: center; color: var(--muted); padding: 56px 16px; }
.empty .btn { margin-top: 14px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 45%, transparent); outline-offset: 2px; }

/* ปุ่ม */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 18px; font-weight: 700; white-space: nowrap; transition: filter .15s, transform .05s; }
.btn:hover { filter: brightness(.96); } .btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-yellow { background: var(--yellow); border-color: var(--yellow); color: var(--navy); }
.btn-block { display: flex; width: 100%; } .btn-lg { padding: 13px 22px; font-size: 16px; }
.link { color: var(--blue); font-weight: 600; cursor: pointer; }

/* ส่วนหัว */
.announce { background: var(--navy); color: #fff; text-align: center; font-size: 13.5px; padding: 7px 16px; }
#header { background: #fff; position: sticky; top: 0; z-index: 30; box-shadow: 0 1px 0 var(--line); }
.hd { display: flex; align-items: center; gap: 16px; padding-top: 12px; padding-bottom: 12px; }
.logo { font-weight: 800; font-size: 30px; letter-spacing: -.5px; line-height: 1; flex: none; }
.logo span:first-child { color: var(--blue); } .logo span:last-child { color: var(--yellow); }
.zone-btn { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px 6px 10px; text-align: left; flex: none; color: var(--blue); }
.zone-btn span { display: flex; flex-direction: column; font-weight: 700; font-size: 13.5px; line-height: 1.2; color: var(--text); }
.zone-btn small, .hd-link small { font-weight: 400; font-size: 11px; color: var(--muted); }
.search { flex: 1; display: flex; min-width: 0; background: var(--bg); border-radius: 999px; border: 1.5px solid transparent; }
.search:focus-within { border-color: var(--blue); background: #fff; }
.search input { flex: 1; min-width: 0; border: 0; background: none; padding: 10px 18px; outline: none; }
.search button { border: 0; background: var(--yellow); color: var(--navy); border-radius: 999px; width: 46px; display: grid; place-items: center; margin: 3px; }
.hd-actions { display: flex; align-items: center; gap: 14px; flex: none; }
.hd-link { display: flex; flex-direction: column; font-weight: 700; font-size: 13.5px; line-height: 1.2; }
.cart-btn { position: relative; color: var(--navy); display: grid; place-items: center; width: 42px; height: 42px; }
.cart-btn b { position: absolute; top: 0; right: -4px; background: var(--red); color: #fff; font-size: 11px; min-width: 19px; height: 19px; border-radius: 99px; display: grid; place-items: center; padding: 0 5px; }
.catbar { background: var(--blue); color: #fff; }
.catbar .wrap { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.catbar a { padding: 9px 14px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.catbar a:hover { background: rgba(255,255,255,.16); }

/* หน้าแรก */
.hero { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; margin-top: 18px; }
.hero-slide { border-radius: 16px; color: #fff; padding: 28px; min-height: 150px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; background-size: cover; background-position: center; }
.hero-slide.big { grid-row: span 2; min-height: 300px; padding: 44px; }
.hero-slide h2 { font-size: 22px; font-weight: 800; max-width: 17em; }
.hero-slide.big h2 { font-size: clamp(26px, 3.4vw, 40px); }
.hero-slide p { margin: 0 0 16px; opacity: .92; max-width: 30em; }
.usp { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.usp div { background: #fff; border-radius: var(--radius); padding: 12px 16px; border-left: 4px solid var(--yellow); display: flex; flex-direction: column; }
.usp span { color: var(--muted); font-size: 13px; }
.cats { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; margin-top: 18px; }
.cats a { background: #fff; border-radius: var(--radius); padding: 14px 8px; text-align: center; font-weight: 600; font-size: 13.5px; box-shadow: var(--shadow); line-height: 1.35; }
.cats a:hover { color: var(--blue); }
.cats i { display: block; font-style: normal; font-size: 30px; margin-bottom: 4px; }
.sec { padding-top: 26px; padding-bottom: 10px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sec-head h1, .sec-head h2 { margin: 0; } .sec-head a { color: var(--blue); font-weight: 600; white-space: nowrap; }
.crumb { color: var(--muted); font-size: 13.5px; margin-bottom: 12px; } .crumb a:hover { color: var(--blue); }

/* การ์ดสินค้า */
.grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.card-img { position: relative; aspect-ratio: 1; display: block; background: #fff; }
.card-img img, .card-img .ph { width: 100%; height: 100%; object-fit: contain; }
.ph { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 10px; background: linear-gradient(150deg, hsl(var(--h) 70% 94%), hsl(var(--h) 60% 86%)); color: hsl(var(--h) 45% 28%); width: 100%; height: 100%; }
.ph b { font-size: 15px; } .ph span { font-size: 12px; opacity: .8; }
.badge { position: absolute; top: 8px; left: 8px; background: var(--red); color: #fff; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.badge.static { position: static; display: inline-block; margin-bottom: 8px; }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.card-name { font-weight: 600; font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.8em; }
.card-name:hover { color: var(--blue); }
.card-pack { color: var(--muted); font-size: 12.5px; }
.card-foot { margin-top: auto; padding-top: 8px; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.price { font-size: 19px; font-weight: 800; color: var(--navy); line-height: 1.2; } .price small { font-size: 12px; font-weight: 500; color: var(--muted); }
.tier { font-size: 12px; color: var(--red); font-weight: 600; }
.add { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--blue); color: #fff; font-size: 24px; line-height: 1; display: grid; place-items: center; }
.add:hover { filter: brightness(.92); }

/* หน้าสินค้า */
.pd { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 26px; }
.pd-main { background: #fff; border-radius: 16px; aspect-ratio: 1; overflow: hidden; box-shadow: var(--shadow); }
.pd-main img, .pd-main .ph { width: 100%; height: 100%; object-fit: contain; } .pd-main .ph b { font-size: 30px; } .pd-main .ph span { font-size: 16px; }
.pd-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pd-thumbs button { width: 66px; height: 66px; border: 2px solid var(--line); border-radius: 10px; background: #fff; padding: 2px; overflow: hidden; }
.pd-thumbs button.on { border-color: var(--blue); } .pd-thumbs img { width: 100%; height: 100%; object-fit: contain; }
.pd-info { background: #fff; border-radius: 16px; padding: 22px; box-shadow: var(--shadow); align-self: start; }
.pd-info h1 { font-size: 23px; }
.pd-price { font-size: 34px; font-weight: 800; color: var(--navy); margin: 8px 0 14px; } .pd-price small { font-size: 15px; font-weight: 500; color: var(--muted); }
.tiers-title { font-weight: 700; margin-bottom: 6px; }
.tiers-row { display: flex; border-radius: 10px; overflow: hidden; border: 1.5px solid var(--line); margin-bottom: 16px; }
.tiers-row div { flex: 1; text-align: center; } .tiers-row span { display: block; background: var(--yellow); font-weight: 700; font-size: 13px; padding: 4px; color: var(--navy); }
.tiers-row .hot span { background: var(--red); color: #fff; } .tiers-row b { display: block; padding: 8px 4px; font-size: 17px; }
.qty-row { display: flex; gap: 12px; margin-bottom: 16px; } .qty-row .btn { flex: 1; }
.qty { display: flex; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; flex: none; background: #fff; }
.qty button { width: 42px; border: 0; background: var(--bg); font-size: 20px; } .qty input { width: 54px; border: 0; text-align: center; font-weight: 700; outline: none; }
.qty.sm button { width: 32px; height: 34px; } .qty.sm input { width: 42px; }
.ship-box { width: 100%; text-align: left; background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 34px 12px 14px; position: relative; display: block; }
.ship-box b, .ship-box span { display: block; } .ship-box span { color: var(--muted); font-size: 13.5px; } .ship-box i { position: absolute; right: 14px; top: 50%; translate: 0 -50%; font-style: normal; font-size: 22px; color: var(--muted); }
.pd-detail { background: #fff; border-radius: 16px; padding: 22px; box-shadow: var(--shadow); margin: 22px 0; }
.pd-desc { margin-bottom: 18px; overflow-wrap: anywhere; }
.specs div, .kv div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-top: 1px solid var(--line); }
dl { margin: 0; } dd { margin: 0; text-align: right; } dt { color: var(--muted); flex: none; }

/* แผง ฟอร์ม ตะกร้า */
.panel { background: #fff; border-radius: 16px; padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.two.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.narrow { max-width: 460px; } .mid { max-width: 780px; }
label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 12px; }
label input:not([type=checkbox]):not([type=radio]), label select { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; font-weight: 400; }
label input:focus, label select:focus { border-color: var(--blue); outline: none; }
input[disabled] { background: var(--bg) !important; color: var(--muted); }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; } .check input { margin-top: 4px; accent-color: var(--blue); width: 16px; height: 16px; flex: none; }
.form-err { color: var(--red); font-weight: 600; min-height: 1.2em; margin: 4px 0 10px; }
form h3 { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); } form h3:first-child { margin-top: 0; padding-top: 0; border: 0; }
.note { background: #EEF6FE; border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin: 10px 0; }
.note-ok { background: #E8F6EF; color: #0B5C41; } .note-bad { background: #FDECEA; color: #A1221A; }
.tabs { display: flex; gap: 8px; margin: 14px 0; flex-wrap: wrap; }
.tabs button { flex: 1; border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 11px; font-weight: 700; white-space: nowrap; }
.tabs button.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.line { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto 90px 28px; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.line:first-child { border: 0; padding-top: 0; }
.line-img { width: 64px; height: 64px; border-radius: 8px; overflow: hidden; } .line-img img, .line-img .ph { width: 100%; height: 100%; object-fit: contain; } .line-img .ph b { font-size: 9px; } .line-img .ph span { display: none; }
.line-main a { font-weight: 600; display: block; } .line-main small { color: var(--muted); } .line-main em { color: var(--red); font-style: normal; font-weight: 700; }
.line-total { text-align: right; } .line-x { border: 0; background: none; font-size: 22px; color: var(--muted); line-height: 1; }
.summary { position: sticky; top: 130px; } .summary dl div { display: flex; justify-content: space-between; padding: 6px 0; }
.summary .grand { border-top: 1.5px solid var(--line); margin-top: 6px; padding-top: 12px; font-weight: 800; font-size: 19px; } .summary .grand dt { color: var(--text); }
.mini { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; padding: 4px 0; }
.pick { display: flex; gap: 10px; border: 1.5px solid var(--line); border-radius: 10px; padding: 12px; font-weight: 400; cursor: pointer; }
.pick:has(input:checked) { border-color: var(--blue); background: #F2F9FF; } .pick input { accent-color: var(--blue); margin-top: 4px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; } .chips label { margin: 0; } .chips input { position: absolute; opacity: 0; }
.chips span { display: block; border: 1.5px solid var(--line); border-radius: 999px; padding: 8px 16px; cursor: pointer; font-weight: 600; }
.chips input:checked + span { background: var(--blue); border-color: var(--blue); color: #fff; } .chips input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--blue) 45%, transparent); }
.pill { display: inline-block; background: #E6F2FD; color: #075A9C; border-radius: 99px; padding: 1px 10px; font-size: 12px; font-weight: 700; vertical-align: middle; }
.pill.warn, .st-pending { background: #FFF4CC; color: #7A5B00; } .st-delivered { background: #E8F6EF; color: #0B5C41; } .st-cancelled { background: #FDECEA; color: #A1221A; }
.addr { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); } .addr small { color: var(--muted); }
details { margin-top: 10px; } details form { margin-top: 12px; } summary { list-style: none; }
.table-wrap { overflow-x: auto; } table { width: 100%; border-collapse: collapse; min-width: 560px; }
th, td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line); white-space: nowrap; } th { color: var(--muted); font-size: 13px; border: 0; } th.r, td.r { text-align: right; }

/* Modal / toast / footer */
.modal { position: fixed; inset: 0; background: rgba(11,39,66,.55); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal[hidden], .toast[hidden] { display: none; }
.modal-card { background: #fff; border-radius: 18px; padding: 30px; width: min(480px, 100%); position: relative; text-align: center; }
.modal-card label { text-align: left; } .modal-x { position: absolute; top: 10px; right: 14px; border: 0; background: none; font-size: 30px; line-height: 1; }
.zone-ico { font-size: 34px; margin-bottom: 8px; }
.toast { position: fixed; bottom: 22px; left: 50%; translate: -50% 0; background: var(--navy); color: #fff; padding: 11px 20px; border-radius: 999px; z-index: 60; max-width: calc(100vw - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.25); }
#footer { background: var(--navy); color: #C9D6E4; margin-top: 40px; }
.ft { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 26px; padding-top: 34px; padding-bottom: 26px; font-size: 14px; }
.ft h4 { color: #fff; font-size: 15px; } .ft a:hover { color: #fff; } .logo-ft { margin-bottom: 8px; }
.ft-bottom { border-top: 1px solid rgba(255,255,255,.12); text-align: center; padding: 14px; font-size: 13px; }

@media (max-width: 1024px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .cats { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 820px) {
  .hd { flex-wrap: wrap; gap: 10px 12px; } .search { order: 5; flex-basis: 100%; } .hd-actions { margin-left: auto; } .hide-sm { display: none; }
  .logo { font-size: 26px; } .zone-btn small { display: none; }
  .hero { grid-template-columns: 1fr; } .hero-slide.big { min-height: 210px; padding: 26px; }
  .usp { grid-template-columns: repeat(2, 1fr); } .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pd, .two, .two.even { grid-template-columns: 1fr; } .summary { position: static; } .ft { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .cats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .f2 { grid-template-columns: 1fr; gap: 0; } h1 { font-size: 22px; } .panel, .pd-info, .pd-detail { padding: 16px; }
  .line { grid-template-columns: 52px minmax(0, 1fr) 28px; } .line-img { width: 52px; height: 52px; } .line .qty { grid-column: 2; justify-self: start; } .line-total { grid-column: 2; grid-row: 2; justify-self: end; align-self: center; } .line-x { grid-column: 3; grid-row: 1; }
  .qty-row { flex-wrap: wrap; } .tabs button { flex-basis: 100%; }
}
