/* =========================================================
   Ripay Design System
   Deep-ink fintech palette, Sora for display, Inter for body/data.
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #090d16;
  --bg-soft: #0c1120;
  --surface: #111729;
  --surface-2: #161d35;
  --surface-3: #1b2340;
  --border: #232b48;
  --border-soft: #1a2138;
  --text: #eaf0ff;
  --text-dim: #8b93ac;
  --text-faint: #5c6584;

  --accent: #ff5b3c;
  --accent-dim: #ff5b3c26;
  --accent-2: #ffb27a;
  --money: #16d9a0;
  --money-dim: #16d9a026;
  --warn: #ffb020;
  --warn-dim: #ffb02026;
  --danger: #ff4757;
  --danger-dim: #ff475726;
  --info: #5b9dff;
  --info-dim: #5b9dff26;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  --font-display: 'Sora', sans-serif;
  --font-body: 'Inter', sans-serif;
}

:root[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-soft: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --surface-3: #e4e8f2;
  --border: #dfe3ee;
  --border-soft: #e9ecf5;
  --text: #161c2c;
  --text-dim: #5b6478;
  --text-faint: #8891a5;
  --accent-dim: #ff5b3c1a;
  --money-dim: #16d9a01a;
  --warn-dim: #ffb0201a;
  --danger-dim: #ff47571a;
  --info-dim: #5b9dff1a;
  --shadow: 0 20px 50px -24px rgba(20, 25, 45, 0.18);
}
:root[data-theme="light"] body { background: radial-gradient(120% 120% at 10% -10%, #eef1fb 0%, var(--bg) 45%); }
:root[data-theme="light"] ::-webkit-scrollbar-thumb { background: #d6dae6; }
:root[data-theme="light"] .qr-hero canvas,
:root[data-theme="light"] #qrCanvas { filter: none; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: radial-gradient(120% 120% at 10% -10%, #131b32 0%, var(--bg) 45%);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background .25s ease, color .25s ease;
}

.theme-toggle {
  width: 38px; height: 38px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-dim); font-size: 16px;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }
h1, h2, h3, h4, .display { font-family: var(--font-display); letter-spacing: -0.01em; }
a { color: inherit; text-decoration: none; }
.tabular { font-variant-numeric: tabular-nums; }
::selection { background: var(--accent-dim); color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------- buttons & inputs ---------- */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 11px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--accent), #ff8154); color: #1a0904; box-shadow: 0 10px 24px -10px rgba(255, 91, 60, .55); }
.btn-primary:hover { box-shadow: 0 14px 30px -10px rgba(255, 91, 60, .7); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-money { background: linear-gradient(135deg, var(--money), #0fb787); color: #052a20; }
.btn-danger { background: var(--danger-dim); color: #ffb3ba; border-color: #4a1f28; }
.btn-danger:hover { background: var(--danger); color: #2a0006; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; justify-content: center; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13px; color: var(--text-dim); font-weight: 600; }
.field input, .field select, .field textarea {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14.5px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.field textarea { resize: vertical; min-height: 90px; }
.pw-wrap { position: relative; }
.pw-wrap input { width: 100%; padding-right: 42px; }
.pw-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-faint); cursor: pointer; padding: 4px;
}
.pw-toggle:hover { color: var(--text); }

/* ---------- badges & status ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 100px; }
.badge-money { background: var(--money-dim); color: var(--money); }
.badge-warn { background: var(--warn-dim); color: var(--warn); }
.badge-danger { background: var(--danger-dim); color: #ff9aa4; }
.badge-info { background: var(--info-dim); color: #a6c8ff; }
.badge-dim { background: var(--surface-3); color: var(--text-dim); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- cards & panels ---------- */
.card {
  background: linear-gradient(180deg, var(--surface), var(--surface) 60%, var(--surface-2));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 22px;
}
.stat-card { display: flex; flex-direction: column; gap: 6px; }
.stat-card .label { font-size: 12.5px; color: var(--text-dim); font-weight: 600; }
.stat-card .value { font-family: var(--font-display); font-size: 26px; font-weight: 700; }
.stat-card .sub { font-size: 12px; color: var(--text-faint); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th { text-align: left; color: var(--text-faint); font-weight: 600; font-size: 11.5px; letter-spacing: .03em; padding: 0 12px 10px; border-bottom: 1px solid var(--border); }
tbody td { padding: 13px 12px; border-bottom: 1px solid var(--border-soft); color: var(--text); }
tbody tr:hover { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-dim); }
.empty-state .icon { font-size: 32px; margin-bottom: 10px; }

/* ---------- toasts / modals ---------- */
#toast-root { position: fixed; top: 18px; right: 18px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px; min-width: 260px; max-width: 340px; box-shadow: var(--shadow);
  animation: toastIn .25s ease;
  font-size: 13.5px;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.toast.success { border-left: 3px solid var(--money); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4, 6, 12, .7); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 999; padding: 20px;
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  width: 100%; max-width: 460px; padding: 26px; box-shadow: var(--shadow); max-height: 88vh; overflow-y: auto;
}
.modal h3 { margin-top: 0; }
.modal-close { position: absolute; }

/* broadcast banner */
#broadcast-banner {
  display: none; background: linear-gradient(90deg, var(--accent), #ffb27a);
  color: #1a0904; font-weight: 600; font-size: 13.5px; padding: 10px 16px; text-align: center;
  position: sticky; top: 0; z-index: 500;
}
#broadcast-banner.show { display: block; animation: slideDown .3s ease; }
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }

/* scrollbar */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }
