:root {
  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #ededea;
  --line: #d6d6d1;
  --text: #111111;
  --muted: #5f5f5a;
  --tape: #ffdd00;
  --tape-ink: #111111;
  --ink: #111111;
  --on-ink: #ffffff;
  --rec: #e02b20;
  --ok: #17924a;
  --warn: #946c00;
  --radius: 10px;
  --sans: "Noto Sans Thai", "IBM Plex Sans Thai", "Leelawadee UI", Tahoma, system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--sans);
  display: flex;
  flex-direction: column;
}
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
kbd {
  font: 600 .8em var(--mono);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  background: var(--surface-2);
}
code { font-family: var(--mono); }

/* แถบบน */
.bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px 20px;
  border-bottom: 4px solid var(--tape);
  background: var(--ink);
  color: var(--on-ink);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-stamp {
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  color: var(--tape);
  border: 2px solid var(--tape);
  border-radius: 6px;
  padding: 5px 7px 4px;
  transform: rotate(-6deg);
}
.brand-name { font-weight: 700; font-size: 19px; letter-spacing: .01em; }
.tabs { display: flex; gap: 4px; }
.tabs a {
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 8px;
  color: #c9c9c4;
  font-weight: 600;
}
.tabs a:hover { color: var(--on-ink); background: #2b2b2b; }
.tabs a[aria-current="page"] { color: var(--tape-ink); background: var(--tape); }
.chip {
  margin-left: auto;
  font-size: 13px;
  color: #c9c9c4;
  max-width: 34ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

main { flex: 1; min-height: 0; padding: 20px; }
.view { height: 100%; }

/* ปุ่ม */
.btn {
  font: 600 15px var(--sans);
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .tabs a:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}
.bar a:focus-visible { outline-color: var(--tape); }
.btn.primary { background: var(--tape); color: var(--tape-ink); border-color: var(--ink); }
.btn.primary:hover { background: #ffe94d; }
.btn.big { font-size: 18px; padding: 13px 18px; width: 100%; }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--rec); border-color: var(--rec); color: #fff; }
.btn.stop { background: var(--rec); border-color: var(--rec); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

input[type="text"], input[type="search"], input[type="number"], input[type="password"], select, textarea {
  width: 100%;
  font: 16px var(--sans);
  color: var(--text);
  background: var(--surface);
  border: 1px solid #9c9c96;
  border-radius: 8px;
  padding: 10px 12px;
}
textarea { resize: vertical; line-height: 1.6; font-size: 14px; }

/* สถานีแพค */
.stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  height: 100%;
  align-items: start;
}
.screen {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #111;
  border: 4px solid var(--ink);
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 215px);
  margin-inline: auto;
  width: 100%;
}
.screen[data-state="recording"] { border-color: var(--rec); }
.screen[data-state="idle"] { border-color: var(--ok); }
.screen canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.screen-msg {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 14px;
  justify-items: center;
  text-align: center;
  padding: 24px;
  background: rgba(17, 17, 17, .92);
  color: #fff;
}

.panel { display: flex; flex-direction: column; gap: 14px; }
.status {
  border-radius: var(--radius);
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 6px solid var(--line);
  min-height: 118px;
}
.status-label { font-weight: 700; font-size: 15px; color: var(--muted); }
.status-code { font: 700 26px/1.25 var(--mono); overflow-wrap: anywhere; margin-top: 4px; }
.status-time { font: 600 20px var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.status[data-state="idle"] { border-left-color: var(--ok); }
.status[data-state="idle"] .status-label { color: var(--ok); }
.status[data-state="recording"] { border-color: var(--rec); background: #fdecea; }
.status[data-state="recording"] .status-label { color: #b3201a; }
.status[data-state="recording"] .status-time { color: var(--text); }
.status[data-state="saving"], .status[data-state="starting"] { border-left-color: var(--tape); }

.setup {
  background: #fff7bf;
  border: 2px dashed var(--ink);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  gap: 12px;
}
#trackForm { display: grid; gap: 8px; }
#trackForm label { font-weight: 600; font-size: 14px; color: var(--muted); }
#trackInput { font: 600 20px var(--mono); padding: 12px; }
.hint { font-size: 13px; color: var(--muted); }

.today { border-top: 1px solid var(--line); padding-top: 12px; }
.today-head { display: flex; align-items: baseline; gap: 8px; color: var(--muted); font-size: 14px; }
.today-head b { font: 700 28px var(--mono); color: var(--text); }
#recent { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
#recent li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
}
#recent .code { font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#recent .t { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ประวัติ */
#view-history { max-width: 1100px; margin-inline: auto; }
.hist-head { display: flex; gap: 12px; }
.hist-head input { font: 600 18px var(--mono); }
.hist-stats { color: var(--muted); font-size: 14px; margin: 10px 2px; }
.hist-list { display: grid; gap: 6px; }
.clip {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 190px 70px 80px auto;
  gap: 14px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
}
.clip .code { font: 600 16px var(--mono); overflow-wrap: anywhere; }
.clip .num { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }
.clip .acts { display: flex; gap: 6px; }
.clip .acts .btn { padding: 6px 10px; font-size: 14px; }
.empty { color: var(--muted); text-align: center; padding: 60px 20px; }

/* ตั้งค่า */
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 20px; max-width: 1200px; margin-inline: auto; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }
.card h2 { font-size: 17px; justify-self: start; box-shadow: inset 0 -0.5em 0 var(--tape); }
.card h2:not(:first-child) { margin-top: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.field { display: grid; gap: 5px; }
.field > span { font-size: 14px; color: var(--muted); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check span { min-width: 0; }
.check input { width: 18px; height: 18px; margin-top: 4px; accent-color: var(--tape); flex: none; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row code { flex: 1 1 12ch; min-width: 0; overflow-wrap: anywhere; }
.note { font-size: 13px; color: var(--muted); }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checks li { display: grid; grid-template-columns: 22px 1fr; gap: 6px; font-size: 14px; }
.checks li::before { content: "✓"; color: var(--ok); font-weight: 700; }
.checks li.bad::before { content: "✕"; color: var(--rec); }
.checks li.warn::before { content: "!"; color: var(--warn); }
.checks small { display: block; color: var(--muted); overflow-wrap: anywhere; }

/* กล่องโต้ตอบ */
.dlg {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  width: min(440px, calc(100vw - 32px));
}
.dlg-wide { width: min(980px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(0, 0, 0, .6); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.dlg-head h3 { font: 700 18px var(--mono); overflow-wrap: anywhere; }
.dlg video { width: 100%; max-height: 62vh; background: #000; border-radius: 8px; display: block; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 14px 0 0; font-size: 14px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; overflow-wrap: anywhere; font-family: var(--mono); }
.claim-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.claim-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

/* แจ้งเตือน */
.toast {
  position: fixed;
  left: 50%;
  top: 66px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--on-ink);
  border: 0;
  border-left: 6px solid var(--tape);
  border-radius: 8px;
  padding: 12px 18px;
  max-width: min(640px, calc(100vw - 32px));
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
  z-index: 50;
}
.toast.ok { border-left-color: #3ddc84; }
.toast.err { border-left-color: #ff5a4f; }

.blocker { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; padding: 24px; z-index: 100; }
.blocker-card { max-width: 560px; display: grid; gap: 14px; }
.blocker-card ul { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--muted); }

@media (max-width: 980px) {
  .stage { grid-template-columns: 1fr; }
  .screen { max-height: none; }
  .clip { grid-template-columns: 1fr 1fr; }
  .clip .acts { grid-column: 1 / -1; flex-wrap: wrap; }
  .claim-cols { grid-template-columns: 1fr; }
  .chip { display: none; }
  .hist-head { flex-wrap: wrap; }
}

/* ---------- หน้าแนะนำ ---------- */
.wrap { max-width: 1120px; margin-inline: auto; display: grid; gap: 28px; padding-bottom: 40px; }
.wrap > .cols { max-width: none; margin: 0; }
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 36px; align-items: center; padding-top: 12px; }
.hero h1 { font-size: clamp(32px, 4.6vw, 54px); line-height: 1.22; letter-spacing: -.01em; text-wrap: balance; }
.hero mark { background: var(--tape); color: var(--ink); padding: 0 .16em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.lead { font-size: 18px; color: var(--muted); margin-top: 16px; max-width: 52ch; }
.hero-cta { display: flex; gap: 12px; margin: 22px 0 12px; flex-wrap: wrap; }
.hero-cta .btn { width: auto; text-decoration: none; }
.frame-demo {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 4px solid var(--ink);
  background: repeating-linear-gradient(135deg, #8a6f4d 0 26px, #80663f 26px 52px);
  box-shadow: 10px 10px 0 var(--tape);
}
.fd { position: absolute; background: rgba(0, 0, 0, .68); color: #fff; font: 600 clamp(10px, 1.25vw, 15px) var(--mono); padding: .35em .6em; border-radius: 5px; white-space: nowrap; }
.fd.tl { top: 5%; left: 3.5%; font-size: clamp(12px, 1.7vw, 20px); }
.fd.tr { top: 5%; right: 3.5%; }
.fd.tr i { display: inline-block; width: .6em; height: .6em; border-radius: 50%; background: #ff3b2f; margin-right: .45em; }
.fd.bl { bottom: 5%; left: 3.5%; }
.fd.br { bottom: 5%; right: 3.5%; font-family: var(--sans); }
.fd-cap { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: #fff; color: var(--ink); font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }

.how { list-style: none; counter-reset: how; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.how li { counter-increment: how; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 4px; align-content: start; }
.how li::before { content: counter(how); font: 700 15px var(--mono); width: 30px; height: 30px; display: grid; place-items: center; background: var(--ink); color: var(--tape); border-radius: 50%; margin-bottom: 6px; }
.how span { font-size: 14px; color: var(--muted); }

.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 10px; }
.step { counter-increment: step; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 8px; }
.step::before { content: counter(step); font: 700 15px var(--mono); width: 32px; height: 32px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 50%; align-self: start; }
.step[data-done="true"] { border-color: var(--ok); background: #f1faf4; }
.step[data-done="true"]::before { content: "✓"; background: var(--ok); border-color: var(--ok); color: #fff; }
.step p { font-size: 14px; color: var(--muted); }
.step .btn { text-decoration: none; }
.step-fields { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; margin: 10px 0 6px; }
.plain { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 15px; }
details { border-top: 1px solid var(--line); padding: 10px 0; }
details:first-of-type { border-top: 0; padding-top: 0; }
summary { cursor: pointer; font-weight: 600; }
details p { font-size: 14px; color: var(--muted); margin-top: 6px; }

/* ---------- มิเตอร์พื้นที่และสถานะเซิร์ฟเวอร์ ---------- */
.meter { display: grid; gap: 6px; }
.panel .meter { border-top: 1px solid var(--line); padding-top: 12px; }
.meter-head { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--muted); }
.meter-head span:last-child { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }
.meter-bar { height: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.meter-bar i { display: block; height: 100%; width: 0; background: var(--ink); }
.meter[data-level="warn"] .meter-bar i { background: #e0a100; }
.meter[data-level="full"] .meter-bar i { background: var(--rec); }
.meter[data-level="warn"] .note { color: var(--warn); font-weight: 600; }
.meter[data-level="full"] .note { color: var(--rec); font-weight: 600; }
.sync { font-size: 13px; color: var(--muted); }
.sync[data-level="err"] { color: var(--rec); font-weight: 600; }

.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag { font: 600 11px var(--sans); padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.tag.ok { color: #0f6b35; border-color: #a9dcbd; background: #eaf7ef; }
.tag.wait { color: var(--warn); border-color: #ead9a0; background: #fff8d9; }
.tag.remote { color: #fff; border-color: var(--ink); background: var(--ink); }

@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .how { grid-template-columns: 1fr 1fr; }
  .step { grid-template-columns: 34px minmax(0, 1fr); }
  .step > .btn { grid-column: 2; justify-self: start; }
  .step-fields { grid-template-columns: 1fr; }
}

/* ---------- หน้าตรวจหลักฐาน ---------- */
.verify { max-width: 820px; }
.verify h1 { font-size: 32px; }
.drop { display: grid; gap: 4px; justify-items: center; text-align: center; padding: 32px 20px; border: 2px dashed var(--ink); border-radius: var(--radius); background: #fff7bf; cursor: pointer; }
.drop[data-over="true"] { background: var(--tape); }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop:focus-within { outline: 3px solid var(--ink); outline-offset: 2px; }
.drop span { font-size: 14px; color: var(--muted); }
.checks.big li { font-size: 16px; font-weight: 600; }
.checks.big small { font-weight: 400; font-size: 14px; }

/* ---------- หน้าผู้ดูแลระบบ ---------- */
.admin { max-width: 980px; gap: 20px; }
#panel { display: grid; gap: 20px; }
.login { max-width: 420px; margin-inline: auto; }
.btn.on-ink { color: var(--on-ink); border-color: #555; margin-left: auto; }
.new-fields, .shop-edit { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 12px; align-items: end; }
.shop-edit { border-top: 1px solid var(--line); padding-top: 14px; }
.shops-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 8px; }
.shops-head h2 { font-size: 20px; }
.shops-head span { color: var(--muted); font-size: 14px; }
.shops { display: grid; gap: 12px; }
.shop-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.shop-head b { font-size: 18px; }
.shop-head code { margin-left: auto; color: var(--muted); font-size: 13px; }
.shop[data-off="true"] { background: var(--surface-2); }
.invite { border: 2px solid var(--ink); box-shadow: 8px 8px 0 var(--tape); }
.invite input { font: 14px var(--mono); }
pre.code { margin: 0; padding: 12px 14px; background: var(--ink); color: #fff; border-radius: 8px; font: 13px/1.6 var(--mono); overflow-x: auto; }
@media (max-width: 980px) { .new-fields, .shop-edit { grid-template-columns: 1fr; } }

/* ---------- การ์ดเชื่อมต่อเซิร์ฟเวอร์ ---------- */
#cloudOff, #cloudOn { display: grid; gap: 14px; }
#cloudOff .btn, #cloudOn > .btn { justify-self: start; }
#shopKey { font-family: var(--mono); }

/* ---------- สถานีแพค: แถบสถานะ กรอบเล็ง ปุ่มลัด ---------- */
#view-pack { display: flex; flex-direction: column; gap: 12px; }
#view-pack .stage { flex: 1; min-height: 0; height: auto; }
.strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  font: 14px var(--sans); color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 14px; min-height: 36px; max-width: 100%;
}
button.pill { cursor: pointer; }
button.pill:hover { border-color: var(--ink); }
button.pill:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.pill-k { color: var(--muted); white-space: nowrap; }
.pill b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 26ch; }
.pill-act { font-size: 12px; font-weight: 600; text-decoration: underline; color: var(--muted); }
.pill select { width: auto; max-width: 26ch; border: 0; padding: 2px 0; background: transparent; font-size: 14px; font-weight: 600; }
.pill.push { margin-left: auto; }
.strip-warn { color: var(--rec); font-weight: 600; font-size: 14px; }

.guide { position: absolute; inset: 22% 26%; pointer-events: none; }
.guide i { position: absolute; width: 34px; height: 34px; border: 4px solid #fff; filter: drop-shadow(0 0 2px rgba(0, 0, 0, .7)); }
.guide i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.guide i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.guide i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.guide i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.guide span {
  position: absolute; left: 50%; bottom: -46px; transform: translateX(-50%);
  background: rgba(0, 0, 0, .72); color: #fff; font-size: 14px; font-weight: 600;
  padding: 6px 14px; border-radius: 999px; white-space: nowrap;
}
.screen[data-state="warn"] { border-color: var(--tape); }
.screen-msg h3 { font-size: 22px; }
.screen-msg ul { text-align: left; margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 15px; max-width: 48ch; color: #ddd; }

.status { min-height: 150px; }
.status-label { font-size: 16px; }
.status-code { font-size: 28px; }
.status-help { font-size: 14px; color: var(--muted); margin-top: 8px; }
.status[data-state="idle"] .status-code { font-family: var(--sans); }
.status[data-state="warn"] { border-color: var(--tape); border-left-color: var(--tape); background: #fff7bf; }
.status[data-state="warn"] .status-label { color: var(--warn); }
.status[data-state="warn"] .status-code { font-family: var(--sans); }
.status[data-state="recording"] .status-time { font-size: 26px; }

.facts { margin: 0; display: grid; gap: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.facts > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; font-size: 14px; }
.facts > div + div { border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: right; }
#factDupRow dd { color: var(--warn); }

.today-head a { margin-left: auto; font-size: 13px; }
#recent li { padding: 0; border: 0; background: none; }
#recent button {
  display: flex; justify-content: space-between; gap: 10px; width: 100%;
  font: 14px var(--sans); color: var(--text); text-align: left; cursor: pointer;
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
}
#recent button:hover { border-color: var(--ink); }
#recent button:focus-visible { outline: 3px solid var(--ink); outline-offset: 1px; }

.keys { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; font-size: 14px; color: var(--muted); padding-top: 10px; border-top: 1px solid var(--line); }
.keys span { display: inline-flex; align-items: center; gap: 8px; }
.keys kbd { background: var(--ink); color: #fff; border-color: var(--ink); font-size: 12px; padding: 3px 8px; }

@media (max-width: 980px) { .pill.push { margin-left: 0; } .guide span { white-space: normal; text-align: center; width: max-content; max-width: 80vw; } }

/* ปุ่มอัดเสียงบนแถบสถานะ */
#pillMic[data-on="true"] { background: var(--tape); border-color: var(--ink); font-weight: 600; }
#pillMic[data-bad="true"] { border-color: var(--rec); color: var(--rec); font-weight: 600; }

/* ---------- เมนูรอง ท้ายหน้า และหน้าข้อมูล ---------- */
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 200; background: var(--tape); color: var(--ink); padding: 8px 12px; border-radius: 6px; }
.bar { flex-wrap: wrap; row-gap: 6px; }
.tabs.sub { margin-left: auto; }
.tabs.sub a { font-weight: 400; font-size: 14px; padding: 6px 10px; }
.tabs.sub a[aria-current="page"] { font-weight: 600; }
#navNew[data-dot="true"]::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--tape); margin-left: 6px; vertical-align: middle; }

.foot { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; padding: 16px 20px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); background: var(--surface); }
.foot a { color: var(--text); }
.foot-contact { margin-left: auto; display: flex; gap: 14px; flex-wrap: wrap; }
body[data-view="pack"] .foot { display: none; }
body[data-page] main, body[data-view="welcome"] main { height: auto; }

.sec { display: grid; gap: 14px; }
.sec > h2, .sec h2 { font-size: 24px; }
.sec.split { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px; align-items: start; }
.sec.split > div { display: grid; gap: 12px; }
.how { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.links { display: inline-flex; gap: 14px; flex-wrap: wrap; }
.links.big a { font-weight: 600; font-size: 17px; background: var(--tape); color: var(--ink); padding: 8px 16px; border-radius: 8px; text-decoration: none; border: 1px solid var(--ink); }
.faq { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 20px; }
.faq details:first-of-type { padding-top: 10px; }

.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-size: 15px; }
.tbl th, .tbl td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.tbl tr:last-child th, .tbl tr:last-child td { border-bottom: 0; }
.tbl th { font-weight: 600; white-space: nowrap; }
.tbl thead th { background: var(--surface-2); font-size: 14px; }

.prose { max-width: 820px; gap: 18px; }
.prose h1 { font-size: 34px; line-height: 1.25; }
.prose .card { gap: 10px; }
.prose .card h3 { font-size: 16px; margin-top: 6px; }
.prose p, .prose li { line-height: 1.7; }
.prose .card h2:not(:first-child) { margin-top: 0; padding-top: 0; border-top: 0; }

.log { display: grid; gap: 14px; }
.rel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: grid; gap: 10px; }
.rel h2 { font-size: 19px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.rel h2 span:not(.tag) { font: 400 14px var(--mono); color: var(--muted); }
.rel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rel li { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.rel li .tag { justify-self: start; }

.donate-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.donate-box { border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: grid; gap: 10px; justify-items: start; align-content: start; }
.donate-box img { width: 240px; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.donate-box .btn { text-decoration: none; }

.upd { position: fixed; left: 20px; bottom: 20px; z-index: 60; display: flex; align-items: center; gap: 12px; background: var(--ink); color: var(--on-ink); padding: 10px 12px 10px 16px; border-radius: 10px; border-left: 6px solid var(--tape); box-shadow: 0 10px 30px rgba(0, 0, 0, .28); font-weight: 600; }

.site-card summary { list-style: none; cursor: pointer; }
.site-card summary::-webkit-details-marker { display: none; }
.site-card summary h2 { display: inline; }
.site-card summary::after { content: "แสดง"; float: right; font-size: 14px; color: var(--muted); text-decoration: underline; }
.site-card[open] summary::after { content: "ซ่อน"; }
.site-card { border-top: 1px solid var(--line); }
.site-form { display: grid; gap: 14px; margin-top: 14px; }
.site-form h3 { font-size: 16px; }
.site-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.site-grid .wide { grid-column: 1 / -1; }
.qr-edit { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.qr-edit img { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.qr-edit .field { flex: 1 1 260px; }

@media (max-width: 980px) {
  .sec.split, .site-grid { grid-template-columns: 1fr; }
  .how { grid-template-columns: 1fr 1fr; }
  .tabs.sub { margin-left: 0; }
  main { padding: 16px; }
  .prose h1 { font-size: 28px; }
  .rel li { grid-template-columns: 1fr; gap: 4px; }
}

/* หน้าที่เนื้อหายาวให้เลื่อนทั้งหน้า ท้ายหน้าอยู่ต่อจากเนื้อหา ส่วนสถานีแพคยังเต็มจอพอดี */
body { height: auto; min-height: 100%; }
main { flex: 1 0 auto; min-height: auto; }
.view { height: auto; }
body[data-view="pack"] { height: 100%; }
body[data-view="pack"] main { flex: 1 1 0; min-height: 0; }
body[data-view="pack"] .view { height: 100%; }

/* ขั้นตอนเปิดกล้องในหน้าแนะนำ */
.tips { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.step-preview { display: block; margin-top: 10px; width: 240px; max-width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border: 2px solid var(--ink); border-radius: 8px; background: #111; }

/* สถานะเซิร์ฟเวอร์ในหน้าแอดมิน */
.stat-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
#statWarn:empty { display: none; }
@media (max-width: 980px) { .stat-grid { grid-template-columns: 1fr; } }

/* การยืนยันสองขั้นในหน้าแอดมิน */
.tfa-block { display: grid; gap: 12px; justify-items: start; }
.tfa-steps { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: start; width: 100%; }
.tfa-steps > * { display: grid; gap: 10px; justify-items: start; }
#tfaQr { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
#tfaCode { font: 600 24px var(--mono); letter-spacing: .2em; width: 9.5em; text-align: center; }
#tfaSecret { font-weight: 600; overflow-wrap: anywhere; }
#tfaCodeList { font-size: 16px; width: 100%; columns: 2; }
.tfa-off { width: 100%; }
.tfa-off form { display: grid; gap: 12px; max-width: 360px; margin-top: 10px; }
@media (max-width: 980px) { .tfa-steps { grid-template-columns: 1fr; } }

/* ---------- ไฟล์บนคลาวด์ ---------- */
.cloudv { max-width: 1100px; gap: 16px; }
.cf-on { display: grid; gap: 14px; }
.cf-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cf-tools { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 12px; }
.cf-tools input { font: 600 18px var(--mono); }
.cf-bulk { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.cf-bulk .check { align-items: center; margin-right: auto; }
.cf-bulk .check input { margin-top: 0; }
.cf-old { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; border-left: 1px solid var(--line); padding-left: 12px; }
.cf-old input { width: 5.5em; padding: 6px 8px; }
.cf-row { grid-template-columns: 22px minmax(0, 1.5fr) 190px 70px 80px auto; }
.cf-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--tape); }
@media (max-width: 980px) { .cf-tools { grid-template-columns: 1fr; } .cf-row { grid-template-columns: 22px 1fr; } .cf-row .acts, .cf-row .num { grid-column: 2; } .cf-old { border-left: 0; padding-left: 0; } }

/* ---------- หน้าเจ้าของร้าน ---------- */
.ow-row { grid-template-columns: minmax(0, 1.4fr) 190px 190px auto; }
.ow-fields { display: grid; grid-template-columns: 2fr 1fr auto; gap: 12px; align-items: end; }
.invite-box { display: grid; gap: 10px; border: 2px solid var(--ink); border-radius: 8px; padding: 14px; box-shadow: 6px 6px 0 var(--tape); }
.invite-box input { font: 14px var(--mono); }
.role-note { background: #fff7bf; border: 1px solid var(--ink); border-radius: 8px; padding: 10px 14px; color: var(--text); }
.act-list { display: grid; }
.act { display: grid; grid-template-columns: 130px 210px minmax(0, 1fr) 120px; gap: 12px; padding: 8px 4px; border-top: 1px solid var(--line); font-size: 14px; align-items: baseline; }
.act:first-child { border-top: 0; }
.act-t, .act-ip { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.act-ip { text-align: right; }
.act-who { font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.act-what { overflow-wrap: anywhere; }
.act.hot .act-what { color: #b3201a; font-weight: 600; }
@media (max-width: 980px) { .ow-row, .ow-fields, .act { grid-template-columns: 1fr; } .act-ip { text-align: left; } }

/* ---------- 0.9.0: ชนิดคลิป ยอดแพค แจ้งเตือน และหน้าจอมือถือ ---------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { font: 600 15px var(--sans); color: var(--text); background: transparent; border: 0; padding: 10px 8px; cursor: pointer; min-height: 44px; }
.seg button + button { border-left: 2px solid var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.seg button[data-mode="return"][aria-pressed="true"] { background: var(--tape); color: var(--tape-ink); }
.seg button:disabled { cursor: not-allowed; }
.seg button:disabled:not([aria-pressed="true"]) { opacity: .5; }
.seg button:focus-visible { outline: 3px solid var(--ink); outline-offset: -5px; }
.screen[data-mode="return"][data-state="idle"] { border-color: var(--tape); }
.screen[data-tall="true"] { aspect-ratio: 9 / 16; height: min(62vh, 640px); width: auto; max-width: 100%; max-height: none; }
#btnCancel { justify-self: start; padding: 6px 0; border: 0; background: none; text-decoration: underline; color: var(--muted); }
#factPair[data-ok="false"] { color: var(--warn); }
#factPair[data-ok="true"] { color: #0f6b35; }
#todayReturn { color: var(--text); font-weight: 600; }
.tag.ret { color: var(--tape-ink); border-color: #cdb100; background: var(--tape); }
.tag.pair { color: var(--text); border-color: var(--ink); background: var(--surface); }
.hist-head select { width: auto; flex: none; }
.play-others { align-items: center; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.play-others .btn { padding: 6px 10px; font-size: 14px; }

.stat-tbl th, .stat-tbl td { padding: 7px 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stat-tbl thead th small { font-weight: 400; color: var(--muted); }
.stat-bar { min-width: 190px; }
.stat-track { display: inline-block; width: 120px; height: 10px; background: var(--surface-2); border-radius: 999px; vertical-align: middle; margin-right: 10px; overflow: hidden; }
.stat-track i { display: block; height: 100%; background: var(--ink); border-radius: 999px; }
.stat-total th, .stat-total td { background: var(--surface-2); font-weight: 600; }
#owDays { width: auto; }

.alert-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.alert-events { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 0; display: grid; gap: 8px; }
.alert-events legend { font-weight: 600; font-size: 14px; color: var(--muted); padding: 0 6px; }
.alert-how summary { cursor: pointer; font-weight: 600; }
.alert-how ol { margin: 10px 0; padding-left: 22px; display: grid; gap: 6px; }
#alertState[data-bad="true"] { color: var(--rec); font-weight: 600; }

@media (max-width: 980px) {
  .alert-fields { grid-template-columns: 1fr; }
  /* สถานีแพคบนจอแคบ: เลื่อนทั้งหน้าได้ ไม่บีบให้พอดีจอ */
  body[data-view="pack"] { height: auto; }
  body[data-view="pack"] main { flex: 1 0 auto; }
  body[data-view="pack"] .view { height: auto; }
  #view-pack .stage { flex: none; }
  .bar { gap: 6px 12px; padding: 8px 12px; }
  .tabs { overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { white-space: nowrap; padding: 7px 10px; }
  .hist-head { flex-wrap: wrap; }
  .hist-head input { flex: 1 1 100%; }
  .strip { gap: 6px; }
  .pill b, .pill select { max-width: 16ch; }
}
/* มือถือและแท็บเล็ต: ไม่มีคีย์บอร์ด ซ่อนคำใบ้ปุ่มลัด และให้ปุ่มกดง่าย */
body[data-mobile] .keys { display: none; }
body[data-mobile] .status { min-height: 0; }
body[data-mobile] #btnMain { min-height: 60px; font-size: 20px; }
body[data-mobile] .screen[data-tall="true"] { height: min(56vh, 640px); }
body[data-mobile] .clip .acts .btn { padding: 9px 12px; }
/* มือถือ: ปุ่มเริ่มและจบคลิปติดขอบล่างของจอ ไม่ต้องเลื่อนหา */
body[data-mobile][data-view="pack"] .tabs.sub { display: none; }
body[data-mobile] .panel #modeSeg { order: -3; }
body[data-mobile] .panel #trackForm { order: -2; }
body[data-mobile] .guide span { bottom: auto; top: -44px; }
/* เตือนนาฬิกาเครื่องไม่ตรงกับเซิร์ฟเวอร์ */
.clock-warn { font-weight: 600; text-align: left; border-color: #ead9a0; background: #fff8d9; color: var(--warn); }
.clock-warn[data-level="bad"] { border-color: var(--rec); background: #fdecea; color: #b3201a; }

/* ---------- 0.10.0: แกะพัสดุที่ได้รับ และหน้าอัดตอนแกะสำหรับผู้รับของ ---------- */
.seg { grid-template-columns: repeat(3, 1fr); }
.seg button { font-size: 14px; padding-inline: 4px; }
.seg button[data-mode="receive"][aria-pressed="true"] { background: var(--tape); color: var(--tape-ink); }
.screen[data-mode="receive"][data-state="idle"] { border-color: var(--tape); }
.unbox-steps { border: 1px solid var(--line); border-left: 6px solid var(--tape); border-radius: 8px; background: var(--surface); padding: 10px 12px; font-size: 14px; }
.unbox-steps ol { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.unbox-steps li b { margin-right: 6px; }
.unbox-steps li span { color: var(--muted); }
.unbox-share { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 24px; }
.unbox-share > div { display: grid; gap: 12px; min-width: 0; }
.unbox-share input { font: 14px var(--mono); }
.unbox-share canvas { width: 180px; height: 180px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
@media (max-width: 980px) { .unbox-share { grid-template-columns: 1fr; } .unbox-share canvas { justify-self: start; } }

body.ub main { height: auto; padding: 16px; }
.ub-wrap { max-width: 640px; }
.ub-view { display: grid; gap: 16px; }
.ub-bar-title { color: #c9c9c4; font-weight: 600; margin-left: auto; }
.ub h1 { font-size: 30px; line-height: 1.25; }
.ub h1 mark { background: var(--tape); padding: 0 6px; }
.ub-shop { font-weight: 600; background: #fff7bf; border: 2px dashed var(--ink); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.ub-steps, .ub-how { margin: 0; padding-left: 22px; display: grid; gap: 10px; }
.ub-steps li b { display: block; }
.ub-steps li span { color: var(--muted); font-size: 15px; }
.ub-preset { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 0; display: grid; gap: 12px; }
.ub-preset legend { font-weight: 600; font-size: 14px; color: var(--muted); padding: 0 6px; }
.ub-preset small { display: block; color: var(--muted); font-size: 14px; }
.ub-screen { position: relative; border-radius: var(--radius); overflow: hidden; background: #111; border: 4px solid var(--ok); aspect-ratio: 16 / 9; width: 100%; margin-inline: auto; }
.ub-screen[data-state="recording"] { border-color: var(--rec); }
.ub-screen[data-tall="true"] { aspect-ratio: 9 / 16; height: min(58vh, 640px); width: auto; max-width: 100%; }
.ub-screen canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.ub-progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.ub-progress i { display: block; height: 100%; width: 0; background: var(--ink); }
.ub-progress[data-low="true"] i { background: var(--rec); }
.ub-panel { display: grid; gap: 8px; }
.ub-step { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; background: var(--surface); border: 2px solid var(--ink); border-radius: 10px; padding: 12px 14px; }
.ub-step-n { font: 700 18px var(--mono); background: var(--tape); border-radius: 8px; padding: 6px 10px; }
.ub-step b { font-size: 19px; }
.ub-step p { color: var(--muted); font-size: 15px; }
.ub-time { font: 600 18px var(--mono); font-variant-numeric: tabular-nums; }
.ub-time span + span { color: var(--muted); font-size: 15px; }
.ub-actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; }
.ub-actions .btn.big { min-height: 60px; font-size: 19px; }
.ub-actions #ubStop { grid-column: 1; grid-row: 1; padding: 13px 16px; }
body[data-ub="cam"] .ub-actions { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); }
body[data-ub="cam"] .foot { display: none; }
#ubPlayer { width: 100%; max-height: 60vh; background: #111; border-radius: 8px; }
.ub-save { display: grid; gap: 10px; }
#ubSaveNote[data-ok="true"] { color: #0f6b35; font-weight: 600; }
#ubSaveNote[data-ok="false"] { color: var(--warn); font-weight: 600; }
.ub-again { justify-content: space-between; }

/* ---------- 0.11.0: แพ็กเกจ คำสั่งซื้อ และวันหมดอายุ ---------- */
.plan-warn { text-decoration: none; }
.plan-line[data-level="warn"] { color: var(--warn); font-weight: 600; }
.plan-line[data-level="bad"] { color: var(--rec); font-weight: 600; }
.plans { display: grid; gap: 10px; }
.plan { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; border: 2px solid var(--line); border-radius: 10px; padding: 14px; cursor: pointer; background: var(--surface); }
.plan:has(input:checked) { border-color: var(--ink); box-shadow: 5px 5px 0 var(--tape); }
.plan input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--ink); }
.plan-body { display: grid; gap: 2px; }
.plan-body b { font-size: 18px; }
.plan-price { font: 700 20px var(--mono); }
.plan-spec { color: var(--muted); font-size: 14px; }
.buy-wrap > section { display: grid; gap: 18px; }
.pay-grid { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: start; }
.pay-grid canvas { width: 220px; height: 220px; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: block; }
.ord-file { cursor: pointer; text-align: center; display: block; }
.ord-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; counter-reset: s; }
.ord-steps li { counter-increment: s; border-top: 5px solid var(--line); padding-top: 8px; font-size: 14px; color: var(--muted); }
.ord-steps li::before { content: counter(s) ". "; }
.ord-steps li[data-state="done"] { border-color: var(--ok); color: var(--text); }
.ord-steps li[data-state="now"] { border-color: var(--tape); color: var(--text); }
.ord-help { border-left: 6px solid var(--tape); }
.orders { display: grid; gap: 8px; }
.order { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: grid; gap: 8px; }
.order[data-status="review"] { border: 2px solid var(--ink); box-shadow: 5px 5px 0 var(--tape); }
.order-main { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.order .row .btn { padding: 6px 12px; font-size: 14px; }
#orderNote[data-bad="true"] { color: var(--rec); font-weight: 600; }
.plan-form { display: grid; gap: 14px; margin-top: 14px; }
.plan-tbl input[type="text"], .plan-tbl input[type="number"] { min-width: 90px; padding: 7px 9px; }
.plan-tbl td { padding: 6px 8px; vertical-align: middle; }
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.slip-img { max-width: 100%; max-height: 75vh; display: block; margin-inline: auto; border-radius: 6px; }
.new-fields { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
@media (max-width: 980px) { .pay-grid, .plan-grid { grid-template-columns: 1fr; } .ord-steps { grid-template-columns: 1fr 1fr; } }

/* ---------- 0.11.1: หน้าแนะนำสองฝั่ง ---------- */
.hero-alt { font-weight: 600; }
.sides { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 8px; align-content: start; }
.side-n { justify-self: start; font: 700 13px var(--sans); background: var(--ink); color: var(--on-ink); border-radius: 999px; padding: 2px 12px; }
.side:nth-child(2) .side-n { background: var(--tape); color: var(--tape-ink); }
.side b { font-size: 20px; }
.side p { color: var(--muted); font-size: 15px; }
.side .btn { justify-self: start; margin-top: 4px; }
@media (max-width: 980px) { .sides { grid-template-columns: 1fr; } }

/* ---------- 0.12.1: หน้าวิธีใช้แยกหมวด ---------- */
.crumb { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.guide-page .row { flex-wrap: wrap; }
.btn.big-inline { font-size: 18px; padding: 12px 22px; }
.plain-ol { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.guide-page .sec.split > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: grid; gap: 10px; align-content: start; }
.guide-next { border-left: 6px solid var(--tape); }
.side .row { flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.side .row .btn { margin-top: 0; }
#pillShop[data-empty="true"] b { color: var(--muted); font-weight: 400; }
a.btn { text-decoration: none; }

/* ---------- 0.13.0: หน้าอัดแยกสามหมวด เห็นชัดว่ากำลังอยู่หมวดไหน ---------- */
body { --mode: #111111; --mode-ink: #ffffff; }
body[data-mode="return"] { --mode: #c2410c; --mode-ink: #ffffff; }
body[data-mode="receive"] { --mode: #1d4ed8; --mode-ink: #ffffff; }
.modebar { display: grid; gap: 6px; }
.modebar .seg { grid-template-columns: repeat(3, 1fr); border-color: var(--mode); border-width: 3px; }
.modebar .seg button { display: grid; gap: 0; padding: 8px 10px; text-align: center; font-size: 16px; min-height: 54px; border-left-color: var(--mode); }
.modebar .seg button b { font-size: 17px; }
.modebar .seg button small { font-weight: 400; font-size: 12.5px; opacity: .8; }
.modebar .seg button[aria-pressed="true"], .modebar .seg button[data-mode][aria-pressed="true"] { background: var(--mode); color: var(--mode-ink); }
.modebar .seg button:disabled:not([aria-pressed="true"]) { opacity: .4; }
.mode-now { font-size: 14px; color: var(--muted); }
.mode-now b { color: var(--mode); font-size: 16px; }
.mode-now a { margin-left: 6px; }
.mode-chip { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: var(--mode); color: var(--mode-ink); font-weight: 700; font-size: 16px; padding: 6px 18px; border-radius: 999px; border: 2px solid #fff; white-space: nowrap; pointer-events: none; }
body[data-view="pack"] .bar { border-bottom-color: var(--mode); }
body[data-mode="pack"][data-view="pack"] .bar { border-bottom-color: var(--tape); }
body[data-view="pack"] .status[data-state="idle"] { border-left-color: var(--mode); }
body[data-view="pack"] .status[data-state="idle"] .status-label { color: var(--mode); }
body[data-mode="pack"] .status[data-state="idle"] { border-left-color: var(--ok); }
body[data-mode="pack"] .status[data-state="idle"] .status-label { color: var(--ok); }
.screen[data-mode="return"][data-state="idle"], .screen[data-mode="receive"][data-state="idle"] { border-color: var(--mode); }
.unbox-steps { border-left-color: var(--mode); }
.tabs a[data-nav="return"][aria-current="page"] { background: #c2410c; color: #fff; }
.tabs a[data-nav="receive"][aria-current="page"] { background: #1d4ed8; color: #fff; }
@media (max-width: 980px) { .modebar .seg button small { display: none; } .modebar .seg button { min-height: 46px; } .mode-now span { display: none; } }
body[data-mobile] .panel #modeSeg { order: 0; }
.setup-wrap { max-width: 1200px; margin: 0 auto 20px; }
.side-link { font-size: 14px; }
.hero-cta .btn.big { width: auto; }
body[data-mobile] .mode-chip { top: auto; bottom: 10px; left: auto; right: 10px; transform: none; font-size: 14px; padding: 4px 12px; }
/* ปุ่มเริ่ม/จบ/ยกเลิกอยู่เหนือการ์ดลำดับการแกะเสมอ จอเตี้ยก็ยังกดถึง ส่วนที่เหลือเลื่อนดูในแผงขวาได้ */
.panel .unbox-steps { order: 1; }
.panel .facts, .panel .today, .panel .meter, .panel .sync { order: 2; }
@media (min-width: 981px) {
  #view-pack .stage { grid-template-rows: minmax(0, 1fr); }
  #view-pack .panel { max-height: 100%; overflow-y: auto; padding-right: 2px; }
  #view-pack .panel > * { flex-shrink: 0; }
  #view-pack .screen { max-height: 100%; }
}

/* ---------- 0.14.0: หน้าแอดมิน ดูการรับคลิปเข้าเซิร์ฟเวอร์ ---------- */
#trafficCard h3 { font-size: 16px; margin: 6px 0 0; }
.tf-now { display: grid; gap: 6px; }
.tf-speed { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.tf-speed b { font-size: 30px; font-variant-numeric: tabular-nums; }
#tfBar { display: block; height: 100%; background: var(--ink); }
.tf-spark { width: 100%; height: 64px; display: block; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.tf-area { fill: rgba(17, 17, 17, .12); }
.tf-line { fill: none; stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.tf-capline { stroke: var(--rec); stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.tf-range { max-width: 420px; grid-template-columns: repeat(3, 1fr); }
.tf-bars { width: 100%; height: 140px; display: block; }
.tf-bar { fill: var(--ink); }
.tf-bar:hover { fill: #c2410c; }
.tf-base { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.tf-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tf-sub { display: block; color: var(--muted); font-weight: 400; font-size: 12px; max-width: 34ch; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 0.15.0: มือถือ หน้าอัดเป็นจอกล้องเต็มจอ ไม่เลื่อน ---------- */
html[data-cam], html[data-cam] body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html[data-cam] body { position: fixed; inset: 0 0 auto 0; height: var(--vvh, 100dvh); min-height: 0; display: flex; flex-direction: column; background: #000; touch-action: manipulation; }
html[data-cam] .bar { flex: none; flex-wrap: nowrap; gap: 8px; padding: 4px 8px; padding-top: calc(4px + env(safe-area-inset-top)); border-bottom-width: 3px; }
html[data-cam] .bar .brand-name { display: none; }
html[data-cam] .bar .tabs a { padding: 7px 10px; font-size: 14px; }
html[data-cam] body[data-state="starting"] .bar, html[data-cam] body[data-state="recording"] .bar, html[data-cam] body[data-state="saving"] .bar { display: none; }
html[data-cam] main { flex: 1 1 0; min-height: 0; padding: 0; display: flex; }
html[data-cam] #view-pack { flex: 1; min-width: 0; min-height: 0; height: auto; display: flex; flex-direction: column; gap: 0; position: relative; }
html[data-cam] #view-pack .modebar { position: absolute; top: 8px; left: 8px; right: 8px; z-index: 5; }
html[data-cam] #view-pack .modebar .seg { border: 0; border-radius: 999px; background: rgba(0, 0, 0, .6); padding: 3px; gap: 3px; backdrop-filter: blur(6px); }
html[data-cam] #view-pack .modebar .seg button { min-height: 38px; padding: 4px 6px; border: 0; border-radius: 999px; color: #fff; }
html[data-cam] #view-pack .modebar .seg button b { font-size: 14.5px; }
html[data-cam] #view-pack .modebar .seg button small { display: none; }
html[data-cam] #view-pack .modebar .seg button[aria-pressed="true"] { background: #fff; color: #111; }
html[data-cam] body[data-mode="return"] #view-pack .modebar .seg button[aria-pressed="true"] { background: #c2410c; color: #fff; }
html[data-cam] body[data-mode="receive"] #view-pack .modebar .seg button[aria-pressed="true"] { background: #1d4ed8; color: #fff; }
html[data-cam] body:not([data-state="idle"]) #view-pack .modebar { display: none; }
html[data-cam] #view-pack .stage { flex: 1 1 0; min-height: 0; height: auto; display: flex; flex-direction: column; gap: 0; }
html[data-cam] #view-pack .screen { flex: 1 1 0; min-height: 0; width: 100%; height: auto; max-height: none; aspect-ratio: auto; border: 0; border-radius: 0; background: #000; margin: 0; }
html[data-cam] #view-pack .screen::after { content: ""; position: absolute; inset: 0; pointer-events: none; border: 0 solid var(--rec); }
html[data-cam] #view-pack .screen[data-state="recording"]::after { border-width: 4px; }
html[data-cam] #view-pack .screen canvas { width: 100%; height: 100%; object-fit: contain; }
html[data-cam] #view-pack .mode-chip { display: none; }
html[data-cam] #view-pack .guide span { top: auto; bottom: -46px; font-size: 13px; }
html[data-cam] #view-pack .screen-msg { overflow-y: auto; }
html[data-cam] #view-pack .panel { flex: none; position: relative; gap: 6px; max-height: none; overflow: visible; background: #111; color: #fff; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
html[data-cam] #view-pack .panel > * { order: 0; }
html[data-cam] #view-pack .status { background: transparent; border: 0; border-radius: 0; padding: 0 96px 0 2px; min-height: 30px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; color: #fff; }
html[data-cam] #view-pack .status .status-label { font-size: 14px; color: #fff; }
html[data-cam] #view-pack .status[data-state="recording"] .status-label { color: #ff7a70; }
html[data-cam] #view-pack .status[data-state="warn"] .status-label, html[data-cam] #view-pack .status[data-state="nofolder"] .status-label, html[data-cam] #view-pack .status[data-state="needperm"] .status-label { color: var(--tape); }
html[data-cam] #view-pack .status .status-code { font-size: 15px; line-height: 1.3; color: #fff; }
html[data-cam] #view-pack .status .status-time { font-size: 15px; color: #fff; }
html[data-cam] #view-pack .status .status-help { flex-basis: 100%; font-size: 12.5px; color: #bdbdb8; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[data-cam] #view-pack .setup { color: #fff; }
html[data-cam] #view-pack #trackForm { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch; }
html[data-cam] #view-pack #trackForm label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
html[data-cam] #view-pack #trackInput { min-height: 54px; font-size: 17px; padding: 8px 12px; min-width: 0; }
html[data-cam] #view-pack #btnMain { position: static; width: auto; min-height: 54px; min-width: 124px; padding: 8px 18px; font-size: 18px; white-space: nowrap; box-shadow: none; }
html[data-cam] #view-pack #btnCancel { grid-column: 1 / -1; justify-self: start; color: #d6d6d2; padding: 2px 2px; min-height: 30px; font-size: 14px; }
.cam-more { position: absolute; top: 6px; right: 10px; font: 600 13.5px var(--sans); color: #fff; background: #2a2a2a; border: 1px solid #555; border-radius: 999px; padding: 6px 14px; min-height: 32px; cursor: pointer; }
.cam-more[data-warn="true"]::after { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--tape); margin-left: 7px; }
.msheet-shade { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 40; }
.msheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 84%; z-index: 41; display: flex; flex-direction: column; background: var(--bg); color: var(--text); border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
.msheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.msheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 14px; display: grid; gap: 14px; }
.msheet .mode-now span { display: inline; }
.msheet .strip .pill.push { margin-left: 0; }
.msheet .today, .msheet .meter { border-top: 1px solid var(--line); padding-top: 12px; }
.cam-rotate { display: none; position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); background: var(--tape); color: var(--tape-ink); font-weight: 600; font-size: 13px; padding: 6px 12px; border-radius: 999px; white-space: nowrap; pointer-events: none; }
html[data-cam] .toast { top: calc(58px + env(safe-area-inset-top)); max-width: calc(100vw - 24px); }
/* เครื่องที่ล็อกแนวตั้งไม่ได้ (iPhone ในเบราว์เซอร์): จัดจอนอนให้ยังกดถึง ภาพอยู่ซ้าย ปุ่มอยู่ขวา */
@media (orientation: landscape) {
  html[data-cam] #view-pack .stage { flex-direction: row; }
  html[data-cam] #view-pack .panel { width: min(48%, 380px); justify-content: center; padding: 8px calc(10px + env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) 10px; }
  html[data-cam] #view-pack .modebar { right: calc(min(48%, 380px) + 8px); left: calc(8px + env(safe-area-inset-left)); }
  html[data-cam] #view-pack .status { padding-right: 0; padding-top: 34px; }
  html[data-cam] #view-pack #trackForm { grid-template-columns: 1fr; }
  html[data-cam] #view-pack .cam-rotate { display: block; }
  html[data-cam] #view-pack .guide span { display: none; }
  html[data-cam] .bar { padding-left: calc(8px + env(safe-area-inset-left)); }
}
html[data-cam] #view-pack .stage { align-items: stretch; }
html[data-cam] #view-pack .screen canvas { position: absolute; inset: 0; }
html[data-cam] #view-pack .panel { align-self: stretch; width: auto; min-width: 0; box-sizing: border-box; }
html[data-cam] #view-pack .status, html[data-cam] #view-pack .status .status-help { min-width: 0; max-width: 100%; }
@media (orientation: landscape) { html[data-cam] #view-pack .panel { width: min(48%, 380px); flex: none; } }
html[data-cam] .toast { left: 10px; right: 10px; transform: none; width: auto; max-width: none; font-size: 14px; padding: 10px 14px; }
html[data-cam] body[data-state="recording"] #view-pack #trackInput, html[data-cam] body[data-state="saving"] #view-pack #trackInput { display: none; }
html[data-cam] body[data-state="recording"] #view-pack #btnMain, html[data-cam] body[data-state="saving"] #view-pack #btnMain { grid-column: 1 / -1; min-height: 60px; font-size: 20px; }

/* หน้าอัดตอนแกะของผู้รับ: จอกล้องเต็มจอแบบเดียวกับหน้าอัดของร้าน */
html[data-ubcam], html[data-ubcam] body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html[data-ubcam] body { position: fixed; inset: 0 0 auto 0; height: var(--vvh, 100dvh); min-height: 0; display: flex; flex-direction: column; background: #000; touch-action: manipulation; }
html[data-ubcam] .bar, html[data-ubcam] .foot { display: none; }
html[data-ubcam] main { flex: 1 1 0; min-height: 0; height: auto; padding: 0; display: flex; }
html[data-ubcam] .ub-wrap { flex: 1; min-width: 0; min-height: 0; max-width: none; width: 100%; margin: 0; padding: 0; display: flex; }
html[data-ubcam] #ubCam { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 0; }
html[data-ubcam] .ub-screen { flex: 1 1 0; min-height: 0; width: 100%; height: auto; max-width: none; aspect-ratio: auto; border: 0; border-radius: 0; background: #000; margin: 0; }
html[data-ubcam] .ub-screen::after { content: ""; position: absolute; inset: 0; pointer-events: none; border: 0 solid var(--rec); }
html[data-ubcam] .ub-screen[data-state="recording"]::after { border-width: 4px; }
html[data-ubcam] .ub-screen canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
html[data-ubcam] .ub-progress { flex: none; border-radius: 0; background: #333; height: 6px; }
html[data-ubcam] .ub-progress i { background: var(--tape); }
html[data-ubcam] .ub-panel { flex: none; background: #111; color: #fff; padding: 8px 12px 0; gap: 4px; }
html[data-ubcam] .ub-panel .field span { color: #bdbdb8; font-size: 13px; }
html[data-ubcam] .ub-panel .field input { min-height: 50px; font-size: 17px; }
html[data-ubcam] .ub-panel .note { color: #bdbdb8; font-size: 13px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
html[data-ubcam] .ub-step { background: transparent; border: 0; padding: 0; color: #fff; gap: 10px; }
html[data-ubcam] .ub-step b { font-size: 17px; }
html[data-ubcam] .ub-step p { color: #cfcfca; font-size: 13.5px; margin: 0; }
html[data-ubcam] .ub-time { color: #fff; margin: 0; }
html[data-ubcam] .ub-time span + span { color: #bdbdb8; }
html[data-ubcam] .ub-actions { flex: none; position: static; background: #111; padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); }
html[data-ubcam] .ub-actions .btn.ghost { color: #e6e6e2; }
html[data-ubcam] .ub-actions .btn.big { min-height: 56px; }
@media (orientation: landscape) and (max-height: 560px) {
  html[data-ubcam] #ubCam { display: grid; grid-template-columns: minmax(0, 1fr) min(48%, 380px); grid-template-rows: auto minmax(0, 1fr) auto; background: #111; }
  html[data-ubcam] .ub-screen { grid-column: 1; grid-row: 1 / -1; height: 100%; }
  html[data-ubcam] .ub-progress { grid-column: 2; grid-row: 1; }
  html[data-ubcam] .ub-panel { grid-column: 2; grid-row: 2; align-content: center; overflow-y: auto; }
  html[data-ubcam] .ub-actions { grid-column: 2; grid-row: 3; }
}
html[data-ubcam] .ub-actions, html[data-ubcam] .ub-panel { min-width: 0; box-sizing: border-box; }
html[data-ubcam] .ub-actions .btn { min-width: 0; }

/* ---------- 0.16.0: จอแคบ เมนูบนเหลือสามหมวดกับปุ่ม “เมนู” ---------- */
.nav-btn { display: none; font: 600 14px var(--sans); color: var(--on-ink); background: #2a2a2a; border: 1px solid #555; border-radius: 8px; padding: 7px 12px; min-height: 36px; cursor: pointer; margin-left: auto; }
.nav-shade { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 60; }
.nav-sheet { position: fixed; top: 0; right: 0; bottom: 0; width: min(320px, 86vw); z-index: 61; background: var(--ink); color: var(--on-ink); display: flex; flex-direction: column; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) 0; box-shadow: -8px 0 30px rgba(0, 0, 0, .4); }
.nav-sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid #333; }
.nav-list { overflow-y: auto; overscroll-behavior: contain; padding: 8px; display: grid; gap: 2px; }
.nav-list a { display: block; padding: 13px 14px; border-radius: 8px; color: var(--on-ink); text-decoration: none; font-weight: 600; font-size: 16px; }
.nav-list a[aria-current="page"] { background: var(--tape); color: var(--tape-ink); }
@media (max-width: 760px), (orientation: landscape) and (max-height: 520px) {
  .nav-btn { display: inline-flex; align-items: center; }
  .bar { flex-wrap: nowrap; gap: 6px; padding: 8px 10px; }
  .bar .brand-name { display: none; }
  .bar .tabs { overflow: visible; flex: 1 1 auto; min-width: 0; display: flex; gap: 2px; }
  .bar .tabs a { display: none; }
  .bar .tabs a[data-cat] { display: block; padding: 7px 8px; font-size: 14px; white-space: nowrap; }
  .bar .tabs.sub, .bar .chip { display: none; }
  html[data-cam] .bar .tabs { display: none; }
  html[data-cam] .bar .brand-name { display: inline; }
}
/* ดูคลิปบนมือถือ: หน้าต่างเต็มจอ วิดีโออยู่บน ข้อมูลและปุ่มเลื่อนดูด้านล่าง */
.play-full { margin-top: 8px; }
@media (max-width: 760px), (orientation: landscape) and (max-height: 520px) {
  #dlgPlay { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; padding: calc(10px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; }
  #dlgPlay .dlg-head { position: sticky; top: 0; background: var(--surface); z-index: 2; margin: 0 -12px 10px; padding: 6px 12px; }
  #dlgPlay video { max-height: 68dvh; border-radius: 0; margin: 0 -12px; width: calc(100% + 24px); }
}

/* ---------- 0.17.0: หลังบ้านแยกหน้า บัญชีรายคน บันทึกการกระทำ ดูคลิปของร้าน ---------- */
.bar .tabs.admin-tabs { flex: 1 1 auto; min-width: 0; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: thin; }
.bar .tabs.admin-tabs a { white-space: nowrap; }
.admin-who { color: #c9c9c4; font-size: 13.5px; white-space: nowrap; }
.admin-title { font-size: 26px; margin: 0 0 4px; }
.warn-link { display: inline-block; margin-top: 4px; font-size: 13.5px; }
.shops-head input[type="search"], .clip-dlg input[type="search"] { margin-left: auto; width: min(340px, 100%); min-height: 40px; padding: 6px 12px; }
.clip-dlg { height: auto; max-height: 92vh; overflow-y: auto; }
dialog.clip-dlg > * + * { margin-top: 12px; }
.clip-dlg .dlg-head { margin-bottom: 0; }
.clip-warn { background: #fff8d9; border: 1px solid #ead9a0; border-left: 6px solid var(--tape); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.clip-dlg video { max-height: 52vh; }
.clip-list { max-height: 44vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.role-help { margin: 4px 0 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.role-help b { color: var(--text); }
.audit-tbl td { white-space: normal; vertical-align: top; }
.audit-tbl td:first-child { white-space: nowrap; }
.audit-detail { color: var(--muted); font-size: 13.5px; max-width: 46ch; overflow-wrap: anywhere; }
#auditCard .row .field { min-width: 180px; }
@media (max-width: 760px) { .admin-who { display: none; } .bar .tabs.admin-tabs { display: flex; } }

/* ---------- 0.18.0: หน้ากั้นเมื่อเปิดจากในแอปแชต และป็อปอัปยืนยันเลขที่สแกนได้ ---------- */
.inapp { z-index: 300; }
.inapp-card { display: grid; gap: 12px; max-width: 460px; }
.inapp-card h1 { font-size: 26px; }
.inapp-card .btn { width: 100%; text-align: center; justify-content: center; }
.inapp-link { width: 100%; font: 13px var(--mono); padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
/* ไม่ใช้ display:grid กับตัว dialog เอง: Safari บน iPhone ยืดกล่องจนเต็มจอ */
.dlg-scan { text-align: center; width: min(420px, calc(100vw - 24px)); height: auto; max-height: calc(100% - 24px); overflow-y: auto; top: 50%; bottom: auto; margin-block: 0; transform: translateY(-50%); }
dialog.dlg-scan > * + * { margin-top: 10px; }
.scan-k { color: var(--muted); font-size: 14px; margin: 0; }
.scan-code { font: 700 28px var(--mono); overflow-wrap: anywhere; margin: 0; padding: 10px; background: #fff7bf; border: 2px dashed var(--ink); border-radius: 10px; }
.scan-actions { display: grid; gap: 8px; }
.scan-actions .btn.big { min-height: 58px; font-size: 19px; }
.clip-step2 { display: grid; gap: 12px; }

/* ---------- 0.19.0: หมวดรับฝากส่ง รูปประกอบ และหน้ารอเลขพัสดุ ---------- */
body[data-mode="dropoff"] { --mode: #6d28d9; --mode-ink: #ffffff; }
.modebar .seg { grid-template-columns: repeat(4, 1fr); }
.tabs a[data-nav="dropoff"][aria-current="page"] { background: #6d28d9; color: #fff; }
html[data-cam] body[data-mode="dropoff"] #view-pack .modebar .seg button[aria-pressed="true"] { background: #6d28d9; color: #fff; }
html[data-cam] #view-pack .modebar .seg button b { font-size: 13px; }
.screen[data-mode="dropoff"][data-state="idle"] { border-color: var(--mode); }
.sides { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1180px) { .sides { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) { .sides { grid-template-columns: 1fr; } }
.tabs a[data-nav="jobs"][data-count]:not([data-count=""])::after { content: attr(data-count); display: inline-block; margin-left: 6px; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--rec); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }
@media (max-width: 760px), (orientation: landscape) and (max-height: 520px) {
  .bar .tabs a[data-cat][data-short] { font-size: 0; padding: 7px 7px; }
  .bar .tabs a[data-cat][data-short]::before { content: attr(data-short); font-size: 14px; }
}
.dlg-shot img { display: block; width: 100%; max-height: 52vh; object-fit: contain; background: #000; border-radius: 8px; }
.job-big { font-size: 64px; letter-spacing: 2px; }
.dlg-bindscan video { display: block; width: 100%; max-height: 56vh; background: #000; border-radius: 8px; object-fit: contain; }
.dlg-bindscan .dlg-head { margin-bottom: 0; text-align: left; }
.play-photos { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.play-photos figure { margin: 0; width: min(220px, 31%); }
.play-photos img { width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; }
.play-photos figcaption { font-size: 13px; color: var(--muted); margin-top: 4px; }
.jobs-wrap { max-width: 980px; display: grid; gap: 14px; }
.job-bind { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 10px; align-items: end; }
.job-bind input { font: 600 18px var(--mono); min-height: 52px; }
.job-bind .btn.big { min-height: 52px; white-space: nowrap; }
.job-msg { font-weight: 600; min-height: 1.5em; margin: 0; }
.job-msg[data-bad="true"] { color: #b3201a; }
.jobs { display: grid; gap: 10px; }
.job { display: grid; grid-template-columns: 110px auto 1fr auto; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid #6d28d9; border-radius: var(--radius); padding: 12px 14px; }
.job[data-status="bound"] { border-left-color: var(--ok); }
.job-code b { display: block; font: 700 30px var(--mono); line-height: 1.1; }
.job-code small { color: var(--muted); font: 12px var(--mono); }
.job-thumbs { display: flex; gap: 6px; }
.job-thumbs img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); }
.job-nothumb { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 6px; border: 1px dashed var(--line); color: var(--muted); font-size: 12px; }
.job-info small { color: var(--muted); display: block; }
@media (max-width: 760px) {
  .job-bind { grid-template-columns: 1fr; }
  .job { grid-template-columns: 1fr auto; }
  .job-info, .job .acts { grid-column: 1 / -1; }
}
.sticker-form { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.sticker-form .field { width: 140px; }
.sticker-sheet { display: grid; gap: 0; background: #fff; }
.sticker { display: grid; justify-items: center; gap: 2px; padding: 10px 6px; border: 1px dashed #bbb; text-align: center; break-inside: avoid; }
.sticker canvas { width: min(100%, 110px); height: auto; }
.sticker b { font: 700 13px var(--mono); }
.sticker small { font-size: 9px; color: #555; }
@media print {
  .no-print, .bar, .foot, .skip, .nav-btn, .nav-sheet, .nav-shade { display: none !important; }
  body, main { background: #fff; padding: 0; margin: 0; }
  .sticker-page { max-width: none; padding: 0; }
  .sticker { border-color: #ddd; }
}

/* จอคอมขนาดกลาง: เมนูมีสิบกว่ารายการ บีบระยะให้อยู่แถวเดียว */
@media (min-width: 761px) and (max-width: 1500px) {
  .bar .tabs { gap: 2px; }
  .bar .tabs a { padding: 7px 9px; font-size: 14.5px; white-space: nowrap; }
  .bar .tabs.sub a { padding: 6px 7px; font-size: 13px; }
  .bar .brand-name { font-size: 17px; }
}
@media (min-width: 761px) and (max-width: 1180px) {
  .bar .tabs a[data-cat][data-short] { font-size: 0; }
  .bar .tabs a[data-cat][data-short]::before { content: attr(data-short); font-size: 14.5px; }
}

/* 0.19.1 แถบสามขั้นของงานรับฝากส่ง */
.drop-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.drop-steps[hidden] { display: none; }
.drop-steps li { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 6px 8px; border-radius: 10px; border: 2px solid var(--line, #d6d6d0); background: #fff; color: #6b6b66; font-weight: 600; font-size: 14px; white-space: nowrap; }
.drop-steps li b { flex: none; width: 22px; height: 22px; border-radius: 50%; background: #d6d6d0; color: #111; display: grid; place-items: center; font-size: 13px; }
.drop-steps li span { overflow: hidden; text-overflow: ellipsis; }
.drop-steps li[data-at="now"] { border-color: #6d28d9; background: #6d28d9; color: #fff; }
.drop-steps li[data-at="now"] b { background: #fff; color: #6d28d9; }
.drop-steps li[data-at="done"] { border-color: #15803d; color: #15803d; }
.drop-steps li[data-at="done"] b { background: #15803d; color: #fff; font-size: 0; }
.drop-steps li[data-at="done"] b::before { content: "✓"; font-size: 13px; }
html[data-cam] #view-pack .drop-steps { gap: 4px; }
html[data-cam] #view-pack .drop-steps li { padding: 3px 6px; font-size: 13px; background: #1c1c1c; border-color: #3a3a3a; color: #b5b5b0; border-width: 1px; }
html[data-cam] #view-pack .drop-steps li b { width: 18px; height: 18px; font-size: 12px; background: #3a3a3a; color: #fff; }
html[data-cam] #view-pack .drop-steps li[data-at="now"] { background: #6d28d9; border-color: #6d28d9; color: #fff; }
html[data-cam] #view-pack .drop-steps li[data-at="done"] { border-color: #22c55e; color: #86efac; }
html[data-cam] #view-pack .drop-steps li[data-at="done"] b { font-size: 0; background: #15803d; }
