/* ===================================================
   NexusAI - Premium Design System
   World-class Financial Intelligence Platform
   =================================================== */

/* ---------- CSS VARIABLES / TOKENS ---------- */
:root {
  /* Color Palette */
  --c-bg-primary: #080b14;
  --c-bg-secondary: #0d1220;
  --c-bg-card: #111827;
  --c-bg-card-hover: #161f30;
  --c-bg-glass: rgba(17, 24, 39, 0.7);
  --c-bg-glass-light: rgba(255,255,255,0.04);
  --c-border: rgba(255,255,255,0.07);
  --c-border-strong: rgba(255,255,255,0.12);

  /* Brand Colors */
  --c-teal: #00f5d4;
  --c-teal-dim: rgba(0, 245, 212, 0.15);
  --c-purple: #7b5ea7;
  --c-purple-bright: #9b7ec8;
  --c-purple-dim: rgba(123, 94, 167, 0.15);
  --c-pink: #f72585;
  --c-pink-dim: rgba(247, 37, 133, 0.15);
  --c-orange: #ff9f1c;
  --c-orange-dim: rgba(255, 159, 28, 0.15);
  --c-red: #ef233c;
  --c-red-dim: rgba(239, 35, 60, 0.15);
  --c-green: #06d6a0;
  --c-green-dim: rgba(6, 214, 160, 0.15);
  --c-yellow: #ffd60a;
  --c-blue: #4895ef;
  --c-blue-dim: rgba(72, 149, 239, 0.15);

  /* Text */
  --t-primary: #f0f4ff;
  --t-secondary: rgba(240, 244, 255, 0.6);
  --t-muted: rgba(240, 244, 255, 0.35);
  --t-accent: #00f5d4;

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #00f5d4 0%, #7b5ea7 100%);
  --grad-card: linear-gradient(145deg, rgba(17, 24, 39, 1) 0%, rgba(13, 18, 32, 1) 100%);
  --grad-glow-teal: radial-gradient(ellipse at center, rgba(0,245,212,0.15) 0%, transparent 70%);
  --grad-glow-purple: radial-gradient(ellipse at center, rgba(123,94,167,0.15) 0%, transparent 70%);

  /* Shadows */
  --shadow-card: 0 4px 24px rgba(0,0,0,0.4), 0 1px 0 rgba(255,255,255,0.05) inset;
  --shadow-card-hover: 0 8px 48px rgba(0,0,0,0.6), 0 1px 0 rgba(255,255,255,0.08) inset;
  --shadow-glow-teal: 0 0 30px rgba(0,245,212,0.2);
  --shadow-glow-purple: 0 0 30px rgba(123,94,167,0.3);

  /* Spacing */
  --gap: 1.25rem;
  --gap-sm: 0.75rem;
  --gap-lg: 1.75rem;

  /* Borders */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  /* Sidebar */
  --sidebar-width: 260px;
  --topbar-height: 72px;

  /* Fonts */
  --font-main: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Transitions */
  --transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  --transition-spring: all 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

/* Light Mode */
body.light-mode {
  --c-bg-primary: #f0f4ff;
  --c-bg-secondary: #e8eef9;
  --c-bg-card: #ffffff;
  --c-bg-card-hover: #f8faff;
  --c-bg-glass: rgba(255,255,255,0.85);
  --c-bg-glass-light: rgba(0,0,0,0.03);
  --c-border: rgba(0,0,0,0.08);
  --c-border-strong: rgba(0,0,0,0.14);
  --t-primary: #1a1f35;
  --t-secondary: rgba(26,31,53,0.65);
  --t-muted: rgba(26,31,53,0.4);
  --shadow-card: 0 4px 24px rgba(0,0,0,0.08), 0 1px 0 rgba(255,255,255,0.9) inset;
  --shadow-card-hover: 0 8px 48px rgba(0,0,0,0.14);
}

/* ---------- RESET & BASE ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  background: var(--c-bg-primary);
  color: var(--t-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-purple); }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
a { text-decoration: none; color: inherit; }
canvas { display: block; }

/* ---------- LOADING SCREEN ---------- */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--c-bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  overflow: hidden;
}
.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  z-index: 2;
}
.logo-icon-large {
  width: 80px;
  height: 80px;
  animation: float 3s ease-in-out infinite;
}
.loading-title {
  font-size: 3rem;
  font-weight: 900;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
  animation: fadeInUp 0.8s ease forwards;
}
.loading-subtitle {
  font-size: 1rem;
  color: var(--t-secondary);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  animation: fadeInUp 0.8s 0.2s ease forwards;
  opacity: 0;
}
.loading-bar-container {
  width: 300px;
  height: 3px;
  background: var(--c-border);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 1rem;
}
.loading-bar {
  height: 100%;
  width: 0%;
  background: var(--grad-primary);
  border-radius: 99px;
  transition: width 0.3s ease;
  box-shadow: 0 0 15px var(--c-teal);
}
.loading-status {
  font-size: 0.8rem;
  color: var(--t-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}
.loading-particles {
  position: absolute;
  inset: 0;
  z-index: 1;
}
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }
@keyframes fadeInUp { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }

/* ---------- APP LAYOUT ---------- */
.app { display: flex; height: 100vh; width: 100vw; overflow: hidden; }
.hidden { display: none !important; }

