:root {
  --bg: #f3f6fb;
  --bg-deep: #e8eef8;
  --card: rgba(255, 255, 255, 0.9);
  --text: #121826;
  --muted: #7b8798;
  --label: #5b6b80;
  --line: rgba(18, 24, 38, 0.08);
  --brand: #e85d04;
  --brand-deep: #c2410c;
  --brand-soft: #fff4eb;
  --ink: #121826;
  --green: #15803d;
  --danger: #dc2626;
  --shadow: 0 28px 70px rgba(18, 40, 80, 0.1);
  --radius: 28px;
  font-family: Manrope, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(1100px 560px at 10% -8%, rgba(232, 93, 4, 0.14), transparent 55%),
    radial-gradient(900px 480px at 92% 8%, rgba(120, 160, 220, 0.18), transparent 52%),
    linear-gradient(180deg, #f8fafd 0%, #eef3fa 52%, #e7edf7 100%);
  position: relative;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(18, 24, 38, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 24, 38, 0.035) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(circle at center, #000 30%, transparent 82%);
}
.glow {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}
.glow-a { top: -120px; left: -80px; background: rgba(232, 93, 4, 0.22); animation: drift 12s ease-in-out infinite; }
.glow-b { right: -100px; bottom: 80px; background: rgba(255, 214, 165, 0.45); animation: drift 14s ease-in-out infinite reverse; }
@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(18px, -22px); }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(18, 24, 38, 0.06);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}
.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  border-radius: 12px;
  background: #0b0b0b;
  padding: 6px;
  box-shadow: 0 10px 24px rgba(26, 21, 16, 0.16);
}
.brand-name {
  font-family: Sora, Manrope, sans-serif;
  font-weight: 800;
  font-size: 17px;
  line-height: 1.1;
  letter-spacing: 0.01em;
}
.brand-sub {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 2px;
}
.top-actions { display: flex; align-items: center; gap: 14px; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #3f3429;
  font-size: 13px;
  font-weight: 700;
  max-width: 150px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(26, 21, 16, 0.06);
}
.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: linear-gradient(135deg, #1a1510, #3b2f24);
  color: #fff7ed;
  border: 0;
  border-radius: 14px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(26, 21, 16, 0.18);
}
.btn-history:hover, .btn-dark:hover { filter: brightness(1.08); }

