/* ============================================================
   WexMaster WebClient — Design System
   Inspired by OpenAI / DeepSeek minimal professional style
   ============================================================ */

/* ── Google Font Import (self-hosted fallback via system) ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ─────────────────────────────────────────────────────────────
   1. CSS Custom Properties — Light Theme (default)
───────────────────────────────────────────────────────────── */
:root {
  /* Sidebar */
  --sidebar-bg:         #0f172a;
  --sidebar-border:     #1e293b;
  --sidebar-text:       #94a3b8;
  --sidebar-text-hover: #e2e8f0;
  --sidebar-active-bg:  rgba(59,130,246,.12);
  --sidebar-active-txt: #60a5fa;
  --sidebar-width:      260px;

  /* Main layout */
  --bg-page:     #f8fafc;
  --bg-card:     #ffffff;
  --bg-input:    #ffffff;
  --bg-hover:    #f1f5f9;
  --topbar-bg:   #ffffff;

  /* Text */
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-inverse:   #f8fafc;

  /* Borders */
  --border:       #e2e8f0;
  --border-focus: #3b82f6;

  /* Brand / Accent */
  --accent:        #2563eb;
  --accent-hover:  #1d4ed8;
  --accent-light:  #eff6ff;

  /* Status */
  --success:       #10b981;
  --success-light: #d1fae5;
  --warning:       #f59e0b;
  --warning-light: #fef3c7;
  --danger:        #ef4444;
  --danger-light:  #fee2e2;
  --info:          #3b82f6;
  --info-light:    #eff6ff;

  /* Shadows */
  --shadow-sm:  0 1px 2px rgba(0,0,0,.05);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,.07), 0 4px 6px -4px rgba(0,0,0,.05);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Topbar */
  --topbar-height: 60px;

  /* Chart colors */
  --chart-income:     #10b981;
  --chart-paid:       #3b82f6;
  --chart-tokens-in:  #8b5cf6;
  --chart-tokens-out: #f59e0b;
  --chart-grid:       rgba(0,0,0,.06);
}

/* ─────────────────────────────────────────────────────────────
   2. Dark Theme
───────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --sidebar-bg:         #080e1a;
  --sidebar-border:     #111827;
  --sidebar-text:       #6b7280;
  --sidebar-text-hover: #d1d5db;
  --sidebar-active-bg:  rgba(59,130,246,.15);
  --sidebar-active-txt: #60a5fa;

  --bg-page:    #0d1117;
  --bg-card:    #161b22;
  --bg-input:   #1c2333;
  --bg-hover:   #1c2333;
  --topbar-bg:  #161b22;

  --text-primary:   #e6edf3;
  --text-secondary: #8b949e;
  --text-muted:     #484f58;
  --text-inverse:   #0d1117;

  --border:       #21262d;
  --border-focus: #388bfd;

  --accent:       #388bfd;
  --accent-hover: #58a6ff;
  --accent-light: rgba(56,139,253,.08);

  --success:       #3fb950;
  --success-light: rgba(63,185,80,.1);
  --warning:       #d29922;
  --warning-light: rgba(210,153,34,.1);
  --danger:        #f85149;
  --danger-light:  rgba(248,81,73,.1);
  --info:          #388bfd;
  --info-light:    rgba(56,139,253,.1);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,.4);
  --shadow-lg: 0 10px 20px rgba(0,0,0,.5);

  --chart-grid: rgba(255,255,255,.06);
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-page);
  transition: background .2s, color .2s;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

img, svg { display: block; }

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

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: calc(100vh - env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow-y: auto;
  z-index: 100;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-name  { color: #f1f5f9; font-size: 15px; font-weight: 600; line-height: 1.2; }
.brand-tagline { color: var(--sidebar-text); font-size: 11px; }

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--sidebar-text);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}
.sidebar-close svg { width: 18px; height: 18px; }
.sidebar-close:hover { color: var(--sidebar-text-hover); }

/* ── Nav ── */
.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--sidebar-text);
  padding: 14px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: var(--sidebar-text-hover); }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-txt); }
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; }
.nav-label { font-size: 13.5px; }