/* ---------- SIDEBAR ---------- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--c-bg-secondary);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.3s cubic-bezier(0.4,0,0.2,1), min-width 0.3s;
  z-index: 100;
  position: relative;
}
.sidebar.collapsed { width: 72px; min-width: 72px; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--c-border);
  min-height: 72px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
}
.logo-icon { width: 36px; height: 36px; flex-shrink: 0; }
.logo-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.2s, width 0.2s;
}
.logo-name {
  font-size: 1.15rem;
  font-weight: 800;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}
.logo-tagline { font-size: 0.65rem; color: var(--t-muted); text-transform: uppercase; letter-spacing: 0.1em; }

.sidebar-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  border-radius: 8px;
  flex-shrink: 0;
  transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--c-bg-glass-light); }
.sidebar-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--t-secondary);
  border-radius: 99px;
  transition: var(--transition);
}

.sidebar-ai-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: var(--c-bg-glass-light);
  margin: 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  color: var(--t-secondary);
  white-space: nowrap;
  overflow: hidden;
}
.ai-version { margin-left: auto; color: var(--t-muted); font-family: var(--font-mono); font-size: 0.65rem; }

.ai-status-dot {
  width: 8px;
  height: 8px;
  background: var(--c-teal);
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse-glow 2s ease-in-out infinite;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0.75rem;
}
.nav-group { margin-bottom: 1.25rem; }
.nav-group-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--t-muted);
  padding: 0 0.5rem;
  margin-bottom: 0.4rem;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--t-secondary);
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 0.15rem;
  position: relative;
}
.nav-item:hover {
  background: var(--c-bg-glass-light);
  color: var(--t-primary);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(0,245,212,0.15), rgba(123,94,167,0.15));
  color: var(--c-teal);
  border: 1px solid rgba(0,245,212,0.2);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  bottom: 15%;
  width: 3px;
  background: var(--grad-primary);
  border-radius: 0 3px 3px 0;
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.nav-badge.live { background: rgba(0,245,212,0.2); color: var(--c-teal); border: 1px solid rgba(0,245,212,0.3); }
.nav-badge.alert { background: var(--c-red-dim); color: var(--c-red); border: 1px solid rgba(239,35,60,0.3); }
.nav-badge.new { background: var(--c-purple-dim); color: var(--c-purple-bright); border: 1px solid rgba(123,94,167,0.3); }

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--c-border);
}
.health-score-widget { overflow: hidden; }
.health-label { font-size: 0.7rem; color: var(--t-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.4rem; white-space: nowrap; }
.health-value {
  font-size: 2rem;
  font-weight: 800;
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.health-bar { height: 4px; background: var(--c-border); border-radius: 99px; margin: 0.4rem 0; overflow: hidden; }
.health-bar-fill { height: 100%; background: var(--grad-primary); border-radius: 99px; box-shadow: 0 0 8px var(--c-teal); transition: width 1s ease; }
.health-status { font-size: 0.7rem; font-weight: 600; white-space: nowrap; }
.health-status.excellent { color: var(--c-teal); }

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

/* ---------- TOPBAR ---------- */
.topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  background: var(--c-bg-secondary);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 1rem; }
.mobile-menu-btn { display: none; flex-direction: column; gap: 4px; padding: 6px; border-radius: 8px; }
.mobile-menu-btn span { display: block; width: 20px; height: 2px; background: var(--t-secondary); border-radius: 99px; }
.page-title { font-size: 1.2rem; font-weight: 700; color: var(--t-primary); white-space: nowrap; }
.breadcrumb { font-size: 0.72rem; color: var(--t-muted); white-space: nowrap; }

.topbar-center { flex: 1; display: flex; justify-content: center; padding: 0 1rem; }
.live-ticker {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--c-bg-glass-light);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem;
  overflow: hidden;
  max-width: 600px;
  width: 100%;
}
.ticker-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--c-teal);
  letter-spacing: 0.1em;
  flex-shrink: 0;
  background: var(--c-teal-dim);
  padding: 2px 6px;
  border-radius: 4px;
}
.ticker-items { display: flex; gap: 1.5rem; overflow: hidden; white-space: nowrap; font-size: 0.78rem; }
.ticker-item { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.ticker-item .t-sym { font-weight: 700; color: var(--t-primary); font-family: var(--font-mono); }
.ticker-item .t-val { color: var(--t-secondary); font-family: var(--font-mono); }
.ticker-item .t-chg.up { color: var(--c-teal); }
.ticker-item .t-chg.down { color: var(--c-red); }

.topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--c-bg-glass-light);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  transition: var(--transition);
}
.search-bar:focus-within { border-color: var(--c-teal); box-shadow: 0 0 0 2px var(--c-teal-dim); }
.search-bar svg { width: 16px; height: 16px; color: var(--t-muted); flex-shrink: 0; }
.search-bar input { background: none; border: none; outline: none; font-size: 0.8rem; color: var(--t-primary); width: 180px; }
.search-bar input::placeholder { color: var(--t-muted); }
.search-bar kbd { font-size: 0.65rem; color: var(--t-muted); border: 1px solid var(--c-border); border-radius: 4px; padding: 1px 5px; font-family: var(--font-mono); }
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }
.icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--t-secondary);
  transition: var(--transition);
  border: 1px solid transparent;
}
.icon-btn:hover { background: var(--c-bg-glass-light); border-color: var(--c-border); color: var(--t-primary); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--c-red);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--c-bg-primary);
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}
.user-avatar:hover { transform: scale(1.05); box-shadow: var(--shadow-glow-teal); }
.avatar-status {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  background: var(--c-teal);
  border-radius: 50%;
  border: 2px solid var(--c-bg-secondary);
}

/* ---------- PAGES ---------- */
.pages-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--gap-lg);
  background: var(--c-bg-primary);
  position: relative;
}
.page { display: none; animation: pageIn 0.35s cubic-bezier(0.4,0,0.2,1); }
.page.active { display: block; }
@keyframes pageIn { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:translateY(0)} }

