/* ============================================================
   FinansApp — Premium Design System v3.0
   Modern · Glassmorphism · Fluid Typography
   ============================================================ */

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

/* ── CSS TOKENS ─────────────────────────────────────────── */
:root {
  /* Palette */
  --blue-50:  #eff6ff; --blue-100: #dbeafe; --blue-500: #3b82f6;
  --blue-600: #2563eb; --blue-700: #1d4ed8;
  --indigo-500:#6366f1; --indigo-600:#4f46e5; --violet-500:#8b5cf6;
  --emerald-400:#34d399; --emerald-500:#10b981; --emerald-600:#059669;
  --rose-400:  #fb7185; --rose-500:#ef4444; --rose-600:#dc2626;
  --amber-400: #fbbf24; --amber-500:#f59e0b;
  --cyan-400:  #22d3ee; --cyan-500:#06b6d4;

  /* Semantic — Light */
  --bg:          #f1f5f9;
  --bg-card:     #ffffff;
  --bg-glass:    rgba(255,255,255,0.72);
  --bg-sidebar:  #0f1623;
  --bg-topbar:   rgba(255,255,255,0.9);
  --bg-input:    #f8fafc;
  --bg-hover:    #f1f5f9;
  --text:        #0f172a;
  --text-2:      #334155;
  --text-muted:  #64748b;
  --text-subtle: #94a3b8;
  --border:      #e2e8f0;
  --border-2:    #f1f5f9;
  --divider:     rgba(0,0,0,0.06);

  /* Brand */
  --primary:      #6366f1;
  --primary-glow: rgba(99,102,241,0.2);
  --primary-dark: #4f46e5;

  /* Status */
  --green:       var(--emerald-500);
  --green-light: #ecfdf5;
  --green-glow:  rgba(16,185,129,0.15);
  --red:         var(--rose-500);
  --red-light:   #fff1f2;
  --red-glow:    rgba(239,68,68,0.15);
  --yellow:      var(--amber-500);
  --yellow-light:#fffbeb;
  --yellow-glow: rgba(245,158,11,0.15);
  --purple:      var(--violet-500);
  --purple-light:#f5f3ff;
  --accent:      var(--indigo-600);
  --accent-light:#eef2ff;

  /* Layout */
  --sidebar-w:  256px;
  --topbar-h:   60px;
  --radius-xs:  6px;
  --radius-sm:  10px;
  --radius:     14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  /* Shadow */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:    0 4px 6px rgba(0,0,0,0.05), 0 10px 30px rgba(0,0,0,0.06);
  --shadow-md: 0 8px 16px rgba(0,0,0,0.08), 0 20px 40px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  --shadow-xl: 0 24px 64px rgba(0,0,0,0.16);

  /* Typography */
  --font:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --text-xs:   11px; --text-sm: 12.5px; --text-base: 14px;
  --text-lg:   16px; --text-xl: 18px;   --text-2xl: 22px;

  /* Animation */
  --dur-fast: 0.12s; --dur: 0.2s; --dur-slow: 0.35s;
  --ease: cubic-bezier(0.4,0,0.2,1);
  --spring: cubic-bezier(0.34,1.56,0.64,1);
}

[data-theme="dark"] {
  --bg:          #0a0e1a;
  --bg-card:     #111827;
  --bg-glass:    rgba(17,24,39,0.8);
  --bg-sidebar:  #070c17;
  --bg-topbar:   rgba(17,24,39,0.95);
  --bg-input:    #1a2235;
  --bg-hover:    #1f2d42;
  --text:        #f1f5f9;
  --text-2:      #cbd5e1;
  --text-muted:  #64748b;
  --text-subtle: #475569;
  --border:      #1e293b;
  --border-2:    #0f1623;
  --divider:     rgba(255,255,255,0.05);
  --bg-card-hover: #1a2235;
  --green-light: #022c22;
  --red-light:   #1a0a0a;
  --yellow-light:#1a1000;
  --purple-light:#150e2a;
  --accent-light:#0f1035;
  --shadow:      0 4px 6px rgba(0,0,0,0.3), 0 10px 30px rgba(0,0,0,0.25);
  --shadow-md:   0 8px 16px rgba(0,0,0,0.35), 0 20px 40px rgba(0,0,0,0.3);
  --shadow-lg:   0 12px 40px rgba(0,0,0,0.5);
}