.stage {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 74px - 48px);
  display: grid;
  place-items: center;
  padding: 36px 16px 72px;
}
.card {
  position: relative;
  width: min(460px, 100%);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 28px 26px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(18px);
  overflow: hidden;
  animation: cardIn 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.card-shine {
  position: absolute;
  inset: 0 auto auto 0;
  width: 180%;
  height: 120px;
  background: linear-gradient(115deg, transparent 20%, rgba(255, 255, 255, 0.55) 45%, transparent 70%);
  transform: translateX(-30%) rotate(8deg);
  pointer-events: none;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.eyebrow {
  margin: 0 0 10px;
  text-align: center;
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.logo {
  display: block;
  height: 58px;
  margin: 2px auto 14px;
  filter: drop-shadow(0 12px 24px rgba(232, 93, 4, 0.22));
}
.site-E39 { color: var(--brand); }
.card h1 {
  margin: 0;
  text-align: center;
  font-family: Sora, Manrope, sans-serif;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.15;
}
.lead {
  margin: 10px 0 26px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}
.field { margin-bottom: 16px; }
.field label {
  display: block;
  margin-bottom: 8px;
  color: var(--label);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.row { display: grid; grid-template-columns: 1fr; gap: 10px; }
.input, .select {
  width: 100%;
  height: 50px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  padding: 0 16px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.input::placeholder { color: #b4aa9d; }
.input:focus, .select:focus {
  border-color: rgba(232, 93, 4, 0.45);
  box-shadow: 0 0 0 4px rgba(232, 93, 4, 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) 22px, calc(100% - 12px) 22px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 28px;
}
.amount-wrap { position: relative; }
.amount-wrap .input { padding-right: 84px; }
.vnd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #fff4eb, #ffe8d4);
  color: var(--brand-deep);
  font: inherit;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.submit {
  width: 100%;
  height: 54px;
  margin-top: 18px;
  border: 0;
  border-radius: 16px;
  background: #e7e1d7;
  color: #9a9084;
  font: inherit;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: not-allowed;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.submit.ready {
  background: linear-gradient(135deg, #ff7a1a, #e85d04 45%, #c2410c);
  color: #fffaf5;
  cursor: pointer;
  box-shadow: 0 16px 34px rgba(232, 93, 4, 0.32);
}
.submit.ready:hover { filter: brightness(1.05); transform: translateY(-1px); }
.form-error, .login-error {
  display: none;
  margin-top: 10px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}
.login-error { display: block; min-height: 18px; }

.ticker {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  height: 48px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(18, 24, 38, 0.06);
  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: #5c5247;
  font-weight: 600;
}
.ticker b { color: var(--brand-deep); }
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 21, 16, 0.28);
  backdrop-filter: blur(10px);
  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: #fffdf9;
  border-radius: 28px;
  padding: 30px 26px 24px;
  box-shadow: 0 34px 80px rgba(26, 21, 16, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.8);
  text-align: center;
}
@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.in { animation: modalIn 0.45s cubic-bezier(0.16, 1, 0.3, 1); }
.modal h2 {
  margin: 0 0 8px;
  font-family: Sora, Manrope, sans-serif;
  font-size: 22px;
  font-weight: 800;
}
.modal p { margin: 0; color: #7a7064; line-height: 1.55; }
.modal .count { margin-top: 10px; font-weight: 800; color: var(--brand); }
.modal.loading h2 { color: var(--brand-deep); }
.modal.ok h2 { color: var(--green); }
.modal.bad h2 { color: var(--danger); }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-actions button, .modal-actions a {
  flex: 1;
  height: 46px;
  border-radius: 14px;
  border: 0;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  display: grid;
  place-items: center;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease;
}
.modal-actions button:hover, .modal-actions a:hover { transform: translateY(-1px); }
.btn-ghost { background: #f3eee6; color: #3f3429; }
.btn-go { background: var(--brand); color: #fff; }

.admin-wrap { width: min(980px, 100%); }
.admin-card { width: min(420px, 100%); }
[hidden] { display: none !important; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: #7a7064; font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.actions { display: flex; gap: 6px; }
.actions button {
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  color: #fff;
}
.btn-ok { background: #16a34a; }
.btn-no { background: #dc2626; }
.admin-note { color: #7a7064; font-size: 13px; margin: 0 0 14px; line-height: 1.55; }

.turnstile-box {
  min-height: 65px;
  display: flex;
  justify-content: center;
}
.spinner {
  width: 46px; height: 46px; margin: 4px auto 14px; border-radius: 50%;
  border: 4px solid #ffe8d4; border-top-color: var(--brand); 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; }

.status-select { height: 34px; border-radius: 10px; border: 1px solid var(--line); 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: 14px;
  background: linear-gradient(135deg, #ff7a1a, #e85d04);
  color: #fff; font: inherit; font-weight: 800; cursor: pointer;
}
.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button {
  border: 1px solid var(--line); background: rgba(255,255,255,0.8);
  border-radius: 999px; padding: 9px 16px; font: inherit; font-weight: 700; cursor: pointer;
}
.tabs button.on {
  background: linear-gradient(135deg, #1a1510, #3b2f24);
  color: #fff7ed; border-color: transparent;
}

.modal.wide { width: min(460px, 100%); }
.vip-cond {
  --acc: var(--brand); --acc-deep: var(--brand-deep); --acc-soft: var(--brand-soft); --acc-line: #ffd0a8;
  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: #ffe08a; 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(26, 21, 16, 0.05); font-size: 14px; font-weight: 800; color: #1a1510;
}
.vip-list em { display: block; font-style: normal; font-weight: 500; font-size: 12.5px; color: #7a7064; margin-top: 2px; }
.vip-list mark { background: #fff1c7; color: #c2410c; 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); } }

.modal.ok { --brand: #e85d04; --brand-deep: #c2410c; width: min(380px, 100%); padding: 26px 22px 22px; position: relative; overflow: hidden; }
.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: 24px !important; font-weight: 800; letter-spacing: -0.02em; font-family: Sora, Manrope, sans-serif; }
.ok-date { margin-top: 4px; color: #9a9084; 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 rgba(26, 21, 16, 0.07); background: #faf6f0; border-radius: 14px; padding: 12px 14px; font-size: 13.5px;
  animation: okRow 0.45s both ease-out;
}
.ok-row span { color: #7a7064; }
.ok-row b { color: #1a1510; 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: #7a7064 !important; font-size: 13.5px; font-weight: 700; }
.modal-actions .btn-close-big {
  height: 52px; border-radius: 16px; color: #fff; font-size: 15px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase;
  background: linear-gradient(135deg, #ff7a1a, var(--brand-deep)); box-shadow: 0 14px 28px -10px 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; background: var(--brand); }
#tab-sources .add-row { grid-template-columns: 1fr 160px 110px; }

.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: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 .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: 10px 14px; border-radius: 14px; font-size: 13.5px; font-weight: 600;
  color: var(--brand-deep); background: var(--brand-soft); border: 1px solid #ffd0a8; animation: okRow 0.3s ease-out;
}
.src-balance b { font-weight: 900; font-size: 15px; }

@media (max-width: 640px) {
  .topbar { padding: 0 14px; }
  .brand-sub, .user-chip { display: none; }
  .card { padding: 28px 18px 22px; }
  .card h1 { font-size: 28px; }
  .add-row, #tab-sources .add-row { grid-template-columns: 1fr; }
  .modal.wide { padding: 24px 16px 18px; max-height: calc(100vh - 36px); overflow-y: auto; }
  .vip-note strong { white-space: normal; }
}