.page-intro {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: var(--gap-lg);
  padding: 1.25rem 1.5rem;
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.page-intro-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.page-intro-icon svg { width: 24px; height: 24px; }
.page-intro-icon.purple { background: var(--c-purple-dim); color: var(--c-purple-bright); border: 1px solid rgba(123,94,167,0.3); }
.page-intro-icon.teal { background: var(--c-teal-dim); color: var(--c-teal); border: 1px solid rgba(0,245,212,0.3); }
.page-intro-icon.red { background: var(--c-red-dim); color: var(--c-red); border: 1px solid rgba(239,35,60,0.3); }
.page-intro-icon.orange { background: var(--c-orange-dim); color: var(--c-orange); border: 1px solid rgba(255,159,28,0.3); }
.page-intro-icon.green { background: var(--c-green-dim); color: var(--c-green); border: 1px solid rgba(6,214,160,0.3); }
.page-intro-icon.yellow { background: rgba(255,214,10,0.15); color: var(--c-yellow); border: 1px solid rgba(255,214,10,0.3); }
.page-intro-icon.blue { background: var(--c-blue-dim); color: var(--c-blue); border: 1px solid rgba(72,149,239,0.3); }
.page-intro h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.2rem; }
.page-intro p { font-size: 0.85rem; color: var(--t-secondary); }

/* ---------- KPI CARDS ---------- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--gap);
  margin-bottom: var(--gap-lg);
}
.kpi-card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.kpi-card:hover { border-color: var(--c-border-strong); box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.kpi-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.02) 0%, transparent 60%);
  pointer-events: none;
}
.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.kpi-icon svg { width: 20px; height: 20px; }
.kpi-icon.kpi-purple { background: var(--c-purple-dim); color: var(--c-purple-bright); border: 1px solid rgba(123,94,167,0.3); }
.kpi-icon.kpi-teal { background: var(--c-teal-dim); color: var(--c-teal); border: 1px solid rgba(0,245,212,0.3); }
.kpi-icon.kpi-orange { background: var(--c-orange-dim); color: var(--c-orange); border: 1px solid rgba(255,159,28,0.3); }
.kpi-icon.kpi-red { background: var(--c-red-dim); color: var(--c-red); border: 1px solid rgba(239,35,60,0.3); }
.kpi-icon.kpi-pink { background: var(--c-pink-dim); color: var(--c-pink); border: 1px solid rgba(247,37,133,0.3); }
.kpi-content { flex: 1; min-width: 0; }
.kpi-label { font-size: 0.72rem; color: var(--t-muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 0.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value { font-size: 1.4rem; font-weight: 800; color: var(--t-primary); letter-spacing: -0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-change { display: flex; align-items: center; gap: 0.25rem; font-size: 0.72rem; margin-top: 0.3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-change svg { width: 12px; height: 12px; flex-shrink: 0; }
.kpi-change.positive { color: var(--c-teal); }
.kpi-change.negative { color: var(--c-red); }
.kpi-sparkline { width: 60px !important; height: 36px !important; position: absolute; right: 1rem; bottom: 1rem; opacity: 0.7; }

/* ---------- CHART CARDS ---------- */
.charts-row {
  display: flex;
  gap: var(--gap);
  margin-bottom: var(--gap);
  flex-wrap: wrap;
}
.chart-card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  flex: 1;
  min-width: 280px;
}
.chart-card:hover { border-color: var(--c-border-strong); }
.chart-card.large { flex: 2.5; min-width: 480px; }
.chart-card.medium { flex: 1.5; min-width: 320px; }
.chart-card.small { flex: 0.8; min-width: 220px; }
.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.5rem;
}
.chart-title { font-size: 0.95rem; font-weight: 700; color: var(--t-primary); }
.chart-subtitle { font-size: 0.72rem; color: var(--t-muted); margin-top: 0.15rem; }
.chart-container { position: relative; width: 100%; height: 220px; }
.chart-container canvas { width: 100% !important; height: 100% !important; }
.donut-container { position: relative; display: flex; align-items: center; justify-content: center; }
.donut-center {
  position: absolute;
  text-align: center;
  pointer-events: none;
}
.donut-center-value { font-size: 1.2rem; font-weight: 800; color: var(--t-primary); }
.donut-center-label { font-size: 0.65rem; color: var(--t-muted); }

.chart-controls { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.time-selector { display: flex; gap: 2px; background: var(--c-bg-glass-light); border-radius: 8px; padding: 3px; }
.time-btn {
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--t-muted);
  transition: var(--transition);
}
.time-btn:hover { color: var(--t-secondary); }
.time-btn.active { background: var(--grad-primary); color: var(--c-bg-primary); }
.chart-action-btn { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--t-muted); transition: var(--transition); }
.chart-action-btn:hover { background: var(--c-bg-glass-light); color: var(--t-primary); }
.chart-action-btn svg { width: 16px; height: 16px; }

.chart-legend { display: flex; gap: 1rem; margin-top: 0.75rem; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; color: var(--t-secondary); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.allocation-legend { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }

/* ---------- LIVE INDICATORS ---------- */
.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--c-teal);
  text-transform: uppercase;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  background: var(--c-teal);
  border-radius: 50%;
  animation: pulse-glow 1.5s ease-in-out infinite;
  flex-shrink: 0;
}
.pulse-dot.red { background: var(--c-red); animation-name: pulse-glow-red; }
@keyframes pulse-glow {
  0%,100%{ box-shadow: 0 0 0 0 rgba(0,245,212,0.4); }
  50%{ box-shadow: 0 0 0 6px rgba(0,245,212,0); }
}
@keyframes pulse-glow-red {
  0%,100%{ box-shadow: 0 0 0 0 rgba(239,35,60,0.4); }
  50%{ box-shadow: 0 0 0 6px rgba(239,35,60,0); }
}

/* ---------- MARKET HEATMAP ---------- */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.heatmap-cell {
  padding: 0.6rem 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}
.heatmap-cell:hover { filter: brightness(1.2); transform: scale(1.03); }
.hm-sym { font-size: 0.7rem; font-weight: 700; color: rgba(255,255,255,0.9); }
.hm-chg { font-size: 0.75rem; font-weight: 600; color: rgba(255,255,255,0.8); margin-top: 2px; }

