/* ============================================================
   Manifold Adoption Dashboard — Styles
   ============================================================ */

/* --- Custom Properties --- */
:root {
  /* Pajamas Dark Theme — Neutral Scale */
  --gl-neutral-0: #ffffff;
  --gl-neutral-50: #ececef;
  --gl-neutral-100: #dcdcde;
  --gl-neutral-200: #bfbfc3;
  --gl-neutral-300: #a4a3a8;
  --gl-neutral-400: #89888d;
  --gl-neutral-500: #737278;
  --gl-neutral-600: #626168;
  --gl-neutral-700: #4c4b51;
  --gl-neutral-800: #3a383f;
  --gl-neutral-900: #28272d;
  --gl-neutral-950: #18171d;
  --gl-neutral-1000: #050506;

  /* Pajamas Blue Scale */
  --gl-blue-50: #e9f3fc;
  --gl-blue-100: #cbe2f9;
  --gl-blue-200: #9dc7f1;
  --gl-blue-300: #63a6e9;
  --gl-blue-400: #428fdc;
  --gl-blue-500: #1f75cb;
  --gl-blue-600: #2f68b4;
  --gl-blue-700: #2f5ca0;
  --gl-blue-800: #284779;
  --gl-blue-900: #213454;
  --gl-blue-950: #1d283e;

  /* Pajamas Green Scale */
  --gl-green-400: #2da160;
  --gl-green-500: #108548;

  /* Pajamas Orange Scale */
  --gl-orange-400: #c17d10;
  --gl-orange-500: #ab6100;

  /* Pajamas Red Scale */
  --gl-red-400: #ec5941;
  --gl-red-500: #dd2b0e;

  /* Brand */
  --gl-brand-orange-1: #fca326;
  --gl-brand-orange-2: #fc6d26;
  --gl-brand-orange-3: #e24329;

  /* Semantic mapping — matched to GitLab dark mode */
  --bg-primary: #1f1e24;
  --bg-secondary: #1f1e24;
  --bg-card: var(--gl-neutral-900, #28272d);
  --bg-card-hover: #333239;
  --bg-input: #333239;
  --border-color: #49484e;
  --border-hover: #5e5d63;
  --text-primary: #e6e1dc;
  --text-secondary: #999795;
  --text-muted: #8b8a90;
  --accent: var(--gl-blue-400);
  --accent-hover: var(--gl-blue-300);
  --accent-dim: rgba(66, 143, 220, 0.12);

  /* Keep archetype palette */
  --color-builder: #4e79a7;
  --color-reviewer: #f28e2b;
  --color-solo-contributor: #e15759;
  --color-platform-engineer: #76b7b2;
  --color-emerging-user: #59a14f;
  --color-dormant-expert: #9c755f;
  --color-generalist: #b07aa1;
  --color-developing: #bab0ac;

  /* Layout — use Pajamas spacing */
  --max-width: 1200px;
  --header-height: 48px;
  --sidebar-width: 48px;
  --summary-bar-height: 0px;
  --radius: 8px;
  --radius-sm: 4px;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  /* Pajamas typography */
  --font-sans: 'GitLab Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
  --font-mono: 'GitLab Mono', 'Menlo', 'DejaVu Sans Mono', 'Liberation Mono', 'Consolas', 'Ubuntu Mono', 'Courier New', monospace;

  /* Typography scale — 5-step hierarchy (ratio >= 1.25 between steps) */
  --text-display: 28px;
  --text-title: 18px;
  --text-body: 14px;
  --text-meta: 11px;
  --text-micro: 9px;

  /* Shadows — minimal for dark theme */
  --shadow-card: 0 1px 2px rgba(0,0,0,0.08);
  --shadow-tooltip: 0 4px 12px rgba(0,0,0,0.3);
}

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Selection color */
::selection {
  background: rgba(66, 143, 220, 0.3);
  color: var(--text-primary);
}

/* --- Scrollbar Styling --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================================
   GitLab Application Page Layout
   ============================================================ */

/* --- GL Top Bar --- */
.gl-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 var(--spacing-md);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--gl-neutral-700);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
}

.gl-topbar-left {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  min-width: 0;
  height: 48px;
}

.gl-topbar-tanuki {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.gl-topbar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
  line-height: 48px;
}

.gl-topbar-title:hover {
  color: var(--accent);
}

.gl-topbar-sep {
  color: var(--gl-neutral-600);
  font-size: 14px;
  margin: 0 4px;
  line-height: 48px;
}

.gl-topbar-page {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  white-space: nowrap;
  line-height: 48px;
}

.gl-topbar-center {
  display: flex;
  align-items: center;
  gap: var(--spacing-xl);
  height: 48px;
}

.gl-topbar-right {
  display: flex;
  align-items: center;
  height: 48px;
}

.gl-topbar-toggle {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  cursor: pointer;
  user-select: none;
  height: 32px;
  padding: 0 2px;
}

/* --- GitLab Pajamas Toggle Switch --- */
.gl-toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--gl-neutral-700);
  border-radius: 10px;
  border: none;
  transition: background 0.2s ease, box-shadow 0.15s ease;
  flex-shrink: 0;
}

.gl-toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: var(--gl-neutral-0);
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.gl-topbar-toggle:hover .gl-toggle-track {
  background: var(--gl-neutral-600);
}

.gl-topbar-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.gl-topbar-toggle input:focus-visible + .gl-toggle-track {
  box-shadow: 0 0 0 3px var(--accent-dim), 0 0 0 1px var(--accent);
}

.gl-topbar-toggle input:checked + .gl-toggle-track {
  background: var(--accent);
}

.gl-topbar-toggle input:checked + .gl-toggle-track::after {
  transform: translateX(16px);
}

.gl-topbar-toggle:hover input:checked + .gl-toggle-track {
  background: var(--accent-hover);
}

/* --- GL Layout --- */
.gl-layout {
  display: flex;
  min-height: calc(100vh - var(--header-height) - var(--summary-bar-height));
  padding-top: calc(var(--header-height) + var(--summary-bar-height));
}

/* --- GL Sidebar --- */
.gl-sidebar {
  position: fixed;
  top: calc(var(--header-height) + var(--summary-bar-height));
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-primary);
  border-right: 1px solid var(--gl-neutral-800);
  box-shadow: 1px 0 0 rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: var(--spacing-sm);
  gap: 2px;
  z-index: 180;
}

.gl-sidebar-item {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--gl-neutral-400);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  position: relative;
}

.gl-sidebar-item:hover {
  background: var(--gl-neutral-800);
  color: var(--gl-neutral-50);
}

.gl-sidebar-item.active {
  color: var(--gl-blue-400);
  background: rgba(66, 143, 220, 0.12);
}

.gl-sidebar-item.active:hover {
  background: rgba(66, 143, 220, 0.18);
  color: var(--gl-blue-300);
}

.gl-sidebar-item.active::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--gl-blue-400);
  border-radius: 0 2px 2px 0;
}

