/* ═══════════════════════════════════════════════════════════
   LinkPay SaaS — Premium Dark Dashboard
   Design: Dark mode, accent violet/cyan, Inter font
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Variables ────────────────────────────────────────────── */
:root {
  --bg-base:      #0d0f1a;
  --bg-card:      #141728;
  --bg-sidebar:   #0f1120;
  --bg-input:     #1a1e32;
  --border:       #252840;
  --border-light: #2e3355;

  --accent-violet: #7c3aed;
  --accent-cyan:   #06b6d4;
  --accent-green:  #10b981;
  --accent-orange: #f59e0b;
  --accent-red:    #ef4444;

  --grad-primary: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
  --grad-card:    linear-gradient(145deg, #141728 0%, #1a1e32 100%);

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #475569;

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  --shadow-sm:  0 2px 8px rgba(0,0,0,.4);
  --shadow-md:  0 4px 24px rgba(0,0,0,.5);
  --shadow-glow-violet: 0 0 32px rgba(124,58,237,.25);
  --shadow-glow-cyan:   0 0 32px rgba(6,182,212,.2);

  --sidebar-w: 240px;
  --header-h:  64px;
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-cyan); text-decoration: none; transition: opacity .2s; }
a:hover { opacity: .8; }

/* ── Layout ───────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform .3s ease;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .logo-icon {
  width: 38px; height: 38px;
  background: var(--grad-primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow-glow-violet);
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.5px;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-logo .logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: .5px;
  text-transform: uppercase;
  -webkit-text-fill-color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all .2s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: rgba(124,58,237,.1);
  color: var(--text-primary);
  border-color: rgba(124,58,237,.2);
}

.nav-item.active {
  background: rgba(124,58,237,.15);
  color: #a78bfa;
  border-color: rgba(124,58,237,.3);
  box-shadow: var(--shadow-glow-violet);
}

.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.sidebar-footer .nav-item {
  color: var(--accent-red);
}
.sidebar-footer .nav-item:hover {
  background: rgba(239,68,68,.1);
  border-color: rgba(239,68,68,.2);
  color: #fca5a5;
}

/* ── Main Content ─────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Header ───────────────────────────────────────────────── */
.header {
  height: var(--header-h);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.partner-label {
  font-size: 13px;
  color: var(--text-muted);
}

.menu-toggle,
.sidebar-backdrop {
  display: none;
}

.status-dot {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.status-dot::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

/* ── Page Content ─────────────────────────────────────────── */
.page {
  padding: 28px;
  flex: 1;
}

.page-header {
  margin-bottom: 28px;
}

.page-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -.5px;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.page-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.content-grid {
  display: grid;
  gap: 24px;
  align-items: start;
}

.content-grid-sidebar {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.side-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--grad-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: border-color .2s, box-shadow .2s;
}

.card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

/* ── Stats Grid ───────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--grad-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: all .25s ease;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}

.stat-card.violet::before { background: var(--grad-primary); }
.stat-card.cyan::before   { background: linear-gradient(90deg, #06b6d4, #0ea5e9); }
.stat-card.green::before  { background: linear-gradient(90deg, #10b981, #34d399); }
.stat-card.orange::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  font-size: 22px;
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}

.stat-card.violet .stat-icon { background: rgba(124,58,237,.15); }
.stat-card.cyan   .stat-icon { background: rgba(6,182,212,.15); }
.stat-card.green  .stat-icon { background: rgba(16,185,129,.15); }
.stat-card.orange .stat-icon { background: rgba(245,158,11,.15); }

.stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-value .unit {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-left: 4px;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── Quick Actions ────────────────────────────────────────── */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.quick-card {
  background: var(--grad-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all .2s ease;
  text-decoration: none;
  color: inherit;
}

.quick-card:hover {
  border-color: var(--accent-violet);
  box-shadow: var(--shadow-glow-violet);
  transform: translateY(-2px);
  color: inherit;
  opacity: 1;
}

.quick-card .quick-icon {
  width: 50px; height: 50px;
  border-radius: var(--radius-md);
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  box-shadow: var(--shadow-glow-violet);
}

.quick-card .quick-info h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
}

.quick-card .quick-info p {
  font-size: 13px;
  color: var(--text-secondary);
}

.quick-card .quick-arrow {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 18px;
  transition: transform .2s;
}

.quick-card:hover .quick-arrow { transform: translateX(4px); }

/* ── Forms ────────────────────────────────────────────────── */
.form-section {
  max-width: 640px;
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.form-input, .form-select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--accent-violet);
  box-shadow: 0 0 0 3px rgba(124,58,237,.15);
}

.form-input::placeholder { color: var(--text-muted); }

.form-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.operator-hint {
  margin-top: 7px;
  color: var(--text-muted);
  font-size: 12px;
}

.operator-hint.success { color: #34d399; }
.operator-hint.error { color: #fca5a5; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Amount input special */
.amount-wrapper {
  position: relative;
}

.amount-wrapper .currency-tag {
  position: absolute;
  right: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-cyan);
  letter-spacing: 1px;
  pointer-events: none;
}

.amount-wrapper .form-input {
  padding-right: 56px;
  font-size: 20px;
  font-weight: 700;
}

.amount-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.amount-shortcuts button {
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--border-light);
  border-radius: 999px;
  background: rgba(6,182,212,.07);
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.amount-shortcuts button:hover,
.amount-shortcuts button.active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(6,182,212,.14);
}

.mobile-submit-bar { width: 100%; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all .2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: var(--shadow-glow-violet);
}

.btn-primary:hover {
  opacity: .9;
  transform: translateY(-1px);
  box-shadow: 0 0 40px rgba(124,58,237,.4);
  color: #fff;
}

.btn-primary:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--accent-violet);
  color: var(--text-primary);
  background: rgba(124,58,237,.08);
}