/* ---------- BOTTOM ROW CARDS ---------- */
.bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--gap);
  margin-top: var(--gap);
}
.card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}
.card:hover { border-color: var(--c-border-strong); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--t-primary);
}
.card-title svg { width: 16px; height: 16px; }
.card-action {
  font-size: 0.75rem;
  color: var(--c-teal);
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid rgba(0,245,212,0.3);
  background: var(--c-teal-dim);
  transition: var(--transition);
  cursor: pointer;
}
.card-action:hover { background: rgba(0,245,212,0.25); }

/* ---------- AI INSIGHTS ---------- */
.ai-spark-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--grad-primary);
  border-radius: 6px;
  flex-shrink: 0;
}
.ai-spark-icon svg { width: 11px; height: 11px; color: #080b14; }
.ai-insights-list { display: flex; flex-direction: column; gap: 0.75rem; }
.ai-insight-item {
  padding: 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
  background: var(--c-bg-glass-light);
  transition: var(--transition);
  cursor: pointer;
}
.ai-insight-item:hover { border-color: var(--c-border-strong); background: rgba(255,255,255,0.05); }
.insight-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.4rem; }
.insight-type { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.insight-type.opportunity { color: var(--c-teal); background: var(--c-teal-dim); padding: 2px 8px; border-radius: 99px; }
.insight-type.warning { color: var(--c-orange); background: var(--c-orange-dim); padding: 2px 8px; border-radius: 99px; }
.insight-type.alert { color: var(--c-red); background: var(--c-red-dim); padding: 2px 8px; border-radius: 99px; }
.insight-type.info { color: var(--c-blue); background: var(--c-blue-dim); padding: 2px 8px; border-radius: 99px; }
.insight-conf { font-size: 0.65rem; color: var(--t-muted); font-family: var(--font-mono); }
.insight-text { font-size: 0.78rem; color: var(--t-secondary); line-height: 1.5; }

/* ---------- TRANSACTIONS ---------- */
.transactions-list { display: flex; flex-direction: column; gap: 0.6rem; }
.tx-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--c-border);
  transition: var(--transition);
  cursor: pointer;
}
.tx-item:last-child { border-bottom: none; }
.tx-item:hover { opacity: 0.85; }
.tx-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.tx-info { flex: 1; min-width: 0; }
.tx-name { font-size: 0.8rem; font-weight: 600; color: var(--t-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-cat { font-size: 0.68rem; color: var(--t-muted); }
.tx-amount { font-size: 0.85rem; font-weight: 700; font-family: var(--font-mono); flex-shrink: 0; }
.tx-amount.income { color: var(--c-teal); }
.tx-amount.expense { color: var(--c-red); }

/* ---------- ALERTS CARD ---------- */
.alert-count { font-size: 0.72rem; background: var(--c-red-dim); color: var(--c-red); padding: 3px 8px; border-radius: 99px; border: 1px solid rgba(239,35,60,0.3); }
.alerts-list { display: flex; flex-direction: column; gap: 0.6rem; }
.alert-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
  background: var(--c-bg-glass-light);
  cursor: pointer;
  transition: var(--transition);
}
.alert-item:hover { border-color: var(--c-border-strong); }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.alert-dot.high { background: var(--c-red); animation: pulse-glow-red 1.5s infinite; }
.alert-dot.medium { background: var(--c-orange); }
.alert-dot.low { background: var(--c-teal); }
.alert-content { flex: 1; min-width: 0; }
.alert-title { font-size: 0.78rem; font-weight: 600; color: var(--t-primary); }
.alert-desc { font-size: 0.7rem; color: var(--t-muted); margin-top: 0.15rem; line-height: 1.4; }
.alert-time { font-size: 0.65rem; color: var(--t-muted); font-family: var(--font-mono); flex-shrink: 0; }

/* ---------- SENTIMENT ---------- */
.sentiment-gauge-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 160px;
}
.sentiment-labels {
  position: absolute;
  text-align: center;
  bottom: 20px;
}
.sentiment-val { font-size: 2rem; font-weight: 800; background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.sentiment-label-text { font-size: 0.72rem; color: var(--t-muted); }
.sentiment-breakdown { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.75rem; }
.sb-item { display: flex; align-items: center; gap: 0.5rem; }
.sb-label { font-size: 0.7rem; color: var(--t-secondary); width: 60px; flex-shrink: 0; }
.sb-bar { flex: 1; height: 4px; background: var(--c-border); border-radius: 99px; overflow: hidden; }
.sb-fill { height: 100%; border-radius: 99px; }
.sb-val { font-size: 0.65rem; color: var(--t-muted); font-family: var(--font-mono); width: 28px; text-align: right; flex-shrink: 0; }

/* ---------- PORTFOLIO PAGE ---------- */
.portfolio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); margin-bottom: var(--gap); }
.holdings-table-container { overflow: auto; max-height: 240px; }
.holdings-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.holdings-table th { padding: 0.5rem 0.75rem; text-align: left; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--t-muted); border-bottom: 1px solid var(--c-border); position: sticky; top: 0; background: var(--c-bg-card); z-index: 1; }
.holdings-table td { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--c-border); color: var(--t-secondary); }
.holdings-table tr:last-child td { border-bottom: none; }
.holdings-table tr:hover td { background: var(--c-bg-glass-light); color: var(--t-primary); }
.ai-score-bar { display: flex; align-items: center; gap: 0.4rem; }
.ai-score-pill { font-size: 0.65rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; }
.ai-score-pill.high { background: var(--c-teal-dim); color: var(--c-teal); }
.ai-score-pill.medium { background: var(--c-orange-dim); color: var(--c-orange); }
.ai-score-pill.low { background: var(--c-red-dim); color: var(--c-red); }

