/* ═══════════════════════════════════════════════════════════
   WealthPlan Pro — Premium Dark Theme
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg-base:        #080d1a;
  --bg-surface:     #0f172a;
  --bg-card:        #1a2340;
  --bg-card-hover:  #1e2a4a;
  --bg-input:       #0f1829;
  --bg-sidebar:     #080d1a;
  --border:         rgba(255,255,255,0.07);
  --border-active:  rgba(245,158,11,0.4);

  --gold:           #f59e0b;
  --gold-light:     #fbbf24;
  --gold-dim:       rgba(245,158,11,0.15);
  --gold-glow:      0 0 24px rgba(245,158,11,0.25);

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

  --green:          #10b981;
  --green-dim:      rgba(16,185,129,0.15);
  --red:            #ef4444;
  --red-dim:        rgba(239,68,68,0.15);
  --blue:           #3b82f6;
  --blue-dim:       rgba(59,130,246,0.15);
  --purple:         #8b5cf6;
  --purple-dim:     rgba(139,92,246,0.15);
  --cyan:           #06b6d4;
  --orange:         #f97316;

  --sidebar-w:      260px;
  --topbar-h:       64px;
  --radius:         12px;
  --radius-sm:      8px;
  --radius-lg:      16px;
  --radius-xl:      24px;

  --shadow-sm:      0 2px 8px rgba(0,0,0,0.4);
  --shadow:         0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg:      0 8px 40px rgba(0,0,0,0.6);
  --transition:     all 0.2s ease;

  --font:           'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

:root[data-theme="light"] {
  --bg-base:        #f3f6fb;
  --bg-surface:     #ffffff;
  --bg-card:        #ffffff;
  --bg-card-hover:  #eef3f9;
  --bg-input:       #f8fafc;
  --bg-sidebar:     #ffffff;
  --border:         rgba(15,23,42,0.10);
  --border-active:  rgba(217,119,6,0.35);

  --gold:           #d97706;
  --gold-light:     #f59e0b;
  --gold-dim:       rgba(217,119,6,0.12);
  --gold-glow:      0 0 24px rgba(217,119,6,0.16);

  --text-primary:   #0f172a;
  --text-secondary: #334155;
  --text-muted:     #64748b;
  --text-gold:      #b45309;

  --green:          #059669;
  --green-dim:      rgba(5,150,105,0.12);
  --red:            #dc2626;
  --red-dim:        rgba(220,38,38,0.12);
  --blue:           #2563eb;
  --blue-dim:       rgba(37,99,235,0.12);
  --purple:         #7c3aed;
  --purple-dim:     rgba(124,58,237,0.12);
  --cyan:           #0891b2;
  --orange:         #ea580c;

  --shadow-sm:      0 2px 10px rgba(15,23,42,0.05);
  --shadow:         0 8px 24px rgba(15,23,42,0.08);
  --shadow-lg:      0 14px 44px rgba(15,23,42,0.12);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

:root[data-theme="light"] body {
  background:
    radial-gradient(circle at top right, rgba(37,99,235,0.06) 0%, transparent 30%),
    radial-gradient(circle at left top, rgba(217,119,6,0.05) 0%, transparent 28%),
    var(--bg-base);
}

a { color: var(--gold); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--gold-light); }

img { max-width: 100%; display: block; }

/* ─── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: #2d3a52; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3d4d6a; }

:root[data-theme="light"] ::-webkit-scrollbar-thumb { background: #cbd5e1; }
:root[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ─── Typography ───────────────────────────────────────────── */
h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 600; }
h4 { font-size: 15px; font-weight: 600; }
h5 { font-size: 13px; font-weight: 600; }

.text-gold    { color: var(--gold)!important; }
.text-green   { color: var(--green)!important; }
.text-red     { color: var(--red)!important; }
.text-blue    { color: var(--blue)!important; }
.text-muted   { color: var(--text-muted)!important; }
.text-secondary { color: var(--text-secondary)!important; }

