:root {
  --bg-grad: linear-gradient(135deg, #e0e7ff 0%, #f0f9ff 50%, #ecfdf5 100%);
  --panel: rgba(255, 255, 255, .92);
  --panel-solid: #ffffff;
  --border: #e2e8f0;
  --input-bg: #ffffff;
  --accent: #4f46e5;
  --accent-soft: #eef2ff;
  --accent-border: #dbeafe;
  --text: #0f172a;
  --muted: #64748b;
  --red: #dc2626;
  --green: #16a34a;
  --shadow: rgba(79, 70, 229, .25);
}
[data-theme="dark"] {
  --bg-grad: linear-gradient(135deg, #0b1220 0%, #111a2e 50%, #0d1a24 100%);
  --panel: rgba(17, 26, 46, .92);
  --panel-solid: #111a2e;
  --border: #22304d;
  --input-bg: #0d1526;
  --accent: #818cf8;
  --accent-soft: #1a2340;
  --accent-border: #2b3a5e;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --red: #f87171;
  --green: #4ade80;
  --shadow: rgba(0, 0, 0, .5);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg-grad); background-attachment: fixed;
  color: var(--text);
  font-family: "Quicksand", sans-serif;
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 16px;
  position: relative; overflow-x: hidden;
  transition: background .3s, color .3s;
}
/* blob trang trí nền */
body::before, body::after {
  content: ""; position: fixed; border-radius: 50%;
  filter: blur(90px); opacity: .5; z-index: -1;
  animation: float 12s ease-in-out infinite;
}
body::before {
  width: 380px; height: 380px;
  background: #a5b4fc; top: -100px; left: -100px;
}
body::after {
  width: 320px; height: 320px;
  background: #6ee7b7; bottom: -80px; right: -80px;
  animation-delay: -6s;
}
[data-theme="dark"] body::before { background: #4338ca; opacity: .35; }
[data-theme="dark"] body::after { background: #065f46; opacity: .3; }
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -30px) scale(1.1); }
}
.wrap { width: 100%; max-width: 490px; }

/* nút đổi theme */
.theme-toggle {
  position: fixed; top: 16px; left: 16px; z-index: 60;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  font-size: 20px; cursor: pointer;
  box-shadow: 0 4px 14px -4px var(--shadow);
  transition: transform .2s;
}
.theme-toggle:hover { transform: rotate(20deg) scale(1.08); }

