/* ==========================================================================
   MYFLUIDITI LEAD HUNTER — OFFICIAL ENTERPRISE DESIGN SYSTEM
   macOS Sonoma & iOS Glassmorphic Architecture with MyFluiditi Brand Identity
   ========================================================================== */

:root {
  /* Official MyFluiditi Brand Colors */
  --mf-blue-primary: #0038A8;
  --mf-blue-deep: #0A1C44;
  --mf-blue-dark: #071229;
  --mf-blue-navy: #050B18;
  --mf-blue-accent: #0284C7;
  --mf-blue-bright: #38BDF8;
  --mf-blue-glow: rgba(0, 56, 168, 0.35);
  --mf-cyan-glow: rgba(56, 189, 248, 0.25);

  /* Dark Mode Default Theme (macOS Deep Space & OLED Glass) */
  --bg-desktop: #070D1A;
  --bg-sidebar: rgba(10, 18, 36, 0.78);
  --bg-topbar: rgba(10, 18, 36, 0.72);
  --bg-card: rgba(15, 26, 52, 0.55);
  --bg-card-hover: rgba(22, 36, 70, 0.65);
  --bg-card-elevated: rgba(18, 31, 62, 0.85);
  --bg-input: rgba(8, 14, 28, 0.68);
  --bg-pill: rgba(255, 255, 255, 0.06);
  --bg-pill-hover: rgba(255, 255, 255, 0.1);

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glass: rgba(255, 255, 255, 0.12);
  --border-glass-highlight: rgba(255, 255, 255, 0.18);
  --border-focus: rgba(56, 189, 248, 0.5);

  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --text-caption: #475569;
  --text-on-accent: #FFFFFF;

  /* Intent & Status Accents (Restrained, Professional) */
  --accent-hot: #EF4444;
  --accent-hot-subtle: rgba(239, 68, 68, 0.12);
  --accent-hot-border: rgba(239, 68, 68, 0.28);

  --accent-high: #0284C7;
  --accent-high-subtle: rgba(2, 132, 199, 0.12);
  --accent-high-border: rgba(2, 132, 199, 0.28);

  --accent-qual: #10B981;
  --accent-qual-subtle: rgba(16, 185, 129, 0.12);
  --accent-qual-border: rgba(16, 185, 129, 0.28);

  --accent-pot: #64748B;
  --accent-pot-subtle: rgba(100, 116, 139, 0.12);
  --accent-pot-border: rgba(100, 116, 139, 0.25);

  /* Shadows & Glassmorphic Highlights */
  --shadow-glass: 0 12px 32px -4px rgba(0, 0, 0, 0.4), inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.3);
  --shadow-float: 0 20px 48px -8px rgba(0, 0, 0, 0.55), inset 0 1px 0 0 rgba(255, 255, 255, 0.15);
  --shadow-button-glow: 0 4px 18px rgba(0, 56, 168, 0.45);

  --blur-glass: blur(24px) saturate(180%);
  --blur-sheet: blur(32px) saturate(190%);

  /* Apple Radii */
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --radius-full: 9999px;

  --sidebar-width: 256px;
  --topbar-height: 64px;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", Menlo, Monaco, Consolas, monospace;
}