.btn-danger {
  background: rgba(239,68,68,.15);
  border: 1px solid rgba(239,68,68,.3);
  color: #fca5a5;
}

.btn-danger:hover {
  background: rgba(239,68,68,.25);
}

.btn-lg { padding: 14px 32px; font-size: 16px; border-radius: var(--radius-md); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-full { width: 100%; }

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none !important;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Favorites Pills ──────────────────────────────────────── */
.favorites-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.fav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: rgba(124,58,237,.12);
  border: 1px solid rgba(124,58,237,.25);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: #a78bfa;
  cursor: pointer;
  transition: all .2s;
}

.fav-pill:hover {
  background: rgba(124,58,237,.22);
  transform: translateY(-1px);
}

.fav-pill .fav-icon { font-size: 14px; }

/* ── Result Box ───────────────────────────────────────────── */
.result-box {
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 24px;
  border: 1px solid;
  animation: fadeInUp .4s ease;
}

.result-box.success {
  background: rgba(16,185,129,.08);
  border-color: rgba(16,185,129,.3);
}

.result-box.error {
  background: rgba(239,68,68,.08);
  border-color: rgba(239,68,68,.3);
}

.result-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-box.success .result-title { color: #34d399; }
.result-box.error   .result-title { color: #fca5a5; }

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
  font-size: 13px;
}

.result-row:last-child { border-bottom: none; }
.result-row .label { color: var(--text-muted); }
.result-row .value { font-weight: 600; color: var(--text-primary); }

/* ── Transactions Table ───────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead {
  background: rgba(255,255,255,.03);
  border-bottom: 1px solid var(--border);
}

thead th {
  padding: 14px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid rgba(255,255,255,.04);
  transition: background .15s;
}

tbody tr:last-child { border-bottom: none; }

tbody tr:hover { background: rgba(255,255,255,.02); }

tbody td {
  padding: 14px 16px;
  color: var(--text-secondary);
  vertical-align: middle;
}

tbody td .mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--accent-cyan);
}

.amount-cell {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
}

.badge-pending {
  background: rgba(245,158,11,.15);
  color: #fbbf24;
  border: 1px solid rgba(245,158,11,.3);
}
.badge-pending::before { background: #f59e0b; }

.badge-success {
  background: rgba(16,185,129,.15);
  color: #34d399;
  border: 1px solid rgba(16,185,129,.3);
}
.badge-success::before { background: #10b981; box-shadow: 0 0 6px #10b981; }

.badge-failed {
  background: rgba(239,68,68,.15);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,.3);
}
.badge-failed::before { background: #ef4444; }

/* ── Alert / Flash ────────────────────────────────────────── */
.flash {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeInUp .3s ease;
}

.flash.success {
  background: rgba(16,185,129,.1);
  border: 1px solid rgba(16,185,129,.3);
  color: #34d399;
}

.flash.error {
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.3);
  color: #fca5a5;
}

/* ── Modals & Toasts ──────────────────────────────────────── */
body.modal-open { overflow: hidden; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5,7,14,.82);
  backdrop-filter: blur(8px);
  animation: fadeIn .18s ease;
}