.panel {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid transparent;
  border-radius: 26px; padding: 44px 44px 38px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.6),
    0 2px 0 rgba(255,255,255,.4) inset,
    0 10px 20px -8px var(--shadow),
    0 30px 60px -12px var(--shadow);
  position: relative;
  animation: cardIn .6s cubic-bezier(.22, 1, .36, 1) both;
  transition: background .3s;
}
/* viền gradient 3D */
.panel::before {
  content: ""; position: absolute; inset: 0;
  border-radius: 26px; padding: 1.5px;
  background: linear-gradient(135deg, #818cf8 0%, #e0e7ff 40%, #6ee7b7 80%, #818cf8 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
[data-theme="dark"] .panel::before {
  background: linear-gradient(135deg, #6366f1 0%, #312e81 40%, #065f46 80%, #6366f1 100%);
}
[data-theme="dark"] .panel {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 10px 20px -8px rgba(0,0,0,.6),
    0 30px 60px -12px rgba(0,0,0,.7);
}
/* hiệu ứng nghiêng 3D theo chuột đã thêm qua JS; nâng nhấc khi hover */
.panel:hover {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.6),
    0 18px 30px -10px var(--shadow),
    0 40px 80px -12px var(--shadow);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
h1.main-title {
  display: inline-block;
  font-size: 20px; text-align: center; margin: 0 auto 18px; font-weight: 800;
  background: #ec4899;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  padding: 10px 24px;
  border-radius: 999px;
  box-shadow: 0 4px 16px -2px rgba(236, 72, 153, 0.45);
  border: 1px solid #f472b6;
  width: 100%;
  box-sizing: border-box;
}
[data-theme="dark"] h1.main-title {
  background: #ec4899;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
}
.sub { text-align: center; font-size: 13px; color: var(--muted); margin-bottom: 26px; }

/* ===== FIELD kiểu nổi + dropdown gợi ý ===== */
.field { position: relative; margin-bottom: 22px; }
.input-wrap { position: relative; }
.float-label {
  position: absolute; top: -11px; left: 14px;
  background: var(--panel-solid); padding: 0 8px;
  font-size: 12px; font-weight: 700; color: var(--accent);
  border: 1px solid var(--border); border-radius: 6px;
  pointer-events: none; z-index: 2;
  transition: background .3s;
}
.field input {
  width: 100%;
  background: var(--input-bg); border: 2px solid var(--border);
  border-radius: 14px; padding: 18px 48px 18px 18px;
  color: var(--text); font-size: 18px; outline: none; transition: .15s;
}
.field input:hover { border-color: var(--accent-border); }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(129,140,248,.18); }
.field input:focus ~ .float-label { border-color: var(--accent); }
.in-clear {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: var(--accent-soft); color: var(--muted);
  font-size: 13px; cursor: pointer; transition: .15s;
}
.in-clear:hover { background: var(--accent-border); color: var(--text); }
.hint { font-size: 13px; color: var(--muted); margin-top: 10px; }
.hint b { color: var(--accent); }
.quick {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-top: 12px;
  width: 100%;
}
.quick button {
  flex: 1;
  background: #16a34a;
  color: #ffffff;
  border: 1px solid #22c55e;
  border-radius: 999px;
  padding: 8px 0;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: .15s;
  box-shadow: 0 3px 8px -2px rgba(22, 163, 74, 0.4);
  text-align: center;
}
.quick button:hover {
  background: #15803d;
  color: #fff;
  border-color: #16a34a;
  transform: translateY(-2px);
  box-shadow: 0 5px 12px -2px rgba(22, 163, 74, 0.55);
}
.quick button:active { transform: translateY(0); }
.quick button.clear {
  flex: 0.9;
  background: #dc2626 !important;
  color: #ffffff !important;
  border: 1px solid #ef4444 !important;
  box-shadow: 0 3px 8px -2px rgba(220, 38, 38, 0.45) !important;
  font-weight: 800;
}
.quick button.clear:hover {
  background: #b91c1c !important;
  border-color: #dc2626 !important;
  box-shadow: 0 5px 12px -2px rgba(220, 38, 38, 0.6) !important;
}

/* ===== TẠO NHANH THEO NGƯỜI NHẬN ===== */
.quick-pickers-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}
.quick-pickers-title {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
  background: #d97706; /* Nền vàng */
  border: 1px solid #f59e0b;
  border-radius: 8px;
  padding: 6px 14px;
  letter-spacing: .5px;
  text-align: center;
  margin-bottom: 12px;
  box-shadow: 0 3px 10px -2px rgba(217, 119, 6, 0.4);
}
.quick-pickers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.qp-btn {
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 4px;
  font-family: "Times New Roman", Times, serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.qp-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px -2px var(--shadow);
}
.qp-btn:active {
  transform: translateY(0);
}

.go {
  width: 100%; margin-top: 10px;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff; border: none; border-radius: 14px;
  padding: 17px; font-size: 18px; font-weight: 700;
  cursor: pointer; transition: .15s;
  box-shadow: 0 6px 18px -4px rgba(79, 70, 229, .5);
  position: relative; overflow: hidden;
}
.go::after {
  content: ""; position: absolute; top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,.35), transparent);
  animation: shimmer 2.8s ease-in-out infinite;
}
@keyframes shimmer {
  0% { left: -100%; }
  60%, 100% { left: 130%; }
}
.go:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -4px rgba(79,70,229,.55); }
.go:active { transform: translateY(0); }