.portfolio-metrics-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); margin-bottom: var(--gap); }
.metric-card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow-card);
}
.metric-label { font-size: 0.7rem; color: var(--t-muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 0.5rem; }
.metric-value { font-size: 1.6rem; font-weight: 800; background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.metric-sub { font-size: 0.7rem; color: var(--t-secondary); margin-top: 0.25rem; }

.ai-recommendations-card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
}
.ai-confidence { font-size: 0.75rem; color: var(--c-teal); font-family: var(--font-mono); }
.confidence-val { font-weight: 700; }
.recommendations-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap-sm); margin-top: 1rem; }
.rec-card {
  background: var(--c-bg-glass-light);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  transition: var(--transition);
}
.rec-card:hover { border-color: var(--c-border-strong); }
.rec-action-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 99px;
  margin-bottom: 0.5rem;
}
.rec-action-badge.buy { background: var(--c-teal-dim); color: var(--c-teal); border: 1px solid rgba(0,245,212,0.3); }
.rec-action-badge.sell { background: var(--c-red-dim); color: var(--c-red); border: 1px solid rgba(239,35,60,0.3); }
.rec-action-badge.hold { background: var(--c-orange-dim); color: var(--c-orange); border: 1px solid rgba(255,159,28,0.3); }
.rec-asset { font-size: 0.9rem; font-weight: 700; color: var(--t-primary); margin-bottom: 0.25rem; }
.rec-reason { font-size: 0.72rem; color: var(--t-secondary); line-height: 1.5; }
.rec-confidence { font-size: 0.65rem; color: var(--t-muted); margin-top: 0.4rem; font-family: var(--font-mono); }

/* ---------- AI ADVISOR ---------- */
.ai-advisor-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--gap);
  height: calc(100vh - var(--topbar-height) - 3.5rem);
}
.advisor-sidebar {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  box-shadow: var(--shadow-card);
}
.advisor-header { text-align: center; }
.advisor-avatar { width: 80px; height: 80px; margin: 0 auto 0.75rem; }
.advisor-name { font-size: 1.2rem; font-weight: 800; background: var(--grad-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.advisor-role { font-size: 0.75rem; color: var(--t-muted); margin-bottom: 0.4rem; }
.advisor-status { display: flex; align-items: center; justify-content: center; gap: 0.4rem; font-size: 0.7rem; color: var(--c-teal); }
.advisor-capabilities { display: flex; flex-direction: column; gap: 0.3rem; }
.capability-item { font-size: 0.78rem; color: var(--t-secondary); padding: 0.4rem 0.6rem; border-radius: 8px; transition: var(--transition); cursor: default; }
.capability-item:hover { background: var(--c-bg-glass-light); color: var(--t-primary); }
.suggested-queries { display: flex; flex-direction: column; gap: 0.4rem; }
.sq-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--t-muted); margin-bottom: 0.2rem; }
.sq-btn {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.75rem;
  color: var(--t-secondary);
  border: 1px solid var(--c-border);
  background: var(--c-bg-glass-light);
  transition: var(--transition);
  cursor: pointer;
}
.sq-btn:hover { border-color: var(--c-teal); color: var(--c-teal); background: var(--c-teal-dim); }

.advisor-chat-area {
  display: flex;
  flex-direction: column;
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.chat-welcome { text-align: center; padding: 2rem; }
.welcome-icon {
  width: 60px;
  height: 60px;
  background: var(--grad-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}
.welcome-icon svg { width: 28px; height: 28px; color: #080b14; }
.chat-welcome h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
.chat-welcome p { font-size: 0.85rem; color: var(--t-secondary); max-width: 400px; margin: 0 auto; line-height: 1.6; }

.chat-message { display: flex; gap: 0.75rem; max-width: 85%; }
.chat-message.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-message.ai { align-self: flex-start; }
.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}
.msg-avatar.ai-avatar { background: var(--grad-primary); color: #080b14; }
.msg-avatar.user-avatar-sm { background: var(--c-purple-dim); color: var(--c-purple-bright); border: 1px solid var(--c-purple-dim); }
.msg-bubble {
  padding: 0.875rem 1rem;
  border-radius: 16px;
  font-size: 0.83rem;
  line-height: 1.6;
}
.chat-message.user .msg-bubble { background: var(--grad-primary); color: #080b14; border-bottom-right-radius: 4px; font-weight: 500; }
.chat-message.ai .msg-bubble { background: var(--c-bg-glass-light); border: 1px solid var(--c-border); color: var(--t-secondary); border-bottom-left-radius: 4px; }
.msg-time { font-size: 0.62rem; color: var(--t-muted); margin-top: 0.3rem; }
.chat-message.ai .msg-time { text-align: left; }
.chat-message.user .msg-time { text-align: right; }

.ai-thinking {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.875rem 1rem;
  background: var(--c-bg-glass-light);
  border: 1px solid var(--c-border);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}
.ai-thinking span {
  width: 6px; height: 6px; background: var(--c-teal); border-radius: 50%;
  animation: thinking 1.2s ease-in-out infinite;
}
.ai-thinking span:nth-child(2) { animation-delay: 0.2s; }
.ai-thinking span:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinking { 0%,80%,100%{transform:scale(0.8);opacity:0.5} 40%{transform:scale(1.1);opacity:1} }

.chat-input-area {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--c-border);
  background: var(--c-bg-card);
}
.chat-input-row { display: flex; gap: 0.75rem; align-items: flex-end; }
.chat-input-wrapper {
  flex: 1;
  display: flex;
  align-items: flex-end;
  background: var(--c-bg-secondary);
  border: 1px solid var(--c-border);
  border-radius: 14px;
  padding: 0.6rem 0.6rem 0.6rem 1rem;
  transition: var(--transition);
}
.chat-input-wrapper:focus-within { border-color: var(--c-teal); box-shadow: 0 0 0 2px var(--c-teal-dim); }
#chat-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 0.85rem;
  color: var(--t-primary);
  resize: none;
  max-height: 120px;
  line-height: 1.5;
}
#chat-input::placeholder { color: var(--t-muted); }
.input-tools { display: flex; gap: 0.25rem; }
.input-tool-btn { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--t-muted); transition: var(--transition); }
.input-tool-btn:hover { background: var(--c-bg-glass-light); color: var(--t-secondary); }
.input-tool-btn svg { width: 16px; height: 16px; }
.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--grad-primary);
  color: #080b14;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-spring);
  flex-shrink: 0;
}
.send-btn:hover { transform: scale(1.08); box-shadow: var(--shadow-glow-teal); }
.send-btn:active { transform: scale(0.96); }
.send-btn svg { width: 18px; height: 18px; }
.chat-footer-info { font-size: 0.65rem; color: var(--t-muted); margin-top: 0.5rem; text-align: center; }