/* ── Sidebar Footer ── */
.sidebar-footer {
  padding: 12px 8px calc(24px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.account-menu {
  position: relative;
}

.account-menu summary {
  list-style: none;
}

.account-menu summary::-webkit-details-marker {
  display: none;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
}

.user-card:hover,
.account-menu[open] .user-card {
  background: rgba(255,255,255,.05);
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.user-info { overflow: hidden; }
.user-email {
  color: var(--sidebar-text-hover);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.user-role-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 1px 6px;
  border-radius: 20px;
  margin-top: 2px;
}
.role-user  { background: rgba(59,130,246,.2); color: #60a5fa; }
.role-admin { background: rgba(168,85,247,.2); color: #c084fc; }

.account-menu-chevron {
  width: 14px;
  height: 14px;
  margin-left: auto;
  color: var(--sidebar-text);
  transition: transform .15s;
  flex-shrink: 0;
}

.account-menu[open] .account-menu-chevron {
  transform: rotate(180deg);
}

.account-menu-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-sm);
  background: var(--sidebar-bg);
  box-shadow: var(--shadow-md);
}

.account-menu-item,
.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s;
  cursor: pointer;
  text-decoration: none;
}
.account-menu-item svg,
.logout-btn svg { width: 15px; height: 15px; }
.account-menu-item:hover,
.account-menu-item.active { background: rgba(255,255,255,.05); color: var(--sidebar-text-hover); }
.account-menu-logout:hover,
.logout-btn:hover { background: rgba(239,68,68,.1); color: #f87171; }

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

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

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.page-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}
.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: .2s;
}
.menu-toggle:hover span { background: var(--text-primary); }

.topbar-right { display: flex; align-items: center; gap: 8px; }

/* Theme toggle */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background .15s, color .15s;
}
.theme-toggle:hover { background: var(--border); color: var(--text-primary); }
.theme-toggle svg { width: 16px; height: 16px; }

