:root {
  /* NexAIPro-inspired palette: dark bg + electric blue */
  --bg-primary: #0c0f14;
  --bg-secondary: #13171e;
  --bg-card: #181d26;
  --bg-card-hover: #1e242e;
  --border: #252b36;
  --border-light: #2d3544;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #0ea5e9;
  --accent-hover: #38bdf8;
  --accent-muted: rgba(14, 165, 233, 0.15);
  /* Muted enterprise colors (restrained, not neon) */
  --accent-green: #34a853;
  --accent-amber: #d4a024;
  --accent-purple: #8b7bb8;
  --radius: 10px;
  --radius-sm: 8px;
  --sidebar-width: 260px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.2);
  --glass-bg: rgba(24, 29, 38, 0.6);
  --glass-border: rgba(255, 255, 255, 0.04);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

/* App layout */
.app {
  display: flex;
  min-height: 100vh;
}

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

.sidebar-brand {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-secondary);
}

.brand-logo {
  width: 32px;
  height: 32px;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(14, 165, 233, 0.2));
}

.brand-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  white-space: nowrap;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
}

.nav-section {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.75rem 1rem 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background 0.2s, color 0.2s;
  margin-bottom: 2px;
}

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

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

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item.active .nav-icon {
  color: var(--accent);
}