/* ---------- COMPLIANCE / ESG / BUDGET ---------- */
.compliance-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); margin-bottom: var(--gap); }
.compliance-card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.compliance-framework { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--t-muted); }
.compliance-score { font-size: 2.2rem; font-weight: 900; }
.compliance-status-bar { height: 6px; background: var(--c-border); border-radius: 99px; overflow: hidden; }
.compliance-status-fill { height: 100%; border-radius: 99px; }
.compliance-details { font-size: 0.75rem; color: var(--t-secondary); }

.compliance-issues { display: flex; flex-direction: column; gap: 0.75rem; }
.issue-item {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
  background: var(--c-bg-glass-light);
}
.issue-severity { font-size: 0.65rem; font-weight: 700; letter-spacing: 0.08em; padding: 3px 8px; border-radius: 99px; flex-shrink: 0; }
.issue-severity.high { background: var(--c-red-dim); color: var(--c-red); }
.issue-severity.medium { background: var(--c-orange-dim); color: var(--c-orange); }
.issue-severity.low { background: var(--c-teal-dim); color: var(--c-teal); }
.issue-content { flex: 1; }
.issue-title { font-size: 0.82rem; font-weight: 600; color: var(--t-primary); margin-bottom: 0.25rem; }
.issue-desc { font-size: 0.72rem; color: var(--t-secondary); line-height: 1.5; }
.issue-action {
  font-size: 0.68rem;
  color: var(--c-teal);
  border: 1px solid rgba(0,245,212,0.3);
  background: var(--c-teal-dim);
  padding: 4px 10px;
  border-radius: 8px;
  flex-shrink: 0;
  cursor: pointer;
  transition: var(--transition);
}
.issue-action:hover { background: rgba(0,245,212,0.25); }

/* ---------- ESG ---------- */
.esg-overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); margin-bottom: var(--gap); }
.esg-card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-card);
}
.esg-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--t-muted); margin-bottom: 0.5rem; }
.esg-score { font-size: 3rem; font-weight: 900; }
.esg-grade { font-size: 0.85rem; color: var(--t-secondary); margin-top: 0.25rem; }
.esg-holdings { background: var(--c-bg-card); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow-card); }

/* ---------- BUDGET ---------- */
.budget-overview { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); margin-bottom: var(--gap); }
.budget-card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
}
.budget-category { font-size: 0.75rem; color: var(--t-muted); margin-bottom: 0.3rem; }
.budget-bar-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.budget-bar-outer { flex: 1; height: 6px; background: var(--c-border); border-radius: 99px; overflow: hidden; }
.budget-bar-inner { height: 100%; border-radius: 99px; transition: width 1s ease; }
.budget-pct { font-size: 0.65rem; color: var(--t-muted); font-family: var(--font-mono); flex-shrink: 0; }
.budget-recommendations { background: var(--c-bg-card); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow-card); margin-top: var(--gap); }

/* ---------- RISK ---------- */
.risk-overview { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); margin-bottom: var(--gap); }
.risk-heatmap { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.rh-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.rh-cell:hover { transform: scale(1.05); }
.stress-test-panel {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  margin-top: var(--gap);
}

/* ---------- REPORTS ---------- */
.reports-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.report-card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  cursor: pointer;
}
.report-card:hover { border-color: var(--c-teal); transform: translateY(-3px); box-shadow: var(--shadow-card-hover); }
.report-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.report-icon svg { width: 24px; height: 24px; }
.report-title { font-size: 0.95rem; font-weight: 700; }
.report-desc { font-size: 0.78rem; color: var(--t-secondary); line-height: 1.5; }
.report-meta { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.report-pages { font-size: 0.68rem; color: var(--t-muted); }
.generate-btn {
  font-size: 0.72rem;
  padding: 5px 12px;
  border-radius: 8px;
  background: var(--grad-primary);
  color: #080b14;
  font-weight: 600;
  transition: var(--transition-spring);
}
.generate-btn:hover { transform: scale(1.05); box-shadow: var(--shadow-glow-teal); }

/* ---------- MARKET INTELLIGENCE ---------- */
.asset-selector { display: flex; gap: 4px; flex-wrap: wrap; }
.asset-btn {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--t-muted);
  border: 1px solid var(--c-border);
  background: transparent;
  transition: var(--transition);
  cursor: pointer;
  font-family: var(--font-mono);
}
.asset-btn:hover { border-color: var(--c-border-strong); color: var(--t-secondary); }
.asset-btn.active { background: var(--grad-primary); color: #080b14; border-color: transparent; }
.movers-list { display: flex; flex-direction: column; gap: 0.5rem; }
.mover-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  background: var(--c-bg-glass-light);
  transition: var(--transition);
}
.mover-item:hover { background: rgba(255,255,255,0.06); }
.mover-sym { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 700; color: var(--t-primary); }
.mover-name { font-size: 0.7rem; color: var(--t-muted); }
.mover-chg { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 700; }
.mover-chg.up { color: var(--c-teal); }
.mover-chg.down { color: var(--c-red); }

.patterns-list { display: flex; flex-direction: column; gap: 0.6rem; }
.pattern-item { padding: 0.75rem; border-radius: 8px; border: 1px solid var(--c-border); background: var(--c-bg-glass-light); }
.pattern-name { font-size: 0.8rem; font-weight: 600; color: var(--t-primary); }
.pattern-asset { font-size: 0.7rem; color: var(--t-muted); }
.pattern-signal { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.3rem; }
.pattern-signal span { font-size: 0.68rem; }