/* Show/hide sun/moon based on theme */
[data-theme="light"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun  { display: none; }
[data-theme="dark"]  .icon-sun  { display: block; }
[data-theme="dark"]  .icon-moon { display: none; }

.theme-toggle-float {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 999;
}

.auth-floating-controls {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-floating-controls .theme-toggle-float {
  position: static;
}

.language-switcher select {
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  padding: 0 10px;
  font-size: 13px;
}

/* ── Content area ── */
.content-area {
  flex: 1;
  padding: 28px 28px 0;
  max-width: 1400px;
  width: 100%;
}

/* ── Footer ── */
.app-footer {
  padding: 20px 28px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  align-items: center;
}
.footer-sep { opacity: .4; }

/* ─────────────────────────────────────────────────────────────
   5. Page content wrapper
───────────────────────────────────────────────────────────── */
.page-content { display: flex; flex-direction: column; gap: 20px; padding-bottom: 24px; }

/* ─────────────────────────────────────────────────────────────
   6. Cards
───────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.card-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
}

.card-body { padding: 20px 24px 24px; }

/* ── Profile ── */
.profile-page {
  max-width: 980px;
}

.profile-summary-card {
  overflow: visible;
}

.profile-summary {
  display: flex;
  align-items: center;
  gap: 18px;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  flex-shrink: 0;
}

.profile-summary h2 {
  margin: 0 0 4px;
  color: var(--text-primary);
  font-size: 22px;
  line-height: 1.2;
}

.profile-summary p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.profile-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(59,130,246,.12);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.profile-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
}

.profile-detail-grid div {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
}

.profile-detail-grid dt {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.profile-detail-grid dd {
  margin: 0;
  color: var(--text-primary);
  font-size: 14px;
  word-break: break-word;
}

.profile-actions {
  display: flex;
  justify-content: flex-start;
}

.profile-preferences-form {
  display: grid;
  gap: 14px;
  max-width: 620px;
}

.profile-timezone-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.profile-timezone-row .form-input {
  flex: 1;
}

.profile-secondary-button,
.profile-save-button,
.profile-logout-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 0;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
}

.profile-secondary-button {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.profile-save-button {
  width: fit-content;
  background: var(--accent);
  color: #fff;
}

.profile-logout-button {
  background: rgba(239,68,68,.1);
  color: #ef4444;
}

.profile-logout-button svg {
  width: 16px;
  height: 16px;
}

/* ─────────────────────────────────────────────────────────────
   7. Alerts / Messages
───────────────────────────────────────────────────────────── */
.messages-container { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
}

.alert-error, .alert-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-color: rgba(239,68,68,.2);
}
.alert-success {
  background: var(--success-light);
  color: var(--success);
  border-color: rgba(16,185,129,.2);
}
.alert-warning {
  background: var(--warning-light);
  color: var(--warning);
  border-color: rgba(245,158,11,.2);
}
.alert-info {
  background: var(--info-light);
  color: var(--info);
  border-color: rgba(59,130,246,.2);
}

.alert-close {
  background: none;
  border: none;
  cursor: pointer;
  color: currentColor;
  opacity: .6;
  padding: 2px;
  border-radius: 4px;
}
.alert-close:hover { opacity: 1; }
.alert-close svg { width: 14px; height: 14px; }

/* ─────────────────────────────────────────────────────────────
   8. Buttons
───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-icon { gap: 4px; }

.google-signin-button {
  width: 100%;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 4px;
  border: 1px solid #747775;
  background: #fff;
  color: #1f1f1f;
  font-family: Roboto, Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.google-signin-button:hover {
  background: #f8fafd;
  color: #1f1f1f;
  border-color: #747775;
  box-shadow: 0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
}
.google-signin-button:focus-visible {
  outline: 2px solid #4285f4;
  outline-offset: 2px;
}
.google-signin-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
  background: #fff;
}

[data-theme="dark"] .google-signin-button {
  background: #131314;
  color: #e3e3e3;
  border-color: #8e918f;
}
[data-theme="dark"] .google-signin-button:hover {
  background: #1f1f1f;
  color: #e3e3e3;
  border-color: #8e918f;
}

.btn-paypal {
  background: #003087;
  color: #fff;
  border-color: #003087;
}
.btn-paypal:hover { background: #001f5b; border-color: #001f5b; color: #fff; }
.btn-paypal:disabled { background: var(--bg-hover); color: var(--text-muted); border-color: var(--border); cursor: not-allowed; }

.btn-mp {
  background: #009ee3;
  color: #fff;
  border-color: #009ee3;
}
.btn-mp:hover { background: #007bb8; border-color: #007bb8; color: #fff; }
.btn-mp:disabled { background: var(--bg-hover); color: var(--text-muted); border-color: var(--border); cursor: not-allowed; }

/* ─────────────────────────────────────────────────────────────
   9. Forms
───────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}

.form-input-sm { padding: 7px 12px; font-size: 13.5px; }
.form-error { font-size: 12px; color: var(--danger); }

.input-prefix-wrapper { position: relative; }
.input-prefix {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-weight: 500;
  pointer-events: none;
}
.input-prefix-wrapper .form-input { padding-left: 24px; }

/* ─────────────────────────────────────────────────────────────
   10. Auth pages
───────────────────────────────────────────────────────────── */
.auth-body  { background: var(--bg-page); }
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-container {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
}

.home-hero {
  width: min(100%, 980px);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
  padding: 32px 16px;
}

.home-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px;
  box-shadow: var(--shadow-xl);
  display: grid;
  gap: 28px;
}

.home-badge {
  display: inline-flex;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(59,130,246,.12);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  width: fit-content;
}

.home-card h1 {
  font-size: clamp(2.3rem, 4vw, 3.4rem);
  margin: 0;
  line-height: 1.05;
}

.home-subtitle {
  max-width: 780px;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.8;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.home-actions .btn {
  min-width: 160px;
}

.home-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.home-feature {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-body);
}

.home-feature strong {
  display: block;
  margin-bottom: 0.6rem;
  color: var(--text-primary);
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo-icon {
  width: 52px;
  height: 52px;
  background: var(--accent);
  color: #fff;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  margin: 0 auto 14px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.no-access-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  background: var(--danger-light);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: var(--radius-md);
  color: var(--danger);
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.5;
}
.no-access-banner svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.auth-alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 8px;
}
.auth-alert-error  { background: var(--danger-light);  color: var(--danger); }
.auth-alert-warning{ background: var(--warning-light); color: var(--warning); }

.auth-note {
  margin-top: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.auth-footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────
   11. Usage — Credit Card
───────────────────────────────────────────────────────────── */
.stats-grid-top { margin-bottom: 0; }

.credit-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-color: #2d3748;
}
[data-theme="light"] .credit-card {
  background: linear-gradient(135deg, #1e3a5f 0%, #0f2448 100%);
  border-color: #1e3a5f;
}

.credit-card-inner {
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.credit-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.5);
  margin-bottom: 8px;
}