/* Light Theme Variables (macOS Light Studio Glass) */
body.theme-light {
  --bg-desktop: #F6F8FC;
  --bg-sidebar: rgba(255, 255, 255, 0.82);
  --bg-topbar: rgba(255, 255, 255, 0.78);
  --bg-card: rgba(255, 255, 255, 0.75);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-card-elevated: #FFFFFF;
  --bg-input: rgba(241, 245, 249, 0.85);
  --bg-pill: rgba(0, 56, 168, 0.05);
  --bg-pill-hover: rgba(0, 56, 168, 0.09);

  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-glass: rgba(0, 56, 168, 0.1);
  --border-glass-highlight: rgba(255, 255, 255, 0.8);
  --border-focus: rgba(0, 56, 168, 0.4);

  --text-primary: #0A1C44;
  --text-secondary: #475569;
  --text-muted: #8492A6;
  --text-caption: #A0ABC0;

  --accent-hot: #DC2626;
  --accent-hot-subtle: rgba(220, 38, 38, 0.08);
  --accent-hot-border: rgba(220, 38, 38, 0.2);

  --accent-high: #0038A8;
  --accent-high-subtle: rgba(0, 56, 168, 0.08);
  --accent-high-border: rgba(0, 56, 168, 0.2);

  --accent-qual: #059669;
  --accent-qual-subtle: rgba(5, 150, 105, 0.08);
  --accent-qual-border: rgba(5, 150, 105, 0.2);

  --shadow-glass: 0 10px 30px -4px rgba(10, 28, 68, 0.06), inset 0 1px 0 0 rgba(255, 255, 255, 0.8);
  --shadow-card: 0 4px 16px -2px rgba(10, 28, 68, 0.04);
  --shadow-float: 0 20px 48px -8px rgba(10, 28, 68, 0.12), inset 0 1px 0 0 rgba(255, 255, 255, 0.9);
  --shadow-button-glow: 0 4px 16px rgba(0, 56, 168, 0.25);
}

/* ==========================================================================
   RESET & FOUNDATIONS
   ========================================================================== */

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-desktop);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 18% 12%, rgba(0, 56, 168, 0.14) 0%, transparent 45%),
    radial-gradient(circle at 82% 88%, rgba(2, 132, 199, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(10, 28, 68, 0.08) 0%, transparent 60%);
  background-attachment: fixed;
}

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

/* ==========================================================================
   SIDEBAR (macOS STYLE)
   ========================================================================== */

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-header {
  padding: 22px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

/* Official Logo Container */
.brand-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  max-width: 190px;
}

.brand-logo-img {
  width: auto;
  height: 38px;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

body.theme-dark .brand-logo-img {
  /* Enhance contrast slightly on dark background without altering geometry */
  filter: drop-shadow(0 2px 8px rgba(0, 56, 168, 0.35));
}

.brand-suite-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--mf-blue-bright);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: rgba(0, 56, 168, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.2);
  width: fit-content;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: var(--radius-full);
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 14px 12px 6px;
  user-select: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.16s ease;
  border: 1px solid transparent;
  user-select: none;
}

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

.nav-item.active {
  color: var(--text-primary);
  background: rgba(0, 56, 168, 0.16);
  border-color: rgba(56, 189, 248, 0.24);
  font-weight: 600;
}

.nav-icon-wrap {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color 0.16s ease;
  flex-shrink: 0;
}

.nav-item:hover .nav-icon-wrap,
.nav-item.active .nav-icon-wrap {
  color: var(--mf-blue-bright);
}

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--bg-pill);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.nav-badge.hot-badge {
  background: var(--accent-hot-subtle);
  color: var(--accent-hot);
  border: 1px solid var(--accent-hot-border);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.system-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: var(--radius-md);
  background: var(--bg-pill);
  font-size: 12px;
  color: var(--text-secondary);
}

.status-dot-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-qual);
  box-shadow: 0 0 8px var(--accent-qual);
  display: inline-block;
  animation: pulse-dot 2.5s infinite;
}

.status-dot-pulse.offline {
  background-color: #EF4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
  animation: none;
}

.backend-offline-banner {
  margin: 16px 28px 0;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: #F87171;
  animation: fadeIn 0.2s ease;
}

.backend-offline-banner .offline-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.backend-offline-banner code {
  background: rgba(0, 0, 0, 0.25);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #FCA5A5;
}

.backend-offline-banner .btn-retry {
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #FFF;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.backend-offline-banner .btn-retry:hover {
  background: rgba(239, 68, 68, 0.45);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.15); }
}

/* ==========================================================================
   TOPBAR (macOS STYLE)
   ========================================================================== */

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