/* ---------- FRAUD PAGE ---------- */
.fraud-feed { display: flex; flex-direction: column; gap: 0.5rem; max-height: 300px; overflow-y: auto; }
.fraud-event {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
  background: var(--c-bg-glass-light);
  animation: slideIn 0.3s ease;
}
@keyframes slideIn { from{transform:translateX(-20px);opacity:0} to{transform:translateX(0);opacity:1} }
.fraud-event-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.fraud-event-dot.blocked { background: var(--c-teal); }
.fraud-event-dot.detected { background: var(--c-orange); }
.fraud-event-dot.critical { background: var(--c-red); animation: pulse-glow-red 1s infinite; }
.fe-type { font-size: 0.7rem; font-weight: 700; color: var(--t-secondary); width: 80px; flex-shrink: 0; }
.fe-desc { flex: 1; font-size: 0.75rem; color: var(--t-secondary); }
.fe-amount { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600; flex-shrink: 0; }
.fe-amount.blocked { color: var(--c-teal); }
.fe-amount.critical { color: var(--c-red); }
.fe-time { font-size: 0.65rem; color: var(--t-muted); font-family: var(--font-mono); flex-shrink: 0; }
.threat-level-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 99px;
  background: var(--c-red-dim);
  border: 1px solid rgba(239,35,60,0.3);
  font-size: 0.8rem;
  color: var(--c-red);
  margin-left: auto;
}

/* ---------- SENTIMENT PAGE ---------- */
.sentiment-map { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
.smap-item {
  padding: 0.875rem;
  border-radius: 10px;
  border: 1px solid var(--c-border);
  cursor: pointer;
  transition: var(--transition);
}
.smap-item:hover { border-color: var(--c-border-strong); }
.smap-sym { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 700; }
.smap-score { font-size: 0.72rem; margin-top: 0.25rem; }
.news-feed { display: flex; flex-direction: column; gap: 0.6rem; overflow-y: auto; max-height: 280px; }
.news-item { padding: 0.75rem; border-radius: 8px; border: 1px solid var(--c-border); background: var(--c-bg-glass-light); cursor: pointer; transition: var(--transition); }
.news-item:hover { border-color: var(--c-border-strong); }
.news-title { font-size: 0.78rem; font-weight: 600; color: var(--t-primary); margin-bottom: 0.2rem; line-height: 1.4; }
.news-meta { display: flex; align-items: center; gap: 0.5rem; }
.news-source { font-size: 0.65rem; color: var(--t-muted); }
.news-sentiment { font-size: 0.65rem; font-weight: 700; padding: 1px 6px; border-radius: 99px; }
.news-sentiment.positive { background: var(--c-teal-dim); color: var(--c-teal); }
.news-sentiment.negative { background: var(--c-red-dim); color: var(--c-red); }
.news-sentiment.neutral { background: var(--c-orange-dim); color: var(--c-orange); }
.word-cloud { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; padding: 0.5rem; }
.word-cloud-tag { padding: 4px 10px; border-radius: 99px; cursor: pointer; transition: var(--transition); font-weight: 600; }
.word-cloud-tag:hover { opacity: 0.8; transform: scale(1.05); }

/* ---------- PREDICTIONS ---------- */
.prediction-horizon-selector { display: flex; gap: 4px; }
.pred-btn {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--t-muted);
  border: 1px solid var(--c-border);
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
}
.pred-btn:hover { color: var(--t-secondary); border-color: var(--c-border-strong); }
.pred-btn.active { background: var(--c-purple-dim); color: var(--c-purple-bright); border-color: rgba(123,94,167,0.3); }
.scenarios-list { display: flex; flex-direction: column; gap: 0.6rem; overflow-y: auto; max-height: 300px; }
.scenario-item { padding: 0.875rem; border-radius: 8px; border: 1px solid var(--c-border); background: var(--c-bg-glass-light); }
.scenario-name { font-size: 0.8rem; font-weight: 600; color: var(--t-primary); }
.scenario-prob { font-size: 0.7rem; color: var(--t-muted); margin-top: 0.15rem; }
.scenario-return { font-size: 1rem; font-weight: 700; margin-top: 0.25rem; font-family: var(--font-mono); }
.predictions-models-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); margin-top: var(--gap); }
.model-card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}
.model-card:hover { border-color: var(--c-border-strong); }
.model-name { font-size: 0.9rem; font-weight: 700; color: var(--t-primary); margin-bottom: 0.5rem; }
.model-accuracy { display: flex; align-items: center; justify-content: space-between; font-size: 0.75rem; margin-bottom: 0.4rem; }
.model-acc-val { font-family: var(--font-mono); font-weight: 700; color: var(--c-teal); }
.model-acc-bar { height: 4px; background: var(--c-border); border-radius: 99px; overflow: hidden; }
.model-acc-fill { height: 100%; background: var(--grad-primary); border-radius: 99px; }

/* ---------- TABLE ---------- */
.table-wrapper { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.data-table th { padding: 0.75rem 1rem; text-align: left; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--t-muted); border-bottom: 1px solid var(--c-border); position: sticky; top: 0; background: var(--c-bg-card); z-index: 1; white-space: nowrap; }
.data-table td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--c-border); color: var(--t-secondary); white-space: nowrap; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--c-bg-glass-light); color: var(--t-primary); }
.table-controls { display: flex; align-items: center; gap: 0.75rem; }
.filter-select {
  background: var(--c-bg-glass-light);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
  color: var(--t-secondary);
  outline: none;
  cursor: pointer;
}
.topbar-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--c-bg-glass-light);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  margin-left: auto;
}
.topbar-search svg { width: 15px; height: 15px; color: var(--t-muted); flex-shrink: 0; }
.topbar-search input { background: none; border: none; outline: none; font-size: 0.78rem; color: var(--t-primary); width: 160px; }
.topbar-search input::placeholder { color: var(--t-muted); }