/* Sidebar tooltips */
.gl-sidebar-item[title]::after {
  content: attr(title);
  position: absolute;
  left: 52px;
  top: 50%;
  background: var(--gl-neutral-950, #18171d);
  color: var(--gl-neutral-50, #ececef);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-meta);
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  z-index: 300;
  pointer-events: none;
  box-shadow: var(--shadow-tooltip);
  opacity: 0;
  transform: translateY(-50%) translateX(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.gl-sidebar-item[title]:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* --- GL Main Content --- */
.gl-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--spacing-xl) 40px;
  max-width: calc(100vw - var(--sidebar-width));
  overflow-x: hidden;
  min-width: 0;
}

/* The exec summary is the hero — give it generous bottom margin */
#executive-summary-container {
  margin-bottom: var(--spacing-xl);
}

/* --- GL Footer --- */
.gl-footer {
  text-align: center;
  padding: var(--spacing-md) var(--spacing-md);
  font-size: var(--text-meta);
  color: var(--gl-neutral-500, #737278);
  border-top: 1px solid var(--gl-neutral-800, #3a383f);
  margin-top: 48px;
  margin-left: var(--sidebar-width);
  letter-spacing: 0.01em;
}

/* --- Summary Stats (used in topbar) --- */
.summary-stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.stat-label {
  font-size: var(--text-meta);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.stat-value {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  line-height: 1;
}

/* --- Toggle Label (used in gl-topbar-toggle) --- */
.toggle-label {
  font-size: var(--text-meta);
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 0.15s;
}

.gl-topbar-toggle:hover .toggle-label {
  color: var(--text-secondary);
}

/* (Archetype summary bar removed — folded into exec summary) */

/* --- Tab Panels with transitions --- */
.tab-panel {
  display: none;
  animation: fadeSlideIn 0.3s ease both;
  max-width: 100%;
  overflow-x: hidden;
}

.tab-panel.active {
  display: block;
}

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

/* --- Panel Intro --- */
.panel-intro {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--accent-dim);
  border: 1px solid rgba(66, 143, 220, 0.15);
  border-radius: var(--radius);
}

.intro-text {
  font-size: var(--text-body);
  line-height: 1.7;
  color: var(--gl-neutral-200, #bfbfc3);
}

.intro-illustration {
  flex-shrink: 0;
  opacity: 0.7;
}

/* --- Cards --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-xl);
}

.card-grid + .card-grid {
  margin-top: calc(var(--spacing-md) - var(--spacing-xl));
}

/* Standard cards — understated */
.card {
  background: var(--gl-neutral-900, #28272d);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: var(--spacing-lg);
  box-shadow: none;
  transition: border-color 0.15s;
}

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

/* Hero card — pipeline hero (executive summary) */

.card-full {
  grid-column: 1 / -1;
}

.card-title {
  font-size: var(--text-title);
  font-weight: 600;
  color: var(--gl-neutral-100, #dcdcde);
  margin-bottom: var(--spacing-xs);
  letter-spacing: 0.01em;
  line-height: 1.3;
}

.card-subtitle {
  font-size: var(--text-meta);
  color: var(--gl-neutral-400, #89888d);
  margin-bottom: var(--spacing-md);
  line-height: 1.5;
}

/* --- Chart Containers --- */
.chart-container {
  width: 100%;
  min-height: 180px;
  max-height: 280px;
  overflow: hidden;
  padding: var(--spacing-sm) 0;
  position: relative;
}

.chart-container svg {
  width: 100%;
  max-height: 260px;
}

/* --- Tables --- */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
}

.data-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  font-size: var(--text-body);
  line-height: 1.4;
}

.data-table th {
  font-size: var(--text-meta);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gl-neutral-400, #89888d);
  border-bottom: 2px solid var(--gl-neutral-700, #4c4b51);
  position: sticky;
  top: 0;
  background: var(--gl-neutral-900, #28272d);
  z-index: 1;
}

#panel-profiles .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-card, var(--gl-neutral-900, #28272d));
}

.data-table td {
  border-bottom: 1px solid var(--gl-neutral-800, #3a383f);
  color: var(--text-primary);
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

.data-table th.sortable:hover {
  color: var(--accent);
}

.data-table th.sorted-asc::after {
  content: " \25B2";
  color: var(--accent);
}

.data-table th.sorted-desc::after {
  content: " \25BC";
  color: var(--accent);
}

.data-table tbody tr {
  transition: background 0.15s;
}

.data-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.01);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

#panel-profiles .data-table tbody tr:not(.profile-detail-row) {
  cursor: pointer;
}

#panel-profiles .data-table tbody tr:not(.profile-detail-row):hover {
  background: rgba(66, 143, 220, 0.06);
}

#panel-profiles .data-table tbody tr:not(.profile-detail-row):hover td:first-child {
  text-decoration: underline;
  text-decoration-color: rgba(66, 143, 220, 0.3);
  text-underline-offset: 2px;
}

#panel-profiles .data-table tbody tr.profile-detail-row:hover {
  background: transparent;
}

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

/* --- Score Cells --- */
.score-cell {
  font-family: var(--font-mono);
  font-size: var(--text-meta);
}

/* --- Momentum Arrow --- */
.momentum-arrow {
  font-size: 15px;
  font-weight: 700;
  vertical-align: middle;
  margin-right: 2px;
}

.momentum-arrow.momentum-up {
  color: var(--gl-green-400);
}

.momentum-arrow.momentum-down {
  color: var(--gl-red-400);
}

/* --- Archetype Badge --- */
.archetype-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-micro);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  min-width: 72px;
  text-align: center;
}

.archetype-badge.builder { background: rgba(78,121,167,0.25); color: var(--color-builder); border: 1px solid rgba(78,121,167,0.35); }
.archetype-badge.reviewer { background: rgba(242,142,43,0.25); color: var(--color-reviewer); border: 1px solid rgba(242,142,43,0.35); }
.archetype-badge.solo_contributor { background: rgba(225,87,89,0.25); color: var(--color-solo-contributor); border: 1px solid rgba(225,87,89,0.35); }
.archetype-badge.platform_engineer { background: rgba(118,183,178,0.25); color: var(--color-platform-engineer); border: 1px solid rgba(118,183,178,0.35); }
.archetype-badge.emerging_user { background: rgba(89,161,79,0.25); color: var(--color-emerging-user); border: 1px solid rgba(89,161,79,0.35); }
.archetype-badge.dormant_expert { background: rgba(156,117,95,0.25); color: var(--color-dormant-expert); border: 1px solid rgba(156,117,95,0.35); }
.archetype-badge.generalist { background: rgba(176,122,161,0.25); color: var(--color-generalist); border: 1px solid rgba(176,122,161,0.35); }
.archetype-badge.developing { background: rgba(186,176,172,0.2); color: var(--color-developing); border: 1px solid rgba(186,176,172,0.3); }

/* --- Domain Label --- */
.domain-label {
  text-transform: capitalize;
}

/* --- Profiles Toolbar --- */
.profiles-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  align-items: center;
  max-width: 100%;
  box-sizing: border-box;
}

/* Search group — prominent, full-width row */
.profiles-search-group {
  display: flex;
  align-items: center;
  flex: 1 1 100%;
  position: relative;
}

.profiles-search-group .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.profiles-search-group .search-input {
  padding-left: 36px;
  width: 100%;
}

/* Filter group — archetypes, privacy, count */
.profiles-filter-group {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-xs) 0;
  flex-wrap: wrap;
}

/* Action group — domain toggle, CSV export */
.profiles-action-group {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-left: auto;
}

.search-input,
.filter-select {
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--text-meta);
  transition: border-color 0.15s, box-shadow 0.15s;
}

/* Prominent search — larger font, more padding */
.search-input {
  flex: 1;
  font-size: var(--text-body);
  padding: 10px var(--spacing-md);
  border-radius: var(--radius);
}

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

.search-input:focus,
.filter-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(66, 143, 220, 0.15);
}

/* Visual indicator for active (non-default) filter controls */
.filter-select.filter-active,
.search-input.filter-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(66, 143, 220, 0.18);
}

.gl-range.filter-active {
  outline: 2px solid rgba(66, 143, 220, 0.35);
  outline-offset: 2px;
  border-radius: 4px;
}

.profiles-count {
  font-size: var(--text-meta);
  color: var(--text-muted);
  white-space: nowrap;
  font-family: var(--font-mono);
}

.profiles-page-range {
  display: inline-block;
  margin-left: 8px;
  font-size: var(--text-meta);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* --- Loading State --- */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  gap: 16px;
  color: var(--text-muted);
  animation: fadeIn 0.3s ease-out;
}

.loading-logo {
  position: relative;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-logo svg {
  width: 40px;
  height: 40px;
  opacity: 0.9;
}

.loading-logo-ring {
  position: absolute;
  inset: 0;
  border: 2.5px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.loading-title {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-secondary);
}

.loading-detail {
  font-size: var(--text-meta);
  color: var(--text-muted);
  animation: pulse 2s ease-in-out infinite;
}

/* --- Error State --- */
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  gap: 8px;
  text-align: center;
  padding: var(--spacing-xl);
  animation: fadeIn 0.3s ease-out;
}

.error-title {
  font-size: var(--text-title);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
}

.error-message {
  color: var(--color-solo-contributor);
  margin-bottom: var(--spacing-sm);
  font-family: var(--font-mono);
  font-size: var(--text-meta);
}

.error-hint {
  color: var(--text-muted);
  font-size: var(--text-meta);
  margin-bottom: var(--spacing-lg);
  max-width: 500px;
}

