/* ============================================
   CENTRO DE GESTIÓN COOPERATIVA INTELIGENTE
   Design System — GenerArise ESS
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Custom Properties --- */
:root {
  /* Colors — Dark Theme */
  --bg-primary: #06080f;
  --bg-secondary: #0c1120;
  --bg-surface: #111827;
  --bg-card: rgba(17, 24, 39, 0.65);
  --bg-card-hover: rgba(17, 24, 39, 0.85);
  --bg-input: rgba(17, 24, 39, 0.9);
  
  /* Glass */
  --glass-border: rgba(255, 255, 255, 0.07);
  --glass-blur: 16px;
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  
  /* Brand Colors */
  --primary: #10B981;
  --primary-light: #34D399;
  --primary-dark: #059669;
  --primary-glow: rgba(16, 185, 129, 0.15);
  
  --secondary: #F59E0B;
  --secondary-light: #FBBF24;
  --secondary-dark: #D97706;
  
  --accent: #6366F1;
  --accent-light: #818CF8;
  
  /* Semantic */
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  
  /* Text */
  --text-primary: #F9FAFB;
  --text-secondary: #9CA3AF;
  --text-tertiary: #6B7280;
  --text-muted: #4B5563;
  
  /* Layout */
  --sidebar-width: 260px;
  --header-height: 0px;
  --chat-width: 380px;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 16px;
  --border-radius-xl: 20px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
}

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

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Subtle background pattern */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(16, 185, 129, 0.04), transparent),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(99, 102, 241, 0.03), transparent);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--primary); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ============================================
   LAYOUT
   ============================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition-slow);
}

.sidebar-brand {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--glass-border);
}

.sidebar-brand h1 {
  font-size: 1.15rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.sidebar-brand .brand-subtitle {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-md) var(--space-sm);
  overflow-y: auto;
}

.nav-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: var(--space-lg) var(--space-md) var(--space-sm);
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 10px var(--space-md);
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  font-size: 0.87rem;
  font-weight: 500;
  transition: all var(--transition-base);
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 2px;
  position: relative;
  overflow: hidden;
}

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

.nav-item.active {
  color: var(--primary);
  background: var(--primary-glow);
  border-color: rgba(16, 185, 129, 0.15);
}

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

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

/* Sidebar footer */
.sidebar-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--glass-border);
}

