/* SPIRIZ Shift Check — คอนกรีต · เหล็กเจาะรู · โต๊ะแดง
   ความโดดเด่นอยู่ที่เดียว: การ์ดกราไฟต์ลายเหล็กเจาะรู (สรุปวันนี้) ที่เหลือเงียบและเรียบ */
:root {
  --concrete: #E6E5E1;   /* พื้นหลัง */
  --slab: #F7F7F4;       /* พื้นผิวการ์ด */
  --graphite: #24272A;   /* ตัวอักษร / การ์ดหลัก */
  --steel: #747C83;      /* ตัวอักษรรอง */
  --line: #D4D2CB;
  --brand: #FF3131;      /* แดงโลโก้ SPiRiZ */
  --red: #E5302C;        /* สถานะไม่ผ่าน (เข้มกว่าโลโก้เล็กน้อย ให้อ่านง่ายบนพื้นขาว) */
  --red-bg: #FBE6E2;
  --green: #2D8655;
  --green-bg: #E1F1E7;
  --amber: #C98516;
  --amber-bg: #FBEFD7;
  --blue: #3D6A9C;
  --blue-bg: #E3ECF6;
  --display: "Bai Jamjuree", "IBM Plex Sans Thai", system-ui, sans-serif;
  --body: "IBM Plex Sans Thai", system-ui, sans-serif;
  --perf: radial-gradient(circle, rgba(255,255,255,.075) 1.3px, transparent 1.5px) 0 0 / 9px 9px;
  --nav-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--concrete); color: var(--graphite); font: 16px/1.5 var(--body); -webkit-tap-highlight-color: transparent; }
body { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- top bar ---------- */
#top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 18px 10px; background: rgba(230,229,225,.92); backdrop-filter: blur(10px); }
.brand { display: flex; align-items: center; gap: 9px; }
.brand img:first-child { height: 26px; width: 26px; }
.brand img:last-child { height: 17px; width: auto; }
#who:empty { display: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--graphite); color: #fff; font: 600 15px var(--display); cursor: pointer; }
#netbar { margin: 0 14px 8px; padding: 9px 14px; border-radius: 12px; background: var(--amber-bg); color: #7a5208; font-size: 14px; }
main { max-width: 560px; margin: 0 auto; padding: 4px 14px 0; }

/* ---------- type ---------- */
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -.005em; }
h1 { font-size: 26px; line-height: 1.15; font-weight: 700; }
h2 { font-size: 20px; line-height: 1.25; font-weight: 700; }
h3 { font-size: 16px; font-weight: 600; }
.muted { color: var(--steel); }
.small { font-size: 13px; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }
.page-head { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; }
.page-head .grow { min-width: 0; }
.page-head p { margin: 2px 0 0; }
.back { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--slab); display: grid; place-items: center; flex: none; cursor: pointer; }

