:root {
  --bg: #0d0f1a;
  --surface: #161929;
  --surface2: #1e2236;
  --border: rgba(255, 255, 255, 0.07);
  --accent: #6c63ff;
  --accent2: #a78bfa;
  --accent-glow: rgba(108, 99, 255, 0.35);
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  --text: #e8eaf0;
  --text2: #9399b2;
  --text3: #5c6380;
}

[data-theme="light"] {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface2: #f0f2f8;
  --border: rgba(0, 0, 0, 0.08);
  --accent: #6c63ff;
  --accent2: #7c6cf0;
  --accent-glow: rgba(108, 99, 255, 0.15);
  --success: #16a34a;
  --error: #dc2626;
  --warning: #d97706;
  --text: #1a1d2e;
  --text2: #5a6078;
  --text3: #8b92a8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow: hidden;
}

/* ═══════════════ AUTH OVERLAY ═══════════════ */
#auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

#auth-content {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  justify-content: center;
  margin-bottom: 8px;
}

.auth-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-title {
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
}

.auth-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.auth-input:focus {
  border-color: var(--accent);
}

.auth-toggle {
  font-size: 0.85rem;
  color: var(--text2);
  text-align: center;
  cursor: pointer;
  margin-top: 4px;
}

.auth-toggle:hover {
  color: var(--accent2);
}

/* ═══════════════ APP SHELL ═══════════════ */
#app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ═══════════════ SIDEBAR ═══════════════ */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
  object-fit: contain;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text2);
  transition: all 0.18s;
  text-decoration: none;
  user-select: none;
}

.nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-item.active {
  background: rgba(108, 99, 255, 0.15);
  color: var(--accent2);
}

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

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 4px;
}

.sidebar-user {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.sidebar-user-role {
  font-size: 0.72rem;
  color: var(--text3);
  text-transform: capitalize;
  margin-top: 1px;
}

.sidebar-logout {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text3);
  border-radius: 8px;
  padding: 7px 0;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.18s;
}

.sidebar-logout:hover {
  border-color: var(--error);
  color: var(--error);
  background: rgba(239, 68, 68, 0.07);
}

/* ═══════════════ MAIN CONTENT ═══════════════ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* === TOPBAR === */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(22, 25, 41, 0.8);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.topbar-title {
  font-size: 1.05rem;
  font-weight: 600;
}

.topbar-stats {
  display: flex;
  gap: 24px;
  align-items: center;
}

.topbar-stat {
  text-align: right;
  cursor: pointer;
}

.topbar-stat .ts-lbl {
  font-size: 0.68rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
}

.topbar-stat .ts-val {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent2);
  display: block;
}

/* ═══════════════ PAGES ═══════════════ */
.page {
  display: none;
  flex: 1;
  overflow-y: auto;
}

.page.active {
  display: flex;
  flex-direction: column;
}

.page-inner {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.page-subtitle {
  color: var(--text2);
  font-size: 0.9rem;
}

/* Coming soon placeholder */
.coming-soon-card {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 18px;
  padding: 48px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.cs-icon {
  font-size: 40px;
}

.cs-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text2);
}

.cs-desc {
  font-size: 0.88rem;
  color: var(--text3);
  max-width: 440px;
  line-height: 1.6;
}

/* Balance widget */
.balance-widget {
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.15), rgba(167, 139, 250, 0.1));
  border: 1px solid rgba(108, 99, 255, 0.25);
  border-radius: 18px;
  padding: 32px;
  text-align: center;
}

.balance-label {
  font-size: 0.82rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.balance-amount {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff, var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.balance-currency {
  font-size: 0.9rem;
  color: var(--text2);
  margin-top: 4px;
}

/* Settings card */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 480px;
}

.settings-section-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 4px;
}

.settings-label {
  font-size: 0.8rem;
  color: var(--text3);
}

.settings-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0 8px;
}


.mode-tabs {
  display: flex;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
}

.tab-btn {
  padding: 8px 20px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text2);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
}

/* === MAIN === */
/* ─── LIGHT THEME OVERRIDES ────────────────────────────────── */
[data-theme="light"] .topbar {
  background: rgba(245, 247, 251, 0.9);
}
[data-theme="light"] .auth-input {
  border-color: rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .balance-amount {
  background: linear-gradient(135deg, #1a1d2e, var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
}
[data-theme="light"] .sidebar-user-avatar {
  color: #fff;
}
