/* หลังบ้านเดโม (admin/index.html) */
:root {
  --night: #0c1311; --night-2: #141e1a; --night-3: #1d2924;
  --bg: #f4f1ea; --paper: #fffdf9; --soft: #f0ebe1; --soft-2: #e6dfd1;
  --ink: #17201c; --ink-2: #48534d; --muted: #858c86;
  --line: rgba(23, 32, 28, .1); --line-2: rgba(23, 32, 28, .2);
  --gold: #c9a66b; --gold-ink: #8a6a35; --gold-grad: linear-gradient(100deg, #9c7a43 0%, #f1dcae 30%, #c9a66b 55%, #f4e3bf 75%, #a8834a 100%);
  --ok: #2f7d4f; --ok-bg: #e3f2e8; --warn: #9a6a12; --warn-bg: #fbf0d9; --bad: #b3261e; --bad-bg: #fbe4e2; --info: #2c5b8a; --info-bg: #e2edf8;
  --f-display: 'Noto Serif Thai', 'Cormorant Garamond', serif;
  --f-latin: 'Cormorant Garamond', 'Noto Serif Thai', serif;
  --f-body: 'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.2, .75, .1, 1);
  --side: 264px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.6 var(--f-body); -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 500; margin: 0; line-height: 1.3; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ico { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ico-fill { fill: currentColor; stroke: none; }

/* ---------- ปุ่ม ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border: 1px solid transparent; border-radius: 12px; background: var(--paper); font-weight: 500; font-size: 14.5px; cursor: pointer; white-space: nowrap; transition: background-color .25s, border-color .25s, color .25s, transform .3s var(--ease), box-shadow .3s; }
.btn:active { transform: scale(.97); }
.btn-gold { background: var(--gold-grad); background-size: 170% 100%; color: #1b1407; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 8px 20px -10px rgba(150, 110, 40, .7); }
.btn-gold:hover { background-position: 100% 0; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #000; }
.btn-line { border-color: var(--line-2); background: transparent; }
.btn-line:hover { border-color: var(--ink); background: var(--paper); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { background: #8f1d17; }
.btn-ghost-danger { background: transparent; color: var(--bad); border-color: rgba(179, 38, 30, .3); }
.btn-ghost-danger:hover { background: var(--bad-bg); }
.btn-sm { height: 36px; padding: 0 13px; font-size: 13.5px; border-radius: 10px; }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); cursor: pointer; color: var(--ink-2); transition: background-color .25s, color .25s, border-color .25s; }
.icon-btn:hover { border-color: var(--ink); color: var(--ink); }
.icon-btn.danger:hover { border-color: var(--bad); color: var(--bad); background: var(--bad-bg); }
.icon-btn:disabled { opacity: .35; pointer-events: none; }
.icon-btn .ico { width: 17px; height: 17px; }

/* ---------- เข้าสู่ระบบ ---------- */
.login { min-height: 100vh; min-height: 100svh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { position: relative; overflow: hidden; background: var(--night); color: #fff; display: flex; align-items: flex-end; padding: 48px; }
.login-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .75; animation: ken 24s ease-in-out infinite alternate; }
@keyframes ken { from { transform: scale(1.05); } to { transform: scale(1.15) translate(-2%, -1%); } }
.login-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(12, 19, 17, .1), rgba(12, 19, 17, .85)); }
.login-art > div { position: relative; z-index: 1; }
.login-art h2 { font-size: clamp(32px, 4vw, 52px); }
.login-art p { color: rgba(255, 255, 255, .75); margin-top: 10px; }
.login-box { display: grid; place-items: center; padding: 40px 24px; }
.login-card { width: min(380px, 100%); }
.login-card .brand { margin-bottom: 36px; }
.login-card h1 { font-size: 30px; }
.login-card .hint { color: var(--muted); font-size: 14px; margin: 6px 0 26px; }
.login-card code { background: var(--soft); padding: 2px 8px; border-radius: 6px; font-size: 13.5px; }
.login-card .btn { width: 100%; height: 50px; margin-top: 8px; }
.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- โครงหน้า ---------- */
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand svg { width: 40px; height: 40px; color: var(--gold); }
.brand b { display: block; font: 600 17px/1.2 var(--f-display); }
.brand small { display: block; font: italic 500 12px/1.2 var(--f-latin); letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 28px; padding: 26px 18px; background: var(--night); color: #e9ece7; }
.side .brand { padding: 0 8px; }
.side-nav { display: grid; gap: 4px; }
.side-nav button { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: 0; border-radius: 12px; background: none; color: rgba(233, 236, 231, .72); cursor: pointer; text-align: left; font-size: 14.5px; transition: background-color .25s, color .25s; }
.side-nav button:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-nav button[aria-current="page"] { background: rgba(201, 166, 107, .16); color: #fff; }
.side-nav button[aria-current="page"]::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--gold); }
.side-nav .count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--gold); color: #1b1407; font-size: 12px; font-weight: 600; display: grid; place-items: center; }
.side-foot { margin-top: auto; display: grid; gap: 6px; }
.side-foot a, .side-foot button { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 0; border-radius: 12px; background: none; color: rgba(233, 236, 231, .62); cursor: pointer; font-size: 14px; text-align: left; transition: background-color .25s, color .25s; }
.side-foot a:hover, .side-foot button:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.main { min-width: 0; padding: 34px clamp(16px, 3.5vw, 48px) 80px; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 26px; }
.top h1 { font-size: clamp(26px, 3vw, 36px); }
.top p { color: var(--muted); font-size: 14.5px; margin-top: 4px; }
.top-acts { display: flex; gap: 10px; flex-wrap: wrap; }
.panel { background: var(--paper); border-radius: 18px; box-shadow: 0 1px 0 var(--line), 0 20px 40px -34px rgba(23, 32, 28, .4); }
.panel + .panel { margin-top: 20px; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.panel-h h2 { font-size: 18px; }
.panel-b { padding: 22px; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--soft); color: var(--ink-2); font-size: 13.5px; }
.note .ico { width: 18px; height: 18px; margin-top: 2px; color: var(--gold-ink); }
.view { animation: viewIn .5s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- การ์ดสรุปตัวเลข ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { padding: 18px 20px; border-radius: 16px; background: var(--paper); box-shadow: 0 1px 0 var(--line); }
.tile span { display: block; font-size: 13px; color: var(--muted); }
.tile b { display: block; font: 500 32px/1.2 var(--f-latin); font-variant-numeric: lining-nums; margin-top: 4px; }
.tile.dark { background: var(--night); color: #fff; }
.tile.dark span { color: rgba(255, 255, 255, .6); }

/* ---------- ป้ายสถานะ ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; background: var(--soft); color: var(--ink-2); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.gold { background: rgba(201, 166, 107, .2); color: var(--gold-ink); }

/* ---------- รายการที่พัก ---------- */
.rows { display: grid; }
.row { display: grid; grid-template-columns: 112px minmax(0, 1.4fr) minmax(0, 1fr) auto auto; gap: 18px; align-items: center; padding: 16px 22px; border-top: 1px solid var(--line); transition: background-color .25s; }
.row:first-child { border-top: 0; }
.row:hover { background: #fffaf2; }
.row-img { width: 112px; height: 78px; border-radius: 12px; object-fit: cover; background: var(--soft); }
.row h3 { font: 500 16px/1.35 var(--f-body); }
.row small { display: block; color: var(--muted); font-size: 13px; }
.row .prices { display: grid; gap: 2px; font-size: 13.5px; }
.row .prices b { font-weight: 500; }
.row .prices s { color: var(--muted); font-size: 12.5px; margin-left: 4px; }
.row .prices .off { color: var(--muted); }
.row-acts { display: flex; gap: 6px; }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.empty { padding: 50px 20px; text-align: center; color: var(--muted); }

/* สวิตช์ */
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 14px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--soft-2); transition: background-color .3s; flex: none; }
.switch i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform .35s var(--ease); }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- ฟอร์ม ---------- */
.fld { display: grid; gap: 6px; min-width: 0; }
.fld > span { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.fld > span em { font-style: normal; font-weight: 400; color: var(--muted); }
.fld input, .fld select, .fld textarea { width: 100%; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: 11px; background: #fff; font-size: 15px; transition: border-color .25s, box-shadow .25s; }
.fld textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.fld input:focus, .fld select:focus, .fld textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(201, 166, 107, .18); }
.fld .help { font-size: 12.5px; color: var(--muted); }
.fld.err input { border-color: var(--bad); }
.fld-err { color: var(--bad); font-size: 12.5px; }
.money-in { position: relative; }
.money-in::before { content: '฿'; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.money-in input { padding-left: 28px; font-variant-numeric: tabular-nums; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.sect { padding: 24px 0; border-top: 1px solid var(--line); }
.sect:first-child { border-top: 0; padding-top: 0; }
.sect > h3 { font: 600 15px/1.4 var(--f-body); margin-bottom: 4px; }
.sect > p.sub { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

/* แท็บภาษา */
.ltabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--soft); margin-bottom: 14px; }
.ltabs button { height: 32px; padding: 0 14px; border: 0; border-radius: 9px; background: none; cursor: pointer; font-size: 13.5px; color: var(--ink-2); }
.ltabs button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); font-weight: 500; }
.ltabs button .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); margin-left: 6px; vertical-align: middle; }
.lpane { display: grid; gap: 14px; }