.credit-amount {
  font-size: 40px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.credit-currency {
  font-size: 16px;
  font-weight: 400;
  color: rgba(255,255,255,.5);
}

.credit-hint {
  font-size: 12px;
  color: rgba(255,255,255,.4);
  margin-top: 8px;
}

.credit-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.credit-actions .btn-ghost {
  color: rgba(255,255,255,.7);
  border-color: rgba(255,255,255,.2);
}
.credit-actions .btn-ghost:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}

/* ─────────────────────────────────────────────────────────────
   12. Charts
───────────────────────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding-bottom: 24px;
}

.chart-container {
  padding: 20px 24px 24px;
  height: 280px;
  position: relative;
}

.chart-error {
  position: absolute;
  inset: 20px 24px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
  padding-top: 4px;
}
.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.legend-income    { background: var(--chart-income); }
.legend-paid      { background: var(--chart-paid); }
.legend-tokens-in  { background: var(--chart-tokens-in); }
.legend-tokens-out { background: var(--chart-tokens-out); }

/* ─────────────────────────────────────────────────────────────
   13. Payments page
───────────────────────────────────────────────────────────── */
.credit-summary-card { padding: 0; }
.credit-summary-inner {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.credit-amount-sm {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Amount buttons grid */
.amount-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  margin-top: 8px;
}

.amount-btn {
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  font-family: inherit;
}
.amount-btn:hover { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }
.amount-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.amount-btn-custom { border-style: dashed; }

.custom-amount-wrapper { margin-bottom: 20px; }

/* Fee summary */
.fee-summary {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-top: 8px;
}
.fee-summary-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.fee-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 13.5px;
  color: var(--text-primary);
}
.fee-row-secondary { color: var(--text-muted); font-size: 13px; }
.fee-row-total {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 10px;
  font-weight: 600;
  font-size: 15px;
}
.fee-note {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.5;
}

/* Payment methods grid */
.payment-methods-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.payment-card { overflow: visible; }
.payment-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
}

.payment-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.payment-logo-paypal svg { color: #003087; }
.payment-logo-mp svg { color: #009ee3; }

.payment-coming-soon {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--warning-light);
  color: var(--warning);
  border: 1px solid rgba(245,158,11,.2);
}

.payment-card-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 12px; }

.payment-amount-display {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  min-height: 32px;
}

.payment-fee-detail {
  font-size: 12px;
  color: var(--text-muted);
  min-height: 16px;
}

.payment-disclaimer {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ─────────────────────────────────────────────────────────────
   14. Billing — Table
───────────────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
}
.data-table th:first-child { padding-left: 24px; }
.data-table th:last-child  { padding-right: 24px; }

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}
.data-table td:first-child { padding-left: 24px; }
.data-table td:last-child  { padding-right: 24px; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bg-hover); }