/* ── RESET ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--dur), color var(--dur);
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--dur) var(--ease);
  border-right: 1px solid rgba(255,255,255,0.04);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  position: sticky;
  top: 0;
  background: var(--bg-sidebar);
  z-index: 1;
}

.logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 900; color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}

.logo-text {
  font-size: 15px; font-weight: 800;
  color: #fff;
  letter-spacing: -0.2px;
}

.sidebar-nav { flex: 1; padding: 12px 0 20px; }

.nav-group { padding: 0 10px; margin-bottom: 4px; }

.nav-group-label {
  display: block;
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 1.4px;
  color: rgba(255,255,255,0.2);
  padding: 10px 10px 4px;
  text-transform: uppercase;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8.5px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  font-size: 13px; font-weight: 500;
  transition: all var(--dur) var(--ease);
  margin-bottom: 1px;
  position: relative;
  letter-spacing: -0.1px;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.85);
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.22), rgba(139,92,246,0.12));
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(99,102,241,0.2);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 25%; height: 50%;
  width: 3px;
  background: linear-gradient(180deg, #6366f1, #8b5cf6);
  border-radius: 0 3px 3px 0;
}

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

.nav-badge {
  margin-left: auto;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  font-size: 9px; font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 8px rgba(99,102,241,0.35);
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,0.04);
}

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

.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
  flex-shrink: 0;
}

.user-name { display: block; font-size: 12.5px; font-weight: 600; color: rgba(255,255,255,0.85); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: 10.5px; color: rgba(255,255,255,0.28); }
.sidebar-actions { display: flex; gap: 6px; }

.btn-icon {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-xs);
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; text-decoration: none;
  transition: all var(--dur);
}
.btn-icon:hover { background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.15); }

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

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 28px;
  height: var(--topbar-h);
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.sidebar-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); padding: 4px; }
.topbar-title { font-size: 14.5px; font-weight: 700; color: var(--text); letter-spacing: -0.2px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }

.price-ticker {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  font-family: var(--font-mono);
  font-size: 11.5px; color: var(--text-muted);
}
.ticker-item { color: var(--text-2); font-weight: 600; }
.ticker-sep { color: var(--border); }
.topbar-date { font-size: 11.5px; color: var(--text-muted); font-family: var(--font-mono); }

/* ── CONTENT ─────────────────────────────────────────────── */
.main-content { flex: 1; padding: 28px; overflow-x: hidden; }

/* ── PAGE HEADER ─────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 28px; flex-wrap: wrap; gap: 14px;
}
.page-header h1 {
  font-size: 22px; font-weight: 800;
  color: var(--text); letter-spacing: -0.5px; line-height: 1.2;
}
.page-header p { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ── CARD ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur), border-color var(--dur), background var(--dur);
}
.card:hover { box-shadow: var(--shadow); }

.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px;
}
.card-title {
  font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-muted);
}

/* ── STAT CARDS ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: all var(--dur) var(--ease);
  position: relative;
  overflow: hidden;
  cursor: default;
}

.stat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--stat-glow, rgba(99,102,241,0.04)), transparent);
  pointer-events: none;
  border-radius: inherit;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--stat-border, var(--border));
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 2.5px;
  background: linear-gradient(90deg, var(--stat-from, #6366f1), var(--stat-to, #8b5cf6));
  border-radius: var(--radius) var(--radius) 0 0;
}

.stat-card.green {
  --stat-from: #10b981; --stat-to: #34d399;
  --stat-glow: rgba(16,185,129,0.05); --stat-border: rgba(16,185,129,0.2);
}
.stat-card.red {
  --stat-from: #ef4444; --stat-to: #fb7185;
  --stat-glow: rgba(239,68,68,0.05); --stat-border: rgba(239,68,68,0.2);
}
.stat-card.yellow {
  --stat-from: #f59e0b; --stat-to: #fbbf24;
  --stat-glow: rgba(245,158,11,0.05); --stat-border: rgba(245,158,11,0.2);
}
.stat-card.purple {
  --stat-from: #8b5cf6; --stat-to: #a78bfa;
  --stat-glow: rgba(139,92,246,0.05); --stat-border: rgba(139,92,246,0.2);
}
.stat-card.blue {
  --stat-from: #6366f1; --stat-to: #818cf8;
  --stat-glow: rgba(99,102,241,0.05); --stat-border: rgba(99,102,241,0.2);
}

.stat-icon {
  position: absolute; top: 18px; right: 18px;
  font-size: 26px; opacity: 0.12; line-height: 1;
}

.stat-label {
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-muted); margin-bottom: 10px;
}

.stat-value {
  font-size: 23px; font-weight: 800;
  color: var(--text); font-family: var(--font-mono);
  line-height: 1.15; letter-spacing: -0.5px;
  word-break: break-all;
}
.stat-value.large { font-size: 26px; }

.stat-sub { font-size: 11px; color: var(--text-subtle); margin-top: 5px; }

/* ── GRID ────────────────────────────────────────────────── */
.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: 14px; }

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

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

