/* PUNPAE Keycap — Glassmorphism 2.0 · ธีมหลัก Ocean Breeze · สำรอง Midnight Neon */
:root, [data-theme="ocean"] {
  --bg: #E8F6FF;
  --ink: #0A2A5E;
  --muted: #3A5A86;
  --primary: #0B3D91;
  --primary-2: #2A6BD3;
  --accent: #1F6FC4;
  --accent-soft: rgba(59, 167, 242, 0.18);
  --accent-line: rgba(31, 111, 196, 0.5);
  --mint: #7FE7D6;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-line: rgba(255, 255, 255, 0.9);
  --line: rgba(11, 61, 145, 0.14);
  --shadow: 0 16px 40px rgba(11, 61, 145, 0.14);
  --blob-1: rgba(59, 167, 242, 0.5);
  --blob-2: rgba(127, 231, 214, 0.7);
  --blob-3: rgba(11, 61, 145, 0.16);
  --warn-bg: rgba(251, 191, 36, 0.22);
  --warn-line: rgba(180, 110, 0, 0.45);
  --warn-ink: #7A4B00;
  --bad: #B42318;
  --good: #067647;
  --input: rgba(255, 255, 255, 0.72);
}
[data-theme="midnight"] {
  --bg: #0F172A;
  --ink: #F5F3FF;
  --muted: #C4B5FD;
  --primary: #7C3AED;
  --primary-2: #8B5CF6;
  --accent: #22D3EE;
  --accent-soft: rgba(34, 211, 238, 0.16);
  --accent-line: rgba(34, 211, 238, 0.6);
  --mint: #22D3EE;
  --glass: rgba(255, 255, 255, 0.07);
  --glass-strong: rgba(15, 23, 42, 0.78);
  --glass-line: rgba(255, 255, 255, 0.16);
  --line: rgba(255, 255, 255, 0.12);
  --shadow: 0 16px 40px rgba(2, 6, 23, 0.45);
  --blob-1: rgba(124, 58, 237, 0.55);
  --blob-2: rgba(34, 211, 238, 0.3);
  --blob-3: rgba(167, 139, 250, 0.3);
  --warn-bg: rgba(251, 191, 36, 0.14);
  --warn-line: rgba(251, 191, 36, 0.45);
  --warn-ink: #FDE68A;
  --bad: #FCA5A5;
  --good: #6EE7B7;
  --input: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
/* กันแตะปุ่มติดๆ กันแล้วจอซูม (double-tap zoom) · ยังถ่างสองนิ้วซูมได้ */
html, button, a, input, label, [role="switch"], .chip { touch-action: manipulation; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Anuphan', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
.num, .brand { font-family: 'Bricolage Grotesque', 'Anuphan', sans-serif; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }

.blobs { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.blobs i { position: absolute; border-radius: 50%; display: block; }
.blobs i:nth-child(1) { width: 380px; height: 380px; left: -140px; top: -90px; background: radial-gradient(circle, var(--blob-1), transparent 70%); }
.blobs i:nth-child(2) { width: 340px; height: 340px; right: -150px; top: 40%; background: radial-gradient(circle, var(--blob-2), transparent 70%); }
.blobs i:nth-child(3) { width: 300px; height: 300px; left: -80px; bottom: -120px; background: radial-gradient(circle, var(--blob-3), transparent 70%); }

#app { position: relative; z-index: 1; max-width: 480px; margin: 0 auto; padding: 24px 20px 120px; min-height: 100vh; }

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), var(--shadow);
  border-radius: 24px;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-strong); }
}

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.card { padding: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
h1 { margin: 0; font-size: 28px; line-height: 1.25; }
h2 { margin: 0; font-size: 20px; }
h3 { margin: 0; font-size: 16px; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }

.header { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.logo img { width: 48px; height: 42px; object-fit: contain; }
.logo b { font-size: 26px; font-weight: 800; letter-spacing: 0.04em; line-height: 1; }
.logo small { display: block; font-size: 11px; letter-spacing: 0.12em; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 999px; border: 0; cursor: pointer;
  text-decoration: none; font-weight: 600; font-size: 16px;
}
.btn-primary {
  background: linear-gradient(180deg, var(--primary-2), var(--primary)); color: #fff;
  box-shadow: 0 12px 28px rgba(11, 61, 145, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-ghost { background: var(--glass); color: var(--ink); border: 1px solid var(--glass-line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.btn-link { background: none; color: var(--accent); min-height: 44px; }
.btn-danger { background: transparent; color: var(--bad); border: 1px solid currentColor; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; text-decoration: none; color: var(--ink); }
.btn:focus-visible, .icon-btn:focus-visible, .chip:focus-visible, .seg button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--glass); cursor: pointer; font-size: 14px; color: var(--muted);
}
.chip.on { border-color: var(--accent-line); background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.chip .badge { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--line); font-size: 12px; font-weight: 700; color: var(--ink); }
.chip.on .badge { background: var(--primary); color: #fff; }

.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.seg button {
  min-height: 56px; border-radius: 16px; border: 1px solid var(--line); background: var(--glass); cursor: pointer; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px;
}
.seg button.on { border-color: var(--accent-line); background: var(--accent-soft); color: var(--ink); font-weight: 600; }

label.lbl { font-size: 15px; font-weight: 600; display: block; margin-bottom: 6px; }
.input {
  width: 100%; min-height: 52px; padding: 0 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--input); color: var(--ink);
}
textarea.input { padding: 12px 16px; min-height: 90px; }
.input.big { font-family: 'Bricolage Grotesque', sans-serif; font-size: 24px; font-weight: 700; letter-spacing: 0.16em; }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--input); font-size: 22px; cursor: pointer; }
.stepper .num { min-width: 28px; text-align: center; font-size: 22px; font-weight: 800; }

/* คีย์แคป */
.chain { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; padding: 12px; border-radius: 18px; border: 1px solid var(--glass-line); background: var(--glass); min-height: 64px; }
.chain.base-flexible .cap { border-radius: 14px; }
.chain.base-flexible .cap.sm { border-radius: 10px; }
.ring { width: 18px; height: 18px; border-radius: 50%; border: 3px solid #7C93B5; flex-shrink: 0; }
.cap {
  width: 46px; height: 46px; display: inline-flex; align-items: center; justify-content: center; border-radius: 11px;
  font-family: 'Bricolage Grotesque', 'Anuphan', sans-serif; font-weight: 800; font-size: 22px; color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55), inset 0 -5px 8px rgba(2, 6, 23, 0.18), 0 6px 14px rgba(11, 61, 145, 0.25);
  position: relative; cursor: pointer; padding: 0;
}
.cap.sm { width: 32px; height: 32px; font-size: 16px; border-radius: 8px; }
.cap.led::after { content: ''; position: absolute; inset: -4px; border-radius: inherit; box-shadow: 0 0 14px 3px rgba(255, 236, 140, 0.85); pointer-events: none; }
.cap.sel { outline: 3px solid var(--accent); outline-offset: 2px; }
.swatch { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; position: relative; }
.swatch.on { outline: 3px solid var(--accent); outline-offset: 2px; }
.swatch.out { opacity: 0.25; pointer-events: none; }

/* แถบราคา sticky */
.pricebar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px; width: calc(100% - 24px); max-width: 456px; z-index: 20;
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 20px; border-radius: 26px; background: var(--glass-strong);
}
.pricebar .total { font-size: 30px; font-weight: 800; line-height: 1; }

.price-lines div { display: flex; justify-content: space-between; padding: 4px 0; font-size: 15px; }
.price-lines .sum { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-weight: 700; font-size: 18px; }

.nudge { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 16px; background: var(--accent-soft); border: 1px solid var(--accent-line); font-size: 14px; }
.warn { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); font-size: 14px; }
.ok-badge { color: var(--good); font-weight: 600; }
.bad-badge { color: var(--bad); font-weight: 600; }