.invoice-number {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

.amount-cell { font-weight: 600; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.status-success { background: var(--success-light); color: var(--success); }
.status-pending { background: var(--warning-light); color: var(--warning); }
.status-failed  { background: var(--danger-light);  color: var(--danger); }

.method-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 500;
}
.method-paypal { background: rgba(0,48,135,.1); color: #003087; }
[data-theme="dark"] .method-paypal { background: rgba(0,48,135,.3); color: #7fb3ff; }
.method-mp { background: rgba(0,158,227,.1); color: #0077b6; }
[data-theme="dark"] .method-mp { background: rgba(0,158,227,.2); color: #56c8ff; }

/* Empty state */
.empty-state {
  padding: 60px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.empty-icon svg { width: 48px; height: 48px; color: var(--text-muted); margin: 0 auto; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.empty-text { font-size: 13.5px; color: var(--text-muted); }

/* ─────────────────────────────────────────────────────────────
   15. Documentation page
───────────────────────────────────────────────────────────── */
.doc-page {
  flex-direction: row !important;
  align-items: flex-start;
  gap: 32px;
  padding-bottom: 48px;
}

.doc-sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--topbar-height) + 20px);
}
.doc-sidebar nav { display: flex; flex-direction: column; gap: 2px; }

.doc-nav-section {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding: 14px 8px 4px;
}
.doc-nav-link {
  display: block;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-secondary);
  transition: background .15s, color .15s;
}
.doc-nav-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.doc-nav-link.active { background: var(--accent-light); color: var(--accent); font-weight: 500; }

.doc-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0; }

.doc-section {
  padding: 32px 0;
  border-bottom: 1px solid var(--border);
}
.doc-section:last-child { border-bottom: none; }
.doc-section h2 { font-size: 22px; font-weight: 700; margin-bottom: 12px; color: var(--text-primary); }
.doc-section h3 { font-size: 15px; font-weight: 600; margin: 20px 0 8px; color: var(--text-primary); }
.doc-section p  { font-size: 14px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 10px; }
.doc-section ul, .doc-section ol { padding-left: 20px; color: var(--text-secondary); font-size: 14px; line-height: 1.8; margin-bottom: 10px; }
.doc-section code {
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  background: var(--bg-hover);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12.5px;
  color: var(--accent);
}

.doc-callout {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  line-height: 1.6;
  margin: 16px 0;
  border-left: 3px solid;
}
.doc-callout-info    { background: var(--info-light);    border-color: var(--info);    color: var(--text-secondary); }
.doc-callout-warning { background: var(--warning-light); border-color: var(--warning); color: var(--text-secondary); }
.doc-table-wrapper { overflow-x: auto; margin-top: 12px; }

/* ─────────────────────────────────────────────────────────────
   16. FAQ page
───────────────────────────────────────────────────────────── */
.faq-header { margin-bottom: 4px; }
.faq-header h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }

.faq-list { display: flex; flex-direction: column; }

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 4px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: left;
  font-family: inherit;
  gap: 16px;
  transition: color .15s;
}
.faq-question:hover { color: var(--accent); }
.faq-icon { width: 18px; height: 18px; flex-shrink: 0; transition: transform .2s; color: var(--text-muted); }
.faq-item.open .faq-icon { transform: rotate(180deg); }

.faq-answer {
  display: none;
  padding: 0 4px 18px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.faq-item.open .faq-answer { display: block; }
.faq-answer p  { margin-bottom: 8px; }
.faq-answer ul { padding-left: 20px; margin-bottom: 8px; }

/* ─────────────────────────────────────────────────────────────
   17. Error pages
───────────────────────────────────────────────────────────── */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  gap: 16px;
  min-height: 60vh;
}
.error-code  { font-size: 80px; font-weight: 800; color: var(--border); line-height: 1; }
.error-title { font-size: 24px; font-weight: 700; color: var(--text-primary); }
.error-text  { font-size: 14px; color: var(--text-muted); }

/* ─────────────────────────────────────────────────────────────
   18. Utilities
───────────────────────────────────────────────────────────── */
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: 12.5px; }
.text-center { text-align: center; }

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .25s;
}
.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ─────────────────────────────────────────────────────────────
   19. Responsive — Tablet (≤1024px)
───────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .charts-grid         { grid-template-columns: 1fr; }
  .payment-methods-grid{ grid-template-columns: 1fr; }

  .doc-page { flex-direction: column !important; }
  .doc-sidebar { width: 100%; position: static; }
  .doc-sidebar nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .doc-nav-section { display: none; }
}

/* ─────────────────────────────────────────────────────────────
   20. Responsive — Mobile (≤768px)
───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Sidebar off-canvas */
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-close { display: flex; }
  .sidebar-overlay { display: block; }

  .main-wrapper { margin-left: 0; }
  .menu-toggle  { display: flex; }

  .topbar { padding: 0 16px; }
  .page-title { font-size: 15px; }

  .content-area { padding: 20px 16px 0; }
  .app-footer   { padding: 16px 20px; }

  .profile-summary {
    align-items: flex-start;
  }
  .profile-detail-grid {
    grid-template-columns: 1fr;
  }
  .profile-timezone-row {
    flex-direction: column;
  }
  .profile-timezone-row .form-input,
  .profile-secondary-button,
  .profile-save-button {
    width: 100%;
    justify-content: center;
  }

  /* Auth */
  .auth-card { padding: 28px 24px; }

  /* Credit card */
  .credit-card-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .credit-amount { font-size: 32px; }

  /* Billing table */
  .data-table th:nth-child(4),
  .data-table td:nth-child(4) { display: none; }

  /* Amount grid */
  .amount-grid { gap: 6px; }
  .amount-btn  { padding: 8px 14px; font-size: 13px; }
}

@media (max-width: 480px) {
  .credit-actions { flex-direction: column; width: 100%; }
  .credit-actions .btn { justify-content: center; }
}