thead th {
  background: var(--bg-input);
  padding: 11px 16px;
  text-align: left;
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--dur-fast); }
tbody tr:hover td { background: var(--bg-hover); }

/* ── BADGE ───────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.1px;
}
.badge-green  { background: var(--green-light);  color: var(--emerald-600); }
.badge-red    { background: var(--red-light);    color: var(--rose-600); }
.badge-yellow { background: var(--yellow-light); color: #92400e; }
.badge-purple { background: var(--purple-light); color: var(--violet-500); }
.badge-blue   { background: var(--accent-light); color: var(--indigo-600); }
.badge-gray   { background: var(--bg-input);     color: var(--text-muted); }
[data-theme="dark"] .badge-yellow { color: var(--amber-400); }

/* ── FORM ────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

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

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 13.5px; color: var(--text); font-family: var(--font);
  transition: all var(--dur) var(--ease);
  outline: none; appearance: none;
}
.form-control:hover { border-color: #94a3b8; }
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3.5px var(--primary-glow);
  background: var(--bg-card);
}
.form-control::placeholder { color: var(--text-subtle); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

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

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
  transition: all var(--dur) var(--ease);
  text-decoration: none; white-space: nowrap;
  font-family: var(--font); letter-spacing: -0.1px;
  position: relative; overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: white; opacity: 0;
  transition: opacity var(--dur-fast);
  border-radius: inherit;
}
.btn:hover::after { opacity: 0.07; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  box-shadow: 0 2px 8px rgba(99,102,241,0.35), 0 1px 2px rgba(0,0,0,0.1);
}
.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(99,102,241,0.45), 0 2px 4px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}
.btn-success:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(16,185,129,0.4); }

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  box-shadow: 0 2px 8px rgba(239,68,68,0.3);
}
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(239,68,68,0.4); }

.btn-ghost {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-2);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm  { padding: 5px 12px; font-size: 11.5px; }
.btn-lg  { padding: 12px 26px; font-size: 14.5px; }
.btn-full{ width: 100%; justify-content: center; }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(2,6,23,0.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur) var(--ease);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%; max-width: 540px; max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: scale(0.94) translateY(8px);
  transition: transform var(--dur-slow) var(--spring);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px; padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 17px; font-weight: 800; color: var(--text); letter-spacing: -0.3px; }
.modal-close {
  background: none; border: none; font-size: 20px;
  cursor: pointer; color: var(--text-muted); padding: 4px; line-height: 1;
  border-radius: 6px; transition: all var(--dur-fast);
}
.modal-close:hover { color: var(--red); background: var(--red-light); }

/* ── FILTER BAR ──────────────────────────────────────────── */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.filter-bar .form-control { width: auto; min-width: 120px; }

/* ── ALERT ───────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border-left: 4px solid;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-warning { background: var(--yellow-light); border-color: var(--yellow); color: #92400e; }
.alert-danger  { background: var(--red-light);    border-color: var(--red);    color: #991b1b; }
.alert-success { background: var(--green-light);  border-color: var(--green);  color: #065f46; }
.alert-info    { background: var(--accent-light); border-color: var(--accent); color: #1e40af; }
[data-theme="dark"] .alert-warning { color: var(--amber-400); }
[data-theme="dark"] .alert-danger  { color: #fca5a5; }
[data-theme="dark"] .alert-success { color: #6ee7b7; }
[data-theme="dark"] .alert-info    { color: #93c5fd; }

/* ── TOAST ───────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  font-size: 13px; max-width: 340px;
  animation: slideInRight var(--dur-slow) var(--spring);
  display: flex; align-items: center; gap: 10px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.warning { border-left: 3px solid var(--yellow); }
@keyframes slideInRight {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── CHART ───────────────────────────────────────────────── */
.chart-container { position: relative; height: 260px; }

/* ── UTILITY ─────────────────────────────────────────────── */
.text-green  { color: var(--emerald-500); }
.text-red    { color: var(--rose-500); }
.text-yellow { color: var(--amber-500); }
.text-muted  { color: var(--text-muted); }
.text-mono   { font-family: var(--font-mono); }
.fw-bold     { font-weight: 700; }

/* ── LOADING ─────────────────────────────────────────────── */
.loading-spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--bg-hover) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s infinite;
  border-radius: 6px; height: 16px;
}
@keyframes skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── AI CHAT ─────────────────────────────────────────────── */
.ai-chat {
  display: flex; flex-direction: column; gap: 14px;
  max-height: 60vh; overflow-y: auto; padding: 2px 0;
}
.ai-message {
  padding: 14px 16px; border-radius: var(--radius);
  font-size: 13.5px; line-height: 1.75; max-width: 90%;
}
.ai-message.user {
  background: linear-gradient(135deg, var(--accent-light), rgba(99,102,241,0.06));
  border: 1px solid rgba(99,102,241,0.15);
  color: var(--text); margin-left: auto;
  border-bottom-right-radius: 4px;
}
.ai-message.assistant {
  background: var(--bg-input); border: 1px solid var(--border);
  color: var(--text); border-bottom-left-radius: 4px;
}
.ai-message h2, .ai-message h3 { font-size: 13.5px; margin-bottom: 6px; color: var(--text); }
.ai-message ul, .ai-message ol { padding-left: 18px; }
.ai-message li { margin-bottom: 2px; }
.ai-message strong { font-weight: 700; }
.ai-message code {
  background: var(--bg-hover); border-radius: 4px;
  padding: 1px 5px; font-family: var(--font-mono); font-size: 12px;
}
.ai-message hr { border: none; border-top: 1px solid var(--border); margin: 10px 0; }

/* ── PROGRESS ────────────────────────────────────────────── */
.progress { height: 5px; background: var(--border); border-radius: 10px; overflow: hidden; }
.progress-bar {
  height: 100%; border-radius: 10px;
  background: linear-gradient(90deg, var(--primary), var(--violet-500));
  transition: width 0.6s var(--ease);
}
.progress-bar.green  { background: linear-gradient(90deg, var(--emerald-500), var(--emerald-400)); }
.progress-bar.red    { background: linear-gradient(90deg, var(--rose-500), var(--rose-400)); }
.progress-bar.yellow { background: linear-gradient(90deg, var(--amber-500), var(--amber-400)); }

/* ── INTEREST CARD ───────────────────────────────────────── */
.interest-summary {
  display: grid; grid-template-columns: repeat(3,1fr);
  gap: 8px; margin-top: 14px;
}
.interest-item {
  background: var(--bg-input); border-radius: var(--radius-sm);
  padding: 12px 10px; text-align: center;
  border: 1px solid var(--border);
  transition: all var(--dur);
}
.interest-item:hover { border-color: var(--primary); background: var(--accent-light); }
.interest-item .label {
  font-size: 10.5px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 5px;
}
.interest-item .value {
  font-size: 15px; font-weight: 800;
  color: var(--emerald-500); font-family: var(--font-mono);
}

/* ── LOGIN ───────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #040818;
  background-image: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(99,102,241,0.18), transparent),
                    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(139,92,246,0.1), transparent);
  padding: 24px; position: relative; overflow: hidden;
}
.login-wrapper::before {
  content: '';
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px, transparent 1px, transparent 60px),
                    repeating-linear-gradient(90deg, rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px, transparent 1px, transparent 60px);
}
.login-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-xl);
  padding: 44px; width: 100%; max-width: 400px;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  position: relative; z-index: 1;
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-badge {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 900; color: white;
  margin: 0 auto 14px;
  box-shadow: 0 8px 28px rgba(99,102,241,0.4);
}
.login-logo h1 { color: #fff; font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.login-logo p { color: rgba(255,255,255,0.35); font-size: 13px; margin-top: 4px; }
.login-card .form-label { color: rgba(255,255,255,0.45); }
.login-card .form-control {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.1); color: #fff;
}
.login-card .form-control:focus {
  background: rgba(255,255,255,0.08);
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.25);
}
.login-card .form-control::placeholder { color: rgba(255,255,255,0.2); }
.login-error {
  background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-sm); padding: 10px 14px;
  color: #fca5a5; font-size: 13px; margin-bottom: 16px;
}

/* ── INSTALL ─────────────────────────────────────────────── */
.install-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #040818; padding: 24px;
}
.install-card {
  background: #fff; border-radius: var(--radius-xl);
  padding: 44px; width: 100%; max-width: 520px;
  box-shadow: var(--shadow-xl);
}
.install-card h1 { font-size: 26px; font-weight: 800; color: #0f172a; margin-bottom: 4px; letter-spacing: -0.5px; }
.install-card p { color: #64748b; margin-bottom: 24px; }
.install-step {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px; margin-bottom: 6px; font-size: 13px;
}
.install-step.done  { background: #ecfdf5; color: #065f46; }
.install-step.error { background: #fff1f2; color: #991b1b; }

/* ── CURRENCY BADGE ──────────────────────────────────────── */
.currency-badge {
  display: inline-flex; align-items: center;
  padding: 2px 7px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 5px; font-size: 10.5px; font-weight: 600;
  color: var(--text-muted); font-family: var(--font-mono);
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 224px; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl); }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .main-content { padding: 16px; }
  .price-ticker { display: none; }
  .interest-summary { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-value { font-size: 20px; }
  .main-content { padding: 12px; }
}