.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.steps div { display: flex; flex-direction: column; gap: 8px; font-size: 12px; color: var(--muted); }
.steps i { height: 6px; border-radius: 6px; background: var(--line); display: block; }
.steps .done i { background: var(--mint); }
.steps .now i { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.steps .now { color: var(--ink); font-weight: 600; }

.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); flex-shrink: 0; }
.code-big { font-size: 38px; font-weight: 800; letter-spacing: 0.06em; line-height: 1; }

.qr-box { background: #fff; border-radius: 22px; padding: 16px; box-shadow: 0 0 0 6px rgba(59, 167, 242, 0.3), var(--shadow); width: 240px; margin: 0 auto; }
.qr-box img { width: 208px; height: 208px; }
.photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.photos figure { margin: 0; border-radius: 18px; overflow: hidden; border: 1px solid var(--glass-line); background: var(--glass); }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.photos figcaption { padding: 6px 10px; font-size: 12px; color: var(--muted); }

.sheet-bg { position: fixed; inset: 0; overscroll-behavior: contain; background: rgba(10, 42, 94, 0.25); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 480px; max-height: 85vh; overflow: auto; overscroll-behavior: contain; border-radius: 28px 28px 0 0; padding: 20px 20px 28px; background: var(--glass-strong); }
.toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 60; padding: 12px 18px; border-radius: 16px; background: var(--ink); color: var(--bg); font-size: 14px; box-shadow: var(--shadow); max-width: 90vw; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.list-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; text-decoration: none; color: var(--ink); }
.word-pill { padding: 6px 12px; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--accent-line); font-weight: 800; letter-spacing: 0.12em; }
.tabs { display: flex; gap: 8px; overflow-x: auto; margin: 0 -20px; padding: 2px 20px 6px; scrollbar-width: none; }
.tabs .chip { flex-shrink: 0; white-space: nowrap; }
.switch { position: relative; width: 56px; height: 32px; border-radius: 999px; border: 0; padding: 0; cursor: pointer; background: rgba(148, 163, 184, 0.45); flex-shrink: 0; }
.switch span { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); transition: left 0.2s; }
.switch.on { background: var(--accent); }
.switch.on span { left: 27px; }
.fab { position: fixed; right: max(16px, calc(50% - 224px)); bottom: 20px; z-index: 20; }
table.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
table.kv td { padding: 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.kv td:first-child { color: var(--muted); width: 40%; }
.hidden { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* เลือกไฟ LED รายช่อง */
.chip.ledpick { min-width: 52px; justify-content: center; }
.chip.ledpick.on { background: #FFF6C7; border-color: #F2C744; color: #5B4300; box-shadow: 0 0 14px rgba(255, 214, 74, .65); }
.kc-render .kc:focus { outline: none; }
.kc-render .kc:focus-visible { filter: drop-shadow(0 0 4px var(--accent, #3BA7F2)); }
/* หน้า "ระบบ" (superadmin) */
.prov { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--glass-line); background: var(--glass); }
.prov .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; background: var(--accent, #3BA7F2); color: #fff; }
.prov.off { opacity: .55; }
.prov.off .n { background: #94A3B8; }
.mini { min-height: 36px; padding: 0 10px; font-size: 13px; }
.keyrow { display: grid; gap: 6px; }
.keyrow .meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }

/* รูปที่ถ่าย: จางขณะ AI อ่าน + แตะเพื่อขยาย */
.shot { position: relative; margin: 0; border-radius: 18px; overflow: hidden; background: var(--glass); }
.shot img { display: block; width: 100%; max-height: var(--mh, 240px); object-fit: contain; margin: 0 auto; cursor: zoom-in; transition: opacity .25s, filter .25s; }
.shot.reading img { opacity: .38; filter: blur(1px) saturate(.8); cursor: default; }
.shot figcaption { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; font-weight: 600; color: var(--ink); text-shadow: 0 1px 8px rgba(255,255,255,.8); }
.shot figcaption .spinner { margin: 0; }
.shot .zoom-hint { position: absolute; right: 8px; bottom: 8px; padding: 3px 8px; border-radius: 999px; font-size: 11px; background: rgba(15,23,42,.55); color: #fff; pointer-events: none; }
.lightbox { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; background: rgba(8,15,30,.0); backdrop-filter: blur(0); transition: background .18s, backdrop-filter .18s; cursor: zoom-out; }
.lightbox.on { background: rgba(8,15,30,.72); backdrop-filter: blur(6px); }
.lightbox img { max-width: 100%; max-height: 92vh; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.45); transform: scale(.92); opacity: 0; transition: transform .18s, opacity .18s; touch-action: pinch-zoom; }
.lightbox.on img { transform: scale(1); opacity: 1; }
.lightbox .lb-x { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); font-size: 18px; color: #0f172a; }
img[data-zoom] { cursor: zoom-in; }

/* กรอบรอภาพ 3D */
.kc-skel { width: 100%; display: grid; place-content: center; justify-items: center; gap: 8px; border-radius: 16px;
  background: linear-gradient(100deg, rgba(255,255,255,0) 20%, rgba(255,255,255,.12) 40%, rgba(255,255,255,0) 60%) #3E4C6C; color: #dbe4f5; background-size: 200% 100%; animation: kcsk 1.4s linear infinite; }
.kc-skel .spinner { margin: 0; }
.kc-skel .muted { color: #c9d3e6; }
@keyframes kcsk { to { background-position: -200% 0; } }
.kc3d canvas:active { cursor: grabbing; }

/* ---------- บอร์ดหลังบ้าน (มือถือ = เรียงลง · iPad/คอม = คอลัมน์เรียงข้าง) ---------- */
body.wide #app { max-width: 1600px; padding: 18px 16px 40px; }
body.wide .fab { right: 20px; }
.bhead { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.bstats { gap: 8px; flex-wrap: wrap; }
.bstat { padding: 8px 14px; border-radius: 16px; min-height: 48px; display: flex; flex-direction: column; justify-content: center; text-align: right; border: 1px solid var(--glass-line); cursor: pointer; }
button.bstat { flex-direction: row; align-items: center; gap: 8px; text-align: left; }
.board { display: grid; gap: 14px; }
.bcol { border-radius: 22px; padding: 10px; background: color-mix(in srgb, var(--c) 7%, transparent); border: 1px solid color-mix(in srgb, var(--c) 25%, transparent); }
.bcol header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 6px 10px; }
.bcol header b { font-size: 17px; }
.bdot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; }
.bcount { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--c); color: #fff; font-weight: 800; font-size: 16px; }
.bsub { width: 100%; padding-left: 20px; }
.bcol.empty { opacity: .7; }
.bcol.empty .bcards p { padding: 4px 0 !important; }
.bcards { display: flex; flex-direction: column; gap: 10px; }
.kcard { padding: 12px; border-radius: 18px; display: flex; flex-direction: column; gap: 7px; cursor: pointer; }
.kcard:active { transform: scale(.99); }
.kcode { font-size: 19px; letter-spacing: .04em; white-space: nowrap; }
.kword { font-size: 15px; padding: 4px 10px; max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kq { min-height: 48px; margin-top: 2px; }
.age { white-space: nowrap; font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--line); }
.age.warn { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line); }
.age.late { background: #E11D48; color: #fff; }
.stag { align-self: flex-start; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 8px; background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--ink); }
.stag[data-s="slip_submitted"] { background: #FDE68A; color: #7A4B00; }
.stag[data-s="awaiting_cash"] { background: #BBF7D0; color: #14532D; }
.kcard.fresh { animation: kflash 1.2s ease-in-out 3; }
@keyframes kflash { 50% { box-shadow: 0 0 0 4px var(--c), var(--shadow); } }
.shopbtn.on { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
@media (min-width: 760px) {
  .board { grid-auto-flow: column; grid-auto-columns: minmax(236px, 1fr); overflow-x: auto; align-items: start; scroll-snap-type: x proximity; padding-bottom: 6px; }
  .bcol { scroll-snap-align: start; max-height: calc(100vh - 150px); display: flex; flex-direction: column; }
  .bcards { overflow-y: auto; flex: 1; padding-right: 2px; }
  .bcol.empty { opacity: 1; }
}
@media (min-width: 1100px) { .board { grid-auto-columns: minmax(0, 1fr); overflow-x: visible; } }

.bnav { position: sticky; top: 0; z-index: 15; display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; margin: -4px 0 8px; scrollbar-width: none; background: linear-gradient(var(--bg) 70%, transparent); }
.bnav .chip { white-space: nowrap; flex: none; text-decoration: none; }
.bnav .bdot { width: 9px; height: 9px; }
@media (min-width: 760px) { .bnav { display: none; } }

/* ---------- เครื่องคิดเลขราคา ---------- */
.calc { display: grid; gap: 16px; align-items: start; }
.crow { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.qchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.qchips .chip { min-width: 44px; min-height: 40px; justify-content: center; }
.cbreak { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 16px; background: var(--input); border: 1px solid var(--line); font-size: 14px; }
.cbreak > div { display: flex; justify-content: space-between; gap: 10px; }
.cbreak .ctot { border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 2px; font-size: 16px; }
.cgrand { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cgrand b { font-size: 44px; line-height: 1.1; font-weight: 800; letter-spacing: -.01em; }
.cgrand small { font-size: 16px; font-weight: 600; margin-left: 4px; }
.csum { background: var(--glass-strong); }
.cbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 12px; width: calc(100% - 24px); max-width: 560px; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 18px; border-radius: 22px; background: var(--glass-strong); box-shadow: var(--shadow); }
.cbar .btn { min-height: 52px; padding: 0 22px; }
body.wide .calc { padding-bottom: 90px; }
@media (min-width: 900px) {
  .calc { grid-template-columns: minmax(0, 1fr) 380px; }
  #items { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
  #items > #add { grid-column: 1 / -1; }
  .csum { position: sticky; top: 16px; }
  .cbar { display: none; }
  body.wide .calc { padding-bottom: 0; }
}
.qr-box.qr-lg { width: min(300px, 78vw); }
.qr-box.qr-lg img { width: 100%; height: auto; aspect-ratio: 1; }

.basepick { display: grid; gap: 10px; }
.basepick button { display: flex; flex-direction: column; gap: 6px; padding: 6px 6px 10px; border-radius: 18px; border: 2px solid var(--line); background: var(--input); cursor: pointer; text-align: center; color: var(--ink); }
.basepick button img { width: 100%; aspect-ratio: 2 / 1; object-fit: cover; border-radius: 13px; background: #EEF5FC; }
.basepick button.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

/* ตารางเลือกตัวอักษร */
.lggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.lgk { min-height: 46px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--input); font: 700 18px/1 var(--font-num, inherit); color: var(--ink); cursor: pointer; }
.lgk.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.lggrid.sym .lgk { font-size: 22px; }
/* เลือกไฟรายช่อง (หน้าถ่ายรูป) */
.ledgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.ledgrid button { min-height: 56px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--input); color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 700; cursor: pointer; }
.ledgrid button .tiny { font-weight: 500; }
.ledgrid button.on { border-color: #F2B705; background: #FFF6D6; box-shadow: 0 0 0 3px rgba(242, 183, 5, 0.25), 0 0 14px rgba(242, 183, 5, 0.35); }

/* การใช้ AI */
.ustat { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.ustat > div { padding: 12px 14px; border-radius: 16px; background: var(--input); border: 1px solid var(--line); }
.ustat small { font-size: 14px; font-weight: 600; margin-left: 4px; }
.utable { display: flex; flex-direction: column; border-radius: 14px; border: 1px solid var(--line); overflow: hidden; }
.utable > div { display: grid; grid-template-columns: 1.4fr .7fr 1.3fr .9fr .8fr; gap: 6px; padding: 9px 12px; align-items: center; font-size: 14px; }
.utable > div + div { border-top: 1px solid var(--line); }
.utable .uh { background: var(--input); font-size: 12px; color: var(--muted); }
.utable > div > span:last-child { text-align: right; }
.ulog { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; max-height: 320px; overflow: auto; }
.ulog > div { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.6fr .7fr; gap: 6px; padding: 5px 0; border-bottom: 1px dashed var(--line); }

.howto { margin: 0; padding: 0; list-style: none; counter-reset: st; display: flex; flex-direction: column; gap: 10px; }
.howto li { counter-increment: st; display: grid; grid-template-columns: 34px 1fr; column-gap: 10px; align-items: start; }
.howto li::before { content: counter(st); grid-row: span 2; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; }
.howto li span { font-size: 13px; color: var(--muted); }

/* เครื่องคิดเลข: ชิ้นจากรูป */
.cthumb { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; flex: none; border: 1px solid var(--line); cursor: zoom-in; }
.cword { font-weight: 800; letter-spacing: .08em; margin-left: 6px; }
.citem .chip { white-space: nowrap; }

/* ขั้นตอนสั่งจากรูป */
.wdots { display: flex; gap: 4px; }
.wdots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); display: block; }
.wdots i.on { background: var(--accent); }
.wbar-sp { height: 96px; }
.wcmp { align-items: start; }
/* รูปจริงกับภาพ 3D กรอบขนาดเท่ากัน (4:5) */
.wcmp .shot { aspect-ratio: 4 / 5; }
.wcmp .shot { background: #E4EAF3; }
.wcmp .shot img { width: 100%; height: 100%; max-height: none; object-fit: contain; } /* เห็นครบทั้งรูป ไม่ตัดขอบ */
.wcmp .kc3d .kc-skel { max-height: none; }
.wword { font-size: 30px; font-weight: 800; letter-spacing: .06em; line-height: 1.2; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; word-break: break-all; }
.wopt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer; font: inherit; color: var(--ink); border: 2px solid transparent; min-height: 76px; }
.wopt.on { border-color: var(--accent); background: var(--accent-soft); }
.code-giant { font-size: 52px; font-weight: 800; letter-spacing: .08em; line-height: 1.05; }
.odetail summary { cursor: pointer; list-style: none; gap: 8px; }
.odetail summary::-webkit-details-marker { display: none; }
.odetail summary::after { content: '▾'; color: var(--muted); }
.odetail[open] summary::after { content: '▴'; }
[hidden] { display: none !important; }

/* แชทลูกค้า ↔ ร้าน */
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; padding: 2px; }
.bub { max-width: 84%; align-self: flex-start; background: var(--input); border: 1px solid var(--line); border-radius: 16px; padding: 8px 12px; font-size: 15px; }
.bub.me { align-self: flex-end; background: var(--accent-soft); border-color: var(--accent-line); }
.wthumb { width: 76px; height: 57px; object-fit: cover; border-radius: 12px; flex: none; }
.ldot { display: inline-block; border-radius: 50%; border: 1px solid rgba(11,37,69,.18); box-shadow: 0 0 6px rgba(255,255,255,.6) inset; vertical-align: middle; flex: none; }
.ledpal { display: flex; flex-wrap: wrap; gap: 8px; }
.ledpal button { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 58px; padding: 8px 6px; border-radius: 14px; border: 2px solid transparent; background: var(--input); font: inherit; font-size: 12px; color: var(--ink); cursor: pointer; }
.ledpal button.on { border-color: var(--accent); background: var(--accent-soft); }

/* ไฟ LED: แถวสี (⊘ + 8 สี เป็น 5 คอลัมน์) + ปุ่มตัวอักษรรายช่อง */
.ledpal5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.ledpal5 button { min-width: 0; }
.lnone { width: 24px; height: 24px; display: grid; place-items: center; font-size: 20px; line-height: 1; color: var(--muted); }
.ledkeys { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.ledkeys button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: 14px; border: 2px solid var(--line); background: var(--input); color: var(--ink); font: inherit; cursor: pointer; }
.ledkeys button.lit { border-color: var(--accent); }
.lk-cap { font-weight: 800; font-size: 18px; min-height: 26px; display: grid; place-items: center; }
.lk-led { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 3px; white-space: nowrap; }