.modal-backdrop.modal-leaving {
  opacity: 0;
  transition: opacity .18s ease;
}

.confirm-modal {
  width: min(100%, 520px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 30px;
  border: 1px solid rgba(245,158,11,.35);
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, #171a2d 0%, #111421 100%);
  box-shadow: 0 28px 90px rgba(0,0,0,.7), 0 0 45px rgba(245,158,11,.1);
  animation: modalIn .22s ease;
}

.confirm-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 18px;
  border: 1px solid rgba(245,158,11,.35);
  border-radius: 50%;
  background: rgba(245,158,11,.14);
  color: #fbbf24;
  font-size: 26px;
  font-weight: 800;
}

.confirm-modal h2 {
  font-size: 21px;
  line-height: 1.25;
}

.confirm-subtitle {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}

.confirm-details {
  display: grid;
  gap: 1px;
  margin: 22px 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--border);
}

.confirm-details > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 15px;
  background: var(--bg-input);
}

.confirm-details span {
  color: var(--text-muted);
  font-size: 12px;
}

.confirm-details strong {
  max-width: 60%;
  overflow-wrap: anywhere;
  color: var(--text-primary);
  font-size: 14px;
  text-align: right;
}

.confirm-details .confirm-amount strong {
  color: #34d399;
  font-size: 18px;
}

.confirm-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px;
  border: 1px solid rgba(6,182,212,.25);
  border-radius: var(--radius-sm);
  background: rgba(6,182,212,.07);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
}

.confirm-check input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--accent-cyan);
  flex-shrink: 0;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 10px;
  margin-top: 22px;
}

.toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1200;
  display: grid;
  width: min(390px, calc(100vw - 28px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 11px;
  padding: 14px;
  border: 1px solid;
  border-radius: var(--radius-md);
  background: rgba(20,23,40,.96);
  box-shadow: 0 16px 50px rgba(0,0,0,.55);
  backdrop-filter: blur(12px);
  pointer-events: auto;
  animation: toastIn .3s ease;
}

.toast-success { border-color: rgba(16,185,129,.42); }
.toast-error { border-color: rgba(239,68,68,.45); }

.toast-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 19px;
  font-weight: 800;
}

.toast-success .toast-icon {
  background: rgba(16,185,129,.15);
  color: #34d399;
}

.toast-error .toast-icon {
  background: rgba(239,68,68,.15);
  color: #fca5a5;
}

.toast-content {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.toast-content strong { font-size: 14px; }
.toast-content span {
  overflow-wrap: anywhere;
  color: var(--text-secondary);
  font-size: 12px;
}

.toast-close {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 22px;
}

.toast-leaving {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity .25s, transform .25s;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Login Page ───────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(124,58,237,.12) 0%, transparent 70%);
  top: -100px; left: -100px;
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(6,182,212,.08) 0%, transparent 70%);
  bottom: -100px; right: -100px;
  pointer-events: none;
}

.login-box {
  width: 100%;
  max-width: 420px;
  background: var(--grad-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  box-shadow: var(--shadow-md), 0 0 80px rgba(124,58,237,.1);
  position: relative;
  z-index: 1;
}

.password-wrapper { position: relative; }

.password-wrapper .form-input { padding-right: 88px; }

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  min-height: 34px;
  padding: 6px 9px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 6px;
  background: rgba(124,58,237,.14);
  color: #a78bfa;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-icon-lg {
  width: 64px; height: 64px;
  background: var(--grad-primary);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-glow-violet);
}

.login-logo h1 {
  font-size: 26px;
  font-weight: 800;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -.5px;
}

.login-logo p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; color: var(--text-secondary); }
.empty-state p { font-size: 14px; }