.sidebar-coop-info {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.coop-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.coop-details {
  overflow: hidden;
}

.coop-name {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coop-plan {
  font-size: 0.65rem;
  color: var(--primary);
  font-weight: 500;
}

/* --- Main Content --- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  padding: var(--space-xl);
}

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
  gap: var(--space-md);
}

.page-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-header .page-subtitle {
  color: var(--text-secondary);
  font-size: 0.87rem;
  margin-top: 2px;
}

.page-header-actions {
  display: flex;
  gap: var(--space-sm);
}

/* Section title */
.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

/* ============================================
   CARDS & GLASS COMPONENTS
   ============================================ */

.card {
  background: var(--bg-card);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  padding: var(--space-lg);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
  box-shadow: var(--glass-shadow);
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.kpi-card {
  padding: var(--space-lg);
  position: relative;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.kpi-card[data-color="green"]::before { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.kpi-card[data-color="gold"]::before { background: linear-gradient(90deg, var(--secondary), var(--secondary-light)); }
.kpi-card[data-color="blue"]::before { background: linear-gradient(90deg, var(--info), #60A5FA); }
.kpi-card[data-color="purple"]::before { background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.kpi-card[data-color="red"]::before { background: linear-gradient(90deg, var(--danger), #F87171); }
.kpi-card[data-color="teal"]::before { background: linear-gradient(90deg, #14B8A6, #2DD4BF); }

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: var(--space-md);
}

.kpi-card[data-color="green"] .kpi-icon { background: rgba(16, 185, 129, 0.12); color: var(--primary); }
.kpi-card[data-color="gold"] .kpi-icon { background: rgba(245, 158, 11, 0.12); color: var(--secondary); }
.kpi-card[data-color="blue"] .kpi-icon { background: rgba(59, 130, 246, 0.12); color: var(--info); }
.kpi-card[data-color="purple"] .kpi-icon { background: rgba(99, 102, 241, 0.12); color: var(--accent); }
.kpi-card[data-color="red"] .kpi-icon { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.kpi-card[data-color="teal"] .kpi-icon { background: rgba(20, 184, 166, 0.12); color: #14B8A6; }

.kpi-label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.kpi-value {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 4px 0;
  line-height: 1.2;
}

.kpi-change {
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.kpi-change.positive { color: var(--success); }
.kpi-change.negative { color: var(--danger); }

/* Chart Cards */
.chart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.chart-card {
  min-height: 300px;
}

.chart-card .card-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 240px;
}

/* ============================================
   ALERTS / NOTIFICATIONS (IA Proactive)
   ============================================ */

.alerts-section {
  margin-bottom: var(--space-xl);
}

.alert-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--border-radius-sm);
  border-left: 3px solid;
  animation: slideInRight 0.4s ease forwards;
  opacity: 0;
}

.alert-item:nth-child(1) { animation-delay: 0.1s; }
.alert-item:nth-child(2) { animation-delay: 0.2s; }
.alert-item:nth-child(3) { animation-delay: 0.3s; }
.alert-item:nth-child(4) { animation-delay: 0.4s; }

.alert-item.alert-warning {
  background: rgba(245, 158, 11, 0.06);
  border-color: var(--warning);
}

.alert-item.alert-danger {
  background: rgba(239, 68, 68, 0.06);
  border-color: var(--danger);
}

.alert-item.alert-info {
  background: rgba(59, 130, 246, 0.06);
  border-color: var(--info);
}

.alert-item.alert-success {
  background: rgba(16, 185, 129, 0.06);
  border-color: var(--success);
}

.alert-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-warning .alert-icon { color: var(--warning); }
.alert-danger .alert-icon { color: var(--danger); }
.alert-info .alert-icon { color: var(--info); }
.alert-success .alert-icon { color: var(--success); }

.alert-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.alert-text strong {
  color: var(--text-primary);
}

.alert-tag {
  margin-left: auto;
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  color: var(--text-tertiary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================================
   TABLES
   ============================================ */

.table-container {
  overflow-x: auto;
  border-radius: var(--border-radius);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table thead {
  position: sticky;
  top: 0;
}

.data-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: var(--space-md);
  text-align: left;
  font-weight: 600;
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--glass-border);
  white-space: nowrap;
}

.data-table td {
  padding: var(--space-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Table elements */
.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.user-cell .user-name {
  font-weight: 500;
  color: var(--text-primary);
}

.user-cell .user-role {
  font-size: 0.73rem;
  color: var(--text-tertiary);
}

/* ============================================
   BADGES & STATUS
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.badge-info { background: rgba(59, 130, 246, 0.12); color: var(--info); }
.badge-neutral { background: rgba(255, 255, 255, 0.06); color: var(--text-tertiary); }
.badge-primary { background: rgba(16, 185, 129, 0.12); color: var(--primary); }

.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 9px 18px;
  border-radius: var(--border-radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all var(--transition-base);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--glass-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 10px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.75rem;
}

.btn-icon {
  padding: 8px;
  border-radius: var(--border-radius-sm);
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

.search-box {
  position: relative;
  max-width: 320px;
}

.search-box input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  background: var(--bg-input);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  transition: all var(--transition-base);
  outline: none;
}

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

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.filter-chip {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  background: rgba(255,255,255,0.04);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: all var(--transition-base);
}

.filter-chip:hover {
  background: rgba(255,255,255,0.07);
  color: var(--text-primary);
}

.filter-chip.active {
  background: var(--primary-glow);
  color: var(--primary);
  border-color: rgba(16, 185, 129, 0.2);
}

/* ============================================
   AI CHAT WIDGET
   ============================================ */

.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none;
  color: white;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.35);
  z-index: 1000;
  transition: all var(--transition-base);
  cursor: pointer;
}

.chat-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 32px rgba(16, 185, 129, 0.45);
}

.chat-fab.has-notification::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
  animation: pulse-dot 2s ease-in-out infinite;
}

.chat-widget {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: var(--chat-width);
  max-height: 520px;
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all var(--transition-slow);
}

.chat-widget.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.chat-header {
  padding: var(--space-md) var(--space-lg);
  background: rgba(16, 185, 129, 0.06);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.chat-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.chat-header-info h4 {
  font-size: 0.87rem;
  font-weight: 600;
}

.chat-header-info span {
  font-size: 0.7rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-header-info span::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
  animation: pulse-dot 2s ease infinite;
}

.chat-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}

.chat-close:hover { color: var(--text-primary); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-height: 360px;
  min-height: 200px;
}

.chat-msg {
  display: flex;
  gap: var(--space-sm);
  max-width: 90%;
  animation: fadeInUp 0.3s ease;
}

.chat-msg.bot { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.chat-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

.chat-msg.bot .chat-msg-avatar {
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

.chat-msg.user .chat-msg-avatar {
  background: var(--secondary);
}

.chat-msg-bubble {
  padding: 10px 14px;
  border-radius: var(--border-radius-sm);
  font-size: 0.82rem;
  line-height: 1.55;
}

.chat-msg.bot .chat-msg-bubble {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
}

.chat-msg.user .chat-msg-bubble {
  background: var(--primary);
  color: white;
}

.chat-msg-bubble strong {
  color: var(--text-primary);
}

.chat-msg.user .chat-msg-bubble strong {
  color: white;
}

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  align-self: flex-start;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }

.chat-input-area {
  padding: var(--space-md);
  border-top: 1px solid var(--glass-border);
  display: flex;
  gap: var(--space-sm);
}

.chat-input-area input {
  flex: 1;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-size: 0.82rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.chat-input-area input::placeholder {
  color: var(--text-muted);
}

.chat-input-area input:focus {
  border-color: var(--primary);
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--border-radius-sm);
  background: var(--primary);
  border: none;
  color: white;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.chat-send-btn:hover {
  background: var(--primary-dark);
}

/* Quick suggestions */
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 var(--space-md) var(--space-md);
}

.chat-suggestion-chip {
  padding: 5px 12px;
  font-size: 0.72rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.15);
  border-radius: 16px;
  color: var(--primary-light);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chat-suggestion-chip:hover {
  background: rgba(16, 185, 129, 0.15);
}

/* ============================================
   MODULE-SPECIFIC STYLES
   ============================================ */

/* Activity feed */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.activity-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.activity-text strong { color: var(--text-primary); }

.activity-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Stats bar for modules */
.stats-bar {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(255,255,255,0.03);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--glass-border);
}

.stat-item .stat-value {
  font-weight: 700;
  font-size: 0.9rem;
}

.stat-item .stat-label {
  font-size: 0.73rem;
  color: var(--text-tertiary);
}

/* Progress bar */
.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}

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

.progress-fill.green { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.progress-fill.gold { background: linear-gradient(90deg, var(--secondary), var(--secondary-light)); }
.progress-fill.blue { background: linear-gradient(90deg, var(--info), #60A5FA); }
.progress-fill.purple { background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.progress-fill.red { background: linear-gradient(90deg, var(--danger), #F87171); }

/* Document cards */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-md);
}

.doc-card {
  cursor: pointer;
}

.doc-card .doc-icon {
  font-size: 2rem;
  margin-bottom: var(--space-md);
}

.doc-card .doc-name {
  font-weight: 600;
  font-size: 0.87rem;
  margin-bottom: 4px;
}

.doc-card .doc-meta {
  font-size: 0.73rem;
  color: var(--text-tertiary);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: var(--space-lg);
}

.tab {
  padding: var(--space-md) var(--space-lg);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: all var(--transition-base);
}

.tab:hover { color: var(--text-primary); }

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Detail cards (side by side layout) */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

/* Cashflow visual */
.cashflow-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

.cashflow-row:last-child { border-bottom: none; }

.cashflow-label {
  width: 140px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.cashflow-amount {
  font-weight: 700;
  font-size: 0.9rem;
  min-width: 100px;
  text-align: right;
}

.cashflow-amount.income { color: var(--success); }
.cashflow-amount.expense { color: var(--danger); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-tertiary);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.empty-state p {
  font-size: 0.85rem;
}

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-slow);
  padding: var(--space-xl);
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* Section fade in */
.page-section {
  display: none;
  animation: fadeInUp 0.35s ease;
}

.page-section.active {
  display: block;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1100px) {
  .chart-grid {
    grid-template-columns: 1fr;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .mobile-menu-btn {
    display: flex !important;
  }
  
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .chat-widget {
    width: calc(100vw - 48px);
    right: 24px;
    left: 24px;
  }
}

@media (max-width: 600px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .main-content {
    padding: var(--space-md);
  }
}

/* Mobile menu button (hidden by default) */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 101;
  background: var(--bg-surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
}

/* ============================================
   UTILITIES
   ============================================ */

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