.btn {
  padding: var(--spacing-sm) var(--spacing-lg);
  background: var(--accent);
  color: white;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--text-body);
  font-weight: 600;
  transition: background 0.15s;
}

.btn:hover {
  background: var(--accent-hover);
}

/* --- Empty State --- */
.empty-state-card {
  text-align: center;
  padding: var(--spacing-xl) var(--spacing-lg) !important;
}

.empty-state-title {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-sm);
}

.empty-state-detail {
  color: var(--text-muted);
  font-size: var(--text-body);
  line-height: 1.6;
  max-width: 520px;
  margin: 0 auto var(--spacing-sm);
}

.empty-state-detail code,
.empty-state-hint code {
  background: var(--bg-input);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  color: var(--accent);
}

.empty-state-hint {
  color: var(--text-muted);
  font-size: var(--text-micro);
}

.empty-state-illustration {
  display: block;
  margin: 0 auto var(--spacing-md);
  opacity: 0.85;
}

.empty-state-icon {
  display: flex;
  justify-content: center;
  margin: 0 auto var(--spacing-md);
  opacity: 0.6;
}

/* --- Tooltip --- */
.tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: var(--text-meta);
  color: var(--text-primary);
  box-shadow: var(--shadow-tooltip);
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.1s ease;
  max-width: 300px;
  line-height: 1.5;
}

.tooltip.visible {
  opacity: 1;
}

/* --- Placeholder Text --- */
.placeholder-text {
  color: var(--text-muted);
  text-align: center;
  padding: var(--spacing-xl);
  font-style: italic;
  font-size: var(--text-body);
}

/* --- Footer content (used inside gl-footer) --- */
.footer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
  line-height: 1.6;
}

.footer-brand {
  color: var(--gl-neutral-500);
}

.footer-brand strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.footer-sep {
  color: var(--gl-neutral-700);
  margin: 0 2px;
}

.footer-detail {
  color: var(--gl-neutral-500);
}

/* --- Utility --- */
.hidden {
  display: none !important;
}

/* --- Skip Navigation Link --- */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  padding: 8px;
  background: var(--accent);
  color: white;
  z-index: 1100;
  transition: top 0.15s;
  text-decoration: none;
  font-weight: 600;
  font-size: var(--text-body);
}

.skip-link:focus {
  top: 0;
}

/* --- Focus Styles --- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- Responsive: MacBook Air (1280px) --- */
@media (max-width: 1280px) {
  :root {
    --spacing-lg: 20px;
    --spacing-xl: 28px;
  }

  .gl-topbar-center {
    gap: var(--spacing-lg);
  }
}

/* --- Responsive: Wide Screens --- */
@media (min-width: 1200px) {
  .gl-main {
    max-width: calc(var(--max-width) + var(--sidebar-width) + 80px);
  }

  /* Prevent charts from stretching too wide */
  .chart-container {
    max-width: 900px;
  }

  .chart-with-sidecar {
    max-width: var(--max-width);
  }

  /* Constrain card grids */
  .card-grid {
    max-width: var(--max-width);
  }

  /* Pipeline hero doesn't need to be full width */
  .pipeline-hero {
    max-width: var(--max-width);
  }

  /* Groups grid cap */
  .enablement-groups-grid {
    max-width: var(--max-width);
  }

  /* Standalone adoption cards match sidecar width */
  #adoption-heatmap-card,
  #panel-adoption > .card {
    max-width: var(--max-width);
  }
}

/* --- Responsive: Tablet / Mobile --- */
@media (max-width: 768px) {
  .gl-topbar {
    flex-direction: column;
    height: auto;
    padding: var(--spacing-md);
    gap: var(--spacing-sm);
    position: relative;
  }

  .gl-sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 48px;
    flex-direction: row;
    justify-content: space-around;
    border-right: none;
    box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.08);
    border-top: 1px solid var(--gl-neutral-800);
    padding: 0;
    z-index: 200;
  }

  .gl-sidebar-item {
    width: auto;
    flex: 1;
    height: 48px;
    border-radius: 0;
  }

  .gl-sidebar-item[title]::after,
  .gl-sidebar-item[title]:hover::after {
    display: none;
    opacity: 0;
  }

  .gl-sidebar-item.active::before {
    left: 50%;
    right: auto;
    top: 0;
    bottom: auto;
    width: 24px;
    height: 3px;
    transform: translateX(-50%);
    border-radius: 0 0 2px 2px;
  }

  .gl-layout {
    flex-direction: column;
    padding-top: 0;
  }

  .gl-main {
    margin-left: 0;
    margin-bottom: 48px;
    padding: 16px;
    max-width: 100%;
  }

  .gl-footer {
    margin-left: 0;
    margin-bottom: 48px;
  }

  .gl-topbar-center {
    gap: var(--spacing-lg);
  }

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

  .card-full {
    grid-column: span 1;
  }

  .profiles-toolbar {
    flex-direction: column;
  }

  .profiles-filter-group,
  .profiles-action-group {
    width: 100%;
    flex-wrap: wrap;
  }

  .profiles-action-group {
    margin-left: 0;
  }

  .panel-intro {
    padding: var(--spacing-sm) var(--spacing-md);
  }

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

  .data-table {
    min-width: 600px;
  }

  .pipeline-hero {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 16px;
  }

  .pipeline-stages {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-sm);
  }

  .pipeline-stages::before {
    display: none;
  }

  .pipeline-arrow {
    display: none;
  }

  .pipeline-stage {
    flex: none;
    min-width: 0;
  }

  /* Charts: ensure readable on tablets */
  .chart-container {
    min-height: 140px;
    max-height: 240px;
  }

  .chart-container svg {
    max-height: 220px;
    height: auto;
  }

  /* Sidecar stacks on tablet */
  .chart-with-sidecar {
    grid-template-columns: 1fr;
  }

  /* Groups grid adjusts */
  .enablement-groups-grid {
    grid-template-columns: 1fr;
  }

  /* Top movers single column on tablet */
  .top-movers-grid {
    grid-template-columns: 1fr;
  }

  /* Shifts grid single column on tablet */
  .shifts-grid {
    grid-template-columns: 1fr;
  }

  /* Heatmap: ensure scrollable on tablet */
  #adoption-heatmap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .heatmap-table {
    min-width: 560px;
  }

  /* Touch-friendly inputs */
  .search-input,
  .filter-select,
  .gl-range {
    min-height: 40px;
  }

  .profiles-toolbar .search-input,
  .profiles-toolbar .filter-select {
    width: 100%;
  }

  /* Methodology tooltips: constrain width on narrow viewports */
  .methodology-tooltip {
    width: 280px;
    max-width: calc(100vw - 32px);
  }

  /* D3 chart tooltip: slightly smaller on tablet */
  .tooltip {
    max-width: 260px;
    font-size: var(--text-meta);
  }

  /* Safe area inset for iOS bottom nav */
  .gl-sidebar {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .gl-main {
    padding-bottom: calc(48px + env(safe-area-inset-bottom, 0) + var(--spacing-md));
  }
}

