/* =========================================================
   ระบบรับชำระเงิน — design system
   ฟอนต์: IBM Plex Sans Thai (SIL OFL) เก็บในเครื่อง ไม่โหลดจากภายนอก
   ========================================================= */
@font-face { font-family: 'Plex Thai'; font-weight: 400; font-display: swap; src: url(/fonts/plex-thai-thai-400.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Plex Thai'; font-weight: 500; font-display: swap; src: url(/fonts/plex-thai-thai-500.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Plex Thai'; font-weight: 600; font-display: swap; src: url(/fonts/plex-thai-thai-600.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Plex Thai'; font-weight: 700; font-display: swap; src: url(/fonts/plex-thai-thai-700.woff2) format('woff2'); unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: 'Plex Thai'; font-weight: 400; font-display: swap; src: url(/fonts/plex-thai-latin-400.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD, U+0E3F; }
@font-face { font-family: 'Plex Thai'; font-weight: 500; font-display: swap; src: url(/fonts/plex-thai-latin-500.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD, U+0E3F; }
@font-face { font-family: 'Plex Thai'; font-weight: 600; font-display: swap; src: url(/fonts/plex-thai-latin-600.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD, U+0E3F; }
@font-face { font-family: 'Plex Thai'; font-weight: 700; font-display: swap; src: url(/fonts/plex-thai-latin-700.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD, U+0E3F; }

:root {
  --bg: #f2f5f5;
  --surface: #ffffff;
  --surface-2: #f6f8f8;
  --surface-3: #edf1f1;
  --border: #e2e8e8;
  --border-strong: #cdd6d6;
  --text: #0e1a1f;
  --text-2: #34434a;
  --muted: #687880;
  --primary: #0b7a6c;
  --primary-hover: #086a5d;
  --primary-press: #065a4f;
  --primary-soft: #e5f4f0;
  --primary-soft-2: #cdeae3;
  --on-primary: #ffffff;
  --hero-1: #0b7a6c;
  --hero-2: #0a4f5c;
  --ok: #14803c;
  --ok-soft: #e7f6ec;
  --warn: #a8580a;
  --warn-soft: #fdf2e1;
  --bad: #c42b2b;
  --bad-soft: #fdeceb;
  --info: #0b66a8;
  --info-soft: #e7f1fa;
  --skip: #8796a0;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-sm: 0 1px 2px rgba(14, 26, 31, 0.05);
  --shadow: 0 1px 2px rgba(14, 26, 31, 0.04), 0 6px 20px rgba(14, 26, 31, 0.06);
  --shadow-lg: 0 18px 50px rgba(14, 26, 31, 0.18);
  --font: 'Plex Thai', 'Noto Sans Thai', 'Leelawadee UI', 'Thonburi', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --nav-h: 68px;
  --header-h: 60px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1214;
    --surface: #141c1f;
    --surface-2: #192326;
    --surface-3: #1f2b2f;
    --border: #26343a;
    --border-strong: #34464d;
    --text: #e8eef0;
    --text-2: #c3cfd3;
    --muted: #8d9ea5;
    --primary: #2bb59f;
    --primary-hover: #3fc6b0;
    --primary-press: #55d3be;
    --primary-soft: #12302b;
    --primary-soft-2: #18413a;
    --on-primary: #04211c;
    --hero-1: #0d6d61;
    --hero-2: #0a3c47;
    --ok: #4ccb7b;
    --ok-soft: #10301d;
    --warn: #f1b04c;
    --warn-soft: #35270e;
    --bad: #ff7a70;
    --bad-soft: #3a1513;
    --info: #64b5f0;
    --info-soft: #102a3d;
    --skip: #6f8089;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 600; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; }
button { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.xs { font-size: 0.8rem; }
.center { text-align: center; }
.hidden { display: none !important; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 16px; }
.ic { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 16px; height: 16px; }
.ic.lg { width: 24px; height: 24px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  border-radius: 12px; border: 1px solid transparent;
  background: var(--surface-3); color: var(--text);
  font-weight: 600; font-size: 0.95rem; line-height: 1.2;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background 0.15s, transform 0.08s, box-shadow 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--border); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 28%, transparent); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.primary:active { background: var(--primary-press); }
.btn.outline { background: var(--surface); border-color: var(--border-strong); }
.btn.outline:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.success { background: var(--ok); color: #fff; }
.btn.success:hover { background: color-mix(in srgb, var(--ok) 88%, #000); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 16%, var(--surface)); }
.btn.white { background: #fff; color: #0a4f5c; }
.btn.white:hover { background: #f0f7f6; }
.btn.lg { min-height: 54px; font-size: 1.05rem; border-radius: 14px; padding: 12px 22px; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 0.875rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; box-shadow: none; transform: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; flex: none;
  border-radius: 12px; border: 0; background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn.soft { background: var(--surface-3); }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 16px; }
.field > span, .label { display: block; font-size: 0.9rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.hint { display: block; font-size: 0.82rem; color: var(--muted); margin-top: 6px; font-weight: 400; }
input[type='text'], input[type='password'], input[type='number'], input[type='date'], select, textarea {
  width: 100%; min-height: 50px; padding: 12px 14px;
  font: inherit; font-size: 1rem; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent); }
input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .ic { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.input-wrap > .ic ~ input { padding-left: 44px; }
.input-wrap > .suffix { position: absolute; right: 14px; color: var(--muted); font-weight: 500; pointer-events: none; }
.input-wrap > .icon-btn { position: absolute; right: 4px; }
.input-wrap.money > input { padding-left: 14px; font-size: 1.35rem; font-weight: 600; padding-right: 56px; font-variant-numeric: tabular-nums; }
.input-wrap.has-btn > input { padding-right: 50px; }
.form-grid { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); }
.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; flex: none; width: 46px; height: 28px; border-radius: 99px; background: var(--border-strong); position: relative; cursor: pointer; transition: background 0.15s; margin: 1px 0 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform 0.15s; }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(18px); }

/* segmented control */
.segmented { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 12px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.segmented button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-weight: 600; font-size: 0.9rem; color: var(--muted); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.segmented button[aria-pressed='true'] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented .count { background: var(--warn-soft); color: var(--warn); border-radius: 99px; padding: 0 7px; font-size: 0.75rem; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 2px 12px; }
.section-head h2 { font-size: 1.05rem; display: flex; align-items: center; }
.section-head .count-pill { background: var(--surface-3); color: var(--muted); border-radius: 99px; padding: 1px 10px; font-size: 0.82rem; font-weight: 600; margin-left: 8px; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--muted); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.primary { background: var(--primary-soft); color: var(--primary); }

/* avatar */
.avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 0.95rem; color: var(--primary); background: var(--primary-soft); }
.avatar.lg { width: 68px; height: 68px; font-size: 1.5rem; }

/* list rows */
.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--border); color: inherit; font: inherit; }
.list-item:last-child { border-bottom: 0; }
button.list-item, .list-item.clickable { cursor: pointer; transition: background 0.12s; }
button.list-item:hover, .list-item.clickable:hover { background: var(--surface-2); }
.list-item .main { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .sub { font-size: 0.84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .end { text-align: right; flex: none; display: grid; justify-items: end; gap: 4px; }
.list-item .amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.list-item .chev { color: var(--skip); }
.status-ic { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; }
.status-ic.ok { background: var(--ok-soft); color: var(--ok); }
.status-ic.warn { background: var(--warn-soft); color: var(--warn); }
.status-ic.bad { background: var(--bad-soft); color: var(--bad); }
.status-ic.info { background: var(--primary-soft); color: var(--primary); }
.menu-item .status-ic { background: var(--surface-3); color: var(--text-2); }
.menu-item.danger { color: var(--bad); }
.menu-item.danger .status-ic { background: var(--bad-soft); color: var(--bad); }

/* empty state */
.empty { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 36px 20px; color: var(--muted); }
.empty .bubble { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--skip); margin-bottom: 6px; }
.empty .bubble.ok { background: var(--ok-soft); color: var(--ok); }
.empty .bubble .ic { width: 28px; height: 28px; }
.empty strong { color: var(--text); font-size: 1.02rem; }

/* banners */
.banner { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--radius); padding: 14px 16px; font-size: 0.9rem; }
.banner .ic { margin-top: 2px; }
.banner strong { display: block; margin-bottom: 2px; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.info { background: var(--info-soft); color: var(--info); }
.banner.ok { background: var(--ok-soft); color: var(--ok); }

/* ---------- customer app ---------- */
.app-header {
  position: sticky; top: 0; z-index: 20;
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
}
.app-header .inner { max-width: 600px; margin: 0 auto; height: var(--header-h); padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); display: flex; align-items: center; gap: 12px; }
.app-header .hello { flex: 1; min-width: 0; line-height: 1.25; }
.app-header .hello small { display: block; color: var(--muted); font-size: 0.8rem; }
.app-header .hello strong { display: block; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-main { max-width: 600px; margin: 0 auto; padding: 8px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }
.page-title { font-size: 1.4rem; margin: 6px 2px 16px; }

.hero {
  position: relative; overflow: hidden;
  border-radius: var(--radius-xl); padding: 22px 22px 20px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 55%), linear-gradient(140deg, var(--hero-1), var(--hero-2));
  box-shadow: 0 14px 34px color-mix(in srgb, var(--hero-2) 35%, transparent);
}
.hero::after { content: ''; position: absolute; right: -40px; bottom: -60px; width: 180px; height: 180px; border-radius: 50%; border: 28px solid rgba(255, 255, 255, 0.06); pointer-events: none; }
.hero .label { color: rgba(255, 255, 255, 0.85); font-size: 0.92rem; font-weight: 500; margin: 0; }
.hero .amount { font-size: 2.4rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.hero .amount small { font-size: 1.05rem; font-weight: 500; opacity: 0.85; margin-left: 6px; }
.hero .meta { opacity: 0.85; font-size: 0.88rem; }
.hero .actions { margin-top: 18px; position: relative; z-index: 1; }
.hero .pill { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 5px 12px; border-radius: 99px; background: rgba(255, 255, 255, 0.16); font-size: 0.84rem; }

.bill { display: grid; gap: 12px; padding: 16px; cursor: pointer; transition: transform 0.1s, box-shadow 0.15s; text-align: left; width: 100%; color: inherit; font: inherit; }
.bill:hover { box-shadow: var(--shadow); }
.bill:active { transform: scale(0.99); }
.bill + .bill { margin-top: 12px; }
.bill .top { display: flex; gap: 12px; align-items: flex-start; }
.bill .title { font-weight: 600; font-size: 1.02rem; }
.bill .sub { font-size: 0.84rem; color: var(--muted); }
.bill .due-amount { margin-left: auto; text-align: right; flex: none; }
.bill .due-amount .v { font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.bill .due-amount .k { font-size: 0.75rem; color: var(--muted); }
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 60%, #22c55e)); }
.bill .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.84rem; color: var(--muted); }
.bill .pay-cta { color: var(--primary); font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.bill.done { cursor: default; }
.bill.done:hover { box-shadow: var(--shadow-sm); }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav .inner { max-width: 600px; margin: 0 auto; height: var(--nav-h); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.bottom-nav button { border: 0; background: none; display: grid; place-items: center; align-content: center; gap: 3px; font-size: 0.74rem; font-weight: 600; color: var(--muted); cursor: pointer; position: relative; }
.bottom-nav button .ic { width: 24px; height: 24px; }
.bottom-nav button[aria-current='page'] { color: var(--primary); }
.bottom-nav button[aria-current='page']::before { content: ''; position: absolute; top: 0; width: 32px; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary); }
.bottom-nav .badge { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--warn); color: #fff; font-size: 0.7rem; display: grid; place-items: center; }

.profile { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 26px 18px; }

/* ---------- sheet (dialog) ---------- */
dialog.sheet {
  padding: 0; border: 0; color: var(--text); background: var(--surface);
  width: min(560px, 100vw); max-width: 100vw; max-height: min(92dvh, 900px);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  overflow: hidden; display: none; flex-direction: column;
}
dialog.sheet[open] { display: flex; animation: sheet-in 0.22s ease-out; }
dialog.sheet.wide { width: min(1000px, 100vw); }
dialog.sheet::backdrop { background: rgba(6, 14, 18, 0.55); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 20px; border-bottom: 1px solid var(--border); flex: none; }
.sheet-head h2 { flex: 1; font-size: 1.1rem; min-width: 0; }
.sheet-head .sub { display: block; font-size: 0.82rem; color: var(--muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { padding: 20px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.sheet-foot { padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--surface); flex: none; display: grid; gap: 10px; }
.sheet-foot .row > .btn { flex: 1; }
@media (max-width: 640px) {
  dialog.sheet, dialog.sheet.wide { width: 100vw; margin: auto 0 0; border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-height: 94dvh; }
  dialog.sheet.full { height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  dialog.sheet.full .sheet-head { padding-top: calc(10px + env(safe-area-inset-top)); }
}

/* pay flow */
.pay-amount { text-align: center; padding: 4px 0 18px; }
.pay-amount .k { color: var(--muted); font-size: 0.9rem; }
.pay-amount .v { font-size: 2.1rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.pay-amount .v small { font-size: 1rem; font-weight: 500; color: var(--muted); margin-left: 4px; }
.step { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.step + .step { margin-top: 14px; }
.step-title { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 14px; }
.step-no { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-size: 0.85rem; font-weight: 700; flex: none; }
.qr-box { display: grid; justify-items: center; gap: 10px; padding: 16px; border-radius: var(--radius); background: var(--surface-2); margin-bottom: 12px; text-align: center; }
.qr-box img { width: 210px; height: 210px; border-radius: 12px; background: #fff; padding: 6px; box-shadow: var(--shadow-sm); }
.qr-box .pp { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: #0b3b6f; background: #e6eefb; padding: 3px 12px; border-radius: 99px; font-size: 0.85rem; }
.copy-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); }
.copy-row + .copy-row { margin-top: 8px; }
.copy-row .k { font-size: 0.8rem; color: var(--muted); }
.copy-row .v { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 420px) { .copy-row .btn .t { display: none; } .copy-row .btn { width: 40px; padding: 0; } }
.copy-row .n { font-size: 0.86rem; color: var(--text-2); }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.82rem; margin: 4px 0 12px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.upload {
  position: relative; display: grid; justify-items: center; gap: 6px; text-align: center; cursor: pointer;
  padding: 22px 16px; border: 2px dashed var(--border-strong); border-radius: var(--radius-lg);
  background: var(--surface-2); transition: border-color 0.15s, background 0.15s; margin-bottom: 16px;
}
.upload:hover, .upload.drag { border-color: var(--primary); background: var(--primary-soft); }
.upload .bubble { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.upload .bubble .ic { width: 26px; height: 26px; }
.upload strong { font-size: 1rem; }
.upload input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.preview { display: flex; gap: 14px; align-items: center; padding: 12px; border: 1.5px solid var(--primary-soft-2); background: var(--primary-soft); border-radius: var(--radius-lg); margin-bottom: 16px; }
.preview img { width: 64px; height: 88px; object-fit: cover; border-radius: 10px; background: #fff; flex: none; }
.preview .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.busy-view { display: grid; justify-items: center; gap: 14px; text-align: center; padding: 48px 16px; }
.busy-view .spinner { width: 54px; height: 54px; border-width: 4px; color: var(--primary); }
.busy-view ul { list-style: none; padding: 0; margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; display: grid; gap: 4px; }

.result { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 12px 0 20px; }
.result .big-ic { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 10px; }
.result .big-ic .ic { width: 42px; height: 42px; stroke-width: 2.4; }
.result.approved .big-ic { background: var(--ok-soft); color: var(--ok); box-shadow: 0 0 0 10px color-mix(in srgb, var(--ok-soft) 50%, transparent); }
.result.pending_review .big-ic { background: var(--warn-soft); color: var(--warn); box-shadow: 0 0 0 10px color-mix(in srgb, var(--warn-soft) 50%, transparent); }
.result.rejected .big-ic { background: var(--bad-soft); color: var(--bad); box-shadow: 0 0 0 10px color-mix(in srgb, var(--bad-soft) 50%, transparent); }
.result h3 { font-size: 1.3rem; }
.result p { color: var(--text-2); max-width: 440px; }
.result .note { margin-top: 6px; padding: 10px 14px; border-radius: var(--radius); background: var(--surface-2); font-size: 0.9rem; color: var(--text-2); }

.summary { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.summary > div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.summary > div:last-child { border-bottom: 0; }
.summary .k { color: var(--muted); }
.summary .v { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.summary .v.ok { color: var(--ok); }
.summary .v.bad { color: var(--bad); }

details.more { border: 1px solid var(--border); border-radius: var(--radius-lg); margin-top: 14px; }
details.more > summary { list-style: none; cursor: pointer; padding: 14px 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary .chev { margin-left: auto; transition: transform 0.15s; color: var(--muted); }
details.more[open] > summary .chev { transform: rotate(90deg); }
details.more > .inner { padding: 0 16px 8px; }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist .mark { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.checklist .mark .ic { width: 14px; height: 14px; stroke-width: 3; }
.checklist .pass .mark { background: var(--ok-soft); color: var(--ok); }
.checklist .warn .mark { background: var(--warn-soft); color: var(--warn); }
.checklist .fail .mark { background: var(--bad-soft); color: var(--bad); }
.checklist .skip .mark { background: var(--surface-3); color: var(--skip); }
.checklist .t { font-weight: 600; font-size: 0.92rem; }
.checklist .skip .t { color: var(--muted); font-weight: 500; }
.checklist .d { font-size: 0.84rem; color: var(--muted); word-break: break-word; }
.checklist .fail .d { color: var(--bad); }
.checklist .warn .d { color: var(--warn); }

.slip-thumb { display: block; width: 100%; max-height: 420px; object-fit: contain; border-radius: var(--radius); background: var(--surface-3); border: 1px solid var(--border); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 0.9rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

/* ---------- admin shell ---------- */
.admin { min-height: 100dvh; }
.sidebar { display: none; }
.admin-top { position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); }
.admin-top .inner { height: var(--header-h); padding: 0 12px 0 16px; display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; line-height: 1.2; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.brand small { display: block; font-size: 0.75rem; font-weight: 500; color: var(--muted); }
.admin-main { padding: 4px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); max-width: 1180px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 6px 0 18px; }
.page-head h1 { font-size: 1.4rem; }
.page-head p { color: var(--muted); font-size: 0.9rem; }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 8px; }
.stat { display: grid; gap: 10px; padding: 16px; text-align: left; font: inherit; color: inherit; }
.stat .chipic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; }
.stat .label { color: var(--muted); font-size: 0.85rem; }
.stat .value { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat .value small { font-size: 0.85rem; font-weight: 500; color: var(--muted); margin-left: 4px; }
button.stat { cursor: pointer; transition: box-shadow 0.15s; }
button.stat:hover { box-shadow: var(--shadow); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.panel-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.settings-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.settings-grid .card h2 { margin-bottom: 4px; }
.settings-grid .card > p.muted { margin-bottom: 16px; font-size: 0.9rem; }
.how { margin: 0; padding-left: 1.2em; font-size: 0.9rem; color: var(--text-2); }
.how li { margin-bottom: 6px; }

@media (min-width: 720px) {
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .settings-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; }
}
@media (min-width: 960px) {
  .admin { display: grid; grid-template-columns: 252px minmax(0, 1fr); }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh;
    padding: 20px 14px; background: var(--surface); border-right: 1px solid var(--border);
  }
  .sidebar .brand { padding: 4px 8px 20px; }
  .sidebar nav { display: grid; gap: 4px; }
  .sidebar nav button { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 0; border-radius: 12px; background: none; color: var(--text-2); font-weight: 600; cursor: pointer; text-align: left; }
  .sidebar nav button:hover { background: var(--surface-2); }
  .sidebar nav button[aria-current='page'] { background: var(--primary-soft); color: var(--primary); }
  .sidebar nav .badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); font-size: 0.75rem; display: grid; place-items: center; }
  .sidebar .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 8px 0; border-top: 1px solid var(--border); }
  .sidebar .me .grow { line-height: 1.25; }
  .admin-top { display: none; }
  .admin-main { padding: 28px 32px 48px; }
  .admin .bottom-nav { display: none; }
  .panel-grid.two { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
  #toast { bottom: 24px; }
}

/* review */
.review { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 820px) { .review { grid-template-columns: 320px minmax(0, 1fr); } .review .slip-thumb { max-height: 68dvh; } }
.compare { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.compare > div { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.compare .k { font-size: 0.75rem; color: var(--muted); }
.compare .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.compare .v.ok { color: var(--ok); }
.compare .v.bad { color: var(--bad); }
.verdict { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--radius); }
.verdict .ic { width: 24px; height: 24px; }
.verdict strong { display: block; }
.verdict span { font-size: 0.88rem; }
.verdict.approved { background: var(--ok-soft); color: var(--ok); }
.verdict.pending_review { background: var(--warn-soft); color: var(--warn); }
.verdict.rejected { background: var(--bad-soft); color: var(--bad); }
.decide { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .decide { grid-template-columns: 190px minmax(0, 1fr); } }

/* ---------- login ---------- */
.login-page { min-height: 100dvh; display: grid; justify-items: center; align-content: center; gap: 16px; padding: 24px 16px; background: radial-gradient(90% 55% at 50% 0%, var(--primary-soft) 0%, transparent 70%), var(--bg); }
.login-card { width: min(420px, 100%); padding: 28px 24px; }
.login-card .logo { width: 68px; height: 68px; border-radius: 20px; display: block; margin: 0 auto 14px; box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 30%, transparent); }
.login-card h1 { text-align: center; font-size: 1.35rem; }
.login-card .lead { text-align: center; color: var(--muted); margin: 4px 0 22px; }
.phone-card { width: min(420px, 100%); text-align: center; }
.phone-card img { display: block; margin: 12px auto; width: 190px; height: 190px; background: #fff; border-radius: 12px; padding: 6px; }
.offline-card { width: min(420px, 100%); text-align: center; padding: 28px 24px; display: grid; gap: 10px; justify-items: center; }
.offline-card .logo { width: 68px; height: 68px; border-radius: 20px; }

/* ---------- toast & misc ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-size: 0.92rem; font-weight: 500;
  opacity: 0; pointer-events: none; transition: all 0.2s; z-index: 100; max-width: calc(100vw - 32px); box-shadow: var(--shadow-lg);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); color: #fff; }
.login-page ~ #toast, .login-page + script ~ #toast { bottom: 24px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; display: inline-block; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.steps { margin: 0; padding-left: 1.3em; }
.steps li { margin-bottom: 10px; }
.share-ic { display: inline-block; border: 1.5px solid currentColor; border-radius: 4px; padding: 0 4px; font-size: 0.8em; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- เชื่อมต่อธนาคาร ---------- */
.choices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); margin: 14px 0 16px; }
.choice { position: relative; display: grid; gap: 4px; padding: 14px 14px 14px 46px; border: 1.5px solid var(--border); border-radius: var(--radius); cursor: pointer; background: var(--surface); transition: border-color 0.15s, background 0.15s; }
.choice:hover { border-color: var(--border-strong); }
.choice input { position: absolute; left: 14px; top: 16px; width: 20px; height: 20px; margin: 0; accent-color: var(--primary); }
.choice strong { font-size: 0.98rem; }
.choice span { font-size: 0.84rem; color: var(--muted); }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice .rec { position: absolute; right: 10px; top: 10px; }
.conn-status { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); }
.conn-status .title { font-weight: 600; }
.conn-fields { border-top: 1px solid var(--border); padding-top: 16px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { flex: 1 1 160px; }
.banner a { color: inherit; text-decoration: underline; font-weight: 600; }
.banner .btn { margin-top: 10px; }

/* ---------- หน้าติดตั้งแอป ---------- */
.phone-qr-img { display: block; margin: 12px auto; width: 200px; height: 200px; background: #fff; border-radius: 12px; padding: 6px; }
.app-card .qr { display: block; width: 168px; height: 168px; background: #fff; border-radius: 12px; padding: 6px; margin: 4px auto 10px; }