/* ---------- BUTTONS ---------- */
.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: 10px;
  background: var(--grad-primary);
  color: #080b14;
  font-size: 0.85rem;
  font-weight: 700;
  transition: var(--transition-spring);
  cursor: pointer;
  white-space: nowrap;
}
.primary-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow-teal); }
.primary-btn:active { transform: translateY(0); }
.primary-btn svg { width: 16px; height: 16px; }
.primary-btn.small { padding: 0.45rem 0.875rem; font-size: 0.75rem; }

/* ---------- CORRELATION MATRIX ---------- */
.correlation-matrix { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; overflow: auto; }
.cm-cell { aspect-ratio: 1; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 0.6rem; font-weight: 700; }

/* ---------- ALERTS PANEL ---------- */
.alerts-panel {
  position: fixed;
  top: 0;
  right: -380px;
  width: 380px;
  height: 100vh;
  background: var(--c-bg-secondary);
  border-left: 1px solid var(--c-border);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.4,0,0.2,1);
  box-shadow: -8px 0 40px rgba(0,0,0,0.4);
}
.alerts-panel.open { right: 0; }
.alerts-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--c-border);
}
.alerts-panel-header h3 { font-size: 1rem; font-weight: 700; }
.close-panel-btn {
  width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: var(--t-muted); font-size: 1rem; transition: var(--transition);
}
.close-panel-btn:hover { background: var(--c-bg-glass-light); color: var(--t-primary); }
.alerts-panel-content { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s;
}
.panel-overlay.active { opacity: 1; pointer-events: all; }

/* ---------- TOAST ---------- */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9998; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--c-bg-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  font-size: 0.8rem;
  color: var(--t-secondary);
  animation: toastIn 0.35s cubic-bezier(0.34,1.56,0.64,1);
  max-width: 320px;
}
.toast.success { border-color: rgba(0,245,212,0.3); }
.toast.warning { border-color: rgba(255,159,28,0.3); }
.toast.error { border-color: rgba(239,35,60,0.3); }
.toast-icon { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 0.7rem; font-weight: 700; }
.toast.success .toast-icon { background: var(--c-teal-dim); color: var(--c-teal); }
.toast.warning .toast-icon { background: var(--c-orange-dim); color: var(--c-orange); }
.toast.error .toast-icon { background: var(--c-red-dim); color: var(--c-red); }
@keyframes toastIn { from{transform:translateX(100px);opacity:0} to{transform:translateX(0);opacity:1} }

/* ---------- VOICE OVERLAY ---------- */
.voice-overlay {
  position: fixed;
  inset: 0;
  z-index: 9997;
  background: rgba(8,11,20,0.92);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1.5rem;
}
.voice-overlay.active { display: flex; }
.voice-orb {
  width: 120px;
  height: 120px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.voice-rings { position: absolute; inset: 0; }
.ring {
  position: absolute;
  border-radius: 50%;
  border: 2px solid rgba(0,245,212,0.4);
  animation: voiceRing 1.5s ease-out infinite;
}
.r1 { inset: 0; animation-delay: 0s; }
.r2 { inset: -15px; animation-delay: 0.3s; }
.r3 { inset: -30px; animation-delay: 0.6s; }
@keyframes voiceRing { 0%{transform:scale(0.8);opacity:0.8} 100%{transform:scale(1.3);opacity:0} }
.voice-icon {
  width: 60px;
  height: 60px;
  background: var(--grad-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.voice-icon svg { width: 28px; height: 28px; color: #080b14; }
.voice-text { font-size: 1.2rem; font-weight: 600; color: var(--t-primary); }
.voice-cancel {
  padding: 0.6rem 1.5rem;
  border-radius: 99px;
  border: 1px solid var(--c-border);
  color: var(--t-secondary);
  font-size: 0.85rem;
  transition: var(--transition);
}
.voice-cancel:hover { border-color: var(--c-border-strong); color: var(--t-primary); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1400px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .bottom-row { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1200px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .portfolio-grid { grid-template-columns: 1fr; }
  .compliance-grid { grid-template-columns: repeat(2, 1fr); }
  .recommendations-grid { grid-template-columns: repeat(2, 1fr); }
  .reports-grid { grid-template-columns: repeat(2, 1fr); }
  .ai-advisor-layout { grid-template-columns: 1fr; }
  .advisor-sidebar { display: none; }
  .chart-card.large { min-width: 100%; }
}
@media (max-width: 900px) {
  :root { --sidebar-width: 0px; }
  .sidebar { position: fixed; left: -260px; width: 260px !important; min-width: 260px !important; transition: left 0.3s; z-index: 200; }
  .sidebar.mobile-open { left: 0; box-shadow: 8px 0 40px rgba(0,0,0,0.5); }
  .mobile-menu-btn { display: flex; }
  .topbar-center { display: none; }
  .search-bar { display: none; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .bottom-row { grid-template-columns: 1fr; }
  .compliance-grid { grid-template-columns: 1fr; }
  .budget-overview { grid-template-columns: 1fr 1fr; }
  .risk-overview { grid-template-columns: 1fr 1fr; }
  .esg-overview { grid-template-columns: 1fr; }
  .predictions-models-row { grid-template-columns: 1fr; }
  .portfolio-metrics-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .kpi-row { grid-template-columns: 1fr; }
  .pages-container { padding: 1rem; }
  .charts-row { flex-direction: column; }
  .chart-card.medium, .chart-card.large, .chart-card.small { min-width: 100%; flex: 1 1 100%; }
  .page-intro { flex-direction: column; align-items: flex-start; }
  .reports-grid { grid-template-columns: 1fr; }
  .recommendations-grid { grid-template-columns: 1fr; }
}

/* ---------- MISC UTILITY ---------- */
.positive { color: var(--c-teal) !important; }
.negative { color: var(--c-red) !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: var(--font-mono); }