.topbar {
  height: var(--topbar-height);
  background: var(--bg-topbar);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  max-width: 520px;
}

/* Spotlight-Style Search */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 7px 16px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.search-bar:focus-within {
  border-color: var(--border-focus);
  background: var(--bg-card-elevated);
  box-shadow: 0 0 0 3px var(--mf-cyan-glow);
}

.search-icon-svg {
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13.5px;
  width: 100%;
}

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

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

.geo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: rgba(0, 56, 168, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.2);
  font-size: 12px;
  font-weight: 600;
  color: var(--mf-blue-bright);
}

.btn-theme-toggle {
  background: var(--bg-pill);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 7px 11px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  transition: all 0.16s ease;
}

.btn-theme-toggle:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-glass);
}

/* ==========================================================================
   BUTTONS & ACTIONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  white-space: nowrap;
}

/* HUNT NOW Primary Button (Pill Radar) */
.btn-hunt {
  background: linear-gradient(135deg, var(--mf-blue-primary), #0284C7);
  color: #FFFFFF;
  padding: 8px 22px;
  font-size: 13.5px;
  letter-spacing: 0.3px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-button-glow);
  position: relative;
  overflow: hidden;
}

.btn-hunt:hover {
  background: linear-gradient(135deg, #002C85, #0369A1);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0, 56, 168, 0.55);
}

.btn-hunt:active {
  transform: translateY(0);
}

.radar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #38BDF8;
  display: inline-block;
  box-shadow: 0 0 8px #38BDF8;
}

.btn-primary {
  background: var(--mf-blue-primary);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 14px rgba(0, 56, 168, 0.3);
}

.btn-primary:hover {
  background: #002C85;
  transform: translateY(-1px);
}

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

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--mf-blue-bright);
}

.btn-export {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.25);
  color: #34D399;
  border-radius: var(--radius-full);
}

.btn-export:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.4);
}

/* ==========================================================================
   CARDS & KPI STATS (macOS SONOMA GLASS)
   ========================================================================== */

.content-area {
  flex: 1;
  padding: 32px;
  max-width: 1540px;
  margin: 0 auto;
  width: 100%;
}

.view-section {
  display: none;
  animation: fadeInView 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

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

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

.page-title-group h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

.page-title-group p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* Glass Card */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-glass);
  padding: 24px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.glass-card:hover {
  border-color: var(--border-glass-highlight);
}

/* KPI Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

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

.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.stat-icon-wrap {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  background: var(--bg-pill);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.stat-value {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.8px;
  color: var(--text-primary);
  line-height: 1.1;
  font-family: var(--font-sans);
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-trend-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--accent-high-subtle);
  color: var(--accent-high);
}

/* ==========================================================================
   SCORE VISUALIZATION & STATUS PILLS
   ========================================================================== */

.score-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.2px;
}

.score-hot {
  background: var(--accent-hot-subtle);
  color: var(--accent-hot);
  border: 1px solid var(--accent-hot-border);
}

.score-high {
  background: var(--accent-high-subtle);
  color: var(--mf-blue-bright);
  border: 1px solid var(--accent-high-border);
}

.score-qual {
  background: var(--accent-qual-subtle);
  color: var(--accent-qual);
  border: 1px solid var(--accent-qual-border);
}

.score-pot {
  background: var(--accent-pot-subtle);
  color: var(--accent-pot);
  border: 1px solid var(--accent-pot-border);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-pill);
  color: var(--text-secondary);
}

.status-pill.status-hot { background: var(--accent-hot-subtle); color: var(--accent-hot); border: 1px solid var(--accent-hot-border); }
.status-pill.status-high { background: var(--accent-high-subtle); color: var(--mf-blue-bright); border: 1px solid var(--accent-high-border); }
.status-pill.status-qualified { background: var(--accent-qual-subtle); color: var(--accent-qual); border: 1px solid var(--accent-qual-border); }
.status-pill.status-new { background: rgba(56, 189, 248, 0.12); color: #38BDF8; border: 1px solid rgba(56, 189, 248, 0.25); }
.status-pill.status-contacted { background: rgba(99, 102, 241, 0.12); color: #818CF8; border: 1px solid rgba(99, 102, 241, 0.25); }

/* Tech Tag */
.tech-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
  background: var(--bg-pill);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  margin-right: 4px;
  margin-bottom: 2px;
}

/* ==========================================================================
   CHARTS GRID
   ========================================================================== */

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 22px;
  margin-bottom: 28px;
}

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

.chart-card-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
}

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

/* ==========================================================================
   LEADS TABLE (macOS DATA SHEET)
   ========================================================================== */

.table-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.select-glass, .input-glass {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 7px 12px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: all 0.16s ease;
}

.select-glass:focus, .input-glass:focus {
  border-color: var(--border-focus);
}

.select-glass option {
  background: var(--mf-blue-deep);
  color: #FFFFFF;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.leads-table th {
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-pill);
  white-space: nowrap;
}

.leads-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

.leads-table tr {
  transition: background 0.14s ease;
}

.leads-table tr:hover td {
  background: var(--bg-pill-hover);
  color: var(--text-primary);
}

.company-cell {
  display: flex;
  flex-direction: column;
}

.company-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13.5px;
  cursor: pointer;
}

.company-name:hover {
  color: var(--mf-blue-bright);
}

.company-meta {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Direct Source Link Button */
.btn-open-source {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--mf-blue-bright);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: rgba(0, 56, 168, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.2);
  transition: all 0.16s ease;
}

.btn-open-source:hover {
  background: rgba(0, 56, 168, 0.24);
  color: #FFFFFF;
  border-color: var(--mf-blue-bright);
}

/* ==========================================================================
   MODALS & DETAIL SHEETS (APPLE GLASS DIALOGS)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 11, 24, 0.75);
  backdrop-filter: var(--blur-sheet);
  -webkit-backdrop-filter: var(--blur-sheet);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop.active {
  display: flex;
}

.modal-dialog {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-glass-highlight);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-float);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalEnter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-dialog-large {
  max-width: 920px;
}

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

.modal-header {
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.1);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.16s ease;
}

.btn-close:hover {
  background: var(--bg-pill);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: rgba(0, 0, 0, 0.08);
}

/* AI Explanation Box */
.ai-explanation-box {
  background: rgba(0, 56, 168, 0.09);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 20px;
}

.ai-explanation-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--mf-blue-bright);
  margin-bottom: 8px;
}

.ai-explanation-text {
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.6;
}

/* Evidence Timeline */
.evidence-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.evidence-item {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-pill);
  border: 1px solid var(--border-subtle);
  transition: border-color 0.16s ease;
}

.evidence-item:hover {
  border-color: var(--border-glass);
}

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

.evidence-source-tag {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--mf-blue-bright);
}

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

.evidence-snippet {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

/* Progress Modal */
.progress-bar-track {
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 14px 0;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--mf-blue-primary), var(--mf-blue-bright));
  width: 0%;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sources-progress-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 16px 0;
}

.source-progress-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-pill);
  font-size: 12.5px;
}

.status-indicator-symbol {
  font-size: 12px;
  font-weight: 700;
}

.status-indicator-symbol.done { color: var(--accent-qual); }
.status-indicator-symbol.running { color: var(--mf-blue-bright); animation: spinSymbol 1s linear infinite; display: inline-block; }
.status-indicator-symbol.pending { color: var(--text-muted); }

@keyframes spinSymbol {
  100% { transform: rotate(360deg); }
}

.live-metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  text-align: center;
  margin-top: 14px;
}

.live-metric-box {
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--bg-pill);
}

.live-metric-num {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.live-metric-label {
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-glass-highlight);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideToast 0.22s ease;
}

@keyframes slideToast {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
}
