/* Nexus AI Dashboard - Modern Design System */

/* ========== CSS VARIABLES ========== */
:root {
  /* Primary palette - warm amber */
  --amber-50: #fffbeb;
  --amber-100: #fef3c7;
  --amber-200: #fde68a;
  --amber-300: #fcd34d;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-700: #b45309;
  
  /* Neutral scale */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  
  /* Semantic colors */
  --emerald-400: #34d399;
  --emerald-500: #10b981;
  --rose-400: #fb7185;
  --rose-500: #f43f5e;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --purple-400: #c084fc;
  --purple-500: #a855f7;
  
  /* Theme variables - Light mode */
  --bg: var(--slate-50);
  --bg-elevated: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.8);
  
  --text-primary: var(--slate-900);
  --text-secondary: var(--slate-600);
  --text-muted: var(--slate-400);
  
  --border: var(--slate-200);
  --border-light: var(--slate-100);
  
  --accent: var(--amber-500);
  --accent-light: var(--amber-100);
  --accent-dark: var(--amber-700);
  
  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Radii */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', Monaco, monospace;
  
  /* Layout */
  --sidebar-width: 260px;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-elevated: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.8);
  
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  --border: rgba(255, 255, 255, 0.12);
  --border-light: rgba(255, 255, 255, 0.06);
  
  --glass-bg: rgba(30, 41, 59, 0.85);
  --glass-border: rgba(255, 255, 255, 0.15);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.25), 0 2px 4px -1px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.25), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 10px 10px -5px rgba(0, 0, 0, 0.15);
}

/* ========== RESET & BASE ========== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.02); }
}

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

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

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.3); }
  50% { box-shadow: 0 0 40px rgba(245, 158, 11, 0.5); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

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

/* ========== APP LAYOUT ========== */
.app {
  display: flex;
  min-height: 100vh;
  animation: fadeIn 0.5s ease-out;
}

/* ========== SIDEBAR ========== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition), width var(--transition);
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--amber-400), var(--amber-600));
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
  animation: glow 3s ease-in-out infinite;
}

.logo-icon svg {
  width: 22px;
  height: 22px;
}

.logo-text {
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.sidebar-close:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

.sidebar-close svg {
  width: 20px;
  height: 20px;
}

/* Sidebar Collapse Button */
.sidebar-collapse {
  display: flex;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  margin-left: auto;
  margin-right: 8px;
}

.sidebar-collapse:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

.sidebar-collapse svg {
  width: 18px;
  height: 18px;
}

/* Collapsed Sidebar State */
.sidebar.collapsed {
  width: 72px;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .back-link span {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 12px;
}

.sidebar.collapsed .nav {
  padding: 20px 12px;
}

.sidebar.collapsed + .main {
  margin-left: 72px;
}

.sidebar.collapsed .sidebar-footer {
  padding: 16px 12px;
}

.sidebar.collapsed .back-link {
  justify-content: center;
  padding: 12px;
}

.sidebar.collapsed .back-link svg {
  margin: 0;
}

/* Navigation */
.nav {
  flex: 1;
  padding: 20px 16px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 28px;
}

.nav-label {
  display: block;
  padding: 0 12px;
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}

.nav-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  height: 20px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  transition: transform var(--transition-fast);
}

.nav-item:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.nav-item.active::before {
  transform: translateY(-50%) scaleY(1);
}

[data-theme="dark"] .nav-item.active {
  background: rgba(245, 158, 11, 0.15);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

.nav-item:hover svg,
.nav-item.active svg {
  opacity: 1;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.back-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition-fast);
  border: 1px solid var(--border);
}

.back-link:hover {
  background: var(--border-light);
  border-color: var(--accent);
  color: var(--text-primary);
}

.back-link svg {
  width: 16px;
  height: 16px;
}

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

/* Top Bar */
.topbar {
  position: sticky;
  top: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--glass-border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 50;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.menu-toggle:hover {
  background: var(--border-light);
}

.menu-toggle svg {
  width: 20px;
  height: 20px;
}

.topbar-title {
  flex: 1;
}

.topbar-title h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.topbar-title .subtitle {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-title .subtitle::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--emerald-500);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

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

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 12px;
  font-weight: 600;
}

.action-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-dark);
  transform: translateY(-1px);
}

