/* ═══════════ APP_NAME — stylesheet (มือถือ 430px, ธีมสีฟ้า) ═══════════ */
:root {
  --brand: #1f6fd6;            /* ฟ้ากลาง (ปุ่มหลัก) */
  --brand-dark: #1757ad;       /* ฟ้าเข้ม (กดปุ่ม) */
  --brand-soft: #5a9be8;       /* ฟ้าอ่อน (ปุ่มรอง/โปรโมชัน) */
  --brand-tint: #1f6fd6;       /* ข้อความเน้นสีฟ้า */
  --brand-light: #e8f0fa;      /* พื้นฟ้าอ่อน */
  --green-line: #06c755;       /* สีแบรนด์ LINE (คงไว้) */
  --black: #1c1c1c;
  --bg: #eaf0f8;               /* พื้นแอปฟ้าอ่อน */
  --bg-card: #f7fafd;
  --text: #262626;
  --muted: #5f6b7a;
  --line: #c3cfe0;
  --error: #d93025;            /* สีแดงสำหรับข้อผิดพลาดเท่านั้น */
}

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

html, body { height: 100%; }

body {
  font-family: Prompt, Kanit, Arial, sans-serif;
  background: #2b2b2b;
  color: var(--text);
}

/* ── กรอบโทรศัพท์บนจอใหญ่ ── */
.phone {
  position: relative;
  width: 430px;
  max-width: 100vw;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
}

/* ═══════════ แถบบน (header) ═══════════ */
.login-header,
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  padding: 12px 14px;
  border-bottom: 2px solid #b8d4f5;
  position: relative;
  z-index: 10;
}

.app-header { border-bottom: 1px solid #d3e2f5; }

.icon-btn {
  background: none;
  border: none;
  color: #111;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.login-header-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
  min-width: 0;
}
.login-title-main { font-size: 17px; font-weight: 700; color: #111; }
.login-title-url { font-size: 11px; color: #8a97a8; }

/* โลโก้ APP_NAME */
.header-logo {
  display: block;
  height: 38px;
  width: auto;
  border-radius: 10px;
}
.admin-logo { height: 34px; border-radius: 8px; }
.admin-brand { display: flex; align-items: center; gap: 8px; }
.admin-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--brand);
  background: var(--brand-light);
  padding: 4px 9px;
  border-radius: 12px;
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.logo-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #7ab8f5, var(--brand) 70%);
  align-self: center;
  flex-shrink: 0;
}
.logo-main {
  font-family: Prompt, Kanit, Arial, sans-serif;
  font-style: italic;
  font-weight: 900;
  font-size: 24px;
  letter-spacing: 0.4px;
  color: #111;
}
.logo-sub {
  font-family: Prompt, Kanit, Arial, sans-serif;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 2.5px;
  color: var(--brand);
  align-self: center;
}

/* ═══════════ Hero การ์ดคะแนน (โมเดิร์น) ═══════════ */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #2f7fe0 0%, #4f9aec 55%, #7db8f5 100%);
  border-radius: 24px;
  padding: 20px 20px 16px;
  color: #fff;
  box-shadow: 0 8px 24px rgba(31, 111, 214, 0.28);
}
.hero-deco {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}
.hero-deco, .hero-bubble { pointer-events: none; }
.hero-deco-1 { width: 170px; height: 170px; top: -64px; right: -44px; }
.hero-deco-2 { width: 120px; height: 120px; bottom: -56px; left: -34px; }
.hero-bubble {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}
.hero-bubble-1 { width: 14px; height: 14px; top: 30px; right: 74px; }
.hero-bubble-2 { width: 8px; height: 8px; top: 56px; right: 50px; }
.hero-top { display: flex; justify-content: space-between; align-items: center; }
.hero-greet { font-size: 15px; font-weight: 700; opacity: 0.95; }
.hero-greet span { font-weight: 800; }
.hero-cup { font-size: 34px; line-height: 1; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.22)); }
.hero-points {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 14px;
}
.hero-points-num {
  font-size: 45px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -1px;
}
.hero-points-label { font-size: 18px; font-weight: 700; opacity: 0.95; }
.hero-refresh {
  margin-left: auto;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.hero-refresh:hover { background: rgba(255, 255, 255, 0.32); }
.hero-refresh:active { transform: scale(0.92); }
.hero-refresh.spinning svg { animation: hero-refresh-spin 0.8s linear infinite; }
@keyframes hero-refresh-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.hero-hint { font-size: 12.5px; opacity: 0.85; margin-top: 8px; }
.hero-stats {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.hero-stat {
  flex: 1;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hero-stat-label { font-size: 11.5px; opacity: 0.85; }
.hero-stat-value { font-size: 15px; font-weight: 800; }

/* ═══════════ เมนูด่วน (action grid) ═══════════ */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}
.action-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  background: #fff;
  border: 1px solid #dce5f1;
  border-radius: 20px;
  padding: 14px;
  font-family: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(31, 111, 214, 0.06);
  transition: transform 0.12s ease;
}
.action-tile:active { transform: scale(0.96); }
.action-tile.primary {
  background: linear-gradient(135deg, #2f7fe0, #5aa8f0);
  border: none;
  color: #fff;
  box-shadow: 0 6px 16px rgba(31, 111, 214, 0.3);
}
.action-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: #e8f1fd;
  color: #1f6fd6;
  display: flex;
  align-items: center;
  justify-content: center;
}
.action-tile.primary .action-icon { background: #fff; color: #1f6fd6; }
.action-icon.tile-cyan { background: #e0f4fb; color: #0f9cc4; }
.action-icon.tile-amber { background: #fdf1dc; color: #d97706; }
.action-icon.tile-violet { background: #efe9fd; color: #7c3aed; }
.action-icon.tile-coral { background: #fdecec; color: #e05252; }
.action-icon.tile-green { background: #dcf5e7; color: #157046; }
.action-label { font-size: 14.5px; font-weight: 800; color: #1c1c1c; }
.action-tile.primary .action-label { color: #fff; }
.action-sub { font-size: 11.5px; color: var(--muted); }
.action-tile.primary .action-sub { color: rgba(255, 255, 255, 0.85); }

/* ═══════════ ส่วนคะแนน ═══════════ */
.points-section { padding: 18px 16px 40px; }

.section-title-brand {
  text-align: center;
  font-size: 21px;
  font-weight: 800;
  color: var(--brand);
  padding-bottom: 10px;
  position: relative;
}
.section-title-brand::after {
  content: "";
  display: block;
  width: 100%;
  height: 2px;
  background: var(--brand);
  margin-top: 8px;
}

.points-big {
  text-align: center;
  font-size: 64px;
  font-weight: 800;
  color: #111;
  margin-top: 18px;
  line-height: 1;
}
.points-label {
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  color: #3d3d3d;
  margin: 4px 0 22px;
}

/* ── ปุ่ม ── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 26px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
}
.btn + .btn { margin-top: 12px; }
.btn-lg { padding: 15px; font-size: 17px; }
.btn-primary { background: var(--brand); }
.btn-primary:active { background: var(--brand-dark); }
.btn-black { background: var(--black); }
.btn-light { background: var(--brand-soft); }
.btn-line { background: var(--green-line); }
.btn-ghost { background: #dbe6f4; color: #333; border: 1px solid #bbb; }
.btn-back { background: #4b4b4b; color: #fff; width: auto; min-width: 180px; font-size: 14px; }

/* ── แถวข้อมูล ── */
.divider-line {
  height: 1px;
  background: var(--line);
  margin: 24px 0 6px;
}
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 2px;
  font-size: 15px;
  color: #444;
  border-bottom: 1px dashed #c8d4e4;
}
.info-row .brand { color: var(--brand-tint); font-weight: 600; }

/* ── ขอบกระดาษฉีก ── */
.tear-edge {
  display: block;
  width: calc(100% + 36px);
  height: 12px;
  margin: 22px -18px 0;
}

/* ── ประวัติ ── */
.history-title {
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  color: #333;
  margin: 20px 0 14px;
}
.history-list { display: flex; flex-direction: column; gap: 12px; }

.history-card {
  background: #fff;
  border: 1px solid #dce5f1;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 1px 4px rgba(31, 111, 214, 0.08);
}
.h-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  padding: 3px 0;
}
.h-row .dim { color: var(--muted); }
.h-row .branch { font-weight: 700; color: #222; }
.h-row .amount { color: #222; }
.h-divider { border-top: 1px solid #e6edf6; margin: 8px 0; }
.h-earn { color: var(--brand-tint); font-weight: 700; }
.h-empty {
  background: #fff;
  border: 1px dashed #c3cfe0;
  border-radius: 12px;
  text-align: center;
  color: var(--muted);
  padding: 26px;
  font-size: 14px;
}

/* ═══════════ หน้าเข้าสู่ระบบ ═══════════ */
.login-body { padding: 34px 28px; }
.login-heading { font-size: 24px; font-weight: 800; margin-bottom: 26px; }
.login-heading.small { font-size: 19px; }

.text-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid #a9bdd8;
  background: transparent;
  padding: 11px 2px;
  font-size: 16px;
  font-family: inherit;
  color: #111;
  border-radius: 0;
  outline: none;
}
.text-input:focus { border-bottom-color: var(--brand); }
.text-input::placeholder { color: #8a97a8; }
.text-input + .text-input { margin-top: 5px; }

.pw-wrap { position: relative; margin-top: 18px; }
.pw-wrap .text-input { margin-top: 0; padding-right: 40px; }
.pw-eye {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #777;
  cursor: pointer;
  display: flex;
  padding: 6px;
}

.forgot-link {
  display: block;
  text-align: right;
  font-size: 13px;
  color: #333;
  margin: 14px 0 26px;
  text-decoration: none;
}

.or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  color: #8a97a8;
  font-size: 14px;
}
.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #c3cfe0;
}

.btn-line svg { flex-shrink: 0; }

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

.demo-note {
  margin-top: 26px;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
  background: #f4f8fe;
  border: 1px dashed #b9cdea;
  border-radius: 10px;
  padding: 12px;
}
.demo-note b { color: var(--brand); }

/* หน้าเลือกบัญชีโหมดสาธิต */
.demo-badge {
  display: inline-block;
  background: #cfe2fa;
  color: #14487f;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 12px;
  margin-bottom: 16px;
}
.demo-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 22px;
}
.demo-desc code { background: #e3ecf8; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.demo-members {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
}
.demo-member {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid #dce5f1;
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  text-align: left;
  color: #222;
}
.demo-member:active { background: #f0f6fd; }
.demo-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--green-line);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.demo-member .dm-name { font-weight: 700; display: block; }
.demo-member .dm-sub { font-size: 12px; color: var(--muted); display: block; }

/* ═══════════ หน้าข้อมูลส่วนตัว ═══════════ */
.profile-header { border-bottom: 2px solid #b8d4f5; }
.profile-body { padding: 26px 18px 40px; }
.profile-card {
  background: #fff;
  border-radius: 14px;
  margin-top: 26px;
  padding: 6px 18px;
  border: 1px solid #dce5f1;
}
.pfield {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #eef3fa;
}
.pfield:last-child { border-bottom: none; }
.plabel { font-size: 14px; color: var(--muted); }
#btn-register-mid { width: 140px; flex: 0 0 140px; margin-left: auto; padding: 8px 16px; min-height: 36px; border-radius: 6px; font-size: 14px; }
#btn-register-mid[hidden] { display: none; }
.pvalue { font-size: 14.5px; font-weight: 600; color: #222; }

/* ── แก้ไขข้อมูลส่วนตัว ── */
.profile-actions { margin-top: 14px; }
.profile-actions .btn + .btn { margin-top: 10px; }
#btn-edit-profile { margin-top: 14px; }

.pfield.is-editing {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.pfield.is-editing .pedit-input {
  flex: none;
  width: 100%;
  box-sizing: border-box;
}

.pedit-input {
  flex: 1;
  min-width: 0;
  text-align: right;
  border: 1px solid #a9bdd8;
  border-radius: 10px;
  background: #f5f9ff;
  padding: 8px 10px;
  font-size: 14.5px;
  font-weight: 600;
  color: #222;
  font-family: inherit;
  outline: none;
}
.pedit-input:focus { border-color: var(--brand); }
.pedit-select { text-align: left; padding-right: 8px; }

.confirm-desc { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 12px; }
.confirm-list {
  background: #f7fafd;
  border: 1px dashed #b9cdea;
  border-radius: 10px;
  padding: 6px 14px;
  margin-bottom: 10px;
}
.confirm-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid #eef3fa;
  font-size: 13.5px;
}
.confirm-row:last-child { border-bottom: none; }
.c-label { flex: 0 0 100px; color: var(--muted); font-size: 12.5px; }
.c-old {
  flex: 1;
  color: #999;
  text-decoration: line-through;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.c-new {
  flex: 1;
  color: var(--brand);
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ═══════════ Modal / Bottom sheet ═══════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 50;
}
.modal-overlay[hidden] { display: none; }
.login-setup-modal { position: fixed; inset: 0; margin: auto; width: min(420px, calc(100vw - 32px)); max-height: 90vh; overflow-y: auto; border: 0; border-radius: 16px; padding: 24px; }
.login-setup-modal::backdrop { background: rgba(0, 0, 0, .55); }
.login-setup-modal .mid-register-logo { display: block; width: 200px; object-fit: contain; border-radius: 10px; margin: 0 auto 26px; }
.login-setup-modal h2 { background: #fa0d68; color: #fff; padding: 10px 6px; font-size: 18px; line-height: 24px; }
.login-setup-modal .text-input { width: 100%; height: 40px; padding: 8px 10px; border: 1px solid #d2d6de; border-radius: 5px; background: #fff; font-size: 15px; }
.login-setup-modal .text-input:focus { border-color: #fa0d68; }
.login-setup-modal .text-input:disabled { background: #eee; color: #000; -webkit-text-fill-color: #000; opacity: 1; }
.login-setup-modal .btn-primary { background: #7fc52b; border-radius: 8px; padding: 10px; font-size: 16px; line-height: 22px; }
.login-setup-modal .btn-primary:active { background: #6dae22; }
.login-setup-modal .mid-form-cancel { background: #619b24; color: #fff; border-radius: 8px; padding: 10px; font-size: 16px; line-height: 22px; }
.login-setup-modal .mid-form-cancel:active { background: #52851e; }
.login-setup-modal label { display: block; margin-top: 16px; margin-bottom: 6px; }
.login-setup-modal button { margin-top: 20px; }
.login-setup-modal .mid-form-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.login-setup-modal .mid-form-actions button { margin-top: 0; }
.guest-otp-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.guest-otp-row #guest-request-otp { width: auto; margin: 0; padding: 0 12px; border-radius: 8px; font-size: 14px; white-space: nowrap; }
.guest-otp-row #guest-request-otp:disabled { opacity: .55; cursor: default; }
#guest-phone-availability { margin-top: 4px; color: var(--error); font-size: 12px; line-height: 1.5; }
#guest-phone-title + p, #guest-phone-status { margin-top: 10px; font-size: 14px; line-height: 1.5; }

/* ป๊อปอัป QR */
.qr-popup {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,0.05) 0 1px, transparent 1px) 0 0 / 6px 6px,
    #2c3a4d;
  border-radius: 16px;
  padding: 26px 24px 20px;
  width: min(380px, 88vw);
}
.qr-left { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.qr-left img { width: 172px; height: 172px; background: #fff; padding: 6px; border-radius: 6px; }
.qr-memberno { color: #fff; font-size: 15px; font-weight: 700; letter-spacing: 2px; }
.qr-member-id { color: #ff8a00; font-size: 1.15em; font-weight: 700; margin-top: -6px; line-height: 1.2; }

.qr-right { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ring-wrap { position: relative; width: 96px; height: 96px; }
.ring { width: 96px; height: 96px; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: rgba(255,255,255,0.22); stroke-width: 5; }
.ring-progress { fill: none; stroke: #7db4f0; stroke-width: 5; stroke-linecap: round; }
.ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.ring-num { font-size: 26px; font-weight: 800; line-height: 1; }
.ring-unit { font-size: 10px; color: rgba(255,255,255,0.75); }
.qr-time { color: #fff; font-size: 15px; font-weight: 700; margin-top: 4px; }
.qr-date { color: rgba(255,255,255,0.7); font-size: 13px; }

.qr-popup .btn-back { margin-top: 12px; }
.qr-warning {
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  margin-top: 14px;
  text-align: center;
}

/* Bottom sheet */
.sheet {
  width: min(420px, 92vw);
  background: #fff;
  border-radius: 18px 18px 0 0;
  overflow: hidden;
  align-self: flex-end;
}
.sheet-header {
  background: var(--brand);
  color: #fff;
  text-align: center;
  font-size: 17px;
  font-weight: 800;
  padding: 15px;
}
#menu-modal .sheet {
  align-self: center;
  border-radius: 18px;
}
.sheet-list { padding: 10px 0; }
.sheet-item {
  display: block;
  width: 100%;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 16px;
  color: #222;
  padding: 16px;
  text-align: center;
  cursor: pointer;
}
.sheet-item + .sheet-item { border-top: 1px solid #f0ede6; }
.sheet-item.danger { color: var(--error); font-weight: 600; }
.sheet-item:active { background: #f0f6fd; }

.sheet-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid #eee;
  font-size: 15px;
  font-weight: 700;
}
.lang-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  color: #999;
}
.lang-btn.lang-active { color: var(--brand); }
.lang-sep { color: #bbb; }
.lang-btn.lang-inactive { color: #999; }

/* แผ่นเปลี่ยนรหัสผ่าน */
#pw-current[hidden] { display: none; }
.otp-request { margin: 12px 0; }
.otp-request:disabled { opacity: .55; cursor: not-allowed; }
.pw-sheet {
  border-radius: 18px;
  align-self: center;
  padding-bottom: 20px;
}
.pw-form { padding: 20px 22px 6px; }
.pw-form .text-input { margin-top: 14px; }
.pw-form .text-input:first-child { margin-top: 0; }
.pw-form .btn { margin-top: 16px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 20, 0.92);
  color: #fff;
  font-size: 14px;
  padding: 12px 22px;
  border-radius: 24px;
  z-index: 100;
  max-width: 86vw;
  text-align: center;
}
.toast[hidden] { display: none; }

/* ── จอเล็ก (มือถือจริง) ── */
@media (max-width: 430px) {
  .phone { width: 100vw; }
  .floating-actions { left: 6px; }
}

/* ═══════════ หน้า: ประกาศความเป็นส่วนตัว (PDPA) ═══════════ */
.privacy-page { background: var(--bg); }
.privacy-header { border-bottom: 1px solid #d3e2f5; }
.privacy-body {
  padding: 22px 20px 48px;
  background: #fff;
  min-height: calc(100vh - 61px);
}
.pn-updated {
  display: inline-block;
  font-size: 12.5px;
  color: var(--brand);
  background: var(--brand-light);
  padding: 6px 12px;
  border-radius: 14px;
  margin-bottom: 18px;
  font-weight: 600;
}
.pn-title {
  font-size: 23px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.35;
  margin: 0 0 4px;
}
.pn-brand {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 14px;
}
.pn-h2 {
  font-size: 17.5px;
  font-weight: 800;
  color: var(--brand-dark);
  margin: 26px 0 10px;
  padding-top: 14px;
  border-top: 2px solid var(--brand-light);
  line-height: 1.4;
}
.pn-h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 18px 0 8px;
  line-height: 1.4;
}
.pn-p {
  font-size: 14px;
  line-height: 1.75;
  color: #3a3f47;
  margin: 0 0 10px;
  text-align: justify;
}
.pn-ul {
  margin: 2px 0 12px;
  padding-left: 22px;
}
.pn-ul li {
  font-size: 14px;
  line-height: 1.75;
  color: #3a3f47;
  margin-bottom: 5px;
}

/* สลับภาษา TH/EN (หน้าเข้าสู่ระบบ) */
.login-lang {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}
.login-admin { margin-top: 18px; text-align: center; }
.login-admin a { display: block; color: var(--muted); font-size: 14px; text-decoration: none; }
.login-admin a:hover { color: var(--brand); }

/* หมายเหตุช่องกรอกเบอร์โทร (หน้าเข้าสู่ระบบ) */
.login-phone-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.login-phone-note .req {
  color: var(--error);
  font-weight: 800;
}

/* ═══════════ หน้าแลกคะแนน ═══════════ */
.redeem-points-bar {
  background: var(--brand-light);
  border: 1px solid #c3d8ed;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 15px;
  color: #333;
  text-align: center;
  margin-bottom: 16px;
}
.redeem-points-bar b { color: var(--brand); font-size: 22px; font-weight: 900; }
.redeem-list { display: flex; flex-direction: column; gap: 12px; }
.redeem-card {
  background: #fff;
  border: 1px solid #dce5f1;
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(31,111,214,0.06);
  transition: opacity .2s;
}
.redeem-card button:disabled { opacity: 0.55; cursor: not-allowed; }
.redeem-detail-modal {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(420px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: transparent;
  overflow: auto;
}
.redeem-detail-modal::backdrop { background: rgba(18, 33, 54, .65); }
body:has(.redeem-detail-modal[open]) { overflow: hidden; }
.redeem-detail-modal > .redeem-card { position: relative; }
.redeem-detail-close {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #d8e5f5;
  border-radius: 50%;
  background: #fff;
  color: #193755;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.redeem-card-img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  margin-bottom: 12px;
  display: block;
  background: #f0f4f9;
}
.redeem-card-top { display: flex; justify-content: space-between; align-items: center; }
.redeem-card-title { font-size: 16px; font-weight: 800; color: #222; flex: 1; }
.redeem-card-cost { font-size: 14px; color: var(--muted); white-space: nowrap; margin-left: 12px; }
.redeem-card-cost b { color: var(--brand); font-weight: 900; font-size: 18px; }
.redeem-card-desc { font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.redeem-history-card .h-earn { color: #d93025 !important; }
.redeem-history-card .redeem-status.is-pending { color: #0a8f3c; }
.redeem-history-card .redeem-status.is-received { color: #d93025; }

/* ═══════════ หน้าคูปอง ═══════════ */
.coupon-input-wrap { margin-bottom: 18px; }
.coupon-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 15px; }
.add-coupon {max-width: 200px; margin: 25px auto;}

/* ═══════════ หน้าโปรโมชัน ═══════════ */
.promo-list, .mission-list { display: flex; flex-direction: column; gap: 14px; }
.promo-card, .mission-card {
  background: #fff;
  border: 1px solid #dce5f1;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(31,111,214,0.06);
}
.promo-img { width: 100%; height: auto; display: block; }
.promo-body { padding: 16px 18px; }
.promo-title { font-size: 17px; font-weight: 800; color: #222; }
.promo-desc { font-size: 13.5px; color: #555; margin-top: 6px; line-height: 1.6; }
.promo-date { font-size: 12.5px; color: var(--muted); margin-top: 8px; }

.mission-card { position: relative; isolation: isolate; padding: 16px 18px; overflow-wrap: anywhere; }
.mission-completed-mark {
  position: absolute;
  right: 6px;
  bottom: 11px;
  z-index: -1;
  width: 94px;
  height: auto;
  color: #cae3c5;
  pointer-events: none;
}
.mission-card h2 {
  padding-bottom: 6px;
  border-bottom: 1px solid #e1e5eb;
  color: #1956b3;
  font-size: 17px;
  line-height: 1.45;
}
.mission-card h3 { margin-top: 9px; font-size: 14px; line-height: 1.5; }
.mission-card ol { padding-inline-start: 1.5em; margin-top: 4px; font-size: 13px; line-height: 1.6; }
.mission-card li + li { margin-top: 4px; }
.mission-points {
  display: inline-block;
  margin-top: 5px;
  padding: 6px 10px;
  border: 1px solid #a3e891;
  border-radius: 10px;
  background: #e3fadc;
  color: #183921;
  font-size: 20px;
  line-height: 1.35;
  font-weight: 800;
}
.mission-period { font-size: 13px; line-height: 1.5; }
.mission-note { margin-top: 12px; color: #b84717; }
.btn.is-processing { display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: wait; }
.btn.is-processing::before { content: ''; flex-shrink: 0; width: 14px; height: 14px; border: 2px solid #ffffff70; border-top-color: #fff; border-radius: 50%; animation: button-processing-spin .8s linear infinite; }
@keyframes button-processing-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn.is-processing::before { animation: none; } }

.hero-commission {
  margin-top: 18px;
  font-size: 16px;
}

.hero-commission-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; }
.hero-commission-row[hidden] { display: none; }
.hero-commission-row .hero-commission { margin-top: 0; }
.commission-withdraw-link { color: #fff; border: 1px solid #fff; border-radius: 18px; padding: 6px 12px; white-space: nowrap; text-decoration: none; }

.mid-registration-notice { margin: 16px 0; padding: 12px 14px; border: 1px solid #f0cf80; border-radius: 12px; background: #fff8e6; color: #714d00; font-size: 14px; line-height: 1.7; }
.mid-registration-notice button { padding: 0; border: 0; background: none; color: #175fb5; font: inherit; text-decoration: underline; cursor: pointer; }
#btn-line[hidden], .or-divider[hidden] { display: none; }

/* Rewards catalog */
#view-redeem { background: #f3f7fc; }
.redeem-intro { position: relative; overflow: hidden; border-radius: 24px; padding: 24px; margin-bottom: 16px; background: linear-gradient(120deg, #e1edff, #fdf4e3); color: #193c70; }
.redeem-eyebrow { font-size: 11px; font-weight: 800; letter-spacing: 2px; color: #426fa5; }
.redeem-intro h2 { position: relative; z-index: 1; margin: 12px 0; font-size: 25px; line-height: 1.35; font-weight: 900; }
.redeem-intro p { position: relative; z-index: 1; max-width: 230px; margin: 0; font-size: 12px; line-height: 1.7; color: #4e6685; }
.redeem-intro-art { position: absolute; right: 14px; top: 50px; font-size: 70px; transform: rotate(10deg); opacity: .8; }
#view-redeem .redeem-points-bar { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; background: #fff; border: 1px solid #d8e5f5; border-radius: 18px; box-shadow: 0 4px 16px #1f4a7d08; padding: 15px; }
#view-redeem .redeem-points-bar b { font-size: 30px; }
.redeem-section-header { margin: 24px 0 14px; }
.redeem-section-heading { margin: 0; padding-bottom: 8px; border-bottom: 1px solid #d8dee6; color: #193755; font-size: 18px; }
.redeem-notice {
  margin-top: 8px;
  color: #c3410c;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
#view-redeem .redeem-list { gap: 20px; }
:is(#view-redeem, .redeem-detail-modal) .redeem-card { overflow: hidden; padding: 14px; border-radius: 24px; box-shadow: 0 8px 24px #193c700b; }
:is(#view-redeem, .redeem-detail-modal) .redeem-card-img { max-height: none; width: 100%; height: auto; object-fit: cover; border-radius: 16px; background: linear-gradient(135deg, #edf4fc, #fff8ed); margin-bottom: 18px; }
:is(#view-redeem, .redeem-detail-modal) .redeem-card-top { gap: 12px; align-items: flex-start; }
:is(#view-redeem, .redeem-detail-modal) .redeem-card-title { color: #203c59; font-size: 17px; line-height: 1.5; overflow-wrap: anywhere; }
:is(#view-redeem, .redeem-detail-modal) .redeem-card-cost { margin-left: 0; border-radius: 12px; padding: 6px 10px; background: #eef5ff; color: #42658c; font-size: 11px; }
:is(#view-redeem, .redeem-detail-modal) .redeem-card-cost b { display: block; font-size: 22px; line-height: 1.2; }
:is(#view-redeem, .redeem-detail-modal) .redeem-card-desc { line-height: 1.7; }
:is(#view-redeem, .redeem-detail-modal) .redeem-action { margin-top: 16px; border-radius: 14px; padding: 13px; font-size: 15px; width: 100%; }
.redeem-detail-modal .redeem-action:not(:disabled) { background: linear-gradient(110deg, #2268ce, #438eeb); box-shadow: 0 5px 12px #286dd226; }
:is(#view-redeem, .redeem-detail-modal) .redeem-action:disabled { opacity: 1; background: #e9eef4; color: #61758b; }
#view-redeem .redeem-list-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 10px;
}
#view-redeem .redeem-list-grid .redeem-card {
  display: flex;
  flex-direction: column;
  padding: 9px;
  border-radius: 16px;
  overflow-wrap: anywhere;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
#view-redeem .redeem-list-grid .redeem-card-img { margin-bottom: 10px; border-radius: 10px; }
#view-redeem .redeem-list-grid .redeem-card-top { width: 100%; flex-direction: column; align-items: flex-start; gap: 6px; }
#view-redeem .redeem-list-grid .redeem-card-title { font-size: 14px; }
#view-redeem .redeem-list-grid .redeem-card-cost { align-self: flex-end; font-size: 10px; }
#view-redeem .redeem-list-grid .redeem-card-cost b { display: inline; font-size: 16px; }
#view-redeem .redeem-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (max-width: 350px) { .redeem-intro-art { font-size: 48px; right: 8px; } .redeem-intro { padding: 18px; } .redeem-intro h2 { font-size: 22px; } }

/* Member home: recent activity tabs */
.recent-history { margin-top: 24px; background: #fff; border: 1px solid #d5e1f3; border-radius: 15px; overflow: hidden; }
.recent-history .history-title { margin: 0; padding: 22px 18px 12px; text-align: left; color: #12345b; }
.history-tabs { display: flex; gap: 22px; padding: 0 18px; border-bottom: 1px solid #d5e1f3; }
.history-tab { padding: 12px 0 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #657e9f; font: inherit; font-size: 14px; cursor: pointer; }
.history-tab[aria-selected="true"] { color: #347cff; border-bottom-color: #347cff; }
.history-tab:focus-visible { outline: 2px solid #347cff; outline-offset: -2px; }
.recent-history .history-list { gap: 0; }
.recent-history .history-list[hidden] { display: none; }
.recent-history .history-card { position: relative; padding: 18px; border: 0; border-radius: 0; box-shadow: none; }
.recent-history .history-card + .history-card { border-top: 1px solid #d5e1f3; }
.recent-history .h-row { gap: 10px; font-size: 13px; }
.recent-history .h-row .branch { font-weight: 400; overflow-wrap: anywhere; }
.recent-history .h-row .amount, .recent-history .h-earn { flex-shrink: 0; }
.recent-history .h-divider { margin: 5px 0; }
.recent-history .h-empty { border: 0; border-radius: 0; }

.recent-history .history-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; align-items: center; }
.recent-history .h-row { display: contents; }
.recent-history .h-divider { display: none; }
.recent-history .branch { grid-column: 1; grid-row: 1; color: #12345b; font-size: 13px; }
.recent-history .h-earn { grid-column: 2; grid-row: 1; color: #00a79d; font-size: 14px; font-weight: 400; text-align: right; }
.recent-history .h-row:first-child .dim { grid-column: 1; grid-row: 2; font-size: 12px; }
.recent-history .h-row:first-child .dim:nth-child(2) { display: none; }
.recent-history .amount { grid-column: 2; grid-row: 2; font-size: 12px; text-align: right; color: var(--muted); }
.recent-history .history-card:not(.redeem-history-card) .h-row:last-child .dim { display: none; }
.recent-history .redeem-history-card .branch { grid-column: 1 / -1; }
.recent-history .redeem-history-card .h-earn { grid-row: 2; }
.recent-history .redeem-history-card .redeem-status { grid-column: 1; grid-row: 3; font-size: 14px; text-align: left; }
.recent-history .redeem-history-card .redeem-received-date { grid-column: 2; grid-row: 3; font-size: 12px; text-align: right; }

.recent-history #history-list .amount { grid-row: 1; }
.recent-history #history-list .h-earn { grid-row: 2; }
/* Member pages grow with the viewport while other flows keep their own sizing. */
.member-app .phone { width: 100%; max-width: 900px; }
.member-bottom-nav { display: none; }
@media (min-width: 600px) {
  .member-app .points-section { padding: 24px; }
  .member-app .actions-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .member-app .action-tile { padding: 20px; }
}
@media (max-width: 599px) {
  .member-app.has-member-nav .phone { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  .member-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 18px #12345b12;
    z-index: 20;
  }
  .member-bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 48px; min-width: 0; color: var(--muted); font-size: 11px; text-decoration: none; border-radius: 10px; }
  .member-bottom-nav a[aria-current="page"] { color: var(--brand); background: var(--brand-light); font-weight: 600; }
  .member-bottom-nav a:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
  .member-app.has-member-nav .toast { bottom: calc(90px + env(safe-area-inset-bottom, 0px)); }
}

/* Login: brand panel beside a comfortable form on tablets and desktops. */
.member-login .login-page { width: 100%; max-width: 900px; }
.login-brand-panel { display: none; }
.member-login .login-body .text-input { border: 1px solid #b9cdea; background: #fff; border-radius: 10px; padding: 13px 12px; }
.member-login .login-body .text-input:focus { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (min-width: 600px) {
  .member-login .login-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: calc(100vh - 66px); min-height: calc(100dvh - 66px); }
  .member-login .login-brand-panel { display: flex; position: relative; isolation: isolate; overflow: hidden; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 32px; background: linear-gradient(145deg, var(--brand-dark), var(--brand), var(--brand-soft)); color: #fff; }
  .member-login .login-brand-panel::before, .member-login .login-brand-panel::after { content: ''; position: absolute; z-index: -1; width: 360px; height: 360px; border-radius: 50%; background: #ffffff10; }
  .member-login .login-brand-panel::before { top: -160px; left: -150px; }
  .member-login .login-brand-panel::after { bottom: -130px; right: -160px; }
  .member-login .login-brand-logo { width: min(100%, 240px); height: auto; border-radius: 18px; }
  .member-login .login-brand-name { max-width: 100%; overflow-wrap: anywhere; text-align: center; font-size: 24px; font-weight: 700; }
  .member-login .login-body { width: 100%; max-width: 420px; margin: auto; padding: 40px 28px; }
  .member-login .login-heading { text-align: center; }


}

.member-login .login-header { justify-content: center; }
.login-password-toggle { display: flex; align-items: center; gap: 12px; margin-top: 5px; min-height: 44px; font-size: 14px; cursor: pointer; }
.login-password-toggle[hidden] { display: none; }
.login-password-toggle input { width: 24px; height: 24px; flex-shrink: 0; accent-color: var(--brand); cursor: pointer; }
.member-login #btn-request-otp[hidden] { display: none; }
.member-login .login-otp-row { display: flex; align-items: stretch; gap: 10px; margin-top: 12px; }
.member-login .login-otp-row .text-input { flex: 1; min-width: 0; }
.member-login .login-otp-row .otp-request { flex: 0 0 auto; width: auto; margin: 0; padding: 10px 12px; border-radius: 5px; font-size: 14px; white-space: nowrap; }
.login-mode-options { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0 12px; }
.login-forgot-link { margin-top: 5px; margin-left: auto; padding-block: 12px; color: var(--brand); font-size: 13px; text-decoration: none; }
.login-forgot-link:hover { text-decoration: underline; }
.login-forgot-link[hidden] { display: none; }