/* การ์ดตัวเลือก (ประเภท / แบบแบนเนอร์) */
.opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.opt { position: relative; display: grid; gap: 4px; padding: 14px 16px; border: 1.5px solid var(--line-2); border-radius: 14px; cursor: pointer; background: #fff; transition: border-color .25s, background-color .25s, box-shadow .25s; }
.opt input { position: absolute; opacity: 0; }
.opt b { font-weight: 500; display: flex; align-items: center; gap: 8px; }
.opt small { color: var(--muted); font-size: 12.5px; }
.opt:has(input:checked) { border-color: var(--gold); background: #fffaf0; box-shadow: 0 0 0 3px rgba(201, 166, 107, .18); }
.opt:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }

.chipset { display: flex; flex-wrap: wrap; gap: 8px; }
.chk { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 999px; cursor: pointer; font-size: 13.5px; background: #fff; transition: background-color .25s, color .25s, border-color .25s; }
.chk input { position: absolute; opacity: 0; }
.chk .ico { width: 16px; height: 16px; }
.chk:has(input:checked) { background: var(--ink); border-color: var(--ink); color: #fff; }
.chk:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }

/* รูป */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.ph { position: relative; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--soft); }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph-main { position: absolute; left: 8px; top: 8px; padding: 3px 9px; border-radius: 999px; background: var(--gold-grad); color: #1b1407; font-size: 11.5px; font-weight: 600; }
.ph-acts { position: absolute; left: 6px; right: 6px; bottom: 6px; display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .3s var(--ease); }
.ph:hover .ph-acts, .ph:focus-within .ph-acts { opacity: 1; transform: none; }
.ph-acts button { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .92); cursor: pointer; }
.ph-acts button:hover { background: #fff; }
.ph-acts button.del:hover { color: var(--bad); }
.ph-acts .ico { width: 15px; height: 15px; }
.ph-add { display: grid; place-items: center; align-content: center; gap: 6px; aspect-ratio: 4 / 3; border: 1.5px dashed var(--line-2); border-radius: 12px; background: transparent; color: var(--ink-2); cursor: pointer; font-size: 13px; transition: border-color .25s, background-color .25s; }
.ph-add:hover { border-color: var(--gold); background: #fffaf0; }
.ph-add input { display: none; }
@media (hover: none) { .ph-acts { opacity: 1; transform: none; } }

/* ราคา */
.price-box { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.price-box + .price-box { margin-top: 14px; }
.price-box-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; background: var(--soft); }
.price-box-h b { font-weight: 600; }
.price-box-b { padding: 18px; display: grid; gap: 14px; }
.price-box.off .price-box-b { display: none; }
.preview-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 12px 14px; border-radius: 12px; background: #fffaf0; border: 1px dashed rgba(201, 166, 107, .6); font-size: 13.5px; color: var(--ink-2); }
.preview-price b { font: 500 22px var(--f-latin); color: var(--ink); font-variant-numeric: lining-nums; }
.preview-price s { color: var(--muted); }

/* 360 */
.tours { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.tour-opt { position: relative; display: grid; gap: 6px; padding: 6px; border: 1.5px solid var(--line-2); border-radius: 12px; cursor: pointer; background: #fff; font-size: 13px; text-align: center; }
.tour-opt input { position: absolute; opacity: 0; }
.tour-opt img, .tour-opt .none { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 8px; background: var(--soft); display: grid; place-items: center; color: var(--muted); }
.tour-opt:has(input:checked) { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 166, 107, .18); }

/* ---------- แบนเนอร์ ---------- */
.bn-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.bn-card { overflow: hidden; display: flex; flex-direction: column; }
.bn-thumb { position: relative; aspect-ratio: 16 / 7; }
.bn-thumb .bn { position: absolute; inset: 0; }
/* การ์ดย่อ: แสดงแค่ป้ายและหัวข้อ ตัวอักษรเล็กลงให้พอดีกล่อง */
.bn-thumb .bn-sub, .bn-thumb .bn-cta { display: none; }
.bn-thumb .bn-copy { justify-content: center; padding-bottom: 0; gap: 8px; }
.bn-thumb .bn-title { font-size: clamp(16px, 6.4cqi, 26px); }
.bn-card-b { padding: 14px 16px 16px; display: grid; gap: 10px; }
.bn-card-b h3 { font: 500 15px/1.4 var(--f-body); }
.bn-card-b small { color: var(--muted); font-size: 12.5px; }
.bn-card-f { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bn-card.is-off .bn-thumb { filter: grayscale(.8); opacity: .6; }
.bn-preview { position: sticky; top: 0; z-index: 3; aspect-ratio: 16 / 6.4; border-radius: 16px; overflow: hidden; margin-bottom: 20px; box-shadow: 0 20px 40px -24px rgba(0, 0, 0, .5); }
.tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tpl { position: relative; display: grid; gap: 6px; padding: 5px; border: 1.5px solid var(--line-2); border-radius: 12px; cursor: pointer; background: #fff; font-size: 12.5px; text-align: center; transition: border-color .25s, box-shadow .25s; }
.tpl input { position: absolute; opacity: 0; }
.tpl .mini { position: relative; aspect-ratio: 16 / 8; border-radius: 8px; overflow: hidden; }
.tpl .mini .bn { position: absolute; inset: 0; }
.tpl .mini .bn-copy, .tpl .mini .bn-veil { display: none; }
.tpl:has(input:checked) { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 166, 107, .2); }
.tpl:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.upload-zone { display: grid; place-items: center; gap: 8px; padding: 26px; border: 1.5px dashed var(--line-2); border-radius: 14px; text-align: center; color: var(--ink-2); cursor: pointer; transition: border-color .25s, background-color .25s; }
.upload-zone:hover, .upload-zone.is-drag { border-color: var(--gold); background: #fffaf0; }
.upload-zone input { display: none; }
.upload-zone small { color: var(--muted); }

/* ---------- ช่วงเทศกาล ---------- */
.season { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; padding: 16px 0; border-top: 1px solid var(--line); }
.season:first-child { border-top: 0; padding-top: 0; }
.md { display: grid; grid-template-columns: 1.3fr 1fr; gap: 6px; }
.cal { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.cal div { display: grid; gap: 4px; text-align: center; font-size: 12px; color: var(--muted); }
.cal i { height: 34px; border-radius: 8px; background: var(--soft); position: relative; overflow: hidden; }
.cal i b { position: absolute; top: 0; bottom: 0; background: var(--gold-grad); opacity: .85; }
.cal .now { color: var(--ink); font-weight: 600; }

/* ---------- คำขอจอง ---------- */
.bk { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, .8fr) 150px auto; gap: 16px; align-items: center; padding: 16px 22px; border-top: 1px solid var(--line); }
.bk:first-child { border-top: 0; }
.bk h3 { font: 500 15px/1.4 var(--f-body); }
.bk small { display: block; color: var(--muted); font-size: 12.5px; }
.bk .total { font: 500 20px var(--f-latin); font-variant-numeric: lining-nums; }
.bk select { padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; font-size: 13.5px; width: 100%; }
.bk.is-new { background: linear-gradient(90deg, rgba(201, 166, 107, .12), transparent 40%); }

/* ---------- ตั้งค่า ---------- */
.pick-map { height: 320px; border-radius: 14px; overflow: hidden; background: var(--soft); z-index: 0; }
.meter { height: 8px; border-radius: 999px; background: var(--soft); overflow: hidden; margin: 8px 0 6px; }
.meter i { display: block; height: 100%; background: var(--gold-grad); border-radius: 999px; transition: width .6s var(--ease); }
.leaflet-container { font: inherit; }

/* ---------- หน้าต่าง ---------- */
.dlg { width: min(860px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: 0; border: 0; border-radius: 22px; background: var(--bg); color: var(--ink); box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .6); overflow: hidden; }
.dlg[open] { display: flex; flex-direction: column; animation: dlgIn .45s var(--ease); }
.dlg::backdrop { background: rgba(8, 12, 11, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
@keyframes dlgIn { from { opacity: 0; transform: translateY(20px) scale(.98); } }
.dlg-h { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 24px; background: var(--paper); border-bottom: 1px solid var(--line); }
.dlg-h h2 { font-size: 21px; }
.dlg-b { padding: 24px; overflow-y: auto; flex: 1; }
.dlg-f { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; background: var(--paper); border-top: 1px solid var(--line); }
.dlg-f .left { margin-right: auto; }
.dlg.sm { width: min(440px, calc(100% - 24px)); }
.confirm-b { padding: 30px 28px 10px; text-align: center; }
.confirm-ic { width: 58px; height: 58px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: var(--gold-ink); }
.confirm-ic.danger { background: var(--bad-bg); color: var(--bad); }
.confirm-ic .ico { width: 26px; height: 26px; }
.confirm-b h2 { font-size: 22px; margin-bottom: 8px; }
.confirm-b p { color: var(--ink-2); font-size: 14.5px; }
.dlg.sm .dlg-f { background: transparent; border: 0; justify-content: center; padding: 20px 28px 28px; }
.dlg.sm .dlg-f .btn { flex: 1; }
.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.lib button { position: relative; padding: 0; border: 2px solid transparent; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; cursor: pointer; background: var(--soft); transition: border-color .2s, transform .3s var(--ease); }
.lib button:hover { transform: translateY(-2px); }
.lib button img { width: 100%; height: 100%; object-fit: cover; }
.lib button[aria-pressed="true"] { border-color: var(--gold); }
.lib button[aria-pressed="true"]::after { content: '✓'; position: absolute; right: 6px; top: 6px; width: 24px; height: 24px; border-radius: 50%; background: var(--gold); color: #1b1407; font-weight: 700; display: grid; place-items: center; font-size: 13px; }

/* ---------- toast ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 1000; display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 380px; padding: 13px 16px; border-radius: 14px; background: var(--night); color: #fff; font-size: 14px; box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .6); animation: toastIn .45s var(--ease); border-left: 4px solid var(--gold); }
.toast.success { border-left-color: #47b36f; }
.toast.error { border-left-color: #e5534b; }
.toast.warning { border-left-color: #e7a93b; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } }

/* ---------- แถบล่างมือถือ ---------- */
.bnav { display: none; }

@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row { grid-template-columns: 92px minmax(0, 1fr) auto; }
  .row-img { width: 92px; height: 68px; }
  .row .prices { grid-column: 2; }
  .row .row-st { grid-column: 3; grid-row: 1; }
  .row-acts { grid-column: 3; grid-row: 2; justify-content: flex-end; }
  .bk { grid-template-columns: minmax(0, 1fr) auto; }
  .bk > :nth-child(2), .bk > :nth-child(3) { grid-column: 1; }
  .bk > :nth-child(4) { grid-column: 2; grid-row: 1; }
  .bk > :nth-child(5) { grid-column: 2; grid-row: 2 / span 2; align-self: end; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .main { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  .mtop { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
  .bnav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--night); }
  .bnav button { position: relative; display: grid; justify-items: center; gap: 2px; padding: 8px 2px; border: 0; border-radius: 12px; background: none; color: rgba(233, 236, 231, .6); font-size: 11px; cursor: pointer; }
  .bnav button[aria-current="page"] { color: #fff; background: rgba(201, 166, 107, .18); }
  .bnav .count { position: absolute; top: 2px; right: calc(50% - 22px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--gold); color: #1b1407; font-size: 10.5px; font-weight: 600; display: grid; place-items: center; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-art { min-height: 240px; padding: 28px 22px; }
  .form-grid.g3, .form-grid.g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .opts { grid-template-columns: minmax(0, 1fr); }
  .season { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .season > :first-child { grid-column: 1 / -1; }
  .cal { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .dlg { width: 100%; max-width: 100%; max-height: 100%; height: 100%; border-radius: 0; }
  .dlg.sm { height: auto; width: calc(100% - 24px); border-radius: 20px; }
  .toasts { left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .bn-list { grid-template-columns: minmax(0, 1fr); }
  .bn-preview { aspect-ratio: 16 / 9; }
}
@media (min-width: 861px) { .mtop { display: none; } }
@media (max-width: 520px) {
  .row { grid-template-columns: 76px minmax(0, 1fr); }
  .row .prices, .row .row-st { grid-column: 1 / -1; grid-row: auto; }
  .row .row-st { justify-self: start; }
  .row-acts { grid-column: 1 / -1; grid-row: auto; justify-self: end; margin-top: -48px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid.g3, .form-grid.g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2 { grid-column: auto; }
  .tiles { gap: 10px; }
  .tile { padding: 14px 16px; }
  .tile b { font-size: 26px; }
  .row { padding: 14px 16px; gap: 12px; }
  .row-img { width: 76px; height: 60px; }
  .bk { padding: 14px 16px; }
  .panel-h, .panel-b { padding-left: 16px; padding-right: 16px; }
  .dlg-b { padding: 18px 16px; }
  .dlg-h, .dlg-f { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
