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

:root {
  --glass: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(30, 51, 71, 0.1);
  --glass-hover: rgba(255, 255, 255, 0.7);
  --glass-strong: rgba(255, 255, 255, 0.65);
  --blur: 16px;
  --radius: 12px;
  --radius-sm: 6px;
  --sidebar-width: 240px;
  --text-primary: #1E3347;
  --text-secondary: rgba(30, 51, 71, 0.7);
  --text-muted: rgba(30, 51, 71, 0.45);
  --border: rgba(30, 51, 71, 0.1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Brand colors */
  --brand-navy: #1E3347;
  --brand-pink: #F1A3AE;
  --brand-white: #FFFFFF;
  --brand-gray: #E8E7E7;

  /* Tag colors — light mode */
  --tag-leak-bg: rgba(230, 81, 0, 0.1);
  --tag-leak-text: #c62828;
  --tag-win-bg: rgba(46, 125, 50, 0.1);
  --tag-win-text: #2e7d32;
  --tag-infra-bg: rgba(30, 51, 71, 0.08);
  --tag-infra-text: #1565c0;
  --tag-opp-bg: rgba(241, 163, 174, 0.2);
  --tag-opp-text: #ad1457;

  /* Accent colors */
  --green: #2e7d32;
  --orange: #e65100;
  --red: #c62828;
  --blue: #1565c0;
  --purple: #ad1457;
  --accent: #F1A3AE;
}

/* === Gradient Mesh Background === */
body {
  font-family: var(--font);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 14px;
  background: #F5F0EB;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(241, 163, 174, 0.3) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 85% 15%, rgba(30, 51, 71, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 50% 85%, rgba(241, 163, 174, 0.2) 0%, transparent 55%),
    radial-gradient(ellipse 50% 70% at 90% 70%, rgba(30, 51, 71, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 40% 40% at 30% 50%, rgba(241, 163, 174, 0.15) 0%, transparent 45%);
  animation: meshDrift 25s ease-in-out infinite alternate;
}

@keyframes meshDrift {
  0% { transform: scale(1) translate(0, 0); }
  50% { transform: scale(1.05) translate(-2%, 1%); }
  100% { transform: scale(1) translate(1%, -1%); }
}

/* === Glass Mixin (applied to all card-like elements) === */
.glass {
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
}

/* === Layout === */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: #1E3347;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: #E8E7E7;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 10;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 8px;
}

.sidebar-logo {
  height: 28px;
  width: auto;
  display: block;
}

.sidebar-subtitle {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 2px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.nav-section-header {
  padding: 18px 20px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.3);
  font-weight: 600;
}

.nav-section-header:first-child {
  padding-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.nav-item svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.5;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.nav-brand-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.nav-brand-icon svg {
  stroke-width: 0;
}

.nav-item:hover {
  color: #fff;
  background: rgba(30, 51, 71, 0.06);
}

.nav-item:hover svg {
  opacity: 0.8;
}

.nav-item.active {
  color: #fff;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border-left-color: var(--accent);
}

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

.nav-divider {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin: auto 0 0 0;
  padding-top: 8px;
}

.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px;
  max-width: 1100px;
}

/* === Cards (Glass) === */
.card {
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
  background: var(--glass-hover);
  border-color: rgba(30, 51, 71, 0.2);
}

.kpi-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 4px 0;
}

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

/* === Section Header === */
.section-header {
  margin-bottom: 24px;
}

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

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

/* === Insight Cards (3-column) === */
.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.insight-card {
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px;
  border-top: 3px solid var(--border);
}

.insight-card.priorities { border-top-color: var(--green); }
.insight-card.questions { border-top-color: var(--orange); }
.insight-card.context { border-top-color: var(--text-muted); }