.fw-700 { font-weight: 700; }
.fw-600 { font-weight: 600; }
.fs-12  { font-size: 12px; }
.fs-13  { font-size: 13px; }
.fs-11  { font-size: 11px; }

/* ─── Layout ───────────────────────────────────────────────── */
.app-wrapper {
  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; bottom: 0;
  z-index: 200;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}

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

.sidebar-logo .logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--gold) 0%, #d97706 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: #000;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(245,158,11,0.35);
}

.sidebar-logo .logo-text {
  display: flex; flex-direction: column;
}
.sidebar-logo .logo-text strong {
  font-size: 15px; font-weight: 800; color: var(--text-primary);
  letter-spacing: -0.3px; line-height: 1;
}
.sidebar-logo .logo-text span {
  font-size: 10px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.8px; margin-top: 2px;
}

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

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  white-space: nowrap;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

:root[data-theme="light"] .nav-item:hover,
:root[data-theme="light"] .user-card:hover,
:root[data-theme="light"] .dropdown-item:hover,
:root[data-theme="light"] .btn-ghost:hover:not(:disabled),
:root[data-theme="light"] .select2-results__option:hover,
:root[data-theme="light"] .select2-results__option--highlighted {
  background: rgba(15,23,42,0.05) !important;
  color: var(--text-primary) !important;
}

.nav-item.active {
  background: var(--gold-dim);
  color: var(--gold);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--gold);
  border-radius: 0 2px 2px 0;
}

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

.nav-badge {
  margin-left: auto;
  background: var(--gold);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
}

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

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

.user-card:hover { background: rgba(255,255,255,0.05); }

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold) 0%, #d97706 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #000;
  flex-shrink: 0;
  overflow: hidden;
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-info { flex: 1; overflow: hidden; }
.user-info .user-name {
  font-size: 13px; font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-info .user-plan {
  font-size: 11px; color: var(--gold);
}

.wallet-pill {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  background: var(--green-dim);
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

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

/* ─── TOPBAR ───────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky; top: 0; z-index: 100;
}

.topbar-title {
  flex: 1;
}
.topbar-title h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}
.topbar-title .breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.topbar-title .breadcrumb span { color: var(--gold); }

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

.topbar-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.topbar-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.topbar-btn .notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--gold);
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}

.topbar-wallet {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  cursor: pointer;
  transition: var(--transition);
}
.topbar-wallet:hover { border-color: var(--gold); }
.topbar-wallet .wbal { font-size: 13px; font-weight: 700; color: var(--green); }
.topbar-wallet .wlbl { font-size: 11px; color: var(--text-muted); }

:root[data-theme="light"] .topbar-btn,
:root[data-theme="light"] .topbar-wallet,
:root[data-theme="light"] .dropdown-menu,
:root[data-theme="light"] .search-bar {
  box-shadow: var(--shadow-sm);
}

/* ─── PAGE CONTENT ─────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 24px;
  overflow-x: hidden;
}

/* ─── CARDS ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card:hover { border-color: rgba(255,255,255,0.1); }

:root[data-theme="light"] .card:hover,
:root[data-theme="light"] .stat-card:hover {
  border-color: rgba(15,23,42,0.12);
}

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

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .card-icon {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
}

.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.1);
}

:root[data-theme="light"] .card-footer {
  background: rgba(15,23,42,0.03);
}

/* ─── STAT CARDS ───────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: 0.08;
  transform: translate(20px,-20px);
}

.stat-card:hover {
  border-color: rgba(255,255,255,0.12);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.stat-card.gold::before  { background: var(--gold); }
.stat-card.green::before { background: var(--green); }
.stat-card.red::before   { background: var(--red); }
.stat-card.blue::before  { background: var(--blue); }
.stat-card.purple::before{ background: var(--purple); }

.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 16px;
}

.stat-card .stat-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 6px;
}

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

.stat-card .stat-change {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 10px;
}

.stat-card .stat-change.up   { color: var(--green); }
.stat-card .stat-change.down { color: var(--red); }

/* ─── TABLES ───────────────────────────────────────────────── */
.wp-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.wp-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  background: rgba(0,0,0,0.15);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.wp-table tbody tr {
  transition: var(--transition);
}

.wp-table tbody tr:hover td {
  background: rgba(255,255,255,0.025);
}

.wp-table tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--text-primary);
  vertical-align: middle;
}