/* --- Responsive: Mobile --- */
@media (max-width: 480px) {
  html {
    font-size: 12px;
  }

  .gl-topbar-center {
    flex-wrap: wrap;
    justify-content: center;
  }

  .gl-topbar-tanuki {
    display: none;
  }

  .gl-topbar-page {
    display: none;
  }

  .gl-topbar-sep {
    display: none;
  }

  /* Pipeline stages wrap into rows on mobile */
  .pipeline-stages {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    gap: var(--spacing-xs);
  }

  .pipeline-stages::before {
    display: none;
  }

  .pipeline-stage {
    flex: 1 1 calc(50% - var(--spacing-xs));
    min-width: 0;
    padding: 8px;
  }

  .pipeline-arrow {
    display: none;
  }

  /* Pipeline hero tighter padding */
  .pipeline-hero {
    padding: 12px;
    gap: 12px;
  }

  /* Group cards single column */
  .enablement-groups-grid {
    grid-template-columns: 1fr;
  }

  /* Mover cards single column */
  .top-movers-grid {
    grid-template-columns: 1fr;
  }

  /* Shift cards single column */
  .shifts-grid {
    grid-template-columns: 1fr;
  }

  /* Filter bar stacks vertically */
  .gl-filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-sm);
  }

  .gl-filter-group {
    width: 100%;
    flex-wrap: wrap;
  }

  .gl-range {
    flex: 1;
    width: auto;
  }

  .gl-filter-label {
    width: 100%;
  }

  /* Profiles toolbar stacks */
  .profiles-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .profiles-search-group,
  .profiles-filter-group,
  .profiles-action-group {
    width: 100%;
  }

  .profiles-action-group {
    margin-left: 0;
  }

  .profiles-toolbar .search-input {
    width: 100%;
  }

  /* Chart with sidecar stacks */
  .chart-with-sidecar {
    grid-template-columns: 1fr;
  }

  /* Heatmap: scroll with compact cells */
  #adoption-heatmap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 calc(-1 * var(--spacing-md));
    padding: 0 var(--spacing-md);
  }

  .heatmap-table {
    min-width: 480px;
  }

  .heatmap-cell {
    padding: 8px 4px;
    min-width: 56px;
    font-size: var(--text-micro);
  }

  .heatmap-row-label {
    width: 100px;
    min-width: 100px;
    font-size: var(--text-micro);
  }

  /* Tables: tighter padding on mobile */
  .data-table th,
  .data-table td {
    padding: 8px 6px;
    font-size: var(--text-meta);
  }

  /* Summary stats in topbar wrap tighter */
  .summary-stat {
    min-width: 48px;
  }

  /* Prevent horizontal overflow */
  body {
    overflow-x: hidden;
  }

  .gl-main {
    padding: 12px;
  }

  /* Panel intro compact */
  .panel-intro {
    flex-direction: column;
    padding: var(--spacing-sm);
  }

  .intro-illustration {
    display: none;
  }

  /* Card padding compact */
  .card {
    padding: var(--spacing-md);
  }

  /* Chart containers compact */
  .chart-container {
    min-height: 120px;
    max-height: 200px;
  }

  .chart-container svg {
    max-height: 180px;
  }
}

/* --- Teams Tab --- */
.teams-toolbar {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  padding: 0 var(--spacing-xs);
}

.teams-sort-label {
  color: var(--text-secondary);
  font-size: var(--text-body);
}

.team-sort-btn {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: var(--text-meta);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.team-sort-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.team-sort-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* Override card-grid for team rows — single column list */
#teams-card-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
}

/* --- Project Tree --- */
.project-tree {
  font-size: var(--text-body);
  padding: var(--spacing-md);
}

.tree-header {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-md);
}

.tree-node {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--gl-neutral-800);
}

.tree-node:last-child {
  border-bottom: none;
}

.tree-connector {
  font-family: var(--font-mono);
  color: var(--gl-neutral-600);
  user-select: none;
  min-width: 16px;
  flex-shrink: 0;
  line-height: 1.4;
}

.tree-content {
  flex: 1;
  min-width: 0;
}

.tree-project-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.tree-project-name {
  font-weight: 600;
  color: var(--text-primary);
}

.tree-project-meta {
  font-size: var(--text-meta);
  color: var(--text-muted);
}

.tree-risk {
  font-size: var(--text-meta);
  font-weight: 600;
}

.tree-project-stats {
  font-size: var(--text-meta);
  color: var(--text-secondary);
  margin-top: 4px;
}

.tree-stat-sep {
  margin: 0 6px;
  color: var(--text-muted);
}

.tree-members {
  font-size: var(--text-meta);
  color: var(--text-muted);
  margin-top: 4px;
}

.tree-members-label {
  color: var(--text-secondary);
  font-weight: 600;
}

.tree-archetypes {
  margin-top: 6px;
}

/* --- Enablement Pipeline Hero --- */

.pipeline-hero {
  display: flex;
  align-items: center;
  gap: var(--spacing-xl);
  padding: var(--spacing-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: var(--spacing-lg);
  max-width: 100%;
  overflow: visible;
  box-sizing: border-box;
}

.pipeline-health {
  text-align: center;
  flex-shrink: 0;
}

.pipeline-health-label {
  font-size: var(--text-meta);
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: var(--spacing-xs);
}

.pipeline-stages {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  flex: 1;
  position: relative;
  min-width: 0;
}

/* Connecting line behind pipeline stages */
.pipeline-stages::before {
  content: '';
  position: absolute;
  top: 50%;
  left: var(--spacing-md);
  right: var(--spacing-md);
  height: 2px;
  background: var(--gl-neutral-700, #49484e);
  z-index: 0;
  pointer-events: none;
}

.pipeline-arrow {
  position: relative;
  z-index: 1;
  color: var(--gl-neutral-500, #737278);
  font-size: var(--text-meta);
  opacity: 0.6;
  flex-shrink: 0;
  line-height: 1;
}

.pipeline-stage {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 12px var(--spacing-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  min-width: 0;
  flex: 1 1 0%;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.pipeline-stage:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.pipeline-stage-active {
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(66, 143, 220, 0.2);
  outline: none;
}

.pipeline-stage-future {
  opacity: 0.5;
  border-style: dashed;
}

.pipeline-stage-icon {
  font-size: var(--text-title);
  margin-bottom: var(--spacing-xs);
}

.pipeline-stage-name {
  font-size: var(--text-micro);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--spacing-xs);
}

.pipeline-stage-stat {
  font-size: var(--text-title);
  font-weight: 700;
  line-height: 1.2;
}

.pipeline-stage-detail {
  font-size: var(--text-micro);
  color: var(--text-muted);
  margin-top: 2px;
}

.pipeline-narrative {
  padding: var(--spacing-md) 0;
  font-size: var(--text-body);
  color: var(--text-primary);
  line-height: 1.7;
}

.pipeline-narrative p {
  margin-bottom: var(--spacing-sm);
}

.pipeline-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 12px 28px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--text-body);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  margin-top: var(--spacing-md);
}

.pipeline-cta:hover {
  background: var(--gl-blue-500);
}

/* Responsive: stack pipeline on narrow screens */
@media (max-width: 900px) {
  .pipeline-hero {
    flex-direction: column;
    align-items: stretch;
  }
  .pipeline-stages {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-sm);
  }
  .pipeline-stages::before {
    display: none;
  }
  .pipeline-arrow {
    display: none;
  }
  .pipeline-stage {
    flex: none;
    min-width: 0;
  }
}

/* --- Enablement Summary --- */

.enablement-summary {
  padding: 12px var(--spacing-md);
  margin-bottom: 12px;
  background: var(--accent-dim);
  border-radius: var(--radius-sm);
}

.enablement-summary-value {
  font-size: var(--text-display);
  font-weight: 700;
  color: var(--accent);
}

.enablement-summary-label {
  font-size: var(--text-body);
  color: var(--text-secondary);
}

/* --- Play Links in Enablement Tables --- */

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

.play-link:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

/* --- Top Enablement Gaps Table Polish --- */

#gaps-table th {
  padding: 6px 12px;
  font-size: var(--text-micro);
  letter-spacing: 0.07em;
}

#gaps-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

#gaps-table tbody tr:hover {
  background: rgba(66, 143, 220, 0.06);
}

#gaps-table .play-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: rgba(66, 143, 220, 0.08);
  transition: background 0.15s, color 0.15s;
}

#gaps-table .play-link::after {
  content: "\2192";
  font-size: 0.85em;
  transition: transform 0.15s;
}

#gaps-table .play-link:hover {
  background: rgba(66, 143, 220, 0.15);
  text-decoration: none;
}

#gaps-table .play-link:hover::after {
  transform: translateX(2px);
}

.gap-delta {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-body);
  color: var(--accent);
  background: rgba(66, 143, 220, 0.10);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  margin-left: 4px;
}

/* --- CSV Export Button --- */

.btn-csv-export {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--text-meta);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.btn-csv-export:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

/* --- Inline Privacy Toggle --- */

.inline-privacy-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-meta);
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--spacing-xs) 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  transition: border-color 0.15s;
  white-space: nowrap;
}

.inline-privacy-toggle:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.inline-privacy-toggle input {
  accent-color: var(--gl-blue-400, #428fdc);
}

/* --- Pagination Controls --- */

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  margin: var(--spacing-md) auto;
  padding-top: var(--spacing-sm);
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  user-select: none;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.pagination-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 4px rgba(66, 143, 220, 0.25);
  border-color: var(--accent);
}

.pagination-btn:active:not(:disabled) {
  background: var(--border-color);
}

.pagination-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  color: var(--text-secondary);
  background: var(--bg-input);
  border-color: var(--border-color);
}