/* ── Divider ──────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.fade-in { animation: fadeIn .3s ease; }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --header-h: 58px; }

  body.menu-open { overflow: hidden; }

  .sidebar {
    width: min(84vw, 300px);
    transform: translateX(-105%);
    box-shadow: 18px 0 50px rgba(0,0,0,.55);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    border: 0;
    background: rgba(5,7,14,.7);
    backdrop-filter: blur(3px);
  }
  body.menu-open .sidebar-backdrop { display: block; }

  .main { margin-left: 0; }

  .header { padding: 0 14px; }
  .header-title {
    max-width: 48vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
  }
  .menu-toggle {
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 20px;
  }
  .header-right { gap: 8px; }
  .status-dot { font-size: 0; }
  .status-dot::before { width: 9px; height: 9px; }
  .partner-label { font-size: 11px; }

  .page { padding: 18px 14px 28px; }
  .page-header { margin-bottom: 20px; }
  .page-header-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .page-header-actions .btn { width: 100%; }
  .page-title { font-size: clamp(21px, 7vw, 25px); line-height: 1.25; }
  .page-subtitle { font-size: 13px; }

  .content-grid-sidebar { grid-template-columns: 1fr; }
  .card { padding: 18px; border-radius: var(--radius-md); }

  .form-row { grid-template-columns: 1fr; }
  .form-input, .form-select {
    min-height: 48px;
    font-size: 16px;
  }
  .btn { min-height: 44px; }
  .btn-lg { min-height: 50px; padding: 13px 18px; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: clamp(21px, 7vw, 27px); overflow-wrap: anywhere; }
  .stat-value .unit { display: block; margin: 4px 0 0; }
  .quick-grid { grid-template-columns: 1fr; gap: 12px; }
  .quick-card { padding: 16px; gap: 12px; }
  .quick-card .quick-icon { width: 44px; height: 44px; }
  .quick-card .quick-info { min-width: 0; }
  .quick-card .quick-info p { overflow-wrap: anywhere; }

  .favorites-row {
    display: grid;
    grid-template-columns: 1fr;
  }
  .fav-pill {
    width: 100%;
    justify-content: flex-start;
    min-height: 44px;
  }

  .amount-shortcuts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
  .amount-shortcuts button { min-height: 42px; }

  .mobile-submit-bar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    margin: 0 -18px -18px;
    width: calc(100% + 36px);
    padding: 12px 18px max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    background: rgba(20,23,40,.94);
    backdrop-filter: blur(14px);
  }

  .result-box { padding: 18px; }
  .result-row {
    align-items: flex-start;
    gap: 8px;
    flex-direction: column;
  }
  .result-row .value {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .table-wrapper {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }
  .table-wrapper table,
  .table-wrapper tbody,
  .table-wrapper tr,
  .table-wrapper td {
    display: block;
    width: 100%;
  }
  .table-wrapper thead { display: none; }
  .table-wrapper tbody {
    display: grid;
    gap: 12px;
  }
  .table-wrapper tbody tr {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--grad-card);
    box-shadow: var(--shadow-sm);
  }
  .table-wrapper tbody td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 0;
    border-bottom: 1px solid rgba(255,255,255,.05);
    text-align: right;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
  .table-wrapper tbody td:last-child { border-bottom: 0; }
  .table-wrapper tbody td::before {
    content: attr(data-label);
    flex: 0 0 38%;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .5px;
    text-align: left;
    text-transform: uppercase;
  }
  .table-wrapper tbody td .mono {
    max-width: 58%;
    overflow-wrap: anywhere;
    text-align: right;
  }

  .login-body { overflow-x: hidden; }
  .login-page {
    min-height: 100svh;
    padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
    align-items: center;
  }
  .login-box {
    max-width: 100%;
    padding: 26px 18px;
    border-radius: var(--radius-lg);
  }
  .login-logo { margin-bottom: 20px; }
  .login-logo .logo-icon-lg {
    width: 54px;
    height: 54px;
    margin-bottom: 12px;
    font-size: 25px;
  }
  .login-logo h1 { font-size: 23px; }
  .login-logo p { font-size: 12px; }
  .login-box .form-group { margin-bottom: 16px; }
  .login-box .btn-lg { width: 100%; }
  .empty-state { padding: 42px 12px; }

  .modal-backdrop {
    align-items: end;
    padding: 10px;
  }
  .confirm-modal {
    width: 100%;
    max-height: calc(100vh - 20px);
    padding: 22px 16px 16px;
    border-radius: var(--radius-lg);
  }
  .confirm-details > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
  .confirm-details strong {
    max-width: 100%;
    text-align: left;
  }
  .confirm-actions { grid-template-columns: 1fr; }
  .confirm-actions .btn-primary { grid-row: 1; }
  .toast-container {
    top: 10px;
    right: 14px;
  }
}

@media (max-width: 430px) {
  .stats-grid { grid-template-columns: 1fr; gap: 12px; }
  .stat-card {
    display: grid;
    grid-template-columns: 46px 1fr;
    column-gap: 12px;
  }
  .stat-icon { grid-row: span 3; margin: 0; }
  .stat-label, .stat-value, .stat-sub { grid-column: 2; }
  .stat-value .unit { display: inline; margin-left: 4px; }
  .partner-label { display: none; }
}