.sidebar-footer {
  padding: 1rem 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

.nav-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

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

/* Header */
.dashboard-header {
  padding: 1rem 2rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.header-search {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

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

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.timeframe-badge {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.last-updated {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.btn-refresh {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-muted);
  border: 1px solid rgba(14, 165, 233, 0.35);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-refresh:hover:not(:disabled) {
  background: rgba(14, 165, 233, 0.25);
  border-color: var(--accent);
}

.btn-refresh:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Main content */
.dashboard-main {
  flex: 1;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.page-title {
  margin-bottom: 0.5rem;
}

.page-title h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Sections - glass + depth */
.section {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 0 0 1px rgba(14, 165, 233, 0.03);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.section:hover {
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 0 0 1px rgba(14, 165, 233, 0.05);
}

.section-header {
  margin-bottom: 1.25rem;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.section-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.leads-icon { background: var(--accent); }
.reps-icon { background: var(--accent-purple); }
.deals-icon { background: var(--accent-green); }

.section-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Metric cards - glass + depth */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
}

.metric-card {
  background: rgba(19, 23, 30, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  transition: background 0.2s, border-color 0.2s;
}

.metric-card:hover {
  background: rgba(30, 36, 46, 0.8);
  border-color: rgba(255, 255, 255, 0.06);
}

.metric-card-wide {
  padding: 1.75rem;
}

.metric-card-primary {
  border-color: rgba(52, 168, 83, 0.2);
  background: rgba(52, 168, 83, 0.04);
}

/* Typography hierarchy - numbers dominate */
.metric-value {
  font-size: 2.25rem;
  font-weight: 800;
  font-family: var(--font-mono);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 0.35rem;
}

.metric-value.highlight-green { color: var(--accent-green); }
.metric-value.highlight-blue { color: var(--accent); }
.metric-value.highlight-amber { color: var(--accent-amber); }

.metric-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

.deals-metrics {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* Trend sparkline */
.metric-card-with-trend {
  position: relative;
}

.metric-trend {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.sparkline {
  width: 100%;
  height: 28px;
  color: var(--accent);
  opacity: 0.7;
}

.sparkline-path {
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 80;
  stroke-dashoffset: 80;
  animation: sparklineDraw 1s ease-out 0.5s forwards;
}

.trend-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
  display: block;
}

@keyframes sparklineDraw {
  to { stroke-dashoffset: 0; }
}

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

/* Sales Reps */
.reps-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rep-row {
  display: grid;
  grid-template-columns: 48px 1fr 100px 120px;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: rgba(19, 23, 30, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, background 0.2s;
  animation: rowFadeIn 0.4s ease-out backwards;
}

.rep-row:nth-child(1) { animation-delay: 0.02s; }
.rep-row:nth-child(2) { animation-delay: 0.04s; }
.rep-row:nth-child(3) { animation-delay: 0.06s; }
.rep-row:nth-child(4) { animation-delay: 0.08s; }
.rep-row:nth-child(5) { animation-delay: 0.1s; }
.rep-row:nth-child(6) { animation-delay: 0.12s; }
.rep-row:nth-child(7) { animation-delay: 0.14s; }
.rep-row:nth-child(8) { animation-delay: 0.16s; }
.rep-row:nth-child(9) { animation-delay: 0.18s; }
.rep-row:nth-child(n+10) { animation-delay: 0.2s; }

.rep-row:hover {
  border-color: rgba(255, 255, 255, 0.06);
  background: rgba(30, 36, 46, 0.7);
}

.rep-row.top-performer {
  border-color: rgba(52, 168, 83, 0.25);
  background: rgba(52, 168, 83, 0.05);
}

.rep-rank {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

.rep-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.rep-winrate {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
}

.rep-winrate.high { color: var(--accent-green); }
.rep-winrate.medium { color: var(--accent-amber); }
.rep-winrate.low { color: var(--text-secondary); }

.rep-response {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.loading-state,
.empty-state {
  padding: 2.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Lead Information table */
.leads-table-wrapper {
  overflow-x: auto;
}

.leads-table-container {
  min-width: 0;
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.leads-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.leads-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.leads-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.leads-table tbody tr:last-child td {
  border-bottom: none;
}

.link-email {
  color: var(--accent);
  text-decoration: none;
}

.link-email:hover {
  text-decoration: underline;
}

.empty-cell {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem !important;
}

/* Footer */
.dashboard-footer {
  padding: 1rem 2rem;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Error toast */
.error-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 0.875rem 1.5rem;
  background: #7f1d1d;
  color: #fecaca;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  opacity: 0;
  visibility: hidden;
  transition: transform 0.3s, opacity 0.3s, visibility 0.3s;
  z-index: 1000;
}

.error-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

/* Micro-animations */
.section {
  animation: cardFadeIn 0.6s ease-out backwards;
}

.section:nth-child(2) { animation-delay: 0.05s; }
.section:nth-child(3) { animation-delay: 0.1s; }
.section:nth-child(4) { animation-delay: 0.15s; }
.section:nth-child(5) { animation-delay: 0.2s; }
.section:nth-child(6) { animation-delay: 0.25s; }

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

/* Responsive */
@media (max-width: 1024px) {
  .sidebar {
    width: 72px;
    min-width: 72px;
  }

  .sidebar-brand {
    padding: 1rem;
  }

  .brand-logo {
    max-width: 48px;
  }

  .nav-section,
  .nav-label,
  .sidebar-footer {
    display: none;
  }

  .nav-item {
    justify-content: center;
  }

  .main-wrapper {
    margin-left: 72px;
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main-wrapper {
    margin-left: 0;
  }

  .dashboard-header {
    padding: 1rem;
  }

  .header-search {
    max-width: none;
  }

  .dashboard-main {
    padding: 1.25rem;
  }

  .rep-row {
    grid-template-columns: 36px 1fr;
    grid-template-rows: auto auto;
    gap: 0.5rem;
  }

  .rep-winrate,
  .rep-response {
    grid-column: 2;
    font-size: 0.8rem;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   === FEATURE 1: Live Refresh Indicator =====================
   ============================================================ */
.last-updated {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.last-updated::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  animation: livePulse 2s ease-in-out infinite;
}

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

/* ============================================================
   === FEATURE 2: Charts =====================================
   ============================================================ */
.charts-section {
  margin-top: 0;
}

.charts-icon {
  background: var(--accent-purple);
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.chart-card {
  background: rgba(19, 23, 30, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  transition: border-color 0.2s;
}

.chart-card:hover {
  border-color: rgba(255, 255, 255, 0.08);
}

.chart-card-wide {
  grid-column: 1 / -1;
}

.chart-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.chart-canvas-wrap {
  position: relative;
  height: 200px;
}

.chart-card-wide .chart-canvas-wrap {
  height: 220px;
}

@media (max-width: 900px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .chart-card-wide {
    grid-column: 1;
  }
}

/* ============================================================
   === FEATURE 3: Global Search Overlay ======================
   ============================================================ */
.global-search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.global-search-overlay.active {
  opacity: 1;
  visibility: visible;
}

.global-search-box {
  width: 100%;
  max-width: 560px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transform: translateY(-12px);
  transition: transform 0.2s;
}

.global-search-overlay.active .global-search-box {
  transform: translateY(0);
}

.global-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.global-search-input-wrap svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

#globalSearchInput {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
}

#globalSearchInput::placeholder {
  color: var(--text-muted);
}

.search-kbd {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  flex-shrink: 0;
}

.global-search-results {
  max-height: 360px;
  overflow-y: auto;
  padding: 0.5rem;
}

.search-hint {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:hover {
  background: var(--accent-muted);
}

.search-result-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.search-result-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.search-result-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.search-result-type {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-muted);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  flex-shrink: 0;
}

/* ============================================================
   === FEATURE 4: Filters Bar ================================
   ============================================================ */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.875rem 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.filters-quick {
  display: flex;
  gap: 0.4rem;
}

.filter-btn {
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.filter-btn:hover {
  background: var(--accent-muted);
  color: var(--text-primary);
  border-color: rgba(14, 165, 233, 0.3);
}

.filter-btn.active {
  background: var(--accent-muted);
  color: var(--accent);
  border-color: rgba(14, 165, 233, 0.4);
}

.filters-selects {
  display: flex;
  gap: 0.75rem;
  margin-left: auto;
}

.filter-select {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.filter-select:focus {
  border-color: var(--accent);
}

/* ============================================================
   === FEATURE 5: Skeleton Loaders ===========================
   ============================================================ */
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.03) 25%,
    rgba(255,255,255,0.07) 50%,
    rgba(255,255,255,0.03) 75%
  );
  background-size: 800px 100%;
  animation: shimmer 1.6s infinite linear;
}

.skeleton-loader {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.5rem 0;
}

.skeleton-row {
  display: grid;
  grid-template-columns: 48px 1fr 100px 120px;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: rgba(19, 23, 30, 0.4);
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
  align-items: center;
}

.skeleton-rank {
  height: 16px;
  width: 32px;
}

.skeleton-name {
  height: 16px;
  width: 70%;
}

.skeleton-stat {
  height: 16px;
  width: 80%;
}

.skeleton-table-header {
  height: 40px;
  width: 100%;
  border-radius: 4px;
}

.skeleton-table-row {
  height: 48px;
  width: 100%;
  border-radius: 4px;
}

/* ============================================================
   === FEATURE 6: Notifications ==============================
   ============================================================ */
.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  position: relative;
  flex-shrink: 0;
}

.btn-icon:hover {
  background: var(--accent-muted);
  color: var(--text-primary);
  border-color: rgba(14, 165, 233, 0.3);
}

.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-secondary);
}

.notif-overlay {
  position: fixed;
  inset: 0;
  z-index: 499;
  display: none;
}

.notif-overlay.active {
  display: block;
}

.notif-panel {
  position: fixed;
  top: 60px;
  right: 1.5rem;
  width: 340px;
  max-height: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  z-index: 500;
  display: flex;
  flex-direction: column;
  transform: translateY(-8px) scale(0.97);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.2s, opacity 0.2s, visibility 0.2s;
}

.notif-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
}

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

.notif-panel-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.notif-clear {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: color 0.15s;
}

.notif-clear:hover {
  color: var(--accent);
}

.notif-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.notif-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.25rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.03);
  animation: notifSlideIn 0.25s ease-out;
}

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

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

.notif-item-content {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
}

.notif-item-msg {
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.notif-item-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ============================================================
   === FEATURE 7: Light Theme ================================
   ============================================================ */
[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --border: #e2e8f0;
  --border-light: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #0284c7;
  --accent-hover: #0ea5e9;
  --accent-muted: rgba(2, 132, 199, 0.1);
  --accent-green: #16a34a;
  --accent-amber: #b45309;
  --accent-purple: #7c3aed;
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .metric-card {
  background: rgba(248, 250, 252, 0.9);
  border-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .rep-row {
  background: rgba(248, 250, 252, 0.8);
  border-color: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .rep-row.top-performer {
  background: rgba(22, 163, 74, 0.06);
  border-color: rgba(22, 163, 74, 0.2);
}

[data-theme="light"] .chart-card {
  background: rgba(248, 250, 252, 0.9);
  border-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .filter-select {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

[data-theme="light"] .skeleton {
  background: linear-gradient(
    90deg,
    rgba(0,0,0,0.04) 25%,
    rgba(0,0,0,0.08) 50%,
    rgba(0,0,0,0.04) 75%
  );
  background-size: 800px 100%;
}

[data-theme="light"] .skeleton-row {
  background: rgba(241, 245, 249, 0.8);
}

[data-theme="light"] .global-search-box {
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] #globalSearchInput {
  color: var(--text-primary);
}

[data-theme="light"] .error-toast {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ============================================================
   === FEATURE 8: Drill-Down Modal ===========================
   ============================================================ */
.drill-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.drill-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.drill-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  width: 100%;
  max-width: 760px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  transform: scale(0.96) translateY(8px);
  transition: transform 0.2s;
}

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

.drill-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.drill-modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.drill-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.drill-modal-close:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.drill-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem 1.5rem;
}

.drill-table-wrap {
  overflow-x: auto;
}

.drill-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.drill-table th {
  text-align: left;
  padding: 0.65rem 1rem;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}

.drill-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

.drill-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.drill-table tbody tr:last-child td {
  border-bottom: none;
}

.drill-group-header td {
  background: rgba(14, 165, 233, 0.06);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.drill-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.drilldown-trigger:hover {
  opacity: 0.85;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 4px;
}

