:root {
  /* Light Theme */
  --bg-color: #f8fafc;
  --sidebar-bg: #ffffff;
  --panel-bg: rgba(255, 255, 255, 0.85);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --border-color: rgba(226, 232, 240, 0.8);
  --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --glass-blur: blur(16px);
  --accent: #3b82f6;
  --accent-hover: #2563eb;

  --yld-color: #f59e0b;
  /* Amber */
  --yll-color: #ef4444;
  /* Red */
}

[data-theme='dark'] {
  /* Dark Theme */
  --bg-color: #0f172a;
  --sidebar-bg: #0b1120;
  --panel-bg: rgba(30, 41, 59, 0.7);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border-color: rgba(51, 65, 85, 0.8);
  --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
  --accent: #60a5fa;
  --accent-hover: #93c5fd;

  --yld-color: #fbbf24;
  --yll-color: #f87171;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  transition: background-color 0.4s ease, color 0.4s ease;
  min-height: 100vh;
  display: flex;
}

.glass {
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

/* Sidebar */
.sidebar {
  width: 250px;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 3rem;
  color: var(--accent);
}

.logo i {
  width: 28px;
  height: 28px;
}

.logo h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.nav-links {
  list-style: none;
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  transition: all 0.2s;
  font-weight: 500;
}

.nav-links a i {
  width: 18px;
  height: 18px;
}

.nav-links a:hover,
.nav-links a.active {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
}

.theme-switch {
  margin-top: auto;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: center;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: rgba(148, 163, 184, 0.1);
}

[data-theme='dark'] .sun-icon {
  display: block;
}

[data-theme='dark'] .moon-icon {
  display: none;
}

[data-theme='light'] .sun-icon {
  display: none;
}

[data-theme='light'] .moon-icon {
  display: block;
}

/* Main Content Area */
.content {
  margin-left: 250px;
  max-width: 1200px;
  padding: 3rem 4rem;
  width: calc(100% - 250px);
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .content {
    margin-left: 0;
    width: 100%;
    padding: 2rem;
  }
}

/* Hero */
.hero {
  margin-bottom: 5rem;
}

.hero h1 {
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -0.025em;
}

.subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 3rem;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.metric-card {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.metric-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-secondary);
}

.metric-icon.accent {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
}

.metric-info h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
  letter-spacing: 0.05em;
}

.metric-info .value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* Sections */
.dashboard-section {
  padding: 4rem 0;
  border-top: 1px solid var(--border-color);
}

.section-header {
  margin-bottom: 2.5rem;
  max-width: 800px;
}

.section-header h2 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Split View for Context */
.split-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.text-content {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.text-content h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.text-content p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.stats-list {
  list-style: none;
  margin-top: 1rem;
}

.stats-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.stats-list i {
  color: var(--accent);
  width: 20px;
}

.chart-content {
  padding: 1.5rem;
  min-height: 350px;
  position: relative;
}

/* Charts Generic Layouts */
.chart-container {
  padding: 1.5rem;
  position: relative;
}

.large-chart {
  height: 450px;
  width: 100%;
}

.charts-grid {
  display: grid;
  grid-template-columns: 2.5fr 1fr;
  gap: 1.5rem;
}

.main-chart {
  height: 500px;
}

.secondary-chart {
  display: flex;
  flex-direction: column;
}

.doughnut-wrapper {
  position: relative;
  flex: 1;
  min-height: 250px;
}

.secondary-chart h4 {
  margin-bottom: 1rem;
}

.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-color);
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  outline: none;
}

.footer {
  text-align: center;
  padding: 3rem 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
}

/* Insight Cards */
.insight-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.insight-card {
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}

.insight-card p {
  margin-top: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 0.95rem;
}

.pill {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pill.red {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.pill.amber {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.pill.green {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

/* 3-Column Chart Grid */
.charts-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .charts-grid-3 {
    grid-template-columns: 1fr;
  }
}

.chart-container h5 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-primary);
}