/* ═══════════ SRSP Money — styles (โทนสว่าง · mobile-first · Inter + Noto Sans Thai) ═══════════ */

:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --ink: #1f2937;
  --ink2: #6b7280;
  --ink3: #9ca3af;
  --line: #e5e7eb;
  --green: #10b981;
  --red: #ef4444;
  --amber-bg: #fef3c7;
  --amber-ink: #92400e;
  --grad: linear-gradient(135deg, #f04ca8, #7b5cf6);
  --shadow-card: 0 8px 30px rgba(99, 102, 241, 0.08);
  --shadow-pop: 0 20px 60px rgba(99, 102, 241, 0.15);
  --nav-h: 64px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', 'Noto Sans Thai', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button, input, select, textarea {
  font-family: 'Inter', 'Noto Sans Thai', system-ui, sans-serif;
  font-size: inherit;
  color: inherit;
}

button { cursor: pointer; }

.hidden { display: none !important; }

body.lock { overflow: hidden; }

/* ไอคอน Lucide */
[data-lucide], svg.lucide { vertical-align: middle; }
svg.lucide { width: 18px; height: 18px; stroke-width: 2; }

/* ───────── จอเข้าสู่ระบบ / จอห้ามเข้า ───────── */
.login-screen {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow-pop);
  padding: 40px 28px 32px;
  text-align: center;
}