.pagination-info {
  color: var(--text-secondary);
  font-size: var(--text-body);
  font-family: var(--font-mono);
  white-space: nowrap;
  min-width: 10ch;
  text-align: center;
  letter-spacing: 0.02em;
}

/* --- Callout Banner (reusable component) --- */
.callout-banner {
  padding: 12px var(--spacing-md);
  margin-bottom: 12px;
  background: var(--accent-dim);
  border-radius: var(--radius-sm);
}

.callout-value {
  font-size: var(--text-display);
  font-weight: 700;
}

.callout-text {
  font-size: var(--text-body);
  color: var(--text-secondary);
}

/* --- Trends Interpretation --- */
.trends-interpretation {
  padding: var(--spacing-md) 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: var(--text-body);
  color: var(--text-secondary);
  line-height: 1.6;
  margin: var(--spacing-md) 0;
}

.trends-interpretation p {
  margin: 0;
}

/* --- Trends Summary Card (hero + narrative combined) --- */
.trends-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
}

.trends-summary-card .trends-interpretation {
  margin: var(--spacing-md) 0 0 0;
  border: none;
  background: rgba(66, 143, 220, 0.06);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
}

/* --- Profiles Guidance --- */
.profiles-guidance {
  font-size: var(--text-meta);
  color: var(--text-muted, #89888d);
  margin-top: var(--spacing-sm);
  padding: 0 var(--spacing-md) var(--spacing-xs);
}

/* --- Section Dividers (replaced progressive disclosure) --- */
.section-divider {
  margin: var(--spacing-xl) 0 var(--spacing-md);
  padding: var(--spacing-sm) 0;
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  letter-spacing: 0.01em;
}

/* --- Hide Confidence column by default (column 3) --- less useful than Influence --- */
#profiles-table th:nth-child(3),
#profiles-table td:nth-child(3) {
  display: none;
}

/* --- Compact profiles table (hide domain score columns 6-11) --- */
.profiles-compact th:nth-child(n+6):nth-child(-n+11),
.profiles-compact td:nth-child(n+6):nth-child(-n+11) {
  display: none;
}

