/* ═══════════════════════════════════════════════════════════════════════════
   Succession v2 - coverage donut hero, bench-depth ladders, severity-coded
   gaps, dept × grade heatmap, filter chips, single-point-of-failure flag,
   skeleton states. Scope: .sv-* classes only. Doesn't touch legacy .ev-*.
   ═══════════════════════════════════════════════════════════════════════════ */

#succession-view { font-family: 'IBM Plex Sans', sans-serif; }

/* ── Hero with donut + summary ─────────────────────────────────────────── */
.sv-hero {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 32px;
  align-items: center;
}
@media (max-width: 900px) {
  .sv-hero { grid-template-columns: 1fr; gap: 18px; }
}
.sv-hero-donut {
  display: flex;
  align-items: center;
  gap: 24px;
}
.sv-hero-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sv-hero-tier {
  align-self: flex-start;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 12px;
  background: #E5E7EB;
  color: #4B5563;
}
.sv-hero-tier-good { background: #D1FAE5; color: #065F46; }
.sv-hero-tier-warn { background: #FEF3C7; color: #92400E; }
.sv-hero-tier-bad  { background: #FEE2E2; color: #991B1B; }
.sv-hero-headline {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #111827;
  line-height: 1.2;
}
.sv-hero-detail {
  font-size: 13px;
  color: #4B5563;
  font-weight: 600;
}
.sv-hero-prompt {
  margin-top: 4px;
  font-size: 12px;
  color: #6B7280;
  display: flex;
  gap: 6px;
  align-items: flex-start;
  padding: 10px 12px;
  background: #F9FAFB;
  border-radius: 6px;
  border-left: 3px solid #D97706;
}
.sv-hero-prompt-icon { font-size: 14px; flex: 0 0 auto; line-height: 1.4; color: #D97706; }

/* ── Coverage donut ────────────────────────────────────────────────────── */
.sv-donut {
  display: flex;
  align-items: center;
  gap: 24px;
}
.sv-donut-svg {
  flex: 0 0 auto;
}
.sv-donut-arc {
  transition: stroke-dasharray 0.8s ease;
}
.sv-donut-pct {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.03em;
  fill: #111827;
}
.sv-donut-lbl {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  fill: #6B7280;
}
.sv-donut-empty {
  width: 200px;
  height: 200px;
  border: 2px dashed #E5E7EB;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-text);
  font-size: 11px;
}
.sv-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sv-donut-legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sv-donut-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex: 0 0 auto;
}
.sv-donut-legend-val {
  font-size: 18px;
  font-weight: 800;
  color: #111827;
  line-height: 1;
}
.sv-donut-legend-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6B7280;
  margin-top: 2px;
}

/* ── KPI cards (border-left accent) ────────────────────────────────────── */
#succ-kpis.ev-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.sv-kpi {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 14px 16px;
  border-left: 3px solid #D1D5DB;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.sv-kpi:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.04);
}
.sv-kpi-ok    { border-left-color: #059669; }
.sv-kpi-info  { border-left-color: #1565C0; }
.sv-kpi-bad   { border-left-color: #DC2626; }
.sv-kpi-hero  { border-left-color: #1565C0; background: #F0F7FF; }
.sv-kpi-val {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  color: #111827;
}
.sv-kpi-ok    .sv-kpi-val { color: #059669; }
.sv-kpi-info  .sv-kpi-val { color: #1565C0; }
.sv-kpi-bad   .sv-kpi-val { color: #DC2626; }
.sv-kpi-hero  .sv-kpi-val { color: #1565C0; }
.sv-kpi-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #6B7280;
  margin-top: 6px;
}
.sv-kpi-sub {
  font-size: 10px;
  color: var(--muted-text);
  margin-top: 3px;
  font-weight: 600;
}

/* ── Manager-gap banner ────────────────────────────────────────────────── */
.sv-mgr-banner {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-left: 4px solid #D97706;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12px;
  color: #78350F;
  margin: 0 0 14px;
}

/* ── Filter bar (chips + search) ───────────────────────────────────────── */
.sv-filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  flex-wrap: wrap;
}
.sv-filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 240px;
}
.sv-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 14px;
  border: 1px solid #D1D5DB;
  background: #FFFFFF;
  font-size: 11px;
  font-weight: 700;
  color: #4B5563;
  cursor: pointer;
  transition: all 0.12s ease;
  font-family: inherit;
}
.sv-chip:hover {
  background: #F3F4F6;
  border-color: var(--muted-text);
  color: #111827;
}
.sv-chip-active {
  background: #1F2937;
  border-color: #1F2937;
  color: #FFFFFF;
}
.sv-chip-active:hover {
  background: #111827;
  color: #FFFFFF;
}
.sv-chip-count {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(0,0,0,0.06);
  color: inherit;
}
.sv-chip-active .sv-chip-count { background: rgba(255,255,255,0.18); }
.sv-filter-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 280px;
}
.sv-filter-search-icon {
  position: absolute;
  left: 10px;
  font-size: 14px;
  color: var(--muted-text);
  pointer-events: none;
}
.sv-filter-search-input {
  width: 100%;
  padding: 7px 12px 7px 30px;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  background: #FFFFFF;
  color: #111827;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.sv-filter-search-input:focus {
  border-color: #1565C0;
  box-shadow: 0 0 0 2px rgba(21,101,192,0.15);
}

/* ── Facet row (Readiness / Risk chip groups) ──────────────────────────── */
.sv-facet-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  flex-basis: 100%;
  padding-top: 8px;
  border-top: 1px dashed #E5E7EB;
}
.sv-facet-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.sv-facet-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6B7280;
  margin-right: 4px;
}

/* ── Gap / flight-risk severity-styled rows ────────────────────────────── */
.sv-gap-item, .sv-risk-item {
  display: flex;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid #F3F4F6;
}
.sv-gap-item:last-child, .sv-risk-item:last-child { border-bottom: 0; }
.sv-gap-rail {
  width: 3px;
  border-radius: 2px;
  flex: 0 0 3px;
  align-self: stretch;
}
.sv-sev-critical .sv-gap-rail { background: #DC2626; }
.sv-sev-high     .sv-gap-rail { background: #F59E0B; }
.sv-sev-medium   .sv-gap-rail { background: #6B7280; }
.sv-sev-low      .sv-gap-rail { background: #D1D5DB; }
.sv-gap-body { flex: 1; min-width: 0; }
.sv-gap-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sv-gap-title {
  font-weight: 700;
  font-size: 12px;
  color: #111827;
}
.sv-gap-row2 {
  font-size: 11px;
  color: #6B7280;
  margin-top: 3px;
}
.sv-gap-row2 em { font-style: normal; font-weight: 600; color: #4B5563; }
.sv-gap-sev {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 10px;
  flex: 0 0 auto;
}
.sv-sev-pill-critical { background: #FEE2E2; color: #991B1B; }
.sv-sev-pill-high     { background: #FED7AA; color: #9A3412; }
.sv-sev-pill-medium   { background: #E5E7EB; color: #4B5563; }
.sv-sev-pill-low      { background: #F3F4F6; color: #6B7280; }

/* ── Slate cards v2 ────────────────────────────────────────────────────── */
.sv-slate {
  position: relative;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
}
.sv-slate-empty { background: #FAFAFA; }
.sv-slate-spof  {
  border-color: #DC2626;
  box-shadow: 0 0 0 1px rgba(220,38,38,0.18);
}
.sv-slate-accent {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
}
.sv-slate-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px 12px 22px;
  border-bottom: 1px solid #F3F4F6;
}
.sv-slate-info { flex: 1; min-width: 0; }
.sv-slate-title {
  font-size: 14px;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.01em;
}
.sv-slate-meta {
  font-size: 11px;
  color: #6B7280;
  margin-top: 3px;
}
.sv-slate-meta em { font-style: normal; font-weight: 600; color: #374151; }
.sv-slate-meters {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex: 0 0 auto;
}
.sv-slate-count {
  font-size: 10px;
  color: #6B7280;
  font-weight: 600;
}
.sv-slate-count strong { color: #111827; font-size: 12px; font-weight: 800; }
.sv-slate-add {
  flex: 0 0 auto;
  padding: 5px 12px;
  border: 1px solid #059669;
  background: #D1FAE5;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 800;
  color: #065F46;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.12s ease;
}
.sv-slate-add:hover {
  background: #059669;
  color: #FFFFFF;
}
.sv-slate-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}
.sv-slate-review {
  padding: 5px 12px;
  border: 1px solid #D1D5DB;
  background: #FFFFFF;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 700;
  color: #4B5563;
  cursor: pointer;
  letter-spacing: 0.03em;
  white-space: nowrap;
  transition: all 0.12s ease;
}
.sv-slate-review:hover { background: #F3F4F6; border-color: #9CA3AF; color: #111827; }

/* Bench review-freshness badge (driven by reviewed_at). */
.sv-review-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  cursor: default;
}
.sv-review-fresh   { background: #ECFDF5; color: #047857; border-color: #A7F3D0; }
.sv-review-due     { background: #FFFBEB; color: #B45309; border-color: #FDE68A; }
.sv-review-overdue { background: #FEF2F2; color: #B91C1C; border-color: #FECACA; }
.sv-review-never   { background: #F3F4F6; color: #6B7280; border-color: #E5E7EB; }
.sv-slate-empty-msg {
  padding: 14px 22px;
  font-size: 11px;
  color: #6B7280;
  font-style: italic;
}
.sv-slate-empty-msg strong { color: #065F46; font-style: normal; }

/* Bench-depth ladder */
.sv-ladder {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.sv-ladder-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  cursor: help;
  transition: transform 0.12s ease;
}
.sv-ladder-dot:hover { transform: scale(1.4); }
.sv-ladder-empty {
  font-size: 10px;
  color: #D1D5DB;
  letter-spacing: 2px;
}
.sv-ladder-empty-msg {
  margin-left: 8px;
  color: var(--muted-text);
  font-style: italic;
  letter-spacing: 0;
}

/* Single-point-of-failure banner inside slate */
.sv-spof-banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #FEF2F2;
  border-bottom: 1px solid #FECACA;
  padding: 10px 18px 10px 22px;
  font-size: 11px;
  color: #991B1B;
  line-height: 1.5;
}
.sv-spof-icon { font-size: 14px; flex: 0 0 auto; }
.sv-spof-banner strong { font-weight: 800; }

/* Candidate row */
.sv-cand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px 9px 22px;
  border-bottom: 1px solid #F3F4F6;
  transition: background 0.12s ease;
}
.sv-cand:last-child { border-bottom: 0; }
.sv-cand:hover { background: #FAFAFA; }
.sv-cand-rank {
  flex: 0 0 24px;
  text-align: center;
  font-size: 9.5px;
  font-weight: 800;
  color: var(--muted-text);
  letter-spacing: 0.04em;
}
.sv-cand-info { flex: 1; min-width: 0; }
.sv-cand-name {
  font-size: 12px;
  font-weight: 700;
  color: #111827;
}
.sv-cand-meta {
  font-size: 10.5px;
  color: #6B7280;
  margin-top: 2px;
}
.sv-pill {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 11px;
  flex: 0 0 auto;
  white-space: nowrap;
  text-transform: capitalize;
}
.sv-cand-btn {
  flex: 0 0 auto;
  background: none;
  border: 1px solid #E5E7EB;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  color: #6B7280;
  cursor: pointer;
  transition: all 0.12s ease;
}
.sv-cand-btn:hover {
  background: #F3F4F6;
  border-color: var(--muted-text);
  color: #111827;
}
.sv-cand-btn-danger:hover {
  background: #FEE2E2;
  border-color: #DC2626;
  color: #991B1B;
}

/* ── Department coverage heatmap ───────────────────────────────────────── */
.sv-heatmap-card {
  margin-top: 18px;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  overflow: hidden;
}
.sv-heatmap-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: linear-gradient(180deg, #FAFAFA 0%, #F5F5F5 100%);
  border-bottom: 1px solid #E5E7EB;
}
.sv-heatmap-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #111827;
}
.sv-heatmap-meta {
  font-size: 10px;
  color: #6B7280;
  font-weight: 600;
}
.sv-heatmap-body {
  padding: 14px 18px;
  overflow-x: auto;
}
.sv-heatmap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 4px;
  font-size: 11px;
}
.sv-heatmap-table thead th {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #6B7280;
  padding: 4px 8px;
  text-align: center;
}
.sv-heatmap-table thead th.sv-heatmap-rowhead {
  text-align: left;
  min-width: 140px;
}
.sv-heatmap-rowhead {
  font-size: 11px;
  font-weight: 700;
  color: #111827;
  padding: 6px 8px;
  white-space: nowrap;
}
.sv-heatmap-cell {
  text-align: center;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  min-width: 60px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.sv-heatmap-cell:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  z-index: 2;
  position: relative;
}
.sv-heatmap-legend {
  display: flex;
  gap: 16px;
  padding: 10px 18px 14px;
  border-top: 1px solid #F3F4F6;
  font-size: 10px;
  color: #4B5563;
  font-weight: 600;
  flex-wrap: wrap;
}
.sv-heatmap-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.sv-heatmap-legend-cell {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

/* ── Department dot (consistent w/ org chart) ──────────────────────────── */
.sv-dept-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  flex: 0 0 auto;
}

/* ── Empty state ───────────────────────────────────────────────────────── */
.sv-empty {
  text-align: center;
  padding: 22px 12px;
  color: var(--muted-text);
}
.sv-empty-icon {
  font-size: 28px;
  margin-bottom: 6px;
  color: #D1D5DB;
}

/* ── Error banner ──────────────────────────────────────────────────────── */
.sv-error-banner {
  padding: 10px 14px;
  background: #FEE2E2;
  border: 1px solid #FCA5A5;
  border-left: 4px solid #DC2626;
  border-radius: 6px;
  font-size: 11px;
  color: #7F1D1D;
  margin-bottom: 12px;
}

/* ── Skeleton states ───────────────────────────────────────────────────── */
.sv-skel {
  background: linear-gradient(90deg, #F3F4F6 0%, #E5E7EB 50%, #F3F4F6 100%);
  background-size: 200% 100%;
  animation: svShimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
  margin-bottom: 8px;
}
.sv-skel-hero  { height: 180px; margin-bottom: 16px; }
.sv-skel-kpi   { height: 86px; margin: 0; }
.sv-skel-bar   { height: 50px; }
.sv-skel-row   { height: 48px; }
.sv-skel-slate { height: 96px; }
@keyframes svShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