.login-logo-badge {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 22px;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 30px rgba(240, 76, 168, 0.35);
}
.login-logo-badge svg.lucide { width: 34px; height: 34px; color: #fff; }

.login-logo-text {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-sub { margin: 0 0 28px; color: var(--ink2); font-size: 14px; }

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-weight: 600;
  font-size: 15px;
  transition: box-shadow 0.15s, transform 0.1s;
}
.btn-google:hover { box-shadow: 0 6px 20px rgba(99, 102, 241, 0.12); }
.btn-google:active { transform: scale(0.98); }
.btn-google:disabled { opacity: 0.5; cursor: not-allowed; }
.google-g { width: 20px; height: 20px; flex: 0 0 auto; }

.forbidden-badge {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 22px;
  background: #fef2f2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.forbidden-badge svg.lucide { width: 34px; height: 34px; color: #dc2626; }
.forbidden-title { margin: 0 0 6px; font-size: 22px; font-weight: 700; }
.forbidden-email {
  margin: -18px 0 24px;
  color: var(--ink3);
  font-size: 13px;
  word-break: break-all;
}

/* ───────── โครงแอป ───────── */
.shell {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100svh;
  padding: 0 16px calc(var(--nav-h) + 40px);
}

.page { display: none; animation: pageIn 0.18s ease; }
.page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 0 10px;
}

.brand-mini { display: flex; align-items: center; gap: 9px; }
.brand-mini-badge {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--grad);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.brand-mini-badge svg.lucide { width: 18px; height: 18px; color: #fff; }
.brand-mini-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.page-title { margin: 0; font-size: 22px; font-weight: 700; }
.page-title-sub { color: var(--ink3); font-size: 14px; font-weight: 500; }
.page-hint { margin: 0 0 14px; color: var(--ink2); font-size: 13px; }

.icon-btn {
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  flex: 0 0 auto;
  transition: background 0.15s;
}
.icon-btn:hover { background: #f1f5f9; }
.icon-btn:active { transform: scale(0.95); }

/* ───────── แถบเดือน ───────── */
.month-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0 14px;
}
.month-label {
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  flex: 1;
}

/* ───────── การ์ด ───────── */
.card {
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* ───────── การ์ดสรุป ───────── */
.sum-card { padding: 22px 20px 16px; text-align: center; margin-bottom: 14px; transition: opacity 0.2s; }
.sum-card.loading { opacity: 0.45; }

.sum-balance-label { color: var(--ink2); font-size: 13px; }
.sum-balance {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 2px 0 16px;
}
.sum-balance.neg { color: var(--red); }

.sum-split {
  display: flex;
  align-items: stretch;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.sum-cell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: left;
}
.sum-divider { width: 1px; background: var(--line); margin: 2px 8px; }
.sum-ic {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.sum-ic-in { background: #d1fae5; color: var(--green); }
.sum-ic-out { background: #fee2e2; color: var(--red); }
.sum-cell-label { font-size: 12px; color: var(--ink2); }
.sum-cell-val { font-size: 16px; font-weight: 700; }
.sum-cell-val.in { color: var(--green); }
.sum-cell-val.out { color: var(--red); }
.sum-txcount { margin-top: 12px; font-size: 12px; color: var(--ink3); }

/* ───────── แถบรอตรวจ (เหลือง) ───────── */
.review-banner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--amber-bg);
  color: var(--amber-ink);
  border: none;
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: left;
  transition: transform 0.1s;
}
.review-banner:active { transform: scale(0.98); }
.review-banner span { flex: 1; }
.review-banner svg.lucide { flex: 0 0 auto; }

/* ───────── หัวข้อ section ───────── */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 10px; }
.section-title { margin: 0; font-size: 16px; font-weight: 700; }

/* ───────── แถวรายการ ───────── */
.tx-list { padding: 4px 0; margin-bottom: 16px; }

.tx-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
  transition: background 0.12s;
}
.tx-row:last-child { border-bottom: none; }
.tx-row:active { background: #f8fafc; }

.tx-ic {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: #fff;
}
.tx-ic svg.lucide { width: 20px; height: 20px; }

.tx-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tx-name {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tx-sub {
  font-size: 12px;
  color: var(--ink3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tx-src { color: var(--ink3); display: inline-flex; flex: 0 0 auto; }
.tx-src svg.lucide { width: 13px; height: 13px; }
.tx-pending {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 600;
  color: var(--amber-ink);
  background: var(--amber-bg);
  border-radius: 999px;
  padding: 1px 7px;
}
.tx-amt { font-size: 15px; font-weight: 700; flex: 0 0 auto; }
.tx-amt.in { color: var(--green); }
.tx-amt.out { color: var(--red); }

/* ───────── empty state ───────── */
.empty { padding: 36px 20px; text-align: center; color: var(--ink3); }
.empty svg.lucide { width: 34px; height: 34px; stroke-width: 1.5; margin-bottom: 8px; }
.empty p { margin: 0; font-size: 13.5px; }

/* ───────── skeleton ───────── */
.sk-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.sk {
  background: linear-gradient(90deg, #eef1f6 25%, #f6f8fb 50%, #eef1f6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite linear;
  border-radius: 8px;
}
.sk-circle { width: 42px; height: 42px; border-radius: 14px; flex: 0 0 auto; }
.sk-mid { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.sk-line { height: 11px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ───────── ชิปกรอง ───────── */
.chip-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  transition: all 0.15s;
}
.chip svg.lucide { width: 14px; height: 14px; }
.chip.active {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(123, 92, 246, 0.3);
}

/* ───────── หน้ารอตรวจ ───────── */
.review-list { display: flex; flex-direction: column; gap: 12px; }

.rv-card {
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  padding: 16px;
  overflow: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.3s ease,
    padding 0.3s ease, margin 0.3s ease;
}
.rv-card.leaving {
  opacity: 0;
  transform: translateX(28px);
  max-height: 0 !important;
  padding-top: 0;
  padding-bottom: 0;
  margin-bottom: -12px;
}

.rv-sms {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: #475569;
  margin-bottom: 12px;
  word-break: break-word;
}
.rv-sms svg.lucide { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 2px; color: var(--ink3); }

.rv-amt { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.rv-meta { font-size: 12.5px; color: var(--ink3); margin: 2px 0 12px; }

.rv-cat { width: 100%; margin-bottom: 12px; }

.rv-actions { display: flex; gap: 10px; }
.rv-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 10px;
  border: none;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  transition: transform 0.1s, opacity 0.15s;
}
.rv-btn:active { transform: scale(0.97); }
.rv-btn:disabled { opacity: 0.55; cursor: wait; }
.rv-in { background: var(--green); box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3); }
.rv-out { background: var(--red); box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3); }

/* ───────── หน้าตั้งค่า ───────── */
.settings-card { padding: 16px; margin-bottom: 14px; }
.settings-row { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.settings-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.settings-link > svg.lucide:last-child { color: var(--ink3); flex: 0 0 auto; }
.settings-ic {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: #ede9fe;
  color: #7b5cf6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.settings-row-main { flex: 1; min-width: 0; }
.settings-row-label { font-size: 14px; font-weight: 700; }
.settings-row-val { font-size: 13px; color: var(--ink2); word-break: break-all; }

.backfill-progress {
  margin-top: 12px;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: #475569;
}

/* ───────── ปุ่ม ───────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: none;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 600;
  transition: transform 0.1s, box-shadow 0.15s, opacity 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg.lucide { width: 17px; height: 17px; }

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 6px 18px rgba(123, 92, 246, 0.35);
}
.btn-ghost {
  background: #fff;
  border: 1.5px solid var(--line);
  color: #475569;
}
.btn-danger { background: #fef2f2; color: #dc2626; }
.btn-danger-solid {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.3);
}
.btn-block { width: 100%; }
.btn-lg { padding: 14px 18px; font-size: 16px; border-radius: 14px; }

/* ───────── ข้อความฟอร์ม ───────── */
.form-msg { font-size: 13px; margin: 10px 0; }
.form-msg.err {
  color: #dc2626;
  background: #fef2f2;
  border-radius: 10px;
  padding: 9px 12px;
}

/* ───────── แถบนำทางล่าง ───────── */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 520px;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: stretch;
  z-index: 40;
}

.nav-btn {
  position: relative;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink3);
  font-size: 10.5px;
  font-weight: 600;
}
.nav-btn svg.lucide { width: 22px; height: 22px; }
.nav-btn.active { color: #7b5cf6; }

.nav-add-slot { position: relative; }
.btn-fab {
  position: absolute;
  left: 50%;
  top: -20px;
  transform: translateX(-50%);
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(240, 76, 168, 0.45);
  transition: transform 0.12s;
}
.btn-fab svg.lucide { width: 26px; height: 26px; stroke-width: 2.5; }
.btn-fab:active { transform: translateX(-50%) scale(0.93); }

.nav-badge {
  position: absolute;
  top: 8px;
  left: calc(50% + 6px);
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ───────── Sheet (เลื่อนขึ้นจากล่าง) ───────── */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.sheet-wrap.open { pointer-events: auto; }

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.sheet-wrap.open .sheet-backdrop { opacity: 1; }

.sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 105%);
  width: 100%;
  max-width: 520px;
  max-height: 90svh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 24px 24px 0 0;
  box-shadow: var(--shadow-pop);
  padding: 10px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0.28, 1);
}
.sheet-wrap.open .sheet { transform: translate(-50%, 0); }

.sheet-grip {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--line);
  margin: 4px auto 10px;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.sheet-title { margin: 0; font-size: 18px; font-weight: 700; }

/* ช่องยอดเงินตัวใหญ่ */
.amount-wrap {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  padding: 14px 0 6px;
}
.amount-cur { font-size: 22px; font-weight: 600; color: var(--ink3); }
.amount-input {
  width: 60%;
  max-width: 240px;
  border: none;
  outline: none;
  background: transparent;
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  padding: 0;
  color: var(--ink);
}
.amount-input::placeholder { color: #d7dce5; }

/* toggle รายจ่าย/รายรับ */
.seg {
  display: flex;
  gap: 6px;
  background: #f1f5f9;
  border-radius: 14px;
  padding: 5px;
  margin: 8px 0 16px;
}
.seg-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: none;
  background: transparent;
  border-radius: 10px;
  padding: 10px 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink2);
  transition: all 0.15s;
}
.seg-btn svg.lucide { width: 16px; height: 16px; }
.seg-out.active { background: #fff; color: var(--red); box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08); }
.seg-in.active { background: #fff; color: var(--green); box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08); }

/* กริดหมวดหมู่ */
.field-label { font-size: 13px; font-weight: 600; color: var(--ink2); margin: 0 0 8px; }

.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 4px 8px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  background: #f8fafc;
  transition: all 0.13s;
}
.cat-item.selected {
  border-color: #a78bfa;
  background: #f5f3ff;
  box-shadow: 0 4px 12px rgba(123, 92, 246, 0.15);
}
.cat-ic {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.cat-ic svg.lucide { width: 19px; height: 19px; }
.cat-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.cat-item.selected .cat-name { color: #7b5cf6; }

/* input ทั่วไป */
.inp {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 14.5px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}
.inp:focus { border-color: #a78bfa; }

.field-2col {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
  margin-bottom: 6px;
}
@media (max-width: 380px) {
  .field-2col { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
}

/* sheet รายละเอียด */
.detail-amt {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  padding: 8px 0 2px;
}
.detail-amt.in { color: var(--green); }
.detail-amt.out { color: var(--red); }

.detail-meta {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.detail-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink2);
  background: #f1f5f9;
  border-radius: 999px;
  padding: 4px 11px;
}
.detail-pill svg.lucide { width: 13px; height: 13px; }
.detail-pill.pill-in { background: #d1fae5; color: #047857; }
.detail-pill.pill-out { background: #fee2e2; color: #b91c1c; }
.detail-pill.pill-warn { background: var(--amber-bg); color: var(--amber-ink); }

.detail-when {
  text-align: center;
  font-size: 13px;
  color: var(--ink3);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.detail-when svg.lucide { width: 14px; height: 14px; }

.detail-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-top: 16px;
}

/* ───────── Modal ยืนยัน ───────── */
.modal-root { position: fixed; inset: 0; z-index: 80; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.45); }
.modal-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 48px);
  max-width: 340px;
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow-pop);
  padding: 24px 20px 18px;
  text-align: center;
  animation: modalIn 0.18s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }

.modal-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: #ede9fe;
  color: #7b5cf6;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-icon svg.lucide { width: 24px; height: 24px; }
.modal-icon--danger { background: #fef2f2; color: #dc2626; }

.modal-title { margin: 0 0 6px; font-size: 17px; font-weight: 700; }
.modal-body { margin: 0 0 18px; font-size: 14px; color: var(--ink2); }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ───────── Toast ───────── */
.toast-root {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom, 0px));
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 48px);
  max-width: 420px;
}
.toast {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #0f172a;
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 12px;
  padding: 11px 16px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.35);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: 100%;
}
.toast.show { opacity: 1; transform: none; }
.toast svg.lucide { width: 16px; height: 16px; flex: 0 0 auto; }
.toast-ok svg.lucide { color: #34d399; }
.toast-err svg.lucide { color: #f87171; }

/* ───────── บัญชีธนาคาร ───────── */
.acc-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  vertical-align: middle;
}
.acc-dot.lg {
  width: 15px;
  height: 15px;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}
.tx-acc {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: var(--ink, #334155);
}
.acc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 12px;
}
.acc-empty {
  font-size: 13px;
  color: #94a3b8;
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px 14px;
  line-height: 1.6;
}
.acc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid var(--line, #e2e8f0);
  border-radius: 14px;
  background: #fff;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.13s, box-shadow 0.13s;
}
.acc-row:hover {
  border-color: #c4b5fd;
  box-shadow: 0 3px 12px rgba(123, 92, 246, 0.1);
}
.acc-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.acc-row-name {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acc-row-sub {
  font-size: 12px;
  color: #94a3b8;
}
.acc-row svg.lucide {
  width: 16px;
  height: 16px;
  color: #94a3b8;
  flex-shrink: 0;
}
.bank-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.bank-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 11px 4px 9px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  background: #f8fafc;
  font-family: inherit;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
  transition: all 0.13s;
}
.bank-item:hover {
  background: #f1f5f9;
}
.bank-item.selected {
  border-color: #a78bfa;
  background: #f5f3ff;
  font-weight: 600;
  color: #6d28d9;
}
#sheet-acc .detail-actions .btn-primary {
  flex: 1;
}

/* ───────── เงินในบัญชีจริง (จาก SMS) ───────── */
.bal-card { padding: 16px 18px; }
.bal-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 6px;
}
.bal-head svg.lucide { width: 17px; height: 17px; color: #10b981; }
.bal-head-sub { font-size: 12px; font-weight: 500; color: #94a3b8; }
.bal-list { display: flex; flex-direction: column; }
.bal-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 0;
  border-bottom: 1px solid #f1f5f9;
}
.bal-row:last-child { border-bottom: none; }
.bal-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bal-name { font-size: 13.5px; font-weight: 600; color: #1e293b; }
.bal-sub { font-size: 11.5px; color: #94a3b8; }
.bal-amt {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bal-total { border-top: 1.5px dashed #e2e8f0; margin-top: 2px; padding-top: 11px; }
.bal-total .bal-amt { color: #7B5CF6; }

/* ───────── แถวรายการหลายบรรทัด (ข้อความ SMS เต็ม) ───────── */
.tx-row { align-items: flex-start; }
.tx-amt { margin-top: 2px; }
.tx-note {
  display: block;
  font-size: 12.5px;
  color: #475569;
  line-height: 1.5;
  white-space: normal;
  word-break: break-word;
  margin-top: 2px;
}
.tx-msg {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.55;
  white-space: normal;
  word-break: break-word;
  margin-top: 2px;
}

/* ───────── โอนระหว่างบัญชีตัวเอง (แถวเดียว สีเทา ไม่นับรายรับ/รายจ่าย) ───────── */
.tx-row.transfer .tx-name { color: #64748b; }
.tx-ic.transfer { background: #94a3b8 !important; }
.tx-amt.transfer { color: #94a3b8; font-weight: 600; }
.detail-amt.transfer { color: #64748b; }
.detail-pill.pill-transfer { background: #f1f5f9; color: #475569; }
.pair-progress {
  margin-top: 10px;
  font-size: 12.5px;
  color: #64748b;
  text-align: center;
}

/* ───────── PWA: การ์ดติดตั้งเป็นแอป (ตั้งค่า) ───────── */
.pwa-hint { font-size: 12.5px; color: #64748b; line-height: 1.5; margin-top: 4px; }
.pwa-icon-preview {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #F04CA8, #7B5CF6);
  display: grid;
  place-items: center;
  color: #fff;
  flex: none;
}
.pwa-icon-preview svg.lucide { width: 22px; height: 22px; }

/* ───────── โครงนำทางใหม่: ไอคอนตั้งค่ามุมขวาบน · แท็บต้องจ่าย (ที่ว่าง) · กล่องงาน ───────── */
.header-actions { display: flex; align-items: center; gap: 8px; }
.page-head-txt { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.inbox-count {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  vertical-align: 3px;
  margin-left: 6px;
}
.inbox-count.zero { background: #e2e8f0; color: #64748b; }
.due-soon {
  margin-top: 14px;
  padding: 22px 18px;
  text-align: center;
  border: 1.5px dashed #e2e8f0;
  border-radius: 16px;
  background: #fff;
  color: #64748b;
}
.due-soon .due-ic {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  background: #f3efff;
  color: #7B5CF6;
}
.due-soon .due-ic svg.lucide { width: 22px; height: 22px; }
.due-soon h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; color: #1e293b; }
.due-soon p { margin: 0; font-size: 13.5px; line-height: 1.55; }
.due-soon ul { margin: 12px auto 0; padding: 0; list-style: none; display: grid; gap: 6px; text-align: left; max-width: 300px; font-size: 13px; }
.due-soon li { display: flex; gap: 8px; align-items: flex-start; }
.due-soon li svg.lucide { width: 15px; height: 15px; flex: none; margin-top: 3px; color: #7B5CF6; }

/* ───────── มุมมองบัญชี (ชิป รวม/ส่วนตัว/บริษัท) + ประเภทบัญชีในชีต ───────── */
.view-chips { margin: 0 0 12px; }
.view-chips .chip.active { background: linear-gradient(135deg, #F04CA8, #7B5CF6); color: #fff; border-color: transparent; }
.view-chips .chip svg.lucide { width: 14px; height: 14px; }
.seg-kind { margin-bottom: 14px; }
.seg-kind .seg-btn.active { background: #f3efff; color: #6d28d9; border-color: #a78bfa; }
/* ชื่อบัญชี + ป้ายชนิด: ให้ตัดชื่อด้วย … แต่ป้ายไม่โดนตัด */
.acc-row-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.acc-row-name-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.acc-kind-badge {
  display: inline-block;
  flex: none;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 1px 6px;
  border-radius: 6px;
  margin-left: 6px;
  vertical-align: 1px;
  background: #f1f5f9;
  color: #64748b;
}
.acc-kind-badge.business { background: #e0f2fe; color: #0369a1; }

/* ───────── กฎจัดหมวดที่เรียนรู้เอง ───────── */
.rv-remember {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0 2px;
  font-size: 12.5px;
  color: #475569;
  line-height: 1.45;
  cursor: pointer;
}
.rv-remember input { margin-top: 3px; accent-color: #7B5CF6; flex: none; }
.rule-list { display: flex; flex-direction: column; margin-top: 4px; }
.rule-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
.rule-row:last-child { border-bottom: none; }
.rule-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rule-name { font-size: 13.5px; font-weight: 600; color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-sub { font-size: 12px; color: #94a3b8; }
.rule-cat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.rule-cat svg.lucide { width: 12px; height: 12px; }
.rule-del {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: none;
  background: #f1f5f9;
  color: #94a3b8;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.rule-del:hover { background: #fee2e2; color: #dc2626; }
.rule-del svg.lucide { width: 15px; height: 15px; }
.rule-empty { font-size: 13px; color: #94a3b8; padding: 8px 0 2px; }

/* ───────── จานสีป้ายบัญชี ───────── */
.color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 14px;
}
.color-sw {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 1.5px #e2e8f0;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.color-sw:hover { transform: scale(1.12); }
.color-sw.selected {
  box-shadow: 0 0 0 2.5px #7B5CF6, 0 2px 8px rgba(123, 92, 246, 0.3);
  transform: scale(1.08);
}

/* ───────── เงินในบัญชี: ฝังท้ายการ์ดสรุปเดือน ───────── */
.bal-inline {
  border-top: 1px solid #f1f5f9;
  margin-top: 15px;
  padding-top: 13px;
  text-align: left;
}
.bal-inline .bal-head { margin-bottom: 4px; }

/* แถวรายการ = 3 บรรทัด: ชื่อ / บัญชี·เวลา / ข้อความ (บรรทัดเดียว) */
.tx-msg,
.tx-note {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ───────── สวิตช์ตั้งค่า (แสดงบัญชีอื่น) ───────── */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
  cursor: pointer;
}
.toggle-ic {
  width: 34px;
  height: 34px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #f1f5f9;
  color: #64748b;
}
.toggle-ic svg.lucide { width: 18px; height: 18px; }
.toggle-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.toggle-label { font-size: 14px; font-weight: 600; color: #1e293b; }
.toggle-sub { font-size: 12px; color: #94a3b8; line-height: 1.4; }
.switch { flex: none; position: relative; display: inline-flex; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track {
  width: 46px;
  height: 28px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 0.2s;
  display: inline-flex;
  align-items: center;
  padding: 3px;
}
.switch-knob {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.28);
  transition: transform 0.2s;
}
.switch input:checked + .switch-track {
  background: linear-gradient(135deg, #F04CA8, #7B5CF6);
}
.switch input:checked + .switch-track .switch-knob { transform: translateX(18px); }
.switch input:focus-visible + .switch-track {
  outline: 2px solid #7B5CF6;
  outline-offset: 2px;
}

/* ───────── ตั้งค่าแจ้งเตือน LINE ───────── */
.ln-field { margin-top: 12px; }
.ln-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 6px;
}
.ln-input {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 11px 13px;
  font-family: inherit;
  font-size: 14px;
  color: #1e293b;
  background: #f8fafc;
  resize: vertical;
  box-sizing: border-box;
}
.ln-input:focus {
  outline: none;
  border-color: #a78bfa;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(123, 92, 246, 0.12);
}
textarea.ln-input { line-height: 1.5; }
.ln-hint { font-size: 11.5px; color: #94a3b8; line-height: 1.45; margin-top: 6px; }
.ln-divider { height: 1px; background: #f1f5f9; margin: 16px 0 4px; }
.ln-time-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 2px 0 2px 46px;
  padding-bottom: 4px;
}
.ln-time-label { font-size: 13px; color: #64748b; }
.ln-time-unit { font-size: 13px; color: #64748b; }
.ln-select {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 11px;
  font-family: inherit;
  font-size: 14px;
  color: #1e293b;
  background: #fff;
  cursor: pointer;
}
.ln-select:focus { outline: none; border-color: #a78bfa; box-shadow: 0 0 0 3px rgba(123, 92, 246, 0.12); }
.ln-actions { display: flex; flex-direction: column; gap: 9px; margin-top: 16px; }
.ln-msg {
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  padding: 4px 0;
}
.ln-msg.ok { color: #138f2d; }
.ln-msg.err { color: #ef4444; }