.insight-card h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.insight-card li {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.insight-card ol { padding-left: 16px; }
.insight-card ul { padding-left: 16px; }

/* === Finding Cards (Glass) === */
.finding {
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.finding:hover {
  border-color: rgba(30, 51, 71, 0.2);
}

.finding-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.finding-header:hover {
  background: rgba(30, 51, 71, 0.06);
}

.finding-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.finding-tag {
  font-size: 10px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  margin-left: 10px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
}

.tag-leak { background: var(--tag-leak-bg); color: var(--tag-leak-text); }
.tag-win { background: var(--tag-win-bg); color: var(--tag-win-text); }
.tag-infra { background: var(--tag-infra-bg); color: var(--tag-infra-text); }
.tag-opp { background: var(--tag-opp-bg); color: var(--tag-opp-text); }

.finding-chevron {
  color: var(--text-muted);
  font-size: 16px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 12px;
}

.finding.open .finding-chevron {
  transform: rotate(90deg);
}

.finding-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.finding.open .finding-body {
  max-height: 800px;
}

.finding-content {
  padding: 16px 20px;
  background: rgba(30, 51, 71, 0.04);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  border-top: 1px solid var(--border);
}

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

/* Technical reveal (nested) */
.tech-reveal {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.tech-toggle {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: color 0.15s;
}

.tech-toggle:hover {
  color: var(--text-secondary);
}

.tech-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.6;
}

.tech-reveal.open .tech-detail {
  max-height: 300px;
}

/* === Gantt Chart (Glass) === */
.gantt-container {
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  overflow-x: auto;
}

.gantt-grid {
  display: grid;
  grid-template-columns: 160px repeat(12, 1fr);
  gap: 0;
  min-width: 700px;
}

.gantt-header-cell {
  padding: 8px 4px;
  font-size: 10px;
  text-align: center;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  border-radius: var(--radius-sm);
}

.gantt-header-cell:hover,
.gantt-header-cell.active {
  background: rgba(241, 163, 174, 0.15);
  color: var(--text-primary);
  font-weight: 600;
}

.gantt-label {
  padding: 6px 8px;
  font-size: 12px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(30, 51, 71, 0.06);
  display: flex;
  align-items: center;
}

.gantt-cell {
  padding: 6px 2px;
  border-bottom: 1px solid rgba(30, 51, 71, 0.06);
  position: relative;
}

.gantt-bar {
  height: 20px;
  border-radius: 4px;
  opacity: 0.75;
  box-shadow: 0 0 12px rgba(30, 51, 71, 0.08);
}

.gantt-week-detail {
  background: rgba(241, 163, 174, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(241, 163, 174, 0.15);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 16px;
  font-size: 13px;
  display: none;
}

.gantt-week-detail.visible {
  display: block;
}

/* === 30/60/90 === */
.roadmap-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.roadmap-phase {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
}

.roadmap-phase.phase-2 { border-left-color: var(--purple); }
.roadmap-phase.phase-3 { border-left-color: var(--green); }

.roadmap-phase h4 {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.roadmap-phase p {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* === Tables (maturity framework) === */
table {
  border-collapse: collapse;
}

th {
  color: var(--text-muted);
}

td {
  color: var(--text-secondary);
}

/* === Links === */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}

a:hover {
  color: #d4808e;
}

/* === Maturity Tabs === */
.maturity-tabs {
  display: flex;
  gap: 8px;
}

.maturity-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
}

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

.maturity-tab.active {
  background: var(--glass-strong);
  border-color: rgba(30, 51, 71, 0.2);
  color: var(--text-primary);
  font-weight: 600;
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
}

/* === Lenis Smooth Scroll === */
html.lenis, html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

/* === Tilt + Glow Transitions === */
.kpi-card,
.insight-card,
.finding {
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.2s ease;
}

/* === Mobile Top Bar === */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: var(--brand-navy);
  z-index: 20;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.mobile-topbar-logo {
  height: 22px;
  width: auto;
}

.hamburger {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.hamburger-icon {
  width: 20px;
  height: 14px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hamburger-icon span {
  display: block;
  height: 2px;
  width: 100%;
  background: #fff;
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.sidebar-open .hamburger-icon span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.sidebar-open .hamburger-icon span:nth-child(2) {
  opacity: 0;
}
.sidebar-open .hamburger-icon span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9;
  opacity: 0;
  transition: opacity 0.25s ease;
}

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

/* === Responsive — Tablet (≤900px) === */
@media (max-width: 900px) {
  .mobile-topbar {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 11;
    width: 260px;
    min-width: 260px;
  }

  .sidebar-open .sidebar {
    transform: translateX(0);
  }

  .content {
    margin-left: 0;
    padding-top: 68px;
  }

  .app {
    flex-direction: column;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

  .gantt-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ef-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .ef-graph-outer {
    min-width: 500px;
  }

  .maturity-tabs {
    flex-direction: column;
  }
}

/* === Responsive — Phone (≤480px) === */
@media (max-width: 480px) {
  .content {
    padding: 60px 14px 24px;
  }

  .kpi-grid,
  .video-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .kpi-value {
    font-size: 24px;
  }

  .section-title {
    font-size: 18px;
  }

  .section-subtitle {
    font-size: 11px;
  }

  .finding-header {
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 44px;
  }

  .finding-title {
    font-size: 13px;
    flex: 1 1 100%;
  }

  .finding-tag {
    margin-left: 0;
  }

  .finding-chevron {
    position: absolute;
    right: 16px;
    top: 16px;
  }

  .finding-header {
    position: relative;
    padding-right: 40px;
  }

  .finding-content {
    padding: 14px 16px;
    font-size: 12px;
  }

  .ef-wrapper {
    padding: 16px;
  }

  .ef-node {
    min-width: 44px;
    min-height: 44px;
  }

  .ef-detail.open {
    padding: 16px;
  }

  .ef-detail-grid {
    grid-template-columns: 1fr;
  }

  .gantt-container {
    padding: 14px;
  }

  .roadmap-phase h4 {
    font-size: 12px;
  }

  .roadmap-phase p {
    font-size: 10px;
  }

  .findings-group-header {
    flex-wrap: wrap;
    gap: 4px;
  }
}

/* === Email Flow Node Graph === */
.ef-wrapper {
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.ef-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.ef-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

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

.ef-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}

.ef-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.ef-graph-outer {
  display: flex;
  gap: 0;
}

.ef-lane-labels {
  width: 100px;
  flex-shrink: 0;
  padding-top: 0;
}

.ef-lane-label {
  height: 72px;
  display: flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-right: 12px;
}

.ef-graph {
  flex: 1;
  position: relative;
  min-width: 0;
}

.ef-lanes {
  position: relative;
  height: 216px; /* 3 lanes × 72px */
}

.ef-lane {
  height: 72px;
  border-bottom: 1px solid var(--border);
}

.ef-lane:last-child {
  border-bottom: none;
}

/* Day axis */
.ef-day-axis {
  position: relative;
  height: 28px;
  border-top: 1px solid var(--border);
}

.ef-day-marker {
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 500;
}

.ef-stage-marker {
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

/* Nodes */
.ef-node {
  position: absolute;
  border-radius: 50%;
  border: 2px solid;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ef-node:hover {
  transform: scale(1.15);
  box-shadow: 0 0 20px rgba(30, 51, 71, 0.15);
}

.ef-node.active {
  transform: scale(1.2);
  box-shadow: 0 0 24px rgba(30, 51, 71, 0.2);
}

.ef-node-num {
  font-size: 16px;
  font-weight: 700;
}

.ef-node-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(245, 240, 235, 0.9);
}

/* SVG edges */
.ef-edges {
  z-index: 1;
}

/* Detail panel */
.ef-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, margin-top 0.3s ease, padding 0.3s ease;
  margin-top: 0;
  background: rgba(30, 51, 71, 0.04);
  border-radius: var(--radius-sm);
}

.ef-detail.open {
  max-height: 500px;
  margin-top: 16px;
  padding: 20px;
  border: 1px solid var(--border);
}

.ef-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.ef-detail-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid;
  white-space: nowrap;
}

.ef-detail-subject {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.ef-detail-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.ef-detail-tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
}

.ef-detail-tag-warn {
  background: rgba(198, 40, 40, 0.1);
  color: #c62828;
}

.ef-detail-tag-code {
  background: rgba(46, 125, 50, 0.1);
  color: #2e7d32;
  font-family: 'SF Mono', 'Fira Code', monospace;
  letter-spacing: 0.02em;
}

.ef-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.ef-detail-card {
  background: rgba(30, 51, 71, 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.ef-detail-card-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-weight: 600;
}

.ef-detail-card-value {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.ef-detail-card-note {
  font-size: 10px;
  color: var(--tag-leak-text);
  margin-top: 4px;
  font-style: italic;
}

.ef-detail-issues {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.ef-detail-issues-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.ef-detail-issue {
  font-size: 11px;
  color: var(--tag-leak-text);
  padding-left: 18px;
  position: relative;
  margin-bottom: 4px;
  line-height: 1.5;
}

.ef-detail-issue::before {
  content: '⚠';
  position: absolute;
  left: 0;
  font-size: 10px;
}

/* Stage summary indicators */
.ef-stage-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
}

.ef-stage-summary-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.4;
}

.ef-stage-summary-icon {
  font-size: 12px;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}

.ef-stage-summary-text {
  color: var(--text-secondary);
}

@media (max-width: 900px) {
  .ef-lane-labels { width: 70px; }
  .ef-lane-label { font-size: 8px; }
  .ef-detail-grid { grid-template-columns: 1fr; }
}

/* === Findings Grouped by Tag === */
.findings-group {
  margin-bottom: 28px;
}

.findings-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.findings-group-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.findings-group-count {
  font-size: 20px;
  font-weight: 700;
  margin-left: 4px;
}

/* === Theme Toggle === */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  transition: color 0.2s ease;
  margin-top: 8px;
}

.theme-toggle:hover {
  color: rgba(255, 255, 255, 0.7);
}

.theme-toggle-track {
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.theme-toggle-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

[data-theme="dark"] .theme-toggle-thumb {
  transform: translateX(16px);
}

[data-theme="dark"] .theme-toggle-track {
  background: rgba(241, 163, 174, 0.35);
}

/* === Dark Theme === */
[data-theme="dark"] {
  --glass: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-hover: rgba(255, 255, 255, 0.08);
  --glass-strong: rgba(255, 255, 255, 0.1);
  --text-primary: #f0f0f0;
  --text-secondary: rgba(255, 255, 255, 0.65);
  --text-muted: rgba(255, 255, 255, 0.35);
  --border: rgba(255, 255, 255, 0.08);

  --tag-leak-bg: rgba(239, 83, 80, 0.15);
  --tag-leak-text: #ef9a9a;
  --tag-win-bg: rgba(102, 187, 106, 0.15);
  --tag-win-text: #a5d6a7;
  --tag-infra-bg: rgba(255, 255, 255, 0.06);
  --tag-infra-text: #90caf9;
  --tag-opp-bg: rgba(241, 163, 174, 0.2);
  --tag-opp-text: #f48fb1;

  --green: #66bb6a;
  --orange: #ffa726;
  --red: #ef5350;
  --blue: #42a5f5;
  --purple: #f48fb1;
  --accent: #F1A3AE;
}

[data-theme="dark"] body {
  background: #0e1117;
}

[data-theme="dark"] body::before {
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(241, 163, 174, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 85% 15%, rgba(30, 51, 71, 0.25) 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 50% 85%, rgba(241, 163, 174, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse 50% 70% at 90% 70%, rgba(30, 51, 71, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 40% 40% at 30% 50%, rgba(241, 163, 174, 0.06) 0%, transparent 45%);
}

[data-theme="dark"] .sidebar {
  background: #0a0d12;
  border-right-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .nav-item.active {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .section-title {
  color: var(--text-primary);
}

[data-theme="dark"] .kpi-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .finding:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .finding-header:hover {
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .finding-tag {
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .finding-content {
  background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .tech-reveal {
  border-top-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .gantt-header-cell:hover,
[data-theme="dark"] .gantt-header-cell.active {
  background: rgba(241, 163, 174, 0.12);
}

[data-theme="dark"] .gantt-bar {
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .gantt-week-detail {
  background: rgba(241, 163, 174, 0.06);
  border-color: rgba(241, 163, 174, 0.1);
}

[data-theme="dark"] .maturity-tab.active {
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .ef-node:hover {
  box-shadow: 0 0 20px rgba(241, 163, 174, 0.2);
}

[data-theme="dark"] .ef-node.active {
  box-shadow: 0 0 24px rgba(241, 163, 174, 0.3);
}

[data-theme="dark"] .ef-node-badge {
  border-color: rgba(14, 17, 23, 0.9);
}

[data-theme="dark"] .ef-detail {
  background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .ef-detail-card {
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .ef-detail-tag-warn {
  background: rgba(239, 83, 80, 0.15);
  color: #ef9a9a;
}

[data-theme="dark"] .ef-detail-tag-code {
  background: rgba(102, 187, 106, 0.15);
  color: #a5d6a7;
}

[data-theme="dark"] a:hover {
  color: #f8c4cc;
}

[data-theme="dark"] .tab-badge {
  color: #fff;
}

[data-theme="dark"] .mobile-topbar {
  background: #0a0d12;
}

[data-theme="dark"] .sidebar-overlay {
  background: rgba(0, 0, 0, 0.6);
}

/* === Chat Panel === */
.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #1E3347;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}

.chat-fab svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.5;
}

.chat-fab.hidden {
  display: none;
}

.chat-panel {
  position: fixed;
  top: 0;
  right: -380px;
  width: 380px;
  height: 100vh;
  background: var(--glass-strong);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border-left: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  z-index: 1001;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
}

.chat-panel.open {
  right: 0;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-header-left svg {
  color: var(--accent);
}

.chat-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, background 0.2s ease;
}

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

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-message {
  display: flex;
}

.chat-message-user {
  justify-content: flex-end;
}

.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
}

.chat-message-ai .chat-bubble {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-bottom-left-radius: 4px;
}

.chat-message-user .chat-bubble {
  background: #1E3347;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-typing .chat-bubble {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 18px;
}

.chat-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: chatBounce 1.4s ease-in-out infinite;
}

.chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }

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

.chat-input-wrap {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--glass);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s ease;
}

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

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

.chat-send {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #1E3347;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.chat-send:hover {
  background: #2a4a63;
}

/* Chat panel — dark mode */
[data-theme="dark"] .chat-panel {
  background: rgba(15, 20, 28, 0.95);
  border-left-color: rgba(255, 255, 255, 0.08);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .chat-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .chat-message-ai .chat-bubble {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .chat-input-wrap {
  border-top-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .chat-input {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Chat panel — mobile */
@media (max-width: 900px) {
  .chat-fab {
    bottom: 16px;
    right: 16px;
    width: 46px;
    height: 46px;
  }

  .chat-panel {
    width: 100%;
    right: -100%;
  }
}