.action-btn svg {
  width: 18px;
  height: 18px;
}

.action-btn.spinning svg {
  animation: spin 1s linear infinite;
}

/* ========== CONTENT ========== */
.content {
  flex: 1;
  padding: 32px;
  max-width: 1440px;
}

/* ========== STATS GRID ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  animation: fadeInScale 0.5s ease-out backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.stat-card.featured {
  background: linear-gradient(135deg, var(--amber-500), #f97316);
  color: white;
  border: none;
}

.stat-card.featured .stat-label,
.stat-card.featured .stat-comparison {
  color: rgba(255, 255, 255, 0.8);
}

.stat-card.featured .stat-value {
  color: white;
  -webkit-text-fill-color: white;
}

.stat-glow {
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 60%);
  pointer-events: none;
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.stat-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-dark);
}

.stat-icon.secondary {
  background: rgba(59, 130, 246, 0.15);
  color: var(--blue-500);
}

.stat-icon.tertiary {
  background: rgba(168, 85, 247, 0.15);
  color: var(--purple-500);
}

.stat-icon.quaternary {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald-500);
}

.stat-card.featured .stat-icon {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.stat-icon svg {
  width: 22px;
  height: 22px;
}

.stat-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.stat-trend.up { color: #86efac; }
.stat-trend.down { color: #fca5a5; }

.stat-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
}

.stat-comparison,
.stat-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.stat-progress {
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  margin-top: 12px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--amber-400), var(--amber-600));
  border-radius: 999px;
  transition: width 1s ease;
}

.provider-dots {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

.provider-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

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

.stat-sparkline {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  opacity: 0.3;
}

/* ========== SECTIONS ========== */
section {
  margin-bottom: 32px;
  animation: fadeIn 0.5s ease-out backwards;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.section-title h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.section-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.section-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Preset Buttons */
.preset-buttons {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
}

.preset-btn {
  padding: 6px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.preset-btn.active {
  background: var(--accent);
  color: white;
}

/* Date Range */
.date-range {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: var(--radius);
}

.date-input {
  padding: 6px 10px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.date-input:focus {
  outline: none;
  background: var(--bg);
}

.date-sep {
  font-size: 13px;
  color: var(--text-muted);
}

/* Select & Buttons */
.select-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.select-input:focus {
  outline: none;
  border-color: var(--accent);
}

.sort-buttons {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
}

.sort-btn {
  padding: 6px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.sort-btn.active {
  background: var(--accent-light);
  color: var(--accent-dark);
}

.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

/* ========== CHART SECTION ========== */
.chart-section {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation-delay: 0.25s;
}

.chart-container {
  position: relative;
  height: 300px;
  margin-bottom: 16px;
}

.chart-container canvas {
  width: 100%;
  height: 100%;
}

.chart-tooltip {
  position: absolute;
  padding: 12px 16px;
  background: var(--slate-900);
  color: white;
  border-radius: var(--radius);
  font-size: 13px;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  z-index: 100;
  box-shadow: var(--shadow-xl);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transform: translateY(5px);
}

.chart-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.chart-legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  background: none;
  border: none;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.legend-item:hover {
  background: var(--border-light);
}

.legend-item.hidden {
  opacity: 0.4;
  text-decoration: line-through;
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* ========== PROVIDERS SECTION ========== */
.providers-section {
  animation-delay: 0.35s;
}

.providers-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.provider-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: all var(--transition);
  animation: fadeInScale 0.4s ease-out backwards;
}

.provider-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.provider-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.provider-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.provider-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: white;
  position: relative;
}

.provider-icon::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: inherit;
  opacity: 0.3;
  filter: blur(8px);
  z-index: -1;
}

.provider-icon.codex {
  background: linear-gradient(135deg, var(--emerald-400), var(--emerald-500));
}

.provider-icon.claude {
  background: linear-gradient(135deg, #cc785c, #d4a574);
}

.provider-icon.gemini {
  background: linear-gradient(135deg, #4285f4, #34a853);
}

.provider-icon.minimax {
  background: linear-gradient(135deg, #9b5cff, #ff5ccf);
}

.provider-icon.kimi {
  background: linear-gradient(135deg, #6c5ce7, #a855f7);
}

.provider-icon.unknown {
  background: linear-gradient(135deg, var(--slate-400), var(--slate-500));
}

.provider-name {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
}

.provider-source {
  font-size: 12px;
  color: var(--text-muted);
}

.provider-badge {
  padding: 4px 10px;
  background: var(--accent-light);
  color: var(--accent-dark);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

[data-theme="dark"] .provider-badge {
  background: rgba(245, 158, 11, 0.15);
}

.provider-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.meta-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.meta-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

/* Usage Bars */
.usage-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.usage-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.usage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.usage-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.usage-values {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.usage-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.usage-pill.good {
  background: rgba(16, 185, 129, 0.1);
  color: var(--emerald-500);
}

.usage-pill.warning {
  background: rgba(249, 115, 22, 0.1);
  color: #f97316;
}

.usage-pill.danger {
  background: rgba(244, 63, 94, 0.1);
  color: var(--rose-500);
}

.usage-bar-bg {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.usage-bar-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.provider-card:hover .usage-bar-bg::after {
  opacity: 1;
}

.usage-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.usage-bar-fill.good {
  background: linear-gradient(90deg, var(--emerald-400), var(--emerald-500));
}

.usage-bar-fill.warning {
  background: linear-gradient(90deg, #fb923c, #f97316);
}

.usage-bar-fill.danger {
  background: linear-gradient(90deg, var(--rose-400), var(--rose-500));
}

.usage-reset {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.countdown {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--border-light);
  padding: 2px 6px;
  border-radius: 4px;
}

.countdown.urgent {
  background: rgba(244, 63, 94, 0.15);
  color: var(--rose-500);
  animation: pulse 1s ease-in-out infinite;
}

/* ========== MODELS SECTION ========== */
.models-section {
  animation-delay: 0.4s;
}

.models-content {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.models-chart-container {
  position: relative;
  height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.models-chart-container canvas {
  max-width: 100%;
  max-height: 100%;
}

.models-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.model-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius);
  transition: all var(--transition-fast);
}

.model-item:hover {
  background: var(--border-light);
}

.model-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.model-info {
  flex: 1;
  min-width: 0;
}

.model-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-percent {
  font-size: 11px;
  color: var(--text-muted);
}

.model-cost {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ========== HEATMAP SECTION ========== */
.heatmap-section {
  animation-delay: 0.45s;
}

.timezone-badge {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.heatmap-container {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: all var(--transition);
}

.heatmap-container:hover {
  box-shadow: var(--shadow-lg);
}

.heatmap-card {
  margin-bottom: 24px;
}

.heatmap-card:last-child {
  margin-bottom: 0;
}

.heatmap-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.heatmap-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: 70px repeat(24, minmax(24px, 1fr)) 40px;
  gap: 3px;
  min-width: 700px;
}

.heatmap-row {
  display: contents;
}

.heatmap-day-label {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 10px;
  font-weight: 500;
}

.heatmap-hour-label {
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
  padding: 3px 0;
}

.heatmap-cell {
  aspect-ratio: 1;
  min-height: 24px;
  border-radius: 3px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.heatmap-cell:hover {
  transform: scale(1.25);
  z-index: 10;
  box-shadow: 0 0 0 2px var(--accent), 0 4px 12px rgba(0, 0, 0, 0.2);
}

.heatmap-cell::after {
  content: attr(data-value);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  padding: 4px 8px;
  background: var(--slate-900);
  color: white;
  font-size: 11px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
}

.heatmap-cell:hover::after {
  opacity: 1;
}

.heatmap-intensity-0 { background: var(--border-light); }
.heatmap-intensity-1 { background: var(--amber-200); }
.heatmap-intensity-2 { background: var(--amber-300); }
.heatmap-intensity-3 { background: var(--amber-400); }
.heatmap-intensity-4 { background: var(--amber-500); }
.heatmap-intensity-5 { background: var(--amber-600); }

[data-theme="dark"] .heatmap-intensity-0 { background: var(--slate-700); }
[data-theme="dark"] .heatmap-intensity-1 { background: rgba(251, 191, 36, 0.2); }
[data-theme="dark"] .heatmap-intensity-2 { background: rgba(251, 191, 36, 0.35); }
[data-theme="dark"] .heatmap-intensity-3 { background: rgba(251, 191, 36, 0.5); }
[data-theme="dark"] .heatmap-intensity-4 { background: rgba(251, 191, 36, 0.65); }
[data-theme="dark"] .heatmap-intensity-5 { background: rgba(251, 191, 36, 0.8); }

.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-muted);
}

.heatmap-legend-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

/* ========== KIMI SECTION ========== */
.kimi-section {
  animation-delay: 0.5s;
}

.telegram-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #0088cc;
  color: white;
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.telegram-btn:hover {
  background: #0099e6;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 136, 204, 0.3);
}

.telegram-btn svg {
  width: 18px;
  height: 18px;
}

.kimi-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.kimi-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.kimi-stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  transition: all var(--transition);
}

.kimi-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.kimi-stat-card.success {
  border-color: var(--emerald-500);
}

.kimi-stat-card.success .kimi-value {
  color: var(--emerald-500);
}

.kimi-stat-card.error {
  border-color: var(--rose-500);
}

.kimi-stat-card.error .kimi-value {
  color: var(--rose-500);
}

.kimi-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
}

.kimi-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.kimi-recent {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.kimi-recent h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 13px;
  transition: all var(--transition-fast);
}

.recent-item:hover {
  background: var(--border-light);
}

.recent-item span:first-child {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.recent-status {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.recent-status.success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--emerald-500);
}

.recent-status.error {
  background: rgba(244, 63, 94, 0.1);
  color: var(--rose-500);
}

/* ========== API SECTION ========== */
.api-section {
  animation-delay: 0.55s;
}

.api-details {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.api-details summary {
  padding: 16px 24px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
}

.api-details summary::-webkit-details-marker {
  display: none;
}

.api-details summary:hover {
  background: var(--border-light);
  color: var(--text-primary);
}

.api-details summary svg {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-fast);
}

.api-details[open] summary svg {
  transform: rotate(90deg);
}

.api-content {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.api-item {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.api-item code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.api-item span {
  font-size: 13px;
  color: var(--text-muted);
}

/* ========== FOOTER ========== */
.footer {
  padding: 32px;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
}

.footer-meta {
  margin-top: 6px;
  font-size: 12px;
}

/* ========== LOADING STATE ========== */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 48px;
  color: var(--text-muted);
  font-size: 14px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ========== CODEX TABS ========== */
.codex-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.codex-tab {
  padding: 6px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.codex-tab.active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent-dark);
}

[data-theme="dark"] .codex-tab.active {
  background: rgba(245, 158, 11, 0.15);
}

.codex-tab.current {
  border-color: var(--emerald-500);
  color: var(--emerald-500);
}

.codex-account-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.codex-account-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* ========== ERROR MESSAGE ========== */
.error-message {
  padding: 16px;
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.2);
  border-radius: var(--radius);
  color: var(--rose-500);
  font-size: 14px;
  text-align: center;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .kimi-content {
    grid-template-columns: 1fr;
  }
  
  .models-content {
    grid-template-columns: 1fr;
  }
  
  .models-chart-container {
    height: 200px;
  }
}

@media (max-width: 920px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .sidebar-close {
    display: block;
  }
  
  .sidebar-collapse {
    display: none;
  }
  
  .sidebar.collapsed .logo-text,
  .sidebar.collapsed .nav-item span,
  .sidebar.collapsed .nav-label,
  .sidebar.collapsed .back-link span {
    opacity: 1;
    width: auto;
  }
  
  .sidebar.collapsed .nav-item {
    justify-content: flex-start;
    padding: 10px 12px;
  }
  
  .sidebar.collapsed + .main {
    margin-left: 0;
  }
  
  .main {
    margin-left: 0 !important;
  }
  
  .menu-toggle {
    display: block;
  }
  
  .providers-grid {
    grid-template-columns: 1fr;
  }
  
  .content {
    padding: 20px;
  }
  
  .topbar {
    padding: 12px 20px;
  }
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .kimi-stats-grid {
    grid-template-columns: 1fr;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .section-controls {
    width: 100%;
  }
  
  .date-range {
    flex: 1;
  }
  
  .date-input {
    flex: 1;
    min-width: 0;
  }
}

/* ========== OVERLAY ========== */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  transition: opacity var(--transition);
}

.sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--border-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
  transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ========== SELECTION ========== */
::selection {
  background: rgba(245, 158, 11, 0.3);
  color: var(--text-primary);
}

/* ========== FOCUS ========== */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