.wp-table tbody tr:last-child td { border-bottom: none; }

.wp-table .amount-credit { color: var(--green); font-weight: 600; }
.wp-table .amount-debit  { color: var(--red);   font-weight: 600; }

/* ─── BADGES ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-gold    { background: var(--gold-dim);   color: var(--gold);   }
.badge-green   { background: var(--green-dim);  color: var(--green);  }
.badge-red     { background: var(--red-dim);    color: var(--red);    }
.badge-blue    { background: var(--blue-dim);   color: var(--blue);   }
.badge-purple  { background: var(--purple-dim); color: var(--purple); }
.badge-muted   { background: rgba(71,85,105,0.2); color: var(--text-muted); }

/* ─── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.1px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, #d97706 100%);
  color: #000;
  box-shadow: 0 2px 12px rgba(245,158,11,0.35);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 20px rgba(245,158,11,0.5);
  transform: translateY(-1px);
  color: #000;
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: rgba(255,255,255,0.15);
  color: var(--text-primary);
}

.btn-success {
  background: linear-gradient(135deg, var(--green) 0%, #059669 100%);
  color: #fff;
}
.btn-success:hover:not(:disabled) { box-shadow: 0 4px 16px rgba(16,185,129,0.4); transform: translateY(-1px); }

.btn-danger {
  background: linear-gradient(135deg, var(--red) 0%, #dc2626 100%);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { box-shadow: 0 4px 16px rgba(239,68,68,0.4); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,0.05); color: var(--text-primary); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-icon { padding: 8px; width: 34px; height: 34px; }

/* ─── FORMS ────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

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

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
  padding: 10px 14px;
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.12);
}

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

.form-control:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

select.form-control { cursor: pointer; }

textarea.form-control { resize: vertical; min-height: 90px; }

.form-control.is-invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.12);
}

.form-error {
  font-size: 12px;
  color: var(--red);
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

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

.input-group { position: relative; }
.input-prefix, .input-suffix {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  pointer-events: none;
}
.input-prefix { left: 12px; }
.input-suffix { right: 12px; }
.input-group .form-control.has-prefix { padding-left: 30px; }
.input-group .form-control.has-suffix { padding-right: 30px; }

/* ─── MODALS ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(10px);
  transition: var(--transition);
  box-shadow: var(--shadow-lg);
}

.modal-overlay.show .modal-box {
  transform: scale(1) translateY(0);
}

.modal-box.modal-lg { max-width: 800px; }
.modal-box.modal-xl { max-width: 1000px; }
.modal-box.modal-sm { max-width: 420px; }

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

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: var(--transition);
}
.modal-close:hover { background: var(--red-dim); color: var(--red); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ─── PROGRESS BARS ────────────────────────────────────────── */
.progress-bar {
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  height: 8px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.8s ease;
}