/* --- Domain column toggle button --- */
.btn-secondary {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

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

/* --- Filter Bar (enablement controls) --- */
.gl-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 12px var(--spacing-md);
  background: var(--bg-primary);
  border: 1px solid var(--gl-neutral-700, #4c4b51);
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
  border-radius: var(--radius);
  margin-bottom: var(--spacing-md);
}

.gl-filter-bar .filter-select {
  font-size: var(--text-meta);
}

.gl-filter-label {
  font-size: var(--text-meta);
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.gl-filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gl-range {
  width: 100px;
  accent-color: var(--accent);
}

.gl-filter-value {
  font-size: var(--text-meta);
  color: var(--text-muted);
  font-family: var(--font-mono);
  min-width: 32px;
}

.gl-filter-count {
  font-size: var(--text-meta);
  color: var(--text-muted);
  margin-left: auto;
  font-family: var(--font-mono);
}

/* Clear filters button — visible but subdued */
.btn-clear-filters {
  margin-left: auto;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.btn-clear-filters:hover {
  color: var(--text-primary);
  background: var(--bg-input);
  border-color: var(--border-color);
}

/* Small button variant */
.btn-sm {
  font-size: var(--text-meta);
  padding: var(--spacing-xs) 12px;
}

/* --- Profile Detail Expansion --- */

.profile-detail-row td {
  padding: 0 !important;
  border-bottom: 1px solid var(--border-color);
}

.profile-detail {
  display: flex;
  gap: var(--spacing-lg);
  padding: var(--spacing-lg);
  background: var(--bg-primary, #18171d);
  align-items: flex-start;
  transition: opacity 0.2s ease-out;
}

/* Selected row indicator */
#panel-profiles .data-table tbody tr.profile-row-expanded {
  background: rgba(66, 143, 220, 0.08);
}

#panel-profiles .data-table tbody tr.profile-row-expanded td:first-child {
  text-decoration: underline;
  text-decoration-color: rgba(66, 143, 220, 0.4);
  text-underline-offset: 2px;
}

.profile-detail-radar {
  flex-shrink: 0;
  align-self: center;
}

.profile-detail-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.profile-detail-header {
  margin-bottom: 4px;
}

.profile-detail-archetype {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: 4px;
}

.profile-detail-confidence {
  font-size: var(--text-meta);
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 2px 8px;
  border-radius: 10px;
}

.profile-detail-domains {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-domain-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.profile-domain-label {
  width: 110px;
  font-size: var(--text-meta);
  font-weight: 500;
  flex-shrink: 0;
}

.profile-domain-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}

.profile-domain-fill {
  height: 100%;
  width: 100%;
  border-radius: 3px;
  transform-origin: left;
  transition: transform 0.3s ease-out;
}

.profile-domain-value {
  width: 36px;
  font-size: var(--text-meta);
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-align: right;
}

/* Gap recommendation — callout card */
.profile-detail-gap-card {
  background: rgba(66, 143, 220, 0.08);
  border: 1px solid rgba(66, 143, 220, 0.2);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-top: 4px;
}

.profile-gap-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.profile-gap-icon {
  font-size: 14px;
  line-height: 1;
}

.profile-gap-title {
  font-size: var(--text-meta);
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.profile-gap-body {
  margin-bottom: 6px;
}

.profile-gap-domains {
  font-size: var(--text-body);
  color: var(--text-primary);
}

.profile-gap-arrow {
  color: var(--accent);
  margin: 0 2px;
}

.profile-gap-play {
  font-size: var(--text-meta);
}

.profile-gap-play .play-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ============================================================
   Enablement Groups — Money View
   ============================================================ */

/* Summary banner — headline style for instant scanning */
.groups-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px var(--spacing-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 20px;
  max-width: 100%;
  box-sizing: border-box;
  overflow: visible;
  position: relative;
}

.groups-summary-headline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.groups-summary-stat {
  font-size: 36px;
  font-weight: 700;
  color: var(--gl-blue-400, #428fdc);
  line-height: 1;
  flex-shrink: 0;
  padding-top: 2px;
}

.groups-summary-subtitle {
  font-size: var(--text-title);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.groups-summary-detail {
  font-size: var(--text-meta);
  color: var(--text-muted);
  line-height: 1.5;
}

.enablement-groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--spacing-md);
  margin-top: var(--spacing-md);
  align-items: stretch;
}

.enablement-group-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: var(--spacing-lg);
  padding-top: calc(var(--spacing-lg) + 4px);
  padding-left: calc(var(--spacing-lg) + 28px);
  transition: border-color 0.15s;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.enablement-group-card:hover {
  border-color: var(--border-hover);
}

.enablement-group-card.eg-highlight {
  border-color: var(--accent, var(--gl-blue-400, #428fdc));
  box-shadow: 0 0 0 2px rgba(66, 143, 220, 0.25);
  animation: eg-highlight-pulse 1.5s ease-out;
}

@keyframes eg-highlight-pulse {
  0% { box-shadow: 0 0 0 4px rgba(66, 143, 220, 0.4); }
  100% { box-shadow: 0 0 0 2px rgba(66, 143, 220, 0.25); }
}

/* Priority rank badge — inset so it never clips the card edge */
.eg-rank {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 22px;
  height: 22px;
  background: var(--accent, var(--gl-blue-400, #428fdc));
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-micro);
  font-weight: 700;
  z-index: 1;
  line-height: 1;
}

/* Play name as hero — the primary CTA, largest text on the card */
.eg-play-hero {
  font-size: var(--text-title);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.35;
  letter-spacing: -0.01em;
}

.eg-play-hero a {
  color: var(--gl-blue-400, #428fdc);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}

.eg-play-hero a:hover {
  color: var(--gl-blue-300, #63a6e9);
  border-bottom-color: var(--gl-blue-300, #63a6e9);
}

/* Stats row — evenly spaced columns with dividers */
.eg-stats {
  display: flex;
  gap: 0;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 0;
}

.eg-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0%;
  min-width: 0;
  text-align: center;
  padding: 0 6px;
}

.eg-stat + .eg-stat {
  border-left: 1px solid var(--border-color);
}

.eg-stat-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.eg-stat-label {
  font-size: var(--text-micro);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 1px;
}

.eg-archetypes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.eg-archetypes .archetype-badge {
  font-size: var(--text-micro);
  padding: 1px 6px;
  line-height: 1.5;
  white-space: nowrap;
  border-radius: 3px;
}

.eg-member-more {
  font-size: var(--text-micro);
  color: var(--gl-neutral-500, #737278);
  font-style: italic;
  padding: var(--spacing-xs) 0;
}

/* --- Trends Hero --- */
.trends-hero {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
}

.trends-hero-stat {
  display: flex;
  align-items: baseline;
  gap: var(--spacing-xs);
  flex-shrink: 0;
}

.trends-hero-icon {
  font-size: var(--text-display);
  font-weight: 700;
  animation: gentlePulse 2s ease-in-out infinite;
}

@keyframes gentlePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.trends-hero-number {
  font-size: var(--text-display);
  font-weight: 700;
}

.trends-hero-text {
  font-size: var(--text-title);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
}

.trends-hero-breakdown {
  display: flex;
  gap: var(--spacing-md);
  font-size: var(--text-meta);
  font-weight: 600;
}

/* --- Top Movers --- */
.top-movers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  margin-bottom: var(--spacing-lg);
}

.mover-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 14px var(--spacing-md);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s, opacity 0.1s;
}

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

.mover-card:active {
  transform: scale(0.98);
  opacity: 0.9;
}

.mover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-sm);
}

.mover-name {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
}

.mover-trajectory {
  font-size: var(--text-meta);
  font-weight: 600;
}

.mover-deltas {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.mover-delta-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mover-delta-label {
  width: 90px;
  font-size: var(--text-micro);
  color: var(--text-secondary);
  text-transform: none;
  white-space: nowrap;
  flex-shrink: 0;
  text-align: right;
  line-height: 1;
}

.mover-delta-bar {
  flex: 1;
  min-width: 100px;
  height: 6px;
  background: var(--gl-neutral-800, #2b2a31);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.mover-delta-center {
  position: absolute;
  left: 50%;
  top: 0;
  width: 1px;
  height: 100%;
  background: var(--gl-neutral-600, #626168);
  z-index: 1;
}

.mover-delta-fill {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: var(--radius-sm);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.mover-delta-value {
  width: 36px;
  font-size: var(--text-meta);
  font-family: var(--font-mono);
  text-align: right;
  flex-shrink: 0;
  line-height: 1;
}

.mover-transition {
  margin-top: var(--spacing-sm);
  padding-top: var(--spacing-sm);
  border-top: 1px solid var(--border-color);
  font-size: var(--text-meta);
}

/* --- Overflow containment --- */
.card, .card-full, .callout-banner, .profiles-count {
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

/* --- Gap Domain Summary Bars --- */

.gap-domain-bars {
  padding: var(--spacing-md) 0;
  margin-bottom: var(--spacing-md);
}

.gap-domain-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: 6px;
  padding: 2px 4px;
  transition: background 0.15s ease;
}

.gap-domain-row:hover {
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
}

.gap-domain-label {
  width: 130px;
  font-size: var(--text-meta);
  font-weight: 600;
  color: var(--text-secondary);
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}

.gap-domain-bar-bg {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.gap-domain-bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transform-origin: left;
}

.gap-domain-count {
  width: 70px;
  font-size: var(--text-meta);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* --- Workshop Order Cards --- */
.workshop-order {
  margin-top: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.workshop-order-heading {
  font-size: var(--text-body);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 var(--spacing-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.workshop-order-cards {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.workshop-order-card {
  flex: 1 1 0;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, background 0.15s;
}

.workshop-order-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.workshop-order-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: var(--text-body);
  font-weight: 700;
  color: var(--gl-neutral-0);
  flex-shrink: 0;
}

.workshop-order-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.workshop-order-domain {
  font-size: var(--text-meta);
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.workshop-order-play {
  font-size: var(--text-body);
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

a.workshop-order-play:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.workshop-order-count {
  font-size: var(--text-title);
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
  line-height: 1.2;
}

.workshop-order-count small {
  display: block;
  font-size: var(--text-meta);
  font-weight: 400;
  color: var(--text-muted);
}

/* --- Copy invite button — subtle, right-aligned at card bottom --- */
.eg-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 4px 10px;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--text-micro);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  align-self: flex-end;
}

.eg-copy-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--gl-blue-400, #428fdc);
  color: var(--gl-blue-400, #428fdc);
}

.eg-copy-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  margin-left: auto;
  margin-top: auto;
  padding: 3px 8px;
  font-size: var(--text-micro);
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-align: right;
  align-self: flex-end;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.eg-copy-btn-ghost:hover {
  border-color: var(--border-color);
  color: var(--text-secondary);
  background: none;
}

/* ============================================================
   Methodology Tooltips — explain how metrics are calculated
   ============================================================ */

.methodology-trigger {
  position: relative;
  cursor: help;
  color: var(--text-muted);
  font-size: var(--text-body);
  margin-left: 6px;
  vertical-align: middle;
  font-weight: 400;
}

.methodology-tooltip {
  position: absolute;
  left: 0;
  top: var(--spacing-lg);
  width: 320px;
  max-width: calc(100vw - 32px);
  padding: 12px var(--spacing-md);
  background: var(--gl-neutral-1000, #050506);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: var(--text-meta);
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.6;
  z-index: 10000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  text-transform: none;
  letter-spacing: normal;
  white-space: normal;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.1s ease, visibility 0.1s ease;
}

.methodology-trigger:hover .methodology-tooltip,
.methodology-trigger:focus .methodology-tooltip,
.methodology-trigger.active .methodology-tooltip {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

/* Right-align tooltip when it would overflow the right edge */
.methodology-tooltip-right {
  left: auto;
  right: 0;
}

/* Methodology tooltip inside table headers — needs special z-index */
.data-table th .methodology-trigger {
  font-size: var(--text-meta);
}

.data-table th .methodology-tooltip {
  z-index: 10010;
}

/* ============================================================
   About Page — Methodology Reference
   ============================================================ */

.about-content {
  max-width: 720px;
}

.about-content h3 {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
  margin: var(--spacing-lg) 0 var(--spacing-sm);
}

.about-content h3:first-child {
  margin-top: 0;
}

.about-content p {
  font-size: var(--text-body);
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 10px;
  max-width: 680px;
}

.about-content ul {
  margin: var(--spacing-sm) 0 var(--spacing-md) 20px;
  font-size: var(--text-body);
  color: var(--text-secondary);
  line-height: 1.75;
}

.about-content code {
  font-family: var(--font-mono);
  font-size: var(--text-meta);
  background: var(--bg-card-hover);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gl-neutral-800, #3a383f);
}

.about-pipeline-visual {
  text-align: center;
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.about-pipeline-visual code {
  font-size: var(--text-title);
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
  font-family: var(--font-mono);
  background: none;
  border: none;
  padding: 0;
}

.about-content h3[id] {
  scroll-margin-top: calc(var(--header-height) + var(--spacing-md));
}

.about-code-block {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin: 8px 0 16px;
  overflow-x: auto;
}

.about-code-block code {
  font-family: var(--font-mono);
  font-size: var(--text-meta);
  color: var(--text-secondary);
  white-space: pre;
  display: block;
  line-height: 1.6;
}

/* --- Health Score Breakdown --- */
.health-breakdown {
  margin-top: var(--spacing-md);
  padding: var(--spacing-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.health-breakdown-title {
  font-size: var(--text-title);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-xs);
}

.health-breakdown-subtitle {
  font-size: var(--text-meta);
  color: var(--gl-neutral-400, #89888d);
  margin-bottom: var(--spacing-md);
  line-height: 1.5;
}

.health-factor {
  margin-bottom: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.health-factor:hover {
  background: var(--accent-dim);
  box-shadow: inset 3px 0 0 var(--accent);
}

.health-factor:active {
  opacity: 0.8;
}

@keyframes fillBar {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.health-factor-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--spacing-xs);
}

.health-factor-name {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
}

.health-factor-nav-hint {
  font-size: var(--text-meta);
  color: var(--text-muted);
  opacity: 0;
  margin-left: var(--spacing-xs);
  transition: opacity 0.15s ease;
}

.health-factor:hover .health-factor-nav-hint {
  opacity: 1;
}

.health-factor-weight {
  font-weight: 400;
  color: var(--text-muted);
  font-size: var(--text-meta);
}

.health-factor-value {
  font-size: var(--text-title);
  font-weight: 700;
  font-family: var(--font-mono);
}

.health-factor-bar {
  height: var(--spacing-sm);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: var(--spacing-xs);
}

.health-factor-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transform-origin: left;
  animation: fillBar 0.6s ease-out backwards;
}

.health-factor-tip {
  font-size: var(--text-meta);
  color: var(--text-muted);
}

.health-improvement {
  margin-top: var(--spacing-lg);
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--accent-dim);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: var(--text-body);
  color: var(--text-primary);
  line-height: 1.6;
}

.health-improvement-label {
  display: inline-block;
  font-size: var(--text-meta);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: var(--spacing-xs);
}

.health-improvement-body {
  color: var(--text-secondary);
  line-height: 1.6;
}

.health-improvement-link {
  display: inline-block;
  margin-top: var(--spacing-sm);
  font-size: var(--text-meta);
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}
.health-improvement-link:hover {
  text-decoration: underline;
}

/* --- Chart with Sidecar --- */
.chart-with-sidecar {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  align-items: stretch;
}

.chart-card {
  min-width: 0;
}

.chart-card .chart-container {
  max-height: 280px;
}

.sidecar-card {
  padding: var(--spacing-lg);
  min-width: 0;
}

.sidecar-title {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
}

.sidecar-text {
  font-size: var(--text-meta);
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: var(--spacing-sm);
}

.sidecar-list {
  font-size: var(--text-meta);
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 8px 0 12px 16px;
  padding: 0;
}

.sidecar-list li {
  margin-bottom: 2px;
}

.sidecar-card a,
.card .sidecar-text a,
.card .sidecar-list a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.sidecar-card a:hover,
.card .sidecar-text a:hover,
.card .sidecar-list a:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

@media (max-width: 900px) {
  .chart-with-sidecar {
    grid-template-columns: 1fr;
  }
}

/* Sidecar stays in HTML order (chart left, sidecar right) */

/* --- Gap Cell in Profiles Table --- */
.gap-cell {
  font-size: var(--text-meta);
  font-family: var(--font-mono);
  white-space: nowrap;
  max-width: 160px;
  letter-spacing: 0.03em;
}

.gap-strong {
  color: var(--gl-blue-300, #63a6e9);
  font-weight: 600;
}

.gap-weak {
  color: var(--gl-neutral-400, #89888d);
}

/* --- Archetype Shifts --- */
.shifts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.shift-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: var(--text-meta);
  min-width: 0;
  min-height: 120px;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
}

.shift-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Shift direction conveyed by internal .shift-direction-label + .shift-arrow */

.shift-transition {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.shift-arrow {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.shift-broadening .shift-arrow {
  color: var(--gl-green-400);
}

.shift-narrowing .shift-arrow {
  color: var(--gl-orange-400);
}

.shift-count-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.shift-count {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1;
}

.shift-count-total {
  font-size: var(--text-meta);
  font-weight: 400;
  color: var(--text-muted);
  font-family: var(--font-mono);
  line-height: 1.6;
}

.shift-direction-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  line-height: 1.4;
}

.shift-broadening .shift-direction-label {
  color: var(--gl-green-400);
  background: rgba(45, 161, 96, 0.12);
}

.shift-narrowing .shift-direction-label {
  color: var(--gl-orange-400);
  background: rgba(193, 125, 16, 0.12);
}
/* --- Archetype Network --- */
#archetype-network {
  min-height: 300px;
  max-height: 480px;
  overflow: hidden;
  position: relative;
}

#archetype-network svg {
  width: 100%;
  display: block;
}

#archetype-network .network-nodes circle {
  transition: fill-opacity 0.12s, stroke-opacity 0.12s;
}

#archetype-network .network-legend text {
  font-family: var(--font-sans);
}

/* --- Adoption Heatmap --- */
#adoption-heatmap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#adoption-heatmap-card,
#archetype-network-card,
#panel-adoption > .card {
  max-width: 100%;
  margin-bottom: var(--spacing-md);
}

#archetype-network-card {
  overflow: hidden;
}

.heatmap-hint {
  font-size: var(--text-meta);
  color: var(--text-muted);
  margin: 0 0 8px 0;
  font-style: italic;
}

.heatmap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 3px;
  font-size: var(--text-meta);
  font-family: var(--font-mono);
  table-layout: fixed;
  min-width: 560px;
}

.heatmap-table th {
  font-size: var(--text-meta);
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  padding: 6px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.heatmap-row-label {
  padding: var(--spacing-xs) var(--spacing-sm);
  white-space: nowrap;
  width: 140px;
  min-width: 140px;
}

.heatmap-cell {
  text-align: center;
  padding: 10px 8px;
  font-weight: 600;
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  min-width: 72px;
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color 0.15s ease;
}

.heatmap-cell:hover {
  outline-color: var(--accent);
}

/* --- Auto-generated Narrative Insights --- */
.auto-insight {
  font-size: var(--text-body);
  color: var(--text-secondary);
  line-height: 1.6;
  margin-top: 12px;
  padding: 12px var(--spacing-md);
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
}

/* ============================================================
   Print Styles — QBR-ready multi-page output
   ============================================================ */
@media print {
  /* --- Suppress screen-only behaviors --- */
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }

  /* --- Hide interactive chrome --- */
  .gl-topbar,
  .gl-sidebar,
  .gl-topbar-toggle, .inline-privacy-toggle,
  .skip-link,
  .profiles-toolbar,
  .gl-filter-bar,
  .teams-toolbar,
  .pagination-controls,
  .btn, .btn-secondary, .btn-csv-export,
  .eg-copy-btn, .eg-copy-btn-ghost,
  .pipeline-cta,
  .tooltip,
  .loading-state,
  .error-state,
  .methodology-trigger,
  .profiles-guidance,
  .empty-state-card {
    display: none !important;
  }

  /* --- White background, dark text --- */
  body {
    background: white;
    color: #222;
    font-size: 11pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* --- Layout reset --- */
  .gl-layout {
    display: block;
    padding-top: 0;
  }

  .gl-main {
    margin-left: 0;
    padding: 0;
    max-width: 100%;
    overflow: visible;
  }

  .gl-footer {
    margin-left: 0;
    margin-bottom: 0;
    border-top-color: #ccc;
    color: #666;
    page-break-before: always;
  }

  .footer-brand strong {
    color: #222;
  }

  /* --- All tab panels visible, each on its own page --- */
  .tab-panel {
    display: block !important;
    page-break-before: always;
    overflow: visible;
    max-width: 100%;
  }

  .tab-panel:first-of-type {
    page-break-before: avoid;
  }

  /* Print section headings (sidebar is hidden, so label each page) */
  .tab-panel::before {
    display: block;
    font-size: 18pt;
    font-weight: 700;
    color: #111;
    margin-bottom: 12pt;
    padding-bottom: 6pt;
    border-bottom: 2px solid #333;
  }

  #panel-health::before  { content: "Health Overview"; }
  #panel-adoption::before { content: "Adoption Analysis"; }
  #panel-gaps::before     { content: "Enablement Gaps"; }
  #panel-profiles::before { content: "User Profiles"; }
  #panel-groups::before   { content: "Workshop Groups"; }
  #panel-trends::before   { content: "Trends"; }
  #panel-about::before    { content: "About \2014  Methodology"; }

  /* --- Cards and containers --- */
  .card, .card-full, .pipeline-hero, .health-breakdown,
  .enablement-group-card, .mover-card, .shift-card,
  .trends-hero, .trends-summary-card, .heatmap-cell, .about-pipeline-visual,
  .groups-summary, .panel-intro, .callout-banner,
  .profile-detail-gap-card, .profile-metric-card {
    border-color: #ccc;
    background: white;
    color: #222;
    box-shadow: none;
    break-inside: avoid;
    overflow: visible;
  }

  .card-grid {
    break-inside: avoid;
  }

  /* --- Typography --- */
  .card-title, .sidecar-title, .health-breakdown-title,
  .pipeline-stage-name, .eg-play-hero, .section-divider,
  .about-content h3,
  .workshop-order-heading, .workshop-order-count,
  .profile-metric-value {
    color: #222;
  }

  .card-subtitle, .sidecar-text, .auto-insight,
  .pipeline-narrative, .health-factor-tip, .intro-text,
  .about-content p, .about-content ul, .trends-interpretation,
  .health-improvement, .profile-detail-description {
    color: #444;
  }

  .stat-value,
  .pipeline-stage-stat, .eg-stat-value {
    color: #222;
  }

  .stat-label,
  .pipeline-stage-detail, .profile-metric-label,
  .profile-domain-value, .profile-metric-rank {
    color: #666;
  }

  .section-divider {
    border-bottom-color: #999;
  }

  .eg-members-flow {
    max-height: none;
    overflow: visible;
    color: #666;
    border-top-color: #ddd;
  }

  .eg-member-link {
    color: #444;
  }

  /* --- Tables --- */
  .table-container {
    overflow: visible;
  }

  .data-table {
    min-width: 0;
    font-size: 10pt;
    width: 100%;
  }

  .data-table th {
    background: #f5f5f5;
    color: #333;
    border-bottom: 2px solid #999;
    position: static;
  }

  .data-table td {
    border-bottom: 1px solid #ddd;
    color: #222;
  }

  /* Prevent table rows from splitting across pages */
  .data-table tr {
    break-inside: avoid;
  }

  /* Repeat table header on each printed page */
  .data-table thead {
    display: table-header-group;
  }

  .data-table tfoot {
    display: table-footer-group;
  }

  .heatmap-table th {
    color: #444;
  }

  /* Profile detail rows print inline */
  .profile-detail-row td {
    background: #fafafa;
    color: #333;
  }

  .profile-domain-bar {
    background: #e5e5e5;
  }

  /* --- Charts: sufficient contrast on white background --- */
  .chart-container {
    max-height: none;
    overflow: visible;
    break-inside: avoid;
  }

  .chart-container svg {
    max-height: none;
  }

  /* Override inline D3 dark-mode colors for axes and gridlines */
  .chart-container svg text {
    fill: #333 !important;
  }

  .chart-container svg .domain {
    stroke: #999 !important;
  }

  .chart-container svg .tick line {
    stroke: #ccc !important;
  }

  /* Preserve intentional colored elements (bars, areas, circles) */
  .chart-container svg rect,
  .chart-container svg circle,
  .chart-container svg path:not(.domain) {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* --- Pipeline hero prints stacked --- */
  .pipeline-hero {
    flex-direction: column;
    align-items: stretch;
    background: white;
  }

  .pipeline-stages::before {
    display: none;
  }

  .pipeline-stage {
    background: white;
    border-color: #ccc;
  }

  .pipeline-stage-future {
    opacity: 0.7;
  }

  /* --- Archetype badges: solid borders for print --- */
  .archetype-badge {
    border-width: 1px;
    border-style: solid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* --- Chart with sidecar: single column for print --- */
  .chart-with-sidecar {
    grid-template-columns: 1fr;
  }

  /* --- Links: show URLs in print --- */
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #666;
  }

  /* --- Enablement groups grid: 2 columns for print --- */
  .enablement-groups-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* --- Rank badges: print with background color --- */
  .eg-rank {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    background: #428fdc;
  }

  /* --- Score bars use exact colors --- */
  .health-factor-bar, .profile-domain-bar, .gap-domain-bar-bg,
  .mover-delta-bar, .workshop-order-num {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .health-factor {
    cursor: default;
    padding: 0;
  }

  .health-factor-fill {
    animation: none;
  }

  .health-factor-nav-hint {
    display: none;
  }

  .health-improvement {
    border-left-color: #428fdc;
    background: #eef4fc;
  }

  .workshop-order-card {
    border-color: #ccc;
    background: #fff;
    break-inside: avoid;
  }

  .workshop-order-play {
    color: #0b5394;
  }

  /* --- About page: full methodology prints completely --- */
  .about-content {
    max-width: 100%;
  }

  .about-content p {
    max-width: 100%;
  }

  .about-content code {
    background: #f0f0f0;
    border-color: #ccc;
    color: #333;
  }

  .about-pipeline-visual {
    background: #f8f8f8;
    border-color: #ccc;
  }

  .about-pipeline-visual code {
    color: #0b5394;
  }

  .about-code-block {
    background: #f5f5f5;
    border-color: #ccc;
    break-inside: avoid;
  }

  .about-code-block code {
    color: #333;
  }

  /* Prevent about headings from being orphaned at page bottom */
  .about-content h3 {
    break-after: avoid;
  }
}

/* Flowing member list — compact comma-separated names */
.eg-members-flow {
  font-size: var(--text-meta);
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-color);
  flex: 1;
}

.eg-member-link {
  color: var(--gl-neutral-300, #a4a3a8);
  text-decoration: none;
}

.eg-member-link:hover {
  color: var(--gl-blue-400, #428fdc);
  text-decoration: underline;
}

/* Profile detail — metrics as pill cards */
.profile-detail-metrics {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
  margin-top: 4px;
}

.profile-metric-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 8px 14px;
  min-width: 100px;
}

.profile-metric-card.momentum-up {
  border-color: rgba(89, 161, 79, 0.3);
  background: rgba(89, 161, 79, 0.06);
}

.profile-metric-card.momentum-down {
  border-color: rgba(225, 87, 89, 0.3);
  background: rgba(225, 87, 89, 0.06);
}

.profile-metric-card.momentum-stable {
  border-color: rgba(255,255,255,0.08);
}

.profile-metric-label {
  font-size: var(--text-micro);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.profile-metric-value {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--text-primary);
}

.momentum-up .profile-metric-value {
  color: var(--gl-green-400, #59a14f);
}

.momentum-down .profile-metric-value {
  color: var(--gl-red-400, #e15759);
}

.momentum-stable .profile-metric-value {
  color: var(--text-secondary);
}

.profile-metric-rank {
  font-size: var(--text-micro);
  color: var(--text-muted);
  font-weight: 400;
}

/* Profile detail — archetype description */
.profile-detail-description {
  font-size: var(--text-body);
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
  font-style: italic;
}

/* Profile detail — archetype affinities */
.profile-affinities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

.profile-affinities-label {
  font-size: var(--text-small);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 4px;
}

.affinity-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--surface-secondary);
  border-radius: 12px;
  font-size: var(--text-small);
  border: 1px solid var(--border);
}

.affinity-chip.affinity-primary {
  border-color: var(--accent);
  background: rgba(66, 143, 220, 0.08);
}

.affinity-name {
  color: var(--text-secondary);
}

.affinity-primary .affinity-name {
  color: var(--text-primary);
}

.affinity-dots {
  color: var(--accent);
  letter-spacing: 1px;
  font-size: 10px;
}

/* --- Profiles table horizontal scroll --- */
#panel-profiles .table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  margin: 0 -24px;
  padding: 0 24px;
}

#panel-profiles .table-container::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 24px;
  background: linear-gradient(to right, transparent, var(--bg-card));
  pointer-events: none;
}

/* Make spider chart column more visible */
.sparkline-cell {
  text-align: center;
  vertical-align: middle;
  padding: 4px !important;
  width: 52px;
  min-width: 52px;
  max-width: 52px;
}

.sparkline-cell svg {
  display: inline-block;
  vertical-align: middle;
}

/* --- Compact profiles table column widths --- */

/* Domain score columns (6-11): narrow padding, compact */
#profiles-table th:nth-child(n+6):nth-child(-n+11),
#profiles-table td:nth-child(n+6):nth-child(-n+11) {
  padding: 6px 4px;
  white-space: nowrap;
  font-size: var(--text-meta);
}

#profiles-table th:nth-child(n+6):nth-child(-n+11) {
  font-size: 10px;
  letter-spacing: 0.03em;
}

/* Gap column: compact */
#profiles-table th:nth-child(5),
#profiles-table td:nth-child(5) {
  padding: 6px 6px;
  white-space: nowrap;
}

/* User column: constrain width */
#profiles-table th:nth-child(1),
#profiles-table td:nth-child(1) {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Influence column: narrow */
#profiles-table th:nth-child(4),
#profiles-table td:nth-child(4) {
  padding: 6px 6px;
  white-space: nowrap;
}

/* --- Accessibility: reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  .trends-hero-icon {
    animation: none;
  }
  .mover-delta-fill {
    transition: none;
  }
}