/* ===== modal chung ===== */
.modal {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 50;
}
.modal.hidden { display: none; }
.modal-box {
  background: var(--panel-solid); border-radius: 20px;
  width: 100%; max-width: 410px; max-height: 82vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.5),
    0 24px 60px -12px rgba(15,23,42,.4);
  transition: background .3s;
  position: relative;
}
.modal-box::before {
  content: ""; position: absolute; inset: 0;
  border-radius: 20px; padding: 1.5px;
  background: linear-gradient(135deg, #818cf8 0%, #e0e7ff 50%, #6ee7b7 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 1;
}
[data-theme="dark"] .modal-box::before {
  background: linear-gradient(135deg, #6366f1 0%, #312e81 50%, #065f46 100%);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  font-weight: 800; letter-spacing: 0; font-size: 13px;
}
.modal-head .x, .pay-box > .x {
  background: var(--accent-soft); border: none; color: var(--muted);
  font-size: 14px; cursor: pointer; padding: 6px 10px; border-radius: 8px; transition: .15s;
}
.modal-head .x:hover, .pay-box > .x:hover { background: var(--accent-border); color: var(--text); }
#search {
  margin: 12px 18px 0; width: calc(100% - 36px);
  font-size: 14px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; outline: none;
  background: var(--input-bg); color: var(--text);
}
#search:focus { border-color: var(--accent); }
.acc-list { overflow-y: auto; padding: 10px; }
.acc {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 12px; cursor: pointer; transition: .12s;
}
.acc:hover { background: var(--accent-soft); }
.acc .avatar {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.acc .avatar img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.acc .info { flex: 1; min-width: 0; }
.acc .name { font-weight: 700; font-size: 14px; }
.acc .bank {
  font-size: 12px;
  font-weight: 700;
  color: #facc15; /* Màu vàng sáng */
  margin-top: 2px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.acc .stk {
  font-family: ui-monospace, monospace; font-size: 12px;
  color: var(--accent); font-weight: 600;
  background: var(--accent-soft); padding: 4px 8px; border-radius: 6px; white-space: nowrap;
}

/* ===== POPUP THANH TOÁN (THEO MẪU ĐƠN GỌN GÀNG) ===== */
.pay-box {
  position: relative;
  background: var(--panel-solid);
  border-radius: 24px;
  width: 100%;
  max-width: 440px;
  padding: 30px 24px 26px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.5),
    0 30px 80px -12px rgba(15,23,42,.5);
  max-height: 94vh;
  overflow-y: auto;
  transition: background .3s;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.pay-box::before {
  content: ""; position: absolute; inset: 0;
  border-radius: 24px; padding: 1.5px;
  background: linear-gradient(135deg, #818cf8 0%, #e0e7ff 40%, #6ee7b7 80%, #818cf8 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 1;
}
[data-theme="dark"] .pay-box::before {
  background: linear-gradient(135deg, #6366f1 0%, #312e81 40%, #065f46 80%, #6366f1 100%);
}
[data-theme="dark"] .pay-box {
  background: #101726;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 30px 80px -12px rgba(0,0,0,.8);
}
.pay-box > .x {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: .15s;
  z-index: 2;
}
.pay-box > .x:hover {
  background: var(--accent-border);
  color: var(--text);
}

/* Vùng chụp ảnh toàn bộ */
.pay-capture-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  background: transparent;
  border-radius: 16px;
}

/* Tiêu đề modal: Nền hồng chữ trắng đậm */
.modal-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ec4899;
  border: 1px solid #f472b6;
  border-radius: 999px;
  padding: 8px 20px;
  font-size: 14.5px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px -3px rgba(236, 72, 153, 0.45);
}
.modal-card-title .card-icon {
  font-size: 16px;
}

/* Bảng thông tin thanh toán pill */
.info-table {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.info-pill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}
[data-theme="dark"] .info-pill {
  background: #141f36;
  border-color: #1e2c4c;
}
.pill-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: .4px;
}
.pill-value {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}
.pill-value.highlight {
  color: #38bdf8;
  letter-spacing: .5px;
}

/* Khung QR viền bo trắng giống ảnh mẫu */
.qr-center {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}
.qr-frame {
  position: relative;
  display: inline-block;
  border-radius: 20px;
  padding: 14px;
  background: #ffffff;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,.2);
}
.qr-frame::before, .qr-frame::after {
  content: ""; position: absolute; width: 34px; height: 34px;
  border: 4px solid #6366f1;
}
.qr-frame::before { top: 6px; left: 6px; border-right: none; border-bottom: none; border-radius: 12px 0 0 0; }
.qr-frame::after { bottom: 6px; right: 6px; border-left: none; border-top: none; border-radius: 0 0 12px 0; }
.qr-frame img {
  width: 240px;
  height: 240px;
  object-fit: contain;
  display: block;
}

/* Số tiền lớn xanh lá */
.total-price {
  font-size: 26px;
  font-weight: 900;
  color: #22c55e;
  text-align: center;
  margin-bottom: 12px;
  letter-spacing: .5px;
}

/* Hộp cảnh báo: Nền vàng chữ trắng đậm */
.warn-box {
  width: 100%;
  background: #d97706;
  border: 1.5px solid #f59e0b;
  border-radius: 10px;
  padding: 12px 14px;
  text-align: center;
  margin-bottom: 14px;
  box-shadow: 0 4px 14px -3px rgba(217, 119, 6, 0.4);
}
.warn-line {
  font-size: 13.5px;
  line-height: 1.55;
  color: #ffffff;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.warn-line.title {
  font-size: 14.5px;
  font-weight: 900;
  color: #ffffff;
  margin-bottom: 2px;
}

/* Nút sao chép */
.copy-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btn-copy-img {
  width: 100%;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: .15s;
  box-shadow: 0 6px 16px -4px rgba(79, 70, 229, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-copy-img:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px -4px rgba(79, 70, 229, .6);
}

/* ===== TOAST ===== */
#toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--panel-solid); color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 22px; border-radius: 999px;
  font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: all .25s ease;
  z-index: 99;
  box-shadow: 0 8px 24px -6px var(--shadow);
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== SUGGEST ===== */
.suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--panel-solid); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 16px 40px -8px rgba(15,23,42,.2);
  z-index: 30; overflow: hidden;
  animation: dropIn .18s ease-out both;
}
@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.suggest.hidden { display: none; }
.s-item {
  padding: 14px 18px; font-size: 16px; font-weight: 700;
  cursor: pointer; border-bottom: 1px solid var(--border); transition: .1s;
}
.s-item:last-child { border-bottom: none; }
.s-item:hover { background: var(--accent-soft); color: var(--accent); }
.s-item .cur { color: var(--muted); font-weight: 400; margin-left: 2px; }
