:root {
  --bg: #e9eef6;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #8b95a5;
  --label: #6b7280;
  --line: #e6ebf2;
  --blue: #1a73e8;
  --blue-deep: #1565d8;
  --ink: #1c2430;
  --green: #22c55e;
  --danger: #ef4444;
  --shadow: 0 18px 50px rgba(31, 45, 80, 0.08);
  font-family: "Be Vietnam Pro", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 68px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid #f0f3f8;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 14px rgba(29, 78, 216, 0.28);
}
.brand-name { font-weight: 800; font-size: 15px; line-height: 1.15; }
.brand-sub { color: var(--muted); font-size: 12px; font-weight: 500; }
.top-actions { display: flex; align-items: center; gap: 14px; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #374151;
  font-size: 14px;
  font-weight: 600;
  max-width: 140px;
}
.user-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
  flex: none;
}
.btn-history, .btn-dark {
  background: var(--ink);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 9px 14px;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
}
.btn-history:hover, .btn-dark:hover { background: #111827; }

.stage {
  min-height: calc(100vh - 68px - 46px);
  display: grid;
  place-items: center;
  padding: 28px 16px 64px;
}
.card {
  width: min(440px, 100%);
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px 26px 22px;
}
.wordmark {
  text-align: center;
  font-weight: 900;
  font-style: italic;
  font-size: 40px;
  letter-spacing: -1px;
  color: #1d74ea;
  line-height: 1;
  margin: 4px 0 8px;
}
.card h1 {
  margin: 0;
  text-align: center;
  font-size: 22px;
  letter-spacing: 0.2px;
}
.lead {
  margin: 8px 0 22px;
  text-align: center;
  color: #9aa3b2;
  font-size: 14px;
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  margin-bottom: 8px;
  color: #7b8494;
  font-size: 13.5px;
  font-weight: 600;
}
.row { display: grid; grid-template-columns: 1fr 148px; gap: 10px; }
.input, .select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 0 14px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
}
.input::placeholder { color: #c0c6d0; }
.input:focus, .select:focus { border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #9ca3af 50%), linear-gradient(135deg, #9ca3af 50%, transparent 50%); background-position: calc(100% - 18px) 20px, calc(100% - 12px) 20px; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; padding-right: 28px; }
.amount-wrap { position: relative; }
.amount-wrap .input { padding-right: 74px; }
.vnd {
  position: absolute;
  right: 8px;
  top: 7px;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: #dcfce7;
  color: #16a34a;
  font: inherit;
  font-weight: 800;
  font-size: 13px;
}
.human {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fbfcfe;
}
.human label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #4b5563;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.human input { width: 22px; height: 22px; accent-color: #f97316; }
.cf-mark { color: #9ca3af; font-size: 11px; font-weight: 800; letter-spacing: 0.8px; }
.submit {
  width: 100%;
  height: 48px;
  margin-top: 18px;
  border: 0;
  border-radius: 12px;
  background: #e5e7eb;
  color: #9ca3af;
  font: inherit;
  font-weight: 800;
  font-size: 15px;
  cursor: not-allowed;
}
.submit.ready {
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(26, 115, 232, 0.28);
}
.submit.ready:hover { background: var(--blue-deep); }
.form-error {
  display: none;
  margin-top: 10px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.ticker {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 46px;
  background: #fff;
  border-top: 1px solid #eef1f6;
  overflow: hidden;
  display: flex;
  align-items: center;
}
.ticker-track {
  display: flex;
  gap: 42px;
  white-space: nowrap;
  animation: marquee 28s linear infinite;
  padding-left: 20px;
  font-size: 13.5px;
  color: #4b5563;
  font-weight: 600;
}
.ticker b { color: #111827; }
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(8px);
  display: none;
  place-items: center;
  z-index: 40;
  padding: 18px;
}
.overlay.show { display: grid; animation: overlayIn 0.28s ease; }
.modal {
  width: min(400px, 100%);
  background: #fff;
  border-radius: 28px;
  padding: 30px 26px 24px;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.7);
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(18px) scale(0.94); }
  to { opacity: 1; transform: none; }
}
.modal h2 { margin: 0 0 8px; font-size: 18px; }
.modal p { margin: 0; color: #6b7280; line-height: 1.5; }
.modal .count { margin-top: 10px; font-weight: 800; color: var(--blue); }
.modal.ok h2 { color: #15803d; }
.modal.bad h2 { color: var(--danger); }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-actions button, .modal-actions a {
  flex: 1;
  height: 42px;
  border-radius: 10px;
  border: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
  text-decoration: none;
}
.btn-ghost { background: #f3f4f6; color: #374151; }
.btn-go { background: var(--blue); color: #fff; }

.panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(380px, 100%);
  height: 100%;
  background: #fff;
  z-index: 50;
  box-shadow: -12px 0 40px rgba(15, 23, 42, 0.12);
  transform: translateX(100%);
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
}
.panel.show { transform: translateX(0); }
.panel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}
.panel header h2 { margin: 0; font-size: 16px; }
.panel header button { border: 0; background: transparent; font-size: 20px; cursor: pointer; }
.panel .list { overflow: auto; padding: 12px 16px 24px; }
.hist-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.hist-item strong { display: block; }
.tag {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}
.tag.pending { background: #fef3c7; color: #b45309; }
.tag.approved { background: #dcfce7; color: #15803d; }
.tag.rejected, .tag.timeout { background: #fee2e2; color: #b91c1c; }
.empty { color: var(--muted); font-size: 14px; }

.admin-wrap { width: min(980px, 100%); }
[hidden] { display: none !important; }
.admin-card { width: min(420px, 100%); }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: #6b7280; font-size: 12px; font-weight: 700; }
.actions { display: flex; gap: 6px; }
.actions button {
  border: 0;
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  color: #fff;
}
.btn-ok { background: #16a34a; }
.btn-no { background: #dc2626; }
.login-error { color: var(--danger); font-size: 13px; font-weight: 600; min-height: 18px; margin-top: 8px; }
.admin-note { color: #6b7280; font-size: 13px; margin: 0 0 14px; }

@media (max-width: 640px) {
  .topbar { padding: 0 12px; }
  .brand-sub, .user-chip { display: none; }
  .row { grid-template-columns: 1fr; }
  .card h1 { font-size: 18px; }
}

/* v2 */
.logo { display: block; height: 46px; margin: 2px auto 12px; }
.site-MM88 { color: #e10600; }
.card h1 { color: #111827; }
.field label { color: #2563eb; }
.lead { color: #64748b; }
.turnstile-box {
  min-height: 65px;
  display: flex;
  justify-content: center;
}
.modal { text-align: center; }
.modal.in { animation: modalIn 0.45s cubic-bezier(0.16, 1, 0.3, 1); }
.modal-actions button, .modal-actions a { border-radius: 14px; transition: transform 0.2s ease, background 0.2s ease; }
.modal-actions button:hover, .modal-actions a:hover { transform: translateY(-1px); }
.submit.ready { background: linear-gradient(135deg, #e10600, #b80500); box-shadow: 0 8px 18px rgba(225, 6, 0, 0.3); }
.submit.ready:hover { background: #b80500; }
.modal { text-align: center; }
.spinner {
  width: 46px; height: 46px; margin: 4px auto 14px; border-radius: 50%;
  border: 4px solid #fee2e2; border-top-color: #e10600; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.result-icon { font-size: 40px; line-height: 1; margin-bottom: 8px; }
.result-icon:empty { display: none; }
.modal.loading h2 { color: #b80500; }
.modal.ok h2 { color: #15803d; }
.modal.bad h2 { color: #dc2626; }
.btn-go { background: #e10600 !important; color: #fff !important; }
.ticker b { color: #b80500; }
.status-select { height: 34px; border-radius: 8px; border: 1px solid #e6ebf2; font: inherit; font-weight: 700; padding: 0 8px; }
.add-row { display: grid; grid-template-columns: 1fr 180px 110px; gap: 8px; margin-bottom: 16px; }
.add-row button { border: 0; border-radius: 12px; background: #e10600; color: #fff; font: inherit; font-weight: 800; cursor: pointer; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tabs button { border: 1px solid #e6ebf2; background: #fff; border-radius: 10px; padding: 8px 14px; font: inherit; font-weight: 700; cursor: pointer; }
.tabs button.on { background: #111827; color: #fff; }
@media (max-width: 640px) { .add-row { grid-template-columns: 1fr; } }

/* popup điều kiện chuyển VIP */
.modal.wide { width: min(460px, 100%); }
.vip-cond {
  --acc: #e10600; --acc-deep: #b80500; --acc-soft: #fef2f2; --acc-line: #fecaca;
  margin-top: 16px; text-align: left; border: 1.5px solid var(--acc-line); border-radius: 18px;
  background: var(--acc-soft); overflow: hidden; animation: vipIn 0.5s 0.15s both cubic-bezier(0.16, 1, 0.3, 1);
}
.vip-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: linear-gradient(135deg, var(--acc), var(--acc-deep)); color: #fff;
  font-weight: 900; font-size: 14px; letter-spacing: 0.2px; line-height: 1.3;
}
.vip-head b { color: #fde047; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.15); }
.vip-head small { display: block; font-size: 11.5px; font-weight: 700; opacity: 0.9; letter-spacing: 0.6px; }
.vip-crown { font-size: 24px; animation: vipBob 1.8s ease-in-out infinite; }
.vip-list { list-style: none; margin: 0; padding: 12px 14px 4px; display: grid; gap: 10px; }
.vip-list li {
  display: flex; gap: 10px; align-items: flex-start; background: #fff; border-radius: 12px;
  padding: 10px 12px; box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05); font-size: 14px; font-weight: 800; color: #111827;
}
.vip-list em { display: block; font-style: normal; font-weight: 500; font-size: 12.5px; color: #6b7280; margin-top: 2px; }
.vip-list mark { background: #fef3c7; color: #dc2626; padding: 0 6px; border-radius: 6px; font-weight: 900; }
.vip-num {
  flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--acc); color: #fff; font-size: 12.5px; font-weight: 900;
}
.vip-note {
  display: flex; gap: 8px; margin: 8px 14px 14px; padding: 10px 12px; border-radius: 12px;
  background: #fffbeb; border: 1px dashed #f59e0b; color: #78350f; font-size: 13px; line-height: 1.55;
}
.vip-note b { color: #b45309; }
.vip-note strong { color: #dc2626; background: #fee2e2; padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
@keyframes vipIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes vipBob { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-3px) rotate(6deg); } }
@media (max-width: 640px) {
  .modal.wide { padding: 24px 16px 18px; max-height: calc(100vh - 36px); overflow-y: auto; }
  .vip-note strong { white-space: normal; }
}
.vnd { top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; line-height: 1; }

/* popup chuyển thành công */
.modal.ok { --brand: #e10600; --brand-deep: #b80500; width: min(380px, 100%); padding: 26px 22px 22px; }
.ok-sheet { text-align: center; }
.ok-logo { display: block; height: 52px; max-width: 70%; object-fit: contain; margin: 0 auto 10px; }
.ok-title { margin: 0 !important; color: var(--brand) !important; font-size: 22px !important; font-weight: 900; letter-spacing: 0.4px; }
.ok-date { margin-top: 4px; color: #94a3b8; font-size: 12.5px; }
.ok-rows { display: grid; gap: 10px; margin-top: 16px; }
.ok-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid #e8edf4; background: #f8fafc; border-radius: 12px; padding: 12px 14px; font-size: 13.5px;
}
.ok-row span { color: #64748b; }
.ok-row b { color: #0f172a; font-weight: 800; word-break: break-all; text-align: right; }
.ok-row b.acc { color: var(--brand); }
.ok-wish { margin: 16px 0 0 !important; color: #64748b !important; font-size: 13.5px; }
.modal-actions .btn-close-big {
  height: 50px; border-radius: 14px; color: #fff; font-size: 16px; font-weight: 900; letter-spacing: 0.6px;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep)); box-shadow: 0 10px 22px -8px var(--brand);
}
.modal.ok .modal-actions { margin-top: 18px; }
.balance-edit { display: flex; gap: 6px; align-items: center; }
.balance-edit .input { height: 34px; width: 130px; padding: 0 10px; }
.balance-edit button { border: 0; border-radius: 8px; padding: 7px 12px; color: #fff; font: inherit; font-weight: 700; font-size: 12px; cursor: pointer; }
#tab-sources .add-row { grid-template-columns: 1fr 160px 110px; }
@media (max-width: 640px) { #tab-sources .add-row { grid-template-columns: 1fr; } }
/* hiệu ứng popup thành công + số dư nguồn */
.modal.ok { position: relative; overflow: hidden; }
.fx { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.fx .spark { position: absolute; width: 6px; height: 6px; margin: -3px; border-radius: 50%; opacity: 0; animation: fxSpark 0.95s ease-out forwards; }
.fx .confetti { position: absolute; top: -14px; width: 7px; height: 12px; border-radius: 2px; opacity: 0; animation: fxConfetti 2.6s ease-in forwards; }
@keyframes fxSpark {
  0% { opacity: 1; transform: rotate(var(--a)) translateX(0) scale(1.2); }
  100% { opacity: 0; transform: rotate(var(--a)) translateX(var(--d)) scale(0.3); }
}
@keyframes fxConfetti {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  85% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), 640px) rotate(var(--r)); }
}
.ok-check {
  position: relative; width: 58px; height: 58px; margin: 0 auto 10px; border-radius: 50%;
  display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  box-shadow: 0 10px 22px -8px var(--brand); animation: okPop 0.55s 0.1s both cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ok-check::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--brand);
  animation: okRing 1.6s 0.4s ease-out infinite;
}
.ok-check svg { width: 30px; height: 30px; fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.ok-check path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: okDraw 0.45s 0.45s ease-out forwards; }
@keyframes okPop { from { opacity: 0; transform: scale(0.3); } to { opacity: 1; transform: none; } }
@keyframes okRing { from { opacity: 0.7; transform: scale(1); } to { opacity: 0; transform: scale(1.6); } }
@keyframes okDraw { to { stroke-dashoffset: 0; } }
.ok-row { animation: okRow 0.45s both ease-out; }
.ok-row:nth-child(1) { animation-delay: 0.35s; }
.ok-row:nth-child(2) { animation-delay: 0.45s; }
.ok-row:nth-child(3) { animation-delay: 0.55s; }
.ok-row:nth-child(4) { animation-delay: 0.65s; }
@keyframes okRow { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.ok-row span i { font-style: normal; margin-right: 6px; }
.ok-wish { font-weight: 700; }
.ok-wish .wave { display: inline-block; animation: okWave 1.4s ease-in-out infinite; }
.ok-wish .wave:last-child { animation-delay: 0.7s; }
@keyframes okWave { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-14deg) scale(1.1); } 75% { transform: rotate(14deg) scale(1.1); } }
.src-balance {
  margin-top: 8px; padding: 8px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  color: #b80500; background: #fef2f2; border: 1px solid #fecaca; animation: okRow 0.3s ease-out;
}
.src-balance b { font-weight: 900; font-size: 15px; }