:root {
  --green: #0ca35c;
  --green-dark: #067a3e;
  --green-soft: #e6f9ef;
  --green-line: #c4ecd7;
  --pink: #ff5fa2;
  --pink-dark: #e23d84;
  --pink-soft: #ffe9f2;
  --pink-line: #ffd0e3;
  --text: #17241c;
  --muted: #6b7a71;
  --line: #e2e9e4;
  --danger: #d64541;
  --bg: #f6faf7;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
}

/* ---------- Formal theme : เฉพาะฝั่งผู้ใช้ (ไม่กระทบหน้า admin) ---------- */
body.app-nav {
  --green: #0b7a45;
  --green-dark: #075c34;
  --green-soft: #eef6f1;
  --green-line: #cfe3d7;
  --text: #1b2420;
  --muted: #5c6a63;
  --line: #d9e0dc;
  --danger: #c0392b;
  --bg: #f1f4f2;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 10px;
  background: #f1f4f2;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

body {
  font-family: "Sarabun", sans-serif;
  background:
    radial-gradient(900px 420px at 88% -10%, rgba(255, 95, 162, 0.10), transparent 60%),
    radial-gradient(700px 400px at -10% 0%, rgba(12, 163, 92, 0.10), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

/* ---------- ฟอนต์ (Sarabun เป็นหลัก = หน้าตาทางการกว่า Prompt) ---------- */
body.app-nav,
body.app-nav input,
body.app-nav textarea,
body.app-nav select,
body.app-nav button {
  font-family: "Sarabun", "Prompt", sans-serif;
}

body.app-nav { font-size: 16px; }

/* ---------- ปุ่มตั้งค่า (เฟือง) บนแถบ nav ---------- */
.settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--green-dark);
  cursor: pointer;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.settings-btn:hover { background: var(--green-soft); }
.settings-btn svg { width: 20px; height: 20px; }

@keyframes settingsFade { from { opacity: 0; } to { opacity: 1; } }

@keyframes settingsPop {
  0% { opacity: 0; transform: translateY(14px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- ตั้งค่าชื่อ / ตำแหน่ง (popup) ---------- */
.settings-gate {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 14px;
  background: rgba(23, 36, 28, 0.55);
  animation: settingsFade 0.25s ease both;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.settings-gate.hidden { display: none; }

.settings-box {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(16, 32, 24, 0.18);
  padding: 24px 22px 22px;
  box-sizing: border-box;
}

.settings-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
}
.settings-close:hover { background: #eef1ef; color: var(--text); }

.settings-title {
  margin: 0 0 6px;
  padding-right: 34px;
  font-size: 18px;
  color: var(--text);
  font-weight: 700;
  line-height: 1.3;
}

.settings-sub {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.settings-fields {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.settings-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin: 4px 0 6px;
}

.settings-input {
  width: 100%;
  box-sizing: border-box;
  padding: 13px 15px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fbfdfc;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 14px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.settings-input:focus { border-color: var(--green); background: #fff; box-shadow: 0 0 0 4px rgba(14, 159, 88, 0.14); }
.settings-input.invalid { border-color: #d64541 !important; }

.settings-btn-save {
  width: 100%;
  margin-top: 6px;
  padding: 13px;
  border-radius: 6px;
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.2s ease;
}
.settings-btn-save:hover { background: var(--green-dark); border-color: var(--green-dark); }
.settings-btn-save:disabled { opacity: 0.65; cursor: default; }

.settings-err { margin: 12px 0 0; font-size: 13px; color: #d4382f; text-align: center; }

/* ---------- หน้าตั้งค่า: หัวเรื่อง + แถวข้อมูล + ปุ่ม ---------- */
.settings-head { margin: 0 0 18px; }
.settings-ver {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.3px;
}

.settings-rows {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fafcfb;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  font-size: 14px;
}
.settings-row + .settings-row { border-top: 1px solid var(--line); }

.sr-k { flex: 0 0 auto; color: var(--muted); font-weight: 600; }
.sr-v {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-weight: 700;
  color: var(--text);
  text-align: right;
  overflow-wrap: anywhere;
}
.sr-code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13.5px;
  letter-spacing: 0.4px;
  color: var(--green-dark);
}
.sr-copy {
  flex: 0 0 auto;
  padding: 5px 10px;
  border: 1px solid var(--green-line);
  border-radius: 4px;
  background: #fff;
  color: var(--green-dark);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.sr-copy:hover { background: var(--green-soft); }
.settings-kp-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.settings-kp-actions .sr-copy:disabled {
  opacity: 0.5;
  cursor: default;
}

.settings-section {
  margin: 22px 0 10px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
}

.settings-note {
  margin: 10px 0 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

.settings-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.settings-actions > * { flex: 1 1 0; }

.settings-btn-ghost,
.settings-btn-danger {
  padding: 12px 10px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.settings-btn-ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}
.settings-btn-ghost:hover { background: #f4f6f5; }
.settings-btn-danger {
  border: 1px solid #e8c3c0;
  background: #fdf5f4;
  color: var(--danger);
}
.settings-btn-danger:hover { background: #fbeceb; }

/* หัวกล่อง: ชื่อเรื่อง + เวอร์ชัน ซ้าย / ปุ่มปิด ขวา (ไม่ลอยทับ) */
.settings-top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fff;
  padding: 2px 0 10px;
}
.settings-top .settings-head {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}
.settings-top .settings-title {
  margin: 0 0 2px;
  padding-right: 0;
  line-height: 1.35;
}
.settings-top .settings-ver {
  margin: 0;
  line-height: 1.4;
}
.settings-top .settings-close {
  position: static;
  flex: 0 0 auto;
  margin-top: -4px;
}

/* ---------- หน้าตั้งค่า: ย่อให้พอดีจอเล็ก ---------- */
@media (max-width: 430px) {
  .settings-gate {
    padding: 12px 10px;
    align-items: flex-start;
  }
  .settings-box {
    padding: 20px 16px 18px;
    border-radius: 8px;
    max-height: calc(100dvh - 24px);
  }
  .settings-title { font-size: 18px; }
  .settings-head { margin: 0 0 14px; }
  .settings-fields { margin-top: 15px; padding-top: 13px; }
  .settings-label { font-size: 12.5px; margin: 3px 0 5px; }
  .settings-input { padding: 11px 13px; margin-bottom: 11px; font-size: 16px; }
  .settings-btn-save { padding: 13px; font-size: 15px; }
  .settings-rows { border-radius: 12px; }
  .settings-row { padding: 10px 12px; font-size: 13.5px; gap: 8px; }
  .sr-code { font-size: 13px; }
  .sr-copy { padding: 4px 9px; font-size: 11.5px; }
  .settings-section { margin: 17px 0 8px; font-size: 12px; }
  .settings-note { margin: 8px 0 0; font-size: 12px; }
  .settings-actions { margin-top: 17px; padding-top: 14px; gap: 8px; }
  .settings-btn-ghost,
  .settings-btn-danger { padding: 11px 6px; font-size: 13.5px; }
}

/* จอสั้น (แนวนอน/คีย์บอร์ดเปิด) ต้องเริ่มจากบนและเลื่อนได้ */
@media (max-height: 680px) {
  .settings-gate { align-items: flex-start; padding: 12px 10px; }
  .settings-box { max-height: calc(100dvh - 24px); }
}

/* ---------- เกตติ้งสมัครบัญชี / เข้าสู่ระบบ (vg-*) ---------- */
@keyframes vgFade { from { opacity: 0; } to { opacity: 1; } }

.vg-gate {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(23, 36, 28, 0.55);
  overflow-y: auto;
}
.vg-gate.hidden { display: none; }

.vg-box {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(16, 32, 24, 0.18);
  padding: 26px 24px 24px;
  margin: auto;
}

.vg-head { text-align: center; margin-bottom: 20px; }
.vg-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
}
.vg-close:hover { background: #eef1ef; color: var(--text); }
.vg-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.vg-logo-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vg-title { margin: 0 0 6px; font-size: 19px; font-weight: 700; color: var(--text); line-height: 1.3; }
.vg-sub { margin: 0; font-size: 13px; line-height: 1.6; color: var(--muted); }

.vg-pane { animation: vgFade 0.2s ease both; }
.vg-pane.hidden { display: none; }

.vg-fields { padding: 16px 0 2px; border-top: 1px solid var(--line); }
.vg-pane[data-pane="login"] .vg-fields { border-top: none; padding-top: 0; }

.vg-label {
  display: block;
  margin: 4px 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.vg-req { color: var(--danger); }

.vg-input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 13px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.vg-input::placeholder { color: #9aa8a1; }
.vg-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(11, 122, 69, 0.14); }
.vg-input.invalid { border-color: var(--danger) !important; }

/* --- ฟิลด์เลือกสาขา (vg-select) : dropdown กำหนดเอง (กัน picker ดีฟอลต์ iOS) --- */
.vg-select { position: relative; margin-bottom: 14px; }

/* select ต้นฉบับซ่อนไว้ ใช้เก็บค่า/ความหมายฟอร์ม (ห้ามแตะเอง ไม่งั้น iOS เด้ง picker) */
.vg-select .vg-hidden-select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
}

/* ปุ่มที่เห็นจริง (กดเปิด/ปิดรายการ) */
.vg-trigger {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 11px 40px 11px 41px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  outline: none;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.vg-trigger::-moz-focus-inner { border: 0; }
.vg-trigger:hover { border-color: #b7c7bd; }
.vg-trigger:focus-visible { border-color: var(--green); box-shadow: 0 0 0 3px rgba(11, 122, 69, 0.14); }
.vg-trigger.is-placeholder { color: #9aa8a1; font-weight: 500; }
.vg-trigger.invalid { border-color: var(--danger) !important; }

.vg-select-ic,
.vg-select-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.vg-select-ic { left: 13px; width: 17px; height: 17px; color: var(--green); transition: color 0.15s ease; }
.vg-select-arrow { right: 13px; width: 16px; height: 16px; color: #93a49a; transition: color 0.15s ease, transform 0.2s ease; }
.vg-select-ic svg,
.vg-select-arrow svg { width: 100%; height: 100%; display: block; }
.vg-trigger:focus-visible ~ .vg-select-arrow { color: var(--green); }
.vg-select.is-open .vg-select-arrow { color: var(--green); transform: translateY(-50%) rotate(180deg); }
.vg-trigger.invalid ~ .vg-select-ic,
.vg-trigger.invalid ~ .vg-select-arrow { color: var(--danger); }

/* รายการตัวเลือกสาขา */
.vg-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 6;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 14px 30px rgba(16, 32, 24, 0.18);
  max-height: 244px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: vgDrop 0.16s ease both;
}
.vg-dropdown.hidden { display: none; }
@keyframes vgDrop {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.vg-dropdown li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.vg-dropdown li:hover,
.vg-dropdown li.is-active { background: rgba(11, 122, 69, 0.08); }
.vg-dropdown li.is-selected { color: var(--green); }
.vg-dropdown .vg-opt-txt { flex: 1 1 auto; }
.vg-dropdown .vg-check {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--green);
  display: none;
}
.vg-dropdown li.is-selected .vg-check { display: block; }

@media (prefers-reduced-motion: reduce) {
  .vg-dropdown { animation: none; }
  .vg-select-arrow { transition: color 0.15s ease; }
}

.vg-wrap { position: relative; margin-bottom: 14px; }
.vg-wrap .vg-input { margin-bottom: 0; padding-right: 52px; }
.vg-eye {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #93a49a;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}
.vg-eye svg { width: 20px; height: 20px; }
.vg-eye:hover { background: #f1f4f2; }
.vg-eye.is-on { color: var(--green); }

.vg-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  margin: 0 0 12px;
  padding: 11px 13px;
  border: 1px solid var(--green-line);
  border-radius: 6px;
  background: var(--green-soft);
  font-size: 13px;
}
.vg-sum-k { color: var(--muted); font-weight: 600; }
.vg-sum-v { color: var(--text); font-weight: 700; text-align: right; overflow-wrap: anywhere; }

.vg-link {
  display: block;
  margin: 16px auto 0;
  padding: 4px 6px;
  border: none;
  background: none;
  color: var(--green-dark);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  text-decoration: underline;
  cursor: pointer;
}

.vg-btn {
  width: 100%;
  margin-top: 6px;
  padding: 13px;
  border: 1px solid var(--green);
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.2s ease;
}
.vg-btn:hover { background: var(--green-dark); border-color: var(--green-dark); }
.vg-btn:disabled { opacity: 0.65; cursor: default; }

.vg-err { margin: 12px 0 0; font-size: 13px; color: var(--danger); text-align: center; }
.vg-err.hidden { display: none; }

/* --- Key Pass --- */
.vg-link-alt { text-align: center; margin-top: 10px; text-decoration: none; color: var(--muted); }
.vg-link-alt:hover { color: var(--green-dark); }

.vg-kp-lead { margin: 0 0 14px; font-size: 14px; line-height: 1.7; color: var(--text); text-align: center; }
.vg-kp-lead strong { color: var(--green-dark); }

.vg-kp-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 14px 18px;
  border: 1px solid var(--green-line);
  border-radius: 8px;
  background: var(--green-soft);
}

.vg-kp-value {
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--text);
  line-height: 1.2;
  user-select: all;
  -webkit-user-select: all;
}

.vg-kp-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 9px 13px;
  border: 1px solid var(--green-line);
  border-radius: 6px;
  background: #fff;
  color: var(--green-dark);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.vg-kp-copy svg { width: 16px; height: 16px; }
.vg-kp-copy:hover { background: #f4f9f6; }
.vg-kp-copy.is-done { background: var(--green); border-color: var(--green); color: #fff; }

.vg-kp-warn {
  margin: 12px 0 0;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
  text-align: center;
}

.vg-input-kp {
  font-family: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
}
.vg-input-kp::placeholder { font-weight: 500; letter-spacing: 0.14em; }

@media (max-width: 420px) {
  .vg-box { padding: 22px 16px 20px; }
  .vg-logo { width: 52px; height: 52px; }
  .vg-title { font-size: 18px; }
}

/* ---------- แถบเมนูด้านล่าง (bottom-nav) ---------- */
body.has-bottom-nav {
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 120;
  display: flex;
  align-items: stretch;
  height: calc(60px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #fff;
  border-top: 1px solid var(--line);
}

.bn-tab {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  text-decoration: none;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  transition: color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.bn-tab:hover { color: var(--green-dark); }
.bn-tab:active { transform: scale(0.94); }
.bn-tab.is-active { color: var(--green-dark); }

.bn-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 26px;
  border-radius: 6px;
  transition: background 0.15s ease;
}
.bn-ico svg { width: 20px; height: 20px; }
.bn-tab.is-active .bn-ico { background: var(--green-soft); }

.bn-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 900px) {
  .bottom-nav {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 520px;
    max-width: 100%;
    border-radius: 8px 8px 0 0;
    border: 1px solid var(--line);
    border-bottom: none;
  }
  body.has-bottom-nav { padding-bottom: 76px; }
}

/* ---------- Splash screen: โหลด asset ให้พร้อมก่อนเข้าหน้า ---------- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 13px;
  background: #0a5c34;
  color: #fff;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  text-align: center;
  padding: 24px;
  box-sizing: border-box;
}
.splash.splash-done { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-logo {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.28);
}
.splash-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.splash-title { font-size: 19px; font-weight: 700; letter-spacing: 0.2px; }
.splash-sub { font-size: 13px; opacity: 0.85; }
.splash-bar { width: 180px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.24); overflow: hidden; margin-top: 4px; }
.splash-bar-fill { height: 100%; width: 38%; border-radius: 2px; background: #fff; animation: splashSlide 1.15s ease-in-out infinite; }
@keyframes splashSlide { 0% { transform: translateX(-120%); } 100% { transform: translateX(420%); } }

/* ---------- แถบโหลดบนสุด (แสดงเมื่อกำลังโหลด asset / API) ---------- */
.top-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 9997;
  pointer-events: none;
}
.top-loader-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  border-radius: 0 3px 3px 0;
  background: var(--green);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.top-loader.on .top-loader-fill {
  opacity: 1;
  animation: topLoaderSlide 1.3s ease-in-out infinite;
}
.top-loader-chip {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}
.top-loader.on .top-loader-chip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.top-loader-spin {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 2.5px solid rgba(11, 122, 69, 0.22);
  border-top-color: var(--green);
  animation: topLoaderSpin 0.8s linear infinite;
}
@keyframes topLoaderSlide { 0% { width: 0; margin-left: 0; } 60% { width: 55%; margin-left: 0; } 100% { width: 0; margin-left: 100%; } }
@keyframes topLoaderSpin { to { transform: rotate(360deg); } }
@media (max-width: 520px) {
  .top-loader-chip { font-size: 12px; padding: 7px 13px; }
}

button,
textarea,
input {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

.hidden {
  display: none !important;
}

/* ---------- NAVBAR ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.navbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--green-dark);
  font-weight: 700;
  font-size: 16px;
}

.navbar-logo {
  width: 26px;
  height: 26px;
  color: var(--green);
  flex: 0 0 auto;
}

.navbar-logo-img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 6px;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  background: var(--green-soft);
  color: var(--green-dark);
}

.nav-link.is-active {
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 600;
}

@media (max-width: 480px) {
  .navbar-inner { flex-wrap: wrap; padding: 8px 12px; }
  .navbar-title { font-size: 15px; }
  .navbar-links { width: 100%; justify-content: space-between; }
  .nav-link { flex: 1; justify-content: center; padding: 9px 6px; font-size: 13px; }
}

/* ---------- MASCOT (สำเร็จ) ---------- */
.done-box {
  max-width: 400px;
  padding: 30px 26px 28px;
  position: relative;
  animation: pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.done-mascot {
  width: 100%;
  max-width: 380px;
  margin: 0 auto 14px;
  position: relative;
}

/* ---------- IT SUPPORT 3D TEXT ---------- */
.done-it-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  font-family: "Sarabun", sans-serif;
  font-weight: 800;
  font-size: clamp(30px, 9vw, 52px);
  line-height: 1;
  letter-spacing: 1px;
  perspective: 900px;
  perspective-origin: 50% 100%;
  padding: 14px 0 20px;
  user-select: none;
}

.done-it-logo .itl {
  display: inline-block;
  position: relative;
  opacity: 0;
  transform-style: preserve-3d;
  color: #0a6b3b;
  background: linear-gradient(180deg, #2fae66 0%, #0a6b3b 55%, #053f22 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 6px 0 rgba(5, 63, 34, 0.28)) drop-shadow(0 14px 18px rgba(5, 63, 34, 0.35));
  text-shadow: none;
  animation:
    itAssemble 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) calc(var(--i) * 0.13s) forwards,
    itWave 3.4s ease-in-out calc(1.6s + var(--i) * 0.14s) infinite;
}

.done-it-logo .itl::after {
  content: attr(data-c);
  position: absolute;
  top: 0;
  left: 0;
  transform: translateZ(-14px);
  color: rgba(5, 63, 34, 0.55);
  -webkit-text-fill-color: rgba(5, 63, 34, 0.55);
  filter: none;
  z-index: -1;
}

.done-it-logo .itl.gap {
  width: 0.55em;
}

@media (prefers-reduced-motion: reduce) {
  .done-it-logo .itl {
    animation: none;
    opacity: 1;
  }
}

@keyframes itAssemble {
  0% {
    opacity: 0;
    transform: translateY(46px) rotateX(92deg) scale(0.4);
  }
  60% {
    opacity: 1;
    transform: translateY(-6px) rotateX(-14deg) scale(1.12);
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotateX(0deg) scale(1);
  }
}

@keyframes itWave {
  0%, 100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
  15% {
    transform: translateY(-6px) rotate(-2deg) scale(1.03);
  }
  30% {
    transform: translateY(-2px) rotate(1.5deg) scale(1);
  }
  45% {
    transform: translateY(-9px) rotate(-1deg) scale(1.04);
  }
  60% {
    transform: translateY(-3px) rotate(2deg) scale(1.01);
  }
  75% {
    transform: translateY(-12px) rotate(1deg) scale(1.06);
  }
  90% {
    transform: translateY(-4px) rotate(-1.5deg) scale(1.02);
  }
}

.done-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--green-dark);
  text-align: center;
  margin-bottom: 6px;
  animation: fadeUp 0.5s 0.08s ease both;
}

.done-desc {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 16px;
  animation: fadeUp 0.5s 0.16s ease both;
}

.done-ticket-label {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.done-code-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  animation: fadeUp 0.5s 0.24s ease both;
}

.done-code-row .ticket-no {
  margin: 0;
}

.done-box .ticket-no {
  text-align: center;
  margin: 2px 0 16px;
}

.done-box .back-btn {
  display: block;
  text-decoration: none;
  text-align: center;
  animation: fadeUp 0.5s 0.32s ease both;
}

.success-box .modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 0;
  background: var(--green-soft);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

.success-box .modal-close:hover {
  background: var(--danger);
  color: #fff;
}

.success-box .modal-close:active {
  transform: scale(0.9);
}

@media (min-width: 768px) {
  .done-box .back-btn {
    max-width: 260px;
    margin: 0 auto;
  }
}

.app-header {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 55%, #5fbd8a 100%);
  color: #fff;
  padding: 34px 20px 38px;
  text-align: center;
  border-radius: 0;
}

.header-inner {
  position: relative;
  z-index: 3;
}

.header-deco {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.blob {
  position: absolute;
  left: 50%;
  top: 50%;
  pointer-events: none;
}

.blob-white {
  width: 150px;
  height: 150px;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.55);
  filter: blur(22px);
  transform: translate(-50%, -54%);
  opacity: 0.6;
  animation: pulseWhite 5s ease-in-out infinite;
}

.blob-green-dark {
  width: 96px;
  height: 96px;
  background: linear-gradient(150deg, #042f1a, var(--green-dark) 55%, var(--green));
  opacity: 0.3;
  transform: translate(-50%, -52%) rotate(45deg);
  animation: spinDark 18s linear infinite;
}

.blob-green-light {
  width: 68px;
  height: 68px;
  background: linear-gradient(150deg, #b7edcf, #7fd9a8);
  opacity: 0.38;
  transform: translate(-34%, -54%) rotate(45deg);
  animation: spinLight 12s linear infinite;
}


.header-icon {
  width: 32px;
  height: 32px;
  display: block;
  margin: 0 auto 10px;
  opacity: 0.95;
}

.app-header h1 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.2px;
  margin-bottom: 5px;
  background: linear-gradient(96deg, #ffffff 8%, #eefaf4 48%, #ffffff 92%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #fff;
  filter: drop-shadow(0 2px 5px rgba(5, 63, 34, 0.35));
}

.app-header p {
  font-size: 13px;
  opacity: 0.9;
  font-weight: 400;
}

.stepper {
  max-width: 480px;
  margin: 0 auto;
  padding: 22px 24px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-ind {
  width: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.step-dot {
  width: 30px;
  height: 30px;
  border-radius: 0;
  background: #fff;
  border: 1.5px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.step-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  transition: color 0.25s ease, font-weight 0.1s ease;
}

.step-line {
  flex: 0 0 42px;
  height: 2px;
  background: var(--line);
  transition: background 0.35s ease;
}

.step-ind.is-active .step-dot {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  animation: stepPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.step-ind.is-active .step-label {
  color: var(--green-dark);
  font-weight: 600;
}

.step-ind.is-done .step-dot {
  background: var(--green-soft);
  border-color: var(--green-line);
  color: var(--green);
}

.step-line.is-done {
  background: var(--green-line);
  transform-origin: left;
  animation: growLine 0.4s ease both;
}

.form-wrap {
  max-width: 480px;
  margin: 18px auto 0;
  padding: 0 18px 180px;
}

.step {
  display: none;
}

.step.is-active {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 26px 20px;
  box-shadow: 0 1px 3px rgba(23, 36, 28, 0.04);
  will-change: transform, opacity;
}

.step.is-active.slide-next {
    animation: slideNext 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  
  .step.is-active.slide-prev {
    animation: slidePrev 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

.step.is-active .field,
.step.is-active .dev-panel,
.step.is-active .dev-selected {
  animation: fadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.step.is-active .field:nth-child(2) { animation-delay: 0.06s; }
.step.is-active .field:nth-child(3) { animation-delay: 0.12s; }
.step.is-active .field:nth-child(4) { animation-delay: 0.18s; }
.step.is-active .field:nth-child(5) { animation-delay: 0.24s; }
.step.is-active .dev-panel:nth-child(2) { animation-delay: 0.08s; }
.step.is-active .dev-panel:nth-child(3) { animation-delay: 0.16s; }

.step-heading {
  font-size: 13px;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: 0;
  padding: 11px 14px;
  margin-bottom: 26px;
}

.field {
  margin-bottom: 30px;
}

.field + .field {
  margin-top: 30px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.field:last-child {
  margin-bottom: 0;
}

.field-label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.req {
  color: var(--danger);
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.status-radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.status-radio-group input[type="radio"] {
  display: none;
}

.status-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 2px solid var(--line);
  border-radius: 0;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #fff;
}

.status-radio-group input[type="radio"]:checked + .status-option {
  background: var(--green-soft);
  border-color: var(--green);
}

.status-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.status-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.status-desc {
  font-size: 12px;
  color: var(--muted);
}

.status-radio-group input[type="radio"]:checked + .status-option .status-title {
  color: var(--green-dark);
}

.photo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.photo-head .field-label {
  margin-bottom: 0;
}

.photo-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 4px 10px;
}

.photo-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 30px 16px;
  border: 1.5px dashed var(--green-line);
  background: #f8fbf9;
  color: var(--green);
  border-radius: 0;
  transition: transform 0.12s ease, background 0.2s ease;
}

.photo-btn:active {
  transform: scale(0.98);
  background: var(--green-soft);
}

.photo-btn-text {
  font-size: 15px;
  font-weight: 600;
}

.photo-btn-hint {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.cam-icon {
  width: 24px;
  height: 24px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.photo-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 0;
  overflow: hidden;
  background: #edf1ef;
  border: 1px solid var(--line);
  will-change: transform;
  animation: photoPop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes photoPop {
  from { opacity: 0; transform: scale(0.82); }
  to { opacity: 1; transform: scale(1); }
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-index {
  position: absolute;
  left: 6px;
  bottom: 6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 0;
  background: rgba(20, 30, 25, 0.75);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-add {
  position: relative;
  aspect-ratio: 1;
  border-radius: 0;
  border: 1.5px dashed var(--green-line);
  background: #f8fbf9;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  transition: color 0.15s ease, background 0.15s ease;
}

.photo-add svg {
  width: 20px;
  height: 20px;
}

.photo-add:active {
  color: var(--green);
  background: var(--green-soft);
}

textarea,
.text-input {
   width: 100%;
   border: 1.5px solid var(--line);
   background: #fff;
   border-radius: 0;
   padding: 12px 14px;
   font-size: 15px;
   resize: none;
   outline: none;
   transition: border-color 0.2s ease, box-shadow 0.2s ease;
 }

 select.text-input {
   appearance: auto;
   cursor: pointer;
 }

 textarea:focus,
 .text-input:focus {
   border-color: var(--green);
   box-shadow: 0 0 0 3px rgba(10, 107, 59, 0.12);
 }

textarea.invalid,
.text-input.invalid {
  border-color: var(--danger);
  animation: shake 0.3s ease;
}

.char-count {
  text-align: right;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.loc-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.loc-group + .text-input {
  margin-top: 12px;
}

.loc-group input {
  display: none;
}

.loc-option {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 14px 16px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 0;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.loc-option::before {
  content: "";
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-right: 12px;
  border: 1.5px solid var(--line);
  border-radius: 0;
  background: #fff;
  transition: all 0.15s ease;
}

.loc-option:active {
  transform: scale(0.99);
}

.loc-group input:checked + .loc-option {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green-dark);
  font-weight: 600;
}

.loc-group input:checked + .loc-option::before {
  border-color: var(--green);
  background: var(--green);
  box-shadow: inset 0 0 0 3px #fff;
}

.loc-text {
  display: block;
  min-width: 0;
}

.loc-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
}

.loc-desc {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}

.loc-group input:checked + .loc-option .loc-desc {
  color: var(--green-dark);
  opacity: 0.85;
}

/* ---------- แผนผังร้าน (แสดงภาพ) ---------- */
.iso-wrap {
  margin-top: 4px;
  background: #fbfcf7;
  border: 1.5px solid var(--line);
  border-radius: 0;
  overflow: hidden;
  position: relative;
}

.branch-map-img {
  display: block;
  width: 100%;
  height: auto;
  padding: 10px;
  cursor: zoom-in;
}

.map-zoom-btn {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--green);
  background: rgba(255, 255, 255, 0.95);
  color: var(--green-dark);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(23, 36, 28, 0.18);
  transition: background 0.15s ease, color 0.15s ease;
}

.map-zoom-btn:hover { background: var(--green); color: #fff; }

/* ---------- Lightbox ขยายแผนผังร้าน ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 20, 14, 0.86);
  padding: 24px;
  animation: fadeIn 0.2s ease both;
}

.lightbox-img {
  max-width: 100%;
  max-height: 92vh;
  border-radius: 0;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  object-fit: contain;
}

.lightbox-close {
  position: fixed;
  top: 16px;
  right: 18px;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.12s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.32);
}

.lightbox-close:active {
  transform: scale(0.94);
}

.iso-placeholder {
  padding: 34px 20px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

/* ---------- การ์ดติดต่อ IT SUPPORT ---------- */
.support-card {
  margin-top: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
}

.support-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 12px;
}

.support-card-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.support-card-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.support-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 13px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.support-ico {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

.support-row-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.support-row-text strong {
  font-size: 17px;
  font-weight: 700;
}

.support-row-text small {
  font-size: 13.5px;
  font-weight: 500;
  opacity: 0.75;
}

.support-line {
  background: #f7faf8;
  border: 1px solid var(--green-line);
  color: var(--green-dark);
}

.support-line:hover {
  background: var(--green-soft);
  border-color: var(--green);
}

.support-phone {
  background: #f7faf8;
  border: 1px solid var(--green-line);
  color: var(--green-dark);
  letter-spacing: 0.3px;
}

.support-phone:hover {
  background: var(--green-soft);
  border-color: var(--green);
}

/* ---------- หน้า ติดต่อฝ่าย IT SUPPORT ---------- */
.contact-wrap {
  max-width: 640px;
  margin: 22px auto 0;
  padding: 0 18px calc(120px + env(safe-area-inset-bottom));
}

.contact-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px 22px;
}

.contact-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.contact-icon {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 0;
  padding: 10px;
}

.contact-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.contact-sub {
  font-size: 15px;
  color: var(--muted);
  margin-top: 3px;
}

.contact-note {
  margin-top: 16px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
}

@media (min-width: 640px) {
  .contact-wrap {
    max-width: 560px;
  }

  .contact-card {
    padding: 36px 34px;
  }

  .contact-title {
    font-size: 24px;
  }
}

.action-bar {
  width: 100%;
  max-width: 680px;
  margin: 0 auto calc(92px + env(safe-area-inset-bottom));
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  background: rgba(245, 248, 246, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 16px;
}

.action-btn {
  border: none;
  border-radius: 0;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 600;
  will-change: transform;
  transition: transform 0.12s ease, background 0.2s ease, opacity 0.2s ease;
}

.action-btn:active {
  transform: scale(0.97);
}

.action-btn.primary {
  flex: 1;
  background: var(--green);
  color: #fff;
  box-shadow: 0 6px 16px rgba(10, 107, 59, 0.3);
}

.action-btn.primary:disabled {
  opacity: 0.6;
  pointer-events: none;
}

.action-btn.secondary {
  background: #fff;
  border: 1.5px solid var(--line);
  color: var(--text);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(245, 248, 246, 0.96);
  padding: 24px;
  animation: fadeIn 0.2s ease both;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(10, 107, 59, 0.18);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.overlay-msg {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.success-box {
  width: 100%;
  max-width: 360px;
  background: #fff;
  border-radius: 0;
  padding: 34px 26px 26px;
  text-align: center;
  box-shadow: 0 12px 36px rgba(23, 36, 28, 0.1);
  animation: pop 0.3s ease both;
}

.success-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 0;
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  animation: pop 0.4s 0.08s ease both;
}

.success-icon::after {
  content: "";
  position: absolute;
  inset: -9px;
  border: 2px solid var(--green-soft);
  animation: ringPulse 1.7s ease-out infinite;
}

@keyframes ringPulse {
  0% { transform: scale(0.92); opacity: 1; }
  100% { transform: scale(1.3); opacity: 0; }
}

.success-icon svg {
  width: 38px;
  height: 38px;
}

.success-card {
  width: 100%;
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 4px 14px;
  margin: 2px 0 16px;
  text-align: left;
  animation: fadeUp 0.5s 0.2s ease both;
}

.success-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(226, 236, 230, 0.75);
}

.success-row:last-child { border-bottom: none; }

.srow-label {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
}

.srow-value {
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--green-dark);
  overflow-wrap: anywhere;
}

.success-card .ticket-no {
  margin: 0;
  font-family: Consolas, monospace;
  font-size: 23px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.5px;
}

.success-box .copy-btn {
  display: block;
  width: 100%;
  margin: 0 0 10px;
}

.success-box h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.ticket-no-label {
  font-size: 12px;
  color: var(--muted);
}

.ticket-no {
  font-size: 26px;
  font-weight: 700;
  color: var(--green);
  margin: 4px 0 14px;
  letter-spacing: 0.5px;
}

.success-msg {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 20px;
}

.back-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 0;
  background: var(--green);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.copy-btn {
  display: block;
  margin: 6px auto 14px;
  padding: 9px 16px;
  border: 1.5px solid var(--green-line);
  border-radius: 0;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.1s ease, background 0.2s ease;
}

.done-code-row .copy-btn {
  margin: 0 auto;
}

.copy-btn:active {
  transform: scale(0.97);
  background: var(--green-line);
}

.back-btn.ghost {
  background: #fff;
  color: var(--green);
  border: 1.5px solid var(--green-line);
  margin-bottom: 8px;
}

.back-btn + .back-btn {
  margin-top: 8px;
}

.back-btn.ghost:active,
.back-btn:active {
  transform: scale(0.98);
}

.countdown {
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
}

.toast {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  background: rgba(23, 36, 28, 0.92);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  padding: 11px 18px;
  border-radius: 6px;
  max-width: calc(100% - 48px);
  text-align: center;
  animation: slideDown 0.25s ease both;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideNext {
    0% { opacity: 0; transform: translateX(64px) scale(0.96); }
    55% { opacity: 1; transform: translateX(-8px) scale(1.015); }
    78% { transform: translateX(2px) scale(0.995); }
    100% { opacity: 1; transform: none; }
  }

  @keyframes slidePrev {
    0% { opacity: 0; transform: translateX(-64px) scale(0.96); }
    55% { opacity: 1; transform: translateX(8px) scale(1.015); }
    78% { transform: translateX(-2px) scale(0.995); }
    100% { opacity: 1; transform: none; }
  }

  .action-btn.bounce {
    animation: btnPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  }

  @keyframes btnPop {
    0% { transform: scale(1); }
    40% { transform: scale(1.09); }
    100% { transform: scale(1); }
  }

  .sparkle {
    position: fixed;
    z-index: 90;
    width: 12px;
    height: 12px;
    pointer-events: none;
    color: var(--green);
    font-size: 15px;
    line-height: 1;
    text-shadow: 0 0 6px rgba(14, 107, 58, 0.55);
    animation: sparkleFly 0.85s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .sparkle::before { content: "✦"; display: block; }
  .sparkle.alt { color: var(--yellow); font-size: 11px; }

  @keyframes sparkleFly {
    0% { opacity: 0; transform: translate(0, 0) scale(0.5) rotate(0deg); }
    18% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.85) rotate(var(--rot)); }
  }

@keyframes stepPop {
  0% { transform: scale(0.6); }
  100% { transform: scale(1); }
}

@keyframes growLine {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes pop {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translate(-50%, -16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes spinDark {
  from { transform: translate(-50%, -52%) rotate(45deg); }
  to { transform: translate(-50%, -52%) rotate(405deg); }
}

@keyframes spinLight {
  from { transform: translate(-34%, -54%) rotate(45deg); }
  to { transform: translate(-34%, -54%) rotate(-315deg); }
}

@keyframes pulseWhite {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.8; }
}

.opt-hint {
  color: #5d6f65;
  font-weight: 400;
  font-size: 12px;
  margin-left: 6px;
}

.reporter-notice {
  background: var(--green-soft);
  color: #0a5f37;
  border-radius: 0;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 10px;
}

.reporter-notice .reporter-chk {
  color: #0a6b3b;
  font-weight: 600;
}

.field .text-input {
  margin-top: 10px;
}

.sub-section {
  margin: 22px 0 30px;
  padding: 18px 14px 2px;
  background: #fbfdfc;
  border: 1px solid var(--green-line);
  border-radius: 0;
}

.sub-section:not(.hidden) {
  animation: fadeUp 0.3s ease both;
}

.sub-heading {
  font-size: 14px;
  font-weight: 600;
  color: var(--green-dark);
  padding-left: 10px;
  border-left: 3px solid var(--green);
  margin-bottom: 22px;
  line-height: 1.3;
}

.devtype-panels {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dev-panel {
  margin: 0;
  animation: fadeUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.cat-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.cat-tab[data-cat="Disk"] {
  grid-column: 1 / -1;
}

.cat-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  animation: fadeUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.cat-tab:active {
  transform: scale(0.97);
}

.cat-tab:hover {
  border-color: var(--green-line);
  transform: translateY(-2px);
}

.cat-tab.is-active {
  background: var(--green-soft);
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(10, 107, 59, 0.1);
}

.cat-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  color: var(--muted);
  transition: color 0.18s ease;
}

.cat-tab.is-active .cat-icon {
  color: var(--green);
}

.cat-tab-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.cat-tab-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.cat-tab.is-active .cat-tab-title {
  color: var(--green-dark);
}

.cat-tab-hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cat-logos {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.cat-logo {
  width: 24px;
  height: 24px;
  display: inline-flex;
  box-shadow: 0 1px 3px rgba(23, 36, 28, 0.18);
  border-radius: 0;
  overflow: hidden;
  background: #fff;
}

.cat-logo img,
.cat-logo svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.dev-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--green-dark);
  padding-left: 10px;
  border-left: 3px solid var(--green);
  margin-bottom: 14px;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dev-panel-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.dev-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.dev-opt {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 12px 16px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  animation: fadeUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.dev-opt svg {
  width: 30px;
  height: 30px;
  color: var(--muted);
  transition: color 0.18s ease, transform 0.18s ease;
  will-change: transform;
}

.dev-opt .dev-logo {
  width: 40px;
  height: 40px;
  color: inherit;
  filter: drop-shadow(0 1px 2px rgba(23, 36, 28, 0.2));
  object-fit: contain;
  border-radius: 0;
}

.dev-opt:active {
  transform: scale(0.96);
}

.dev-opt:not(.sel):hover {
  border-color: var(--green-line);
  transform: translateY(-2px);
}

.dev-opt:not(.sel):hover svg {
  color: var(--green);
  transform: scale(1.08);
}

.dev-opt:not(.sel):hover img.dev-logo {
  transform: scale(1.08);
}

.dev-opt.sel {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green-dark);
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(10, 107, 59, 0.1);
}

.dev-opt.sel svg {
  color: var(--green);
}

.dev-opt.sel::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 18px;
  height: 18px;
  border-radius: 0;
  background: var(--green);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: 10px;
  background-position: center;
  background-repeat: no-repeat;
  animation: stepPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.dev-custom-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-top: 12px;
}

.dev-custom-input {
  flex: 1;
}

.cat-custom-toggle {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  border: 1.5px dashed var(--green-line);
  border-radius: 0;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.cat-custom-toggle:hover {
  background: #e2f1e8;
}

.cat-custom-toggle:active {
  transform: scale(0.99);
}

.cat-custom-toggle.is-open {
  border-style: solid;
}

.mini-add {
  flex: 0 0 auto;
  padding: 0 20px;
  border: none;
  border-radius: 0;
  background: var(--green);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.12s ease;
}

.mini-add:hover {
  background: #0d5e32;
}

.mini-add:active {
  transform: scale(0.96);
}

.problem-item .prob-flex {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prob-logo {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 0;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  box-shadow: 0 1px 3px rgba(23, 36, 28, 0.16);
}

.prob-logo img,
.prob-logo svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.prob-logo.prob-generic {
  color: var(--muted);
  background: var(--green-soft);
}

.dev-selected {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--green-line);
  animation: fadeUp 0.3s ease both;
}

.dev-selected-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--green-dark);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dev-selected-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.dev-selected-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dev-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px 7px 12px;
  background: var(--green-soft);
  border: 1px solid var(--green-line);
  border-radius: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--green-dark);
  animation: chipIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes chipIn {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}

.dev-chip-type {
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: var(--green);
  border-radius: 0;
  padding: 2px 8px;
}

.dev-chip-label {
  line-height: 1.2;
}

.dev-chip-del {
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 0;
  background: rgba(10, 107, 59, 0.15);
  color: var(--green-dark);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.dev-chip-del:hover {
  background: var(--danger);
  color: #fff;
}

.problem-fields {
  display: block;
}

.problem-item {
  animation: fadeUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.problem-fields .problem-item {
  margin-bottom: 24px;
}

.problem-fields .problem-item + .problem-item {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.disk-problem-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--green-soft, rgba(14, 107, 58, 0.08));
  border: 1px solid var(--line);
  border-left: 3px solid #0e6b3a;
  border-radius: 10px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}

.disk-problem-note svg {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  color: #0e6b3a;
}

.disk-problem-note strong {
  color: #0e6b3a;
}

@media (min-width: 768px) {
  .app-header {
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: 0;
    padding: 38px 24px 42px;
  }

  .stepper {
    width: 100%;
    max-width: none;
    margin-top: 18px;
    padding: 24px 12px 8px;
  }

  .step-ind {
    width: 96px;
    gap: 9px;
  }

  .step-dot {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }

  .step-label {
    font-size: 13px;
  }

  .form-wrap {
    width: 100%;
    max-width: none;
    margin-top: 22px;
    padding: 0 22px 60px;
  }

  .step {
    max-width: 1100px;
    margin: 0 auto;
  }

  .step.is-active {
    padding: 40px 46px;
  }

  .app-header h1 {
    font-size: 26px;
  }
}

@media (min-width: 1024px) {
  .dev-grid {
    grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
    gap: 12px;
  }

  .dev-opt {
    padding: 24px 16px 20px;
  }

  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }

  .action-bar {
    max-width: calc(100% - 44px);
    padding: 16px 24px;
  }
}

@media (min-width: 1280px) {
  .dev-grid {
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  }

  .dev-opt {
    padding: 26px 18px 22px;
  }

  .photo-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .navbar-inner {
    max-width: 1600px;
  }

  .action-bar,
  .form-wrap {
    max-width: calc(100% - 48px);
    margin-left: auto;
    margin-right: auto;
  }
}

/* ---------- DESKTOP : ปรับให้เหมาะกับหน้าจอคอมพิวเตอร์ (เฉพาะหน้า Ticket) ---------- */

@media (min-width: 768px) {
  .ticket-page .navbar-inner {
    max-width: 960px;
  }

  .ticket-page .stepper {
    width: 100%;
    max-width: 960px;
    margin: 20px auto 0;
    padding: 26px 24px 6px;
  }

  .ticket-page .step-line {
    flex-basis: 52px;
  }

  .ticket-page .form-wrap {
    max-width: 960px;
    margin: 24px auto 0;
    padding: 0 24px 8px;
  }

  .ticket-page .step {
    max-width: 960px;
  }

  .ticket-page .step.is-active {
    padding: 42px 48px 48px;
    box-shadow: 0 2px 10px rgba(23, 36, 28, 0.05);
  }

  .ticket-page .step-heading {
    font-size: 14px;
    padding: 13px 16px;
  }

  /* แถบปุ่มล่าง -> การ์ดท้ายแบบฟอร์ม */
  .ticket-page .action-bar {
    width: 100%;
    max-width: 960px;
    border-radius: 20px;
    padding: 13px 16px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: 0 16px 44px rgba(23, 36, 28, 0.14);
  }

  .ticket-page .action-btn {
    padding: 15px 22px;
    font-size: 15px;
  }

  .ticket-page .action-btn.secondary {
    flex: 0 1 150px;
  }

  .ticket-page .action-btn.primary {
    flex: 1 1 auto;
  }
}

@media (min-width: 900px) {
  /* ขั้นตอน 1 : จัดพื้นที่เลือกให้เป็นระเบียบ */
  .ticket-page .devtype-panels { gap: 24px; }
  .ticket-page .cat-tabs { grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
  .ticket-page .cat-tab[data-cat="Disk"] { grid-column: auto; }
  .ticket-page .dev-grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; }
  .ticket-page .dev-opt { padding: 22px 14px 18px; }
  .ticket-page .dev-opt:hover svg { transform: scale(1.06); }

  /* ขั้นตอน 2 : สาเหตุผิดปกติด้านบน + แนบรูปภาพด้านล่าง (เรียงตามลำดับ) */

  /* ขั้นตอน 3 : ข้อมูลด้านซ้าย + แผนผังร้านด้านขวา (ยึดติดเมื่อเลื่อน) */
  .ticket-page .step.is-active[data-step="3"] {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.5fr);
    gap: 34px;
    align-items: start;
  }
  .ticket-page .step[data-step="3"] .step-heading { grid-column: 1 / -1; }
  .ticket-page .step[data-step="3"] > .field { margin-top: 0; }
  .ticket-page .step[data-step="3"] #branchField { grid-column: 1; grid-row: 2; }
  .ticket-page .step[data-step="3"] #mapField { grid-column: 2; grid-row: 2 / span 2; border: none; padding: 0; }
  .ticket-page .step[data-step="3"] #positionField { grid-column: 1; grid-row: 3; padding-top: 28px; border-top: 1px solid var(--line); }
  .ticket-page .step[data-step="3"] #phoneField { grid-column: 1; grid-row: 4; padding-top: 28px; border-top: 1px solid var(--line); }
  .ticket-page .step[data-step="3"] #lineIdField { grid-column: 1; grid-row: 5; padding-top: 28px; border-top: 1px solid var(--line); }

  .ticket-page .step[data-step="3"] #mapField .iso-wrap {
    position: sticky;
    top: 96px;
    border-radius: 0;
    background: #fff;
  }

  .ticket-page .iso-placeholder {
    padding: 44px 26px;
  }
}

@media (min-width: 1280px) {
  .ticket-page .dev-grid { grid-template-columns: repeat(auto-fill, minmax(164px, 1fr)); gap: 14px; }
  .ticket-page .step.is-active[data-step="2"],
  .ticket-page .step.is-active[data-step="3"] { gap: 46px; }
}

/* ---------- DESKTOP : แถบเมนูด้านซ้าย (เฉพาะหน้า Ticket) ---------- */

/* ---------- NAVBAR แนวนอนบนสุด (มุมซ้ายบน) ทุกหน้า ---------- */
.app-nav { padding-top: 64px; }

.app-nav .navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.app-nav .navbar-inner {
  height: 64px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  position: relative;
}

.app-nav .navbar-links {
  position: fixed;
  left: 50%;
  bottom: calc(10px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 24px);
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

/* ---------- หัวแถบ nav ---------- */
.app-nav .navbar-brand { flex: 0 1 auto; min-width: 0; }
.app-nav .navbar-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-nav .nav-link {
  flex-direction: column;
  gap: 2px;
  min-width: 62px;
  padding: 7px 12px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
}

.app-nav .nav-link svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.app-nav .nav-link:hover {
  background: var(--green-soft);
  color: var(--green-dark);
}

.app-nav .nav-link.is-active {
  background: var(--green);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 5px 14px rgba(12, 163, 92, 0.30);
}

/* ---------- DRAFT BANNER (ฉบับร่าง) ---------- */
.draft-banner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 480px;
  margin: 18px auto 0;
  padding: 12px 16px;
  background: #fdf7e8;
  border: 1px solid #e8d9ae;
  border-radius: 6px;
  color: #5c4a12;
}

.draft-banner-text { flex: 1; min-width: 0; }
.draft-banner-text strong { display: block; font-size: 14.5px; margin-bottom: 2px; color: #4d3f10; }
.draft-banner-text span { display: block; font-size: 12.5px; line-height: 1.5; }
.draft-banner-text small { color: #8a7a3a; }

.draft-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: #8a7a3a;
  cursor: pointer;
  padding: 2px 6px;
  align-self: flex-start;
}

.draft-close:hover { color: #5c4a12; }

.draft-banner-actions { display: flex; gap: 8px; }
.draft-btn {
  border: none;
  border-radius: 5px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.draft-btn.restore { background: var(--green); color: #fff; }
.draft-btn.restore:hover { background: var(--green-dark); }
.draft-btn.discard {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.draft-btn.discard:hover { color: #b3261e; border-color: #d8a8a8; }

@media (min-width: 768px) {
  .draft-banner { max-width: 960px; margin-top: 24px; }
}

@media (max-width: 520px) {
  .draft-banner { flex-wrap: wrap; }
  .draft-banner-actions { width: 100%; }
  .draft-banner-actions .draft-btn { flex: 1; }
}

/* ---------- TICKET : hover (แบน ไม่ลอย ไม่เงาหนา) ---------- */
.ticket-page button {
  transition: background-color 0.15s ease,
              border-color 0.15s ease,
              color 0.15s ease,
              opacity 0.15s ease;
}

.ticket-page .loc-option {
  transition: border-color 0.15s ease,
              background-color 0.15s ease;
}

@media (hover: hover) {
  .ticket-page .action-btn.secondary:hover {
    border-color: var(--green);
    background: var(--green-soft);
    color: var(--green-dark);
  }

  .ticket-page .photo-btn:hover {
    background: var(--green-soft);
    border-color: var(--green);
  }

  .ticket-page .photo-add:hover {
    border-color: var(--green);
    color: var(--green);
    background: var(--green-soft);
  }

  .ticket-page .photo-del:hover {
    background: #b3261e;
  }

  .ticket-page .loc-option:hover {
    border-color: #b9c9c0;
  }

  .ticket-page .draft-btn.restore:hover {
    background: var(--green-dark);
  }

  .ticket-page .back-btn.ghost:hover {
    background: var(--green-soft);
    border-color: var(--green);
    color: var(--green-dark);
  }

  .ticket-page .copy-btn:hover {
    background: #f4f6f5;
  }

  .ticket-page .modal-close:hover {
    color: var(--text);
    background: #eef1ef;
  }
}

/* ============ MOBILE : ปรับ UI ให้เหมาะกับโทรศัพท์ (เฉพาะหน้า Ticket) ============ */
@media (max-width: 767.98px) {
  /* Stepper 4 ขั้นตอน — หดให้พอดีจอ ไม่ล้นแนวนอน */
  .ticket-page .stepper {
    width: 100%;
    max-width: 700px;
    padding: 16px 10px 2px;
  }
  .ticket-page .step-ind {
    width: auto;
    flex: 1 1 0;
    min-width: 0;
    gap: 5px;
  }
  .ticket-page .step-dot {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }
  .ticket-page .step-label {
    font-size: 10px;
    line-height: 1.15;
    white-space: normal;
    text-align: center;
    max-width: 80px;
  }
  .ticket-page .step-line {
    flex: 1 1 18px;
    min-width: 8px;
    max-width: 28px;
  }

  /* ฟอร์ม */
  .ticket-page .form-wrap {
    margin-top: 12px;
    padding: 0 12px 8px;
  }
  .ticket-page .step.is-active {
    padding: 22px 16px 26px;
    box-shadow: 0 2px 12px rgba(23, 36, 28, 0.06);
  }
  .ticket-page .step-heading {
    font-size: 13px;
    line-height: 1.4;
    padding: 12px 14px;
    margin-bottom: 22px;
  }
  .ticket-page .field { margin-bottom: 24px; }
  .ticket-page .field + .field { margin-top: 22px; padding-top: 22px; }

  /* ป้องกัน iOS Auto-zoom ตอนโฟกัสช่องกรอก (ต้อง >= 16px) + พื้นที่แตะใหญ่ขึ้น */
  .ticket-page textarea,
  .ticket-page .text-input {
    font-size: 16px;
    padding: 13px 14px;
  }
  .ticket-page input[type="date"].text-input,
  .ticket-page select.text-input {
    min-height: 50px;
  }
  .ticket-page .status-option { padding: 14px 16px; gap: 12px; }
  .ticket-page .loc-option { padding: 14px 15px; }

  /* แถบปุ่มท้ายแบบฟอร์ม — กว้างเต็มจอมือถือ แตะง่าย */
  .ticket-page .action-bar {
    width: 100%;
    max-width: 560px;
    padding: 10px 12px;
    gap: 10px;
  }
  .ticket-page .action-btn {
    min-height: 54px;
    padding: 16px 18px;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .ticket-page .action-btn.primary { box-shadow: 0 8px 20px rgba(10, 107, 59, 0.34); }

  /* ขั้นตอน 1 : หมวดแบบ 2x2 + ปุ่มเลือกอุปกรณ์คว้าจอ */
  .ticket-page .cat-tabs { grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 14px; }
  .ticket-page .cat-tab[data-cat="Disk"] { grid-column: auto; }
  .ticket-page .cat-tab { gap: 10px; padding: 13px 12px; }
  .ticket-page .cat-tab-title { font-size: 14px; }
  .ticket-page .cat-tab-hint { font-size: 10px; white-space: normal; line-height: 1.3; }
  .ticket-page .cat-icon { width: 28px; height: 28px; }
  .ticket-page .cat-logos { gap: 3px; }
  .ticket-page .cat-logo { width: 22px; height: 22px; }

  .ticket-page .devtype-panels { gap: 16px; }
  .ticket-page .dev-grid { gap: 9px; }
  .ticket-page .dev-opt { padding: 16px 6px 14px; font-size: 13px; min-height: 92px; }
  .ticket-page .dev-opt svg { width: 28px; height: 28px; }
  .ticket-page .dev-opt .dev-logo { width: 36px; height: 36px; }
  .ticket-page .dev-opt.sel::after { top: 6px; right: 6px; width: 20px; height: 20px; background-size: 11px; }
  .ticket-page .cat-custom-toggle { padding: 13px; }
  .ticket-page .mini-add { min-height: 50px; padding: 0 18px; }
  .ticket-page .dev-custom-row { margin-top: 10px; }

  /* รายการที่เลือก — chip ใหญ่ขึ้น แตะปุ่มลบง่ายขึ้น */
  .ticket-page .dev-chip { padding: 8px 8px 8px 12px; font-size: 13px; gap: 8px; }
  .ticket-page .dev-chip-type { padding: 3px 8px; }
  .ticket-page .dev-chip-del { width: 28px; height: 28px; font-size: 16px; }
  .ticket-page .dev-selected { margin-top: 14px; padding-top: 14px; }

  /* ขั้นตอน 2 : รายละเอียด + รูป */
  .ticket-page .problem-fields .problem-item { margin-bottom: 20px; }
  .ticket-page .problem-fields .problem-item + .problem-item { margin-top: 20px; padding-top: 20px; }
  .ticket-page .problem-item textarea { min-height: 84px; }
  .ticket-page .photo-btn { padding: 26px 14px; }
  .ticket-page .photo-grid { gap: 8px; }
  .ticket-page .photo-add { font-size: 10px; }
  .ticket-page .photo-del { width: 26px; height: 26px; }

  /* ขั้นตอน 3 : แผนผังร้าน ให้ภาพเต็มความกว้าง แตะขยายง่าย */
  .ticket-page .step[data-step="3"] .iso-wrap { margin-top: 2px; }
  .ticket-page .iso-placeholder { padding: 28px 16px; font-size: 13px; }

  /* ขั้นตอน 4 : ตัวเลือกสถานะเต็มความกว้าง */
  .ticket-page .status-radio-group { gap: 9px; }
  .ticket-page .status-title { font-size: 14px; }
  .ticket-page .status-desc { font-size: 12px; }

  /* การ์ดสำเร็จภายใต้จอเล็ก */
  .ticket-page .success-box { padding: 28px 18px 20px; }
  .ticket-page .toast { top: 74px; font-size: 13px; padding: 12px 16px; }

  /* ปัดลบ hover float ที่ไม่จำเป็นบนจอสัมผัส */
  .ticket-page .cat-tab:hover,
  .ticket-page .dev-opt:not(.sel):hover {
    transform: none;
  }
}

@media (max-width: 360px) {
  .ticket-page .stepper { padding: 14px 6px 0; }
  .ticket-page .step-dot { width: 24px; height: 24px; font-size: 11px; }
  .ticket-page .step-label { font-size: 9.5px; max-width: 70px; }
  .ticket-page .step.is-active { padding: 20px 13px 24px; }
  .ticket-page .form-wrap { padding: 0 10px 8px; }
  .ticket-page .dev-opt { min-height: 86px; padding: 14px 5px 12px; }
}

/* ---------- UX : กันซูม + กดปุ่ม + ตัวอักษรค่อย ๆ เข้า ---------- */
html, body, main, form, .app-nav, .navbar-inner, .form-wrap, .support-wrap, .my-wrap {
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@keyframes tkPress {
  0% { transform: scale(1); }
  40% { transform: scale(0.94); }
  100% { transform: scale(1); }
}
.tk-press {
  animation: tkPress 0.18s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

@keyframes tkTypeIn {
  from { opacity: 0.45; }
  to { opacity: 1; }
}
.tk-typein { animation: tkTypeIn 0.12s ease-out; }