:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --card: #ffffff;
  --text: #182235;
  --muted: #8a94a6;
  --line: #e5eaf2;
  --primary: #6457ff;
  --primary2: #7c3aed;
  --success: #16a34a;
  --danger: #ef4444;
  --shadow: 0 12px 35px rgba(15, 23, 42, .08);
}

body.dark {
  --bg: #0e1525;
  --panel: #111827;
  --card: #172033;
  --text: #eef2ff;
  --muted: #9ca3af;
  --line: #29364f;
  --shadow: 0 12px 35px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.shell {
  display: grid;
  grid-template-columns: 76px 1fr;
  min-height: 100vh;
  max-width: 720px;
  margin: 0 auto;
  background: var(--panel);
}

.sidebar {
  border-right: 1px solid var(--line);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--card);
  position: sticky;
  top: 0;
  height: 100vh;
}

.logo {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  box-shadow: var(--shadow);
}

.side-btn {
  width: 48px;
  height: 48px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 16px;
  font-size: 21px;
  cursor: pointer;
}

.side-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: white;
  box-shadow: var(--shadow);
}

.bottom-btn {
  margin-top: auto;
  border-color: var(--line);
  background: var(--bg);
}

.main {
  padding: 18px;
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.topbar h1 {
  margin: 0;
  font-size: 21px;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.fee-pill {
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

.fee-pill b { color: var(--primary); }

.panel { display: none; }
.panel.active { display: block; }

.card, .preview-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}

.card h2 {
  margin: 0 0 14px;
  font-size: 15px;
  color: var(--primary);
  letter-spacing: .03em;
}

.bank-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 16px;
}

.bank-btn, .theme-btn, .amount-btn {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 7px;
  font-weight: 800;
  cursor: pointer;
}

.bank-btn.active, .theme-btn.active, .amount-btn.active {
  color: white;
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary), var(--primary2));
}

.theme-grid, .amount-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.amount-grid {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 8px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 14px;
  padding: 14px;
  outline: none;
  font-size: 15px;
  font-weight: 700;
}

input:focus {
  border-color: var(--primary);
}

.primary-btn {
  margin-top: 16px;
  border: none;
  color: white;
  width: 100%;
  border-radius: 16px;
  padding: 14px;
  font-weight: 900;
  font-size: 15px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  cursor: pointer;
  box-shadow: var(--shadow);
}

.secondary-btn, .mini-btn {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 14px;
  padding: 11px 12px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
}

.preview-empty {
  min-height: 340px;
  border: 1px dashed var(--line);
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: var(--bg);
}

.qr-img {
  max-width: 100%;
  width: 420px;
  border-radius: 18px;
}

.info-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.info-list div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg);
  border-radius: 14px;
  padding: 11px;
  font-size: 13px;
}

.info-list span { color: var(--muted); }
.info-list b { text-align: right; word-break: break-word; }

.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  margin-top: 14px;
}

.status {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 800;
}

.status.success { background: #dcfce7; color: #166534; }
.status.error { background: #fee2e2; color: #991b1b; }
.status.info { background: #dbeafe; color: #1d4ed8; }

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
}

.history-item b { display: block; font-size: 14px; }
.history-item span { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }

.admin-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.success-btn, .danger-btn {
  border: none;
  color: white;
  border-radius: 14px;
  padding: 11px;
  font-weight: 900;
}

.success-btn { background: var(--success); }
.danger-btn { background: var(--danger); }

.badge {
  display: inline-block !important;
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px !important;
  font-weight: 900;
  margin-top: 7px;
}

.badge.pending { background: #fef3c7; color: #92400e; }
.badge.waiting_admin { background: #dbeafe; color: #1d4ed8; }
.badge.approved { background: #dcfce7; color: #166534; }
.badge.rejected { background: #fee2e2; color: #991b1b; }

.hidden { display: none !important; }

@media (max-width: 560px) {
  .shell { grid-template-columns: 64px 1fr; }
  .sidebar { padding: 12px 8px; }
  .logo, .side-btn { width: 46px; height: 46px; }
  .main { padding: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .bank-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { align-items: flex-start; }
  .fee-pill { font-size: 12px; padding: 9px; }
}

.bank-select-wrap {
  position: relative;
  margin-bottom: 16px;
}

.bank-select-btn {
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(100,87,255,.10), rgba(124,58,237,.06));
  color: var(--text);
  border-radius: 18px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 900;
  cursor: pointer;
}

.bank-left {
  display: flex;
  align-items: center;
  gap: 11px;
}

.bank-logo,
.bank-logo-empty {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  object-fit: contain;
  background: #fff;
  padding: 5px;
  box-shadow: 0 6px 18px rgba(15,23,42,.10);
  display: grid;
  place-items: center;
}

.bank-dropdown {
  position: absolute;
  z-index: 20;
  top: 66px;
  left: 0;
  right: 0;
  max-height: 360px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 8px;
}

.bank-option {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 10px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 900;
  cursor: pointer;
  text-align: left;
}

.bank-option:hover,
.bank-option.active {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: white;
}

body.bank-mb {
  --primary: #165DFF;
  --primary2: #7C3AED;
}

body.bank-vietcombank {
  --primary: #007a3d;
  --primary2: #00b894;
}

body.bank-vietinbank {
  --primary: #005baa;
  --primary2: #00a6e8;
}

body.bank-bidv {
  --primary: #006b68;
  --primary2: #d4a017;
}

body.bank-acb {
  --primary: #005baa;
  --primary2: #1e90ff;
}

body.bank-vpbank {
  --primary: #008a45;
  --primary2: #e11d48;
}

body.bank-msb {
  --primary: #f97316;
  --primary2: #dc2626;
}

body.bank-techcombank {
  --primary: #dc2626;
  --primary2: #991b1b;
}

body.bank-abbank {
  --primary: #0ea5e9;
  --primary2: #ef4444;
}

body.bank-tpbank {
  --primary: #7c3aed;
  --primary2: #f97316;
}

body.bank-ocb {
  --primary: #16a34a;
  --primary2: #2563eb;
}

body.bank-eximbank {
  --primary: #2563eb;
  --primary2: #ef4444;
}

body.bank-vib {
  --primary: #f97316;
  --primary2: #2563eb;
}

body.bank-pgbank {
  --primary: #f59e0b;
  --primary2: #166534;
}

body.bank-kienlongbank {
  --primary: #16a34a;
  --primary2: #f59e0b;
}

.toast-popup {
  position: fixed;
  left: 50%;
  top: 24px;
  transform: translateX(-50%);
  z-index: 9999;
  max-width: 92%;
  min-width: 260px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 18px;
  padding: 14px 16px;
  font-weight: 800;
  animation: toastIn .25s ease;
}

.toast-popup.success { border-color: #22c55e; }
.toast-popup.error { border-color: #ef4444; }
.toast-popup.info { border-color: #3b82f6; }

.toast-close {
  margin-top: 10px;
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 10px;
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  font-weight: 900;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, -12px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.badge.expired {
  background: #e5e7eb;
  color: #374151;
}