.progress-fill.gold   { background: linear-gradient(90deg, var(--gold) 0%, #fbbf24 100%); }
.progress-fill.green  { background: linear-gradient(90deg, var(--green) 0%, #34d399 100%); }
.progress-fill.red    { background: linear-gradient(90deg, var(--red) 0%, #f87171 100%); }
.progress-fill.blue   { background: linear-gradient(90deg, var(--blue) 0%, #60a5fa 100%); }
.progress-fill.purple { background: linear-gradient(90deg, var(--purple) 0%, #a78bfa 100%); }

/* ─── ALERTS ───────────────────────────────────────────────── */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-left: 3px solid;
}

.alert-success { background: var(--green-dim);  border-color: var(--green);  color: #4ade80; }
.alert-danger  { background: var(--red-dim);    border-color: var(--red);    color: #f87171; }
.alert-warning { background: var(--gold-dim);   border-color: var(--gold);   color: var(--gold); }
.alert-info    { background: var(--blue-dim);   border-color: var(--blue);   color: #60a5fa; }

/* ─── CHART CONTAINERS ─────────────────────────────────────── */
.chart-container {
  position: relative;
  width: 100%;
}

/* ─── EMPTY STATES ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h4 {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 600;
}

.empty-state p {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 280px;
  margin: 0 auto 20px;
}

/* ─── TABS ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── TOOLTIP ──────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: var(--text-primary);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 1000;
  box-shadow: var(--shadow);
}

[data-tooltip]:hover::after { opacity: 1; }

/* ─── SKELETON LOADER ──────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-wave {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── TOAST NOTIFICATIONS ──────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 420px;
  animation: toast-in 0.3s ease;
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}

.toast.success::before { background: var(--green); }
.toast.error::before   { background: var(--red); }
.toast.warning::before { background: var(--gold); }
.toast.info::before    { background: var(--blue); }

.toast .toast-icon { font-size: 18px; flex-shrink: 0; }
.toast.success .toast-icon { color: var(--green); }
.toast.error   .toast-icon { color: var(--red); }
.toast.warning .toast-icon { color: var(--gold); }
.toast.info    .toast-icon { color: var(--blue); }

.toast .toast-msg {
  flex: 1;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 2px;
  flex-shrink: 0;
}

@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes toast-out {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}

/* ─── AMOUNT DISPLAY ───────────────────────────────────────── */
.amount-display {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.amount-display .currency { font-size: 0.65em; color: var(--text-muted); font-weight: 600; }
.amount-display .value    { font-weight: 800; letter-spacing: -0.5px; }
.amount-display .unit     { font-size: 0.65em; color: var(--text-muted); font-weight: 500; }

/* ─── GRID LAYOUTS ─────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.grid-5 { display: grid; grid-template-columns: repeat(5,1fr); gap: 16px; }

/* ─── SEARCH & FILTERS ─────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  transition: var(--transition);
}

.search-bar:focus-within {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.12);
}

.search-bar i { color: var(--text-muted); font-size: 14px; }

.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font);
  padding: 10px 0;
  width: 100%;
}

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

.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ─── SIDEBAR TOGGLE (Mobile) ──────────────────────────────── */
.sidebar-toggle {
  display: none;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  align-items: center; justify-content: center;
  font-size: 18px;
}

/* ─── LOADING OVERLAY ──────────────────────────────────────── */
.page-loader {
  position: fixed; inset: 0;
  background: var(--bg-base);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(245,158,11,0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ─── DROPDOWN ─────────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  z-index: 500;
  opacity: 0; visibility: hidden;
  transform: translateY(-4px);
  transition: var(--transition);
  overflow: hidden;
}

.dropdown-menu.show {
  opacity: 1; visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13.5px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.dropdown-item.danger { color: var(--red); }
.dropdown-item.danger:hover { background: var(--red-dim); }
.dropdown-divider { border-top: 1px solid var(--border); margin: 4px 0; }

/* ─── DATEPICKER OVERRIDE ──────────────────────────────────── */
.flatpickr-calendar { background: var(--bg-card)!important; border: 1px solid var(--border)!important; border-radius: var(--radius)!important; box-shadow: var(--shadow-lg)!important; }
.flatpickr-day { color: var(--text-secondary)!important; }
.flatpickr-day.selected { background: var(--gold)!important; border-color: var(--gold)!important; color: #000!important; }
.flatpickr-day:hover { background: var(--bg-card-hover)!important; }
.flatpickr-months .flatpickr-month { color: var(--text-primary)!important; }
.flatpickr-current-month .flatpickr-monthDropdown-months { color: var(--text-primary)!important; }
.flatpickr-weekday { color: var(--text-muted)!important; }

/* ─── SELECT2 OVERRIDE ─────────────────────────────────────── */
.select2-container .select2-selection--single { background: var(--bg-input)!important; border: 1px solid var(--border)!important; border-radius: var(--radius-sm)!important; height: 42px!important; }
.select2-container .select2-selection__rendered { color: var(--text-primary)!important; line-height: 42px!important; padding: 0 14px!important; }
.select2-container .select2-selection__arrow { height: 40px!important; }
.select2-dropdown { background: var(--bg-card)!important; border: 1px solid var(--border)!important; border-radius: var(--radius)!important; box-shadow: var(--shadow-lg)!important; }
.select2-results__option { color: var(--text-secondary)!important; padding: 10px 14px!important; }
.select2-results__option:hover,.select2-results__option--highlighted { background: rgba(255,255,255,0.05)!important; color: var(--text-primary)!important; }
.select2-results__option--selected { background: var(--gold-dim)!important; color: var(--gold)!important; }
.select2-search__field { background: var(--bg-input)!important; border: 1px solid var(--border)!important; color: var(--text-primary)!important; border-radius: var(--radius-sm)!important; padding: 6px 10px!important; }

/* ─── SECTION HEADERS ──────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title .section-icon {
  width: 32px; height: 32px;
  background: var(--gold-dim);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
  font-size: 14px;
}

/* ─── AI CHAT ──────────────────────────────────────────────── */
.chat-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
}

.chat-bubble.user {
  background: var(--gold-dim);
  border: 1px solid var(--border-active);
  color: var(--text-primary);
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.chat-bubble.assistant {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-bubble.assistant.typing {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 16px;
}

.typing-dot {
  width: 8px; height: 8px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing-pulse 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-pulse {
  0%, 80%, 100% { transform: scale(1); opacity: 0.5; }
  40%           { transform: scale(1.3); opacity: 1; }
}

/* ─── GAUGES / RINGS ───────────────────────────────────────── */
.ring-chart { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.ring-chart canvas { position: absolute; }
.ring-chart-center { text-align: center; z-index: 1; }

/* ─── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2,1fr); }
  .grid-5 { grid-template-columns: repeat(3,1fr); }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    transform: translateX(-260px);
    width: 260px;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: translateX(0);
    --sidebar-w: 260px;
  }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .grid-3, .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-5 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .modal-box { margin: 0; border-radius: var(--radius) var(--radius) 0 0; align-self: flex-end; max-height: 85vh; }
  .modal-overlay { align-items: flex-end; padding: 0; }
}

/* ─── UTILITY ──────────────────────────────────────────────── */
.d-flex   { display: flex; }
.d-none   { display: none!important; }
.d-block  { display: block; }
.d-grid   { display: grid; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.gap-24 { gap: 24px; }
.mb-0 { margin-bottom: 0!important; }
.mb-8 { margin-bottom: 8px; }
.mb-12{ margin-bottom: 12px; }
.mb-16{ margin-bottom: 16px; }
.mb-20{ margin-bottom: 20px; }
.mb-24{ margin-bottom: 24px; }
.mt-8 { margin-top: 8px; }
.mt-16{ margin-top: 16px; }
.mt-24{ margin-top: 24px; }
.p-0  { padding: 0!important; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }
.p-24 { padding: 24px; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.overflow-hidden { overflow: hidden; }
.flex-1 { flex: 1; }
.rounded { border-radius: var(--radius)!important; }
.no-select { user-select: none; }
.cursor-pointer { cursor: pointer; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ─── ANIMATIONS ───────────────────────────────────────────── */
.fade-in  { animation: fadeIn  0.3s ease; }
.slide-up { animation: slideUp 0.3s ease; }

@keyframes fadeIn  { from { opacity: 0; }               to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ─── PRINT ────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .no-print { display: none!important; }
  .main-content { margin: 0; }
  .page-content { padding: 0; }
  body { background: white; color: black; }
  .card { border: 1px solid #ddd; }
}