/* ---------- surfaces ---------- */
.panel { background: var(--slab); border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.group { background: var(--slab); border-radius: 16px; margin-bottom: 12px; overflow: hidden; }
.group > .row-item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-top: 1px solid #ebe9e3; }
.group > .row-item:first-child { border-top: 0; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 22px 4px 10px; }
.section-title h2 { font-size: 18px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.between { justify-content: space-between; }
.empty { text-align: center; color: var(--steel); padding: 34px 16px; }

/* ---------- hero (สรุปวันนี้) — จุดเด่นเดียวของแอป ---------- */
.hero { position: relative; background: var(--perf), var(--graphite); color: #EDEDEA; border-radius: 22px; padding: 18px 18px 16px; margin-bottom: 8px; overflow: hidden; }
.hero .date { font: 600 15px var(--display); color: #B9BDC0; }
.hero .count { display: flex; align-items: baseline; gap: 8px; margin: 10px 0 2px; }
.hero .count b { font: 700 64px/0.95 var(--display); letter-spacing: -.02em; color: #fff; }
.hero .count span { font: 500 22px var(--display); color: #8E959A; }
.hero .caption { color: #C9CCCE; font-size: 15px; }
.plates { display: flex; flex-wrap: wrap; gap: 5px; margin: 14px 0 12px; }
.plates i { width: 16px; height: 16px; border-radius: 4px; background: rgba(255,255,255,.13); }
.plates i.g { background: #4CC17F; } .plates i.r { background: var(--red); } .plates i.y { background: #E8A93A; } .plates i.b { background: #6E9BD0; } .plates i.x { background: #8C99A8; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.hero .tag { font-size: 13px; padding: 4px 10px; border-radius: 99px; background: rgba(255,255,255,.09); color: #DADDDF; }
.hero .tag.night { background: rgba(232,169,58,.18); color: #F2C77A; }
.hero .warn { margin-top: 12px; font-size: 13px; color: #B9BDC0; }
.hero .warn b { color: #fff; }
.hero input[type=date] { position: absolute; right: 14px; top: 14px; width: auto; padding: 4px 8px; font-size: 13px; background: rgba(255,255,255,.1); color: #fff; border: 0; border-radius: 8px; color-scheme: dark; }

/* ---------- รอบ + โซน ---------- */
.round-head { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 4px 10px; }
.round-head h2 { font-size: 18px; }
.round-head .when { font-size: 14px; color: var(--steel); }
.round-head .when.open { color: var(--green); font-weight: 600; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 92px; text-align: left; border: 0; border-radius: 14px;
  background: var(--slab); padding: 12px 12px 12px 16px; cursor: pointer; overflow: hidden; }
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: #CFCdC6; }
.tile b { font: 600 16px/1.25 var(--display); }
.tile .st { font-size: 13px; color: var(--steel); }
.tile .sc { position: absolute; right: 12px; top: 10px; font: 700 15px var(--display); }
.tile.g::before { background: var(--green); } .tile.g .st { color: var(--green); }
.tile.r { background: var(--red-bg); } .tile.r::before { background: var(--red); } .tile.r .st, .tile.r .sc { color: var(--red); font-weight: 600; }
.tile.y::before { background: var(--amber); } .tile.y .st, .tile.y .sc { color: var(--amber); }
.tile.b::before { background: var(--blue); } .tile.b .st { color: var(--blue); }
.tile.x::before { background: #8C99A8; }
.tile.locked { opacity: .55; }
.tile:active { transform: scale(.98); }

/* ---------- chips / status ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: #E4E2DC; color: var(--steel); white-space: nowrap; }
.chip.ok { background: var(--green-bg); color: var(--green); }
.chip.bad { background: var(--red-bg); color: var(--red); }
.chip.warn { background: var(--amber-bg); color: var(--amber); }
.chip.info { background: var(--blue-bg); color: var(--blue); }
.score { font: 700 30px/1 var(--display); }
.score.g { color: var(--green); } .score.r { color: var(--red); } .score.y { color: var(--amber); }

/* ---------- ผลของโซน ---------- */
.verdict { border-radius: 18px; padding: 16px; margin-bottom: 12px; background: var(--slab); }
.verdict.r { background: var(--red-bg); } .verdict.g { background: var(--green-bg); } .verdict.y { background: var(--amber-bg); }
.verdict .big { font: 700 52px/1 var(--display); letter-spacing: -.02em; }
.verdict.r .big { color: var(--red); } .verdict.g .big { color: var(--green); } .verdict.y .big { color: var(--amber); }
.verdict p { margin: 6px 0 0; }

/* ---------- มุมถ่ายรูป ---------- */
.point { background: var(--slab); border-radius: 16px; padding: 12px; margin-bottom: 10px; }
.point-top { display: flex; gap: 12px; align-items: center; }
.point-top .thumb { width: 64px; height: 84px; }
.point-top .thumb.land { width: 104px; height: 78px; }
.point h3 { font-size: 15px; line-height: 1.3; }
.point .crit { font-size: 13px; color: var(--steel); margin-top: 2px; }
.thumb { border-radius: 10px; object-fit: cover; background: #DEDCD6; flex: none; display: grid; place-items: center; color: var(--steel); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.pair.land { grid-template-columns: 1fr; }
.pair figure { margin: 0; } .pair figcaption { font-size: 12px; color: var(--steel); margin-bottom: 4px; }
.shot { position: relative; background: #DEDCD6; border-radius: 12px; overflow: hidden; }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot .box { position: absolute; border: 3px solid var(--red); border-radius: 6px; box-shadow: 0 0 0 1px rgba(255,255,255,.6); }
.shot .box span { position: absolute; top: -22px; left: -3px; background: var(--red); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 5px; white-space: nowrap; }

/* ---------- buttons / inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px; padding: 13px 18px; font-weight: 600; background: var(--graphite); color: #fff; cursor: pointer; text-decoration: none; }
.btn.block { width: 100%; }
.btn.red { background: var(--red); } .btn.green { background: var(--green); }
.btn.ghost { background: transparent; color: var(--graphite); border: 1.5px solid var(--line); }
.btn.light { background: #E4E2DC; color: var(--graphite); }
.btn.sm { padding: 8px 12px; border-radius: 11px; font-size: 14px; }
.btn:disabled { opacity: .4; }
.btn:active { transform: scale(.98); }
.sticky-cta { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px); z-index: 4; margin-top: 14px; }
.sticky-cta .btn { box-shadow: 0 8px 24px rgba(36,39,42,.25); }
input, select, textarea { width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--graphite); }
label { display: block; font-size: 14px; color: var(--steel); margin: 12px 0 5px; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--graphite); }
.check { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--graphite); font-size: 14px; }
details > summary { cursor: pointer; list-style: none; } details > summary::-webkit-details-marker { display: none; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid #ebe9e3; } th { color: var(--steel); font-weight: 500; }

/* ---------- segmented tabs (ตั้งค่า) ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 -14px 14px; padding: 0 14px 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; border: 0; border-radius: 99px; padding: 8px 14px; background: #DCDAD4; color: var(--graphite); font-size: 14px; cursor: pointer; }
.tabs button.on { background: var(--graphite); color: #fff; }

/* ---------- เดือน ---------- */
.month-big { display: flex; align-items: baseline; gap: 10px; }
.month-big b { font: 700 56px/1 var(--display); }
.month-big b.zero { color: var(--green); } .month-big b.some { color: var(--red); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 10px; }
.cal .h { font-size: 12px; color: var(--steel); text-align: center; }
.cal .d { aspect-ratio: 1; border-radius: 10px; background: #ECEAE5; display: grid; place-items: center; font: 600 14px var(--display); color: var(--steel); position: relative; }
.cal .d.g { background: var(--green-bg); color: var(--green); }
.cal .d.r { background: var(--red); color: #fff; }
.cal .d.p { background: #fff; color: var(--graphite); box-shadow: inset 0 0 0 1.5px var(--line); }
.cal .d.off { background: transparent; color: #B5B3AD; }
.cal .d small { position: absolute; bottom: 2px; font-size: 10px; }
.person { display: flex; align-items: center; gap: 12px; }
.person .av { width: 40px; height: 40px; border-radius: 50%; background: var(--graphite); color: #fff; display: grid; place-items: center; font: 600 16px var(--display); flex: none; }
.bonus b { font: 700 18px var(--display); }

/* ---------- bottom nav ---------- */
#nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center; background: rgba(247,247,244,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
#nav:empty { display: none; }
#nav a { flex: 1; max-width: 140px; height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; color: var(--steel); text-decoration: none; position: relative; }
#nav a svg { width: 24px; height: 24px; }
#nav a.on { color: var(--graphite); font-weight: 600; }
#nav a.on::after { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand); }
#nav .badge { position: absolute; top: 9px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff; font: 600 11px/17px var(--display); text-align: center; }

/* ---------- toast ---------- */
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); transform: translate(-50%, 10px); background: var(--graphite); color: #fff;
  padding: 11px 16px; border-radius: 14px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; max-width: 90vw; z-index: 60; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- sheet (เลื่อนขึ้นจากล่าง) ---------- */
.sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgba(20,22,24,.45); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s; }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: var(--slab); border-radius: 22px 22px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); animation: up .22s ease-out; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: #CFCDC6; margin: 0 auto 12px; }
@keyframes up { from { transform: translateY(30px); opacity: .6; } }
@keyframes fade { from { opacity: 0; } }

/* ---------- PIN (แบบปลดล็อก iPhone) ---------- */
.lock { position: fixed; inset: 0; z-index: 30; background: var(--perf), var(--graphite); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(20px + env(safe-area-inset-top)) 24px calc(20px + env(safe-area-inset-bottom)); }
.lock .brand { flex-direction: column; gap: 14px; margin-bottom: 26px; }
.lock .brand img:first-child { width: 68px; height: 68px; }
.lock .brand img:last-child { height: 22px; }
.lock h2 { font-size: 20px; text-align: center; }
.lock .sub { color: #A9AFB3; font-size: 14px; text-align: center; margin-top: 4px; min-height: 21px; }
.lock .sub.err { color: #FF8B7B; }
.dots { display: flex; gap: 16px; margin: 22px 0 30px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid #fff; transition: background .1s; }
.dots i.on { background: #fff; }
.dots.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 16px 26px; }
.pad button { width: 76px; height: 76px; border-radius: 50%; border: 0; background: rgba(255,255,255,.13); color: #fff; font: 500 30px/1 var(--display); cursor: pointer; }
.pad button:active { background: rgba(255,255,255,.35); }
.pad button.fn { background: transparent; font: 500 15px var(--body); }
.pad button.empty { visibility: hidden; }
.lock .link { margin-top: 22px; background: none; border: 0; color: #C9CCCE; font-size: 14px; text-decoration: underline; cursor: pointer; }
.lock form { width: 100%; max-width: 320px; }
.lock input { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); color: #fff; font-size: 18px; text-align: center; }
.lock input::placeholder { color: #8E959A; }
.lock input:focus { border-color: #fff; }
.lock .btn { margin-top: 12px; background: #fff; color: var(--graphite); }

/* ---------- camera ---------- */
.cam { position: fixed; inset: 0; background: #000; z-index: 50; display: flex; flex-direction: column; color: #fff; }
.cam .bar { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; }
.cam .bar .grow { font-size: 14px; }
.cam .x { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.16); color: #fff; font-size: 18px; }
.stage { position: relative; width: 100%; margin: 0 auto; overflow: hidden; background: #111; }
.stage video, .stage .ghost { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stage .ghost { pointer-events: none; }
.stage .grid { position: absolute; inset: 0; pointer-events: none; background:
  linear-gradient(#fff3,#fff3) 33.3% 0/1px 100% no-repeat, linear-gradient(#fff3,#fff3) 66.6% 0/1px 100% no-repeat,
  linear-gradient(#fff3,#fff3) 0 33.3%/100% 1px no-repeat, linear-gradient(#fff3,#fff3) 0 66.6%/100% 1px no-repeat; }
.align { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; align-items: center; gap: 8px; font-size: 13px; text-shadow: 0 1px 2px #000; }
.meter { height: 8px; border-radius: 9px; background: rgba(255,255,255,.2); overflow: hidden; flex: 1; }
.meter i { display: block; height: 100%; }
.cam .ctl { padding: 12px 18px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; }
.cam .ctl .row { justify-content: center; }
.cam .hint { text-align: center; font-size: 13px; color: #F2C77A; padding: 0 14px 6px; }
.shutter { width: 74px; height: 74px; border-radius: 50%; background: #fff; border: 5px solid rgba(255,255,255,.4); background-clip: padding-box; cursor: pointer; }
input[type=range] { padding: 0; border: 0; background: transparent; accent-color: #fff; }

/* ---------- ผลหลังถ่าย ---------- */
.result { position: fixed; inset: 0; z-index: 55; background: #151719; color: #fff; overflow: auto; }
.result .inner { max-width: 520px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom)); }
.result .pct { font: 700 64px/1 var(--display); text-align: center; margin-top: 14px; }
.result .pct.g { color: #5BCB8C; } .result .pct.r { color: #FF7A66; } .result .pct.y { color: #F2BC5A; }
.result .lbl { text-align: center; color: #A9AFB3; font-size: 14px; }
.result .why { text-align: center; margin: 10px 0 16px; font-size: 15px; }
.result .btn.ghost { color: #fff; border-color: rgba(255,255,255,.3); }

/* เครื่องหมายบนรูป: หมายเลข + คำอธิบายใต้รูป (แตะรูปเพื่อซ่อน) */
.shot { cursor: pointer; }
.shot .mk { position: absolute; border-radius: 8px; pointer-events: none; transition: opacity .15s; }
.shot .mk.object { border: 2.5px solid var(--red); background: rgba(229,48,44,.10); }
.shot .mk.area { border: 2px dashed #F2BC5A; background: rgba(242,188,90,.12); }
.shot .mk span { position: absolute; top: -11px; left: -11px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font: 700 12px/1 var(--display); color: #fff; background: var(--red); box-shadow: 0 0 0 2px #fff; }
.shot .mk.area span { background: #E0A43A; }
.shot .focus { position: absolute; border: 2px solid rgba(255,255,255,.95); border-radius: 6px; box-shadow: 0 0 0 9999px rgba(20,22,24,.42); pointer-events: none; }
.shot.clean .mk, .shot.clean .focus { opacity: 0; }
.legend { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.legend li { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--red-bg); color: var(--red); font-weight: 600; }
.legend li.area { background: var(--amber-bg); color: var(--amber); font-weight: 500; }
.legend li span { min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center; background: var(--red); color: #fff; font: 700 11px/1 var(--display); }
.legend li.area span { background: #E0A43A; }
.result .legend { justify-content: center; }
/* ตัวแก้กรอบตรวจ */
.fe { position: relative; margin-top: 12px; border-radius: 12px; overflow: hidden; touch-action: none; user-select: none; background: #DEDCD6; }
.fe img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.fe .focus { position: absolute; border: 2px solid #fff; border-radius: 6px; box-shadow: 0 0 0 9999px rgba(20,22,24,.5); }
/* ใครถ่าย */
.tile .by { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 12px; color: var(--steel); }
.tile .by svg { width: 13px; height: 13px; }
.taker { display: flex; align-items: center; gap: 5px; margin: 4px 0 0; font-size: 12.5px; color: var(--steel); }
.taker svg { width: 14px; height: 14px; flex: none; }
.taker b { color: var(--graphite); font-weight: 600; }

/* v3: ป้าย AI */
.shot .mk.move { border: 2.5px dashed #F08A24; background: rgba(240,138,36,.12); }
.shot .mk.move span { background: #F08A24; }
.legend li.move { background: #FDE9D6; color: #B25D0C; }
.legend li.move span { background: #F08A24; }
/* ป้ายสดบนกล้อง */
.stage .live { position: absolute; inset: 0; pointer-events: none; }
.lmk { position: absolute; border-radius: 8px; transition: all .25s ease-out; }
.lmk.object { border: 3px solid #FF4D3D; background: rgba(255,77,61,.14); }
.lmk.move { border: 3px dashed #FFA043; background: rgba(255,160,67,.14); }
.lmk span { position: absolute; left: -3px; top: -26px; white-space: nowrap; font: 600 13px/1 var(--display); color: #fff; padding: 5px 8px; border-radius: 7px; background: #FF4D3D; }
.lmk.move span { background: #E57F18; }
.livepill { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); max-width: 92%; padding: 8px 14px; border-radius: 999px;
  font: 600 14px/1.3 var(--body); background: rgba(20,22,24,.72); color: #fff; text-align: center; backdrop-filter: blur(6px); }
.livepill.g { background: rgba(46,160,96,.92); } .livepill.y { background: rgba(229,140,30,.92); } .livepill.r { background: rgba(229,48,44,.92); }
.shutter.ok { box-shadow: 0 0 0 4px #5BCB8C, 0 0 24px rgba(91,203,140,.6); }
/* ตัวแก้ป้าย AI */
.le .lbls { position: absolute; inset: 0; }
.le .lb { position: absolute; border-radius: 6px; cursor: pointer; }
.le .lb.keep { border: 3px solid #3BB273; background: rgba(59,178,115,.18); }
.le .lb.ignore { border: 2px dashed rgba(255,255,255,.85); background: rgba(0,0,0,.12); }
.le .lb.fx { border: 1px dotted rgba(255,255,255,.45); pointer-events: none; }
.le .lb span { position: absolute; top: -10px; left: -10px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 700 12px/1 var(--display); background: #24272A; color: #fff; box-shadow: 0 0 0 2px #fff; }
.le .lb.keep span { background: #3BB273; }
.le-row { width: 100%; border: 0; background: none; text-align: left; font: inherit; gap: 10px; cursor: pointer; }
.le-row .num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #ECEAE5; font: 700 12px var(--display); flex: none; }
.teach { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.teach > span { width: 100%; }
.teach .btn b { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-right: 4px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; }
.cam .torch { margin-left: auto; } .cam .torch.on { background: #F2BC5A; }

/* ตั้งค่ามุมถ่าย: รูปตอนเปิด ☀️ / ตอนปิด 🌙 */
.pt-row { width: 100%; border: 0; background: none; text-align: left; font: inherit; cursor: pointer; gap: 12px; }
.pt-row .refs { display: flex; gap: 4px; flex: none; }
.pt-row .chev { color: var(--steel); font-size: 22px; line-height: 1; }
.rt { position: relative; height: 48px; border-radius: 8px; overflow: hidden; background: #ECEAE5; flex: none; }
.rt.none { border: 1.5px dashed #C9C6BF; background: transparent; }
.rt img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rt i { position: absolute; right: 2px; bottom: 1px; font-style: normal; font-size: 11px; line-height: 1; filter: drop-shadow(0 0 2px rgba(0,0,0,.5)); }
.rt.none i { left: 50%; top: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%); filter: none; opacity: .6; }
.refpair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.refcard { border-radius: 14px; padding: 10px; background: #F1EFEA; display: flex; flex-direction: column; gap: 8px; }
.refcard.n { background: #E7E8EE; }
.refcard .rc-h { font: 600 14px/1.2 var(--display); }
.refcard .rc-img { border-radius: 10px; overflow: hidden; background: #DEDCD6; display: grid; place-items: center; }
.refcard .rc-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.refcard .rc-img span { font-size: 12px; color: var(--steel); }
.refcard .btn.sm { padding: 9px 8px; }
.linkbtn { border: 0; background: none; color: var(--red); font: inherit; font-size: 12.5px; text-decoration: underline; padding: 2px; cursor: pointer; }

/* ซื้อของ */
.pur .amt { font: 700 20px/1.1 var(--display); }
.pur.cancelled { opacity: .55; }
.pur.cancelled .amt { text-decoration: line-through; }
.pur .items { white-space: pre-wrap; font: 14px/1.55 var(--body); margin: 10px 0 0; padding: 10px 12px; background: #F1EFEA; border-radius: 10px; }
.pfiles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pfiles:empty { display: none; }
.pf { position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; border: 0; padding: 0; background: #DEDCD6; cursor: pointer; }
.pf img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf i { position: absolute; left: 4px; bottom: 4px; font: 600 10px/1 var(--body); font-style: normal; color: #fff; background: rgba(20,22,24,.7); padding: 3px 5px; border-radius: 5px; }
.pf button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(20,22,24,.75); color: #fff; font-size: 12px; cursor: pointer; }
.pnote { font-size: 13px; margin: 8px 0 0; padding-left: 10px; border-left: 3px solid var(--line); }
.warnbox { background: #FFF3DC; }
textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; resize: vertical; }

/* ซื้อของ v2: ใช้ง่าย */
.bigbtn { min-height: 56px; font-size: 17px; border-radius: 16px; }
#np { margin-bottom: 14px; }
.gbanner { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; margin-bottom: 12px; }
.psum { background: var(--graphite); color: #fff; border-radius: 20px; padding: 14px 16px 16px; margin-bottom: 12px; text-align: center; }
.psum .big { font: 700 34px/1.1 var(--display); margin-top: 6px; }
.psum .big small { font-size: 15px; font-weight: 500; opacity: .7; }
.psum .small { opacity: .8; margin-top: 2px; }
.mnav { width: 36px; height: 36px; border-radius: 12px; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 20px; cursor: pointer; }
.mnav:disabled { opacity: .3; }
.seg { display: flex; gap: 4px; padding: 4px; background: #E3E1DB; border-radius: 14px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: none; padding: 9px; border-radius: 10px; font: inherit; font-size: 14px; color: var(--steel); cursor: pointer; }
.seg button.on { background: #fff; color: var(--graphite); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.prow { width: 100%; border: 0; background: none; text-align: left; font: inherit; gap: 12px; cursor: pointer; }
.prow.cancelled { opacity: .5; }
.prow .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pth { width: 52px; height: 52px; border-radius: 12px; overflow: hidden; background: #DEDCD6; flex: none; }
.pth img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pr { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.pr b { font: 700 16px/1 var(--display); }
.pgal { display: flex; gap: 8px; overflow-x: auto; margin: 12px -2px 0; padding: 2px; scroll-snap-type: x mandatory; }
.pgal a { position: relative; flex: none; width: 70%; max-width: 260px; aspect-ratio: 3/4; border-radius: 14px; overflow: hidden; background: #DEDCD6; scroll-snap-align: start; }
.pgal img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pgal i { position: absolute; left: 8px; bottom: 8px; font: 600 12px/1 var(--body); font-style: normal; color: #fff; background: rgba(20,22,24,.7); padding: 4px 7px; border-radius: 6px; }
.amt { font: 700 22px/1.1 var(--display); }
/* ตัวช่วยบันทึก 3 ขั้น */
.wiz { position: fixed; inset: 0; z-index: 40; background: var(--concrete); display: flex; flex-direction: column; }
.wbar { display: flex; align-items: center; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 16px 8px; }
.wbar b { flex: 1; font-size: 17px; }
.wbar .x { width: 38px; height: 38px; border-radius: 12px; border: 0; background: #E3E1DB; font-size: 16px; cursor: pointer; }
.wdots { display: flex; gap: 6px; padding: 0 16px; }
.wdots i { flex: 1; height: 4px; border-radius: 2px; background: #D3D0C9; }
.wdots i.on { background: var(--brand); }
.wbody { flex: 1; overflow-y: auto; padding: 18px 16px; }
.wbody h2 { margin: 0 0 4px; }
.wfoot { padding: 12px 16px max(14px, env(safe-area-inset-bottom)); background: var(--concrete); }
.wtiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.wt { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: #DEDCD6; }
.wt img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wt button { position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(20,22,24,.75); color: #fff; cursor: pointer; }
.wt.add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 2px dashed #B9B5AD; background: transparent; color: var(--graphite); font: 600 13px/1.2 var(--body); cursor: pointer; }
.wt.add svg { width: 30px; height: 30px; }
.wtiles:has(.wt:only-child) { grid-template-columns: 1fr; }
.wtiles:has(.wt:only-child) .wt.add { aspect-ratio: 4/3; font-size: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 8px; }
.chips:empty { display: none; }
.chipbtn { border: 1.5px solid #CFCBC3; background: #fff; border-radius: 999px; padding: 9px 14px; font: inherit; font-size: 14px; cursor: pointer; }
.chipbtn.on { background: var(--graphite); border-color: var(--graphite); color: #fff; }
.bignum { font: 700 26px/1.2 var(--display) !important; }
/* ซื้อของ: รอบ + ตรวจอัตโนมัติ */
.rhead{display:flex;align-items:baseline;gap:8px;margin:18px 4px 6px}
.rhead b:first-child{font-size:15px}
.autobox{margin-top:12px;padding:10px 12px;border-radius:10px;font-size:14px;line-height:1.45;background:#fdf3e3;color:#8a5a12}
.autobox.ok{background:#e8f6ee;color:#1d6b40}
.autobox.wait{background:#eef2fb;color:#2c4a8a}
.rtag{padding:8px 12px;border-radius:999px;background:var(--ink,#1b1b1b);color:#fff;font-weight:600;white-space:nowrap}
.wt em.q{position:absolute;left:4px;right:4px;bottom:4px;font-style:normal;font-size:11px;text-align:center;padding:2px 4px;border-radius:6px;background:rgba(0,0,0,.6);color:#fff}
.wt em.q.ok{background:#1d8a4e}
.wt em.q.no{background:#b45309}
.ilist{display:flex;flex-direction:column;gap:8px}
.irow{display:grid;grid-template-columns:1fr 96px 36px;gap:6px;align-items:center}
.irow input{margin:0}
.irow input[data-p2]{text-align:right}
.irow button{height:36px;border:0;border-radius:10px;background:transparent;color:var(--muted,#888);font-size:16px}
.irow button:disabled{opacity:.25}
.itotal{display:flex;justify-content:space-between;align-items:baseline;margin-top:14px;padding:12px 14px;border-radius:12px;background:var(--ink,#1b1b1b);color:#fff}
.itotal b{font-size:26px}
.itotal small{opacity:.7;margin-left:6px}
.itab{width:100%;border-collapse:collapse;margin-top:12px;font-size:15px}
.itab td{padding:7px 2px;border-bottom:1px solid rgba(0,0,0,.07)}
.itab td:last-child{text-align:right;white-space:nowrap}
.itab tfoot td{font-weight:700;border:0}
/* แผ่นเลื่อน: แถบบน + ปุ่มปิด */
.sheet .shead{position:sticky;top:-10px;z-index:2;margin:-10px -18px 6px;padding:10px 18px 4px;background:var(--slab);display:flex;justify-content:center;align-items:center;min-height:44px;touch-action:none;cursor:grab}
.sheet .shead .grab{margin:0}
.sheet .sx{position:absolute;right:12px;top:8px;width:36px;height:36px;border-radius:50%;border:0;background:rgba(20,22,24,.08);color:var(--ink,#1b1b1b);font-size:17px;line-height:1;cursor:pointer}
.sheet .sx:hover{background:rgba(20,22,24,.14)}
@keyframes sheetup{from{transform:translateY(100%)}}
.sheet{animation:sheetup .32s cubic-bezier(.2,.8,.2,1);overscroll-behavior:contain}
.sheet-bg{transition:background-color .24s}
.sheet-bg.out{background:rgba(20,22,24,0)!important}
@media (prefers-reduced-motion:reduce){.sheet{animation:none}}

/* ---------- คั่วกาแฟ ---------- */
.topseg { margin-top: 4px; }
.csum { padding: 16px 10px; }
.cstats { display: grid; grid-template-columns: repeat(3, 1fr); }
.cstats div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cstats div + div { border-left: 1px solid rgba(255,255,255,.14); }
.cstats b { font: 700 28px/1.1 var(--display); }
.cstats span { font-size: 12px; opacity: .72; }
code, .code { font: 600 12px/1.4 var(--display); letter-spacing: .02em; background: #E4E2DC; color: var(--graphite); padding: 2px 7px; border-radius: 7px; white-space: nowrap; }
.code.big { font-size: 15px; background: var(--graphite); color: #fff; }
.pth { position: relative; }
.lvdot { position: absolute; right: 4px; bottom: 4px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; }
.pth:not(:has(img)) .lvdot { inset: 0; width: auto; height: auto; border: 0; border-radius: 0; }
/* การ์ดล็อต */
.lotgrid, .lotpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.lotpick { grid-template-columns: 1fr; }
.lot { display: flex; flex-direction: column; align-items: stretch; gap: 6px; text-align: left; font: inherit; color: inherit; border: 0; cursor: pointer;
  background: var(--slab); border-radius: 16px; padding: 14px; position: relative; overflow: hidden; border-left: 5px solid var(--green); }
.lot.low { border-left-color: var(--amber); }
.lot.empty { border-left-color: var(--line); opacity: .7; }
.lot.sel { outline: 2.5px solid var(--graphite); }
.lot b { line-height: 1.25; }
.lot .chip { align-self: flex-start; }
.lot .row.between { gap: 6px; align-items: flex-start; }
.lnum { color: var(--steel); font-size: 13px; }
.lnum b { font: 700 30px/1 var(--display); color: var(--graphite); }
.lbar { height: 6px; border-radius: 3px; background: #E4E2DC; overflow: hidden; }
.lbar i { display: block; height: 100%; background: var(--green); border-radius: 3px; }
.lot.low .lbar i { background: var(--amber); }
.lotpick .lot { flex-direction: column; padding: 16px; }
/* รายละเอียด */
.cphoto { width: 100%; max-height: 280px; object-fit: cover; border-radius: 14px; display: block; margin-bottom: 12px; background: #DEDCD6; }
.dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.dgrid > div { background: #fff; border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.dgrid > div span { font-size: 12px; color: var(--steel); }
.dgrid > .wide { grid-column: 1 / -1; }
.ldate { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 14px 2px 6px; }
.ldate span { font-size: 13px; color: var(--red); font-weight: 600; }
/* ฟอร์มคั่ว */
.wpair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cshot { display: flex; align-items: flex-end; gap: 10px; }
.cshot img { width: 120px; height: 120px; object-fit: cover; border-radius: 14px; }
.levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.levels button { border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 8px 2px 7px; font: inherit; font-size: 12px; line-height: 1.2; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--steel); }
.levels button i { width: 22px; height: 22px; border-radius: 50%; background: var(--c); }
.levels button.on { border-color: var(--graphite); color: var(--graphite); font-weight: 600; box-shadow: inset 0 0 0 1px var(--graphite); }
.rcode { font: 700 54px/1.1 var(--display); letter-spacing: .04em; background: var(--graphite); color: #fff; border-radius: 18px; padding: 18px 10px; margin: 12px 0 14px; }
#nav a { min-width: 0; text-align: center; line-height: 1.15; }

/* ---------- เปิด/ปิดร้าน ---------- */
#nav.n6 a { font-size: min(10px, 2.5vw); letter-spacing: -.03em; white-space: nowrap; padding: 0 1px; }
#nav.n6 a svg { width: 22px; height: 22px; }
.building { display: flex; flex-direction: column; gap: 10px; position: relative; }
.floor { display: flex; gap: 12px; background: var(--slab); border-radius: 18px; padding: 14px; border-left: 6px solid var(--line); }
.floor.open { border-left-color: var(--green); }
.floor.closed { border-left-color: var(--graphite); }
.floor .fl { width: 46px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #E4E2DC; border-radius: 12px; align-self: flex-start; padding: 8px 0; }
.floor.open .fl { background: var(--green); color: #fff; }
.floor .fl b { font: 700 22px/1 var(--display); }
.floor .fl span { font-size: 11px; opacity: .8; }
.fbody { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fname { font-size: 17px; }
.flast { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 0; background: none; padding: 0; font: inherit; font-size: 13.5px; color: var(--steel); text-align: left; cursor: pointer; }
.fth { display: flex; flex: none; }
.fth img { width: 34px; height: 34px; object-fit: cover; border-radius: 8px; border: 2px solid var(--slab); margin-left: -8px; background: #DEDCD6; }
.fbtn { margin-top: 2px; }
.emailbox { margin-top: 14px; display: flex; flex-direction: column; gap: 4px; }
.rhead .mnav { background: #E4E2DC; color: var(--graphite); }
.sdate { margin: 14px 4px 6px; font-weight: 600; font-size: 14px; }
.slog .grow { display: flex; flex-direction: column; gap: 1px; }
.sdot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--graphite); }
.sdot.open { background: var(--green); }
.sphotos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.sphotos a { display: block; border-radius: 12px; overflow: hidden; background: #DEDCD6; aspect-ratio: 3/4; }
.sphotos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sphotos a.broken::after { content: "เปิดรูปไม่ได้"; display: grid; place-items: center; height: 100%; font-size: 13px; color: var(--steel); }
.sbig { text-align: center; padding: 18px 10px; border-radius: 18px; background: var(--graphite); color: #fff; font: 700 30px/1.15 var(--display); margin-bottom: 6px; }
.sbig.open { background: var(--green); }
.sbig small { display: block; font: 400 13px/1.4 var(--body, inherit); opacity: .85; margin-top: 4px; }
.slog { width: 100%; border: 0; background: none; text-align: left; font: inherit; color: inherit; gap: 12px; cursor: pointer; }
