/* =============================================================================
   Code Explorer - Editorial Data Viz Theme

   "Data viz, not SaaS" - Minimalist print-inspired design with warm beige
   palette, monospace typography, and clean visual hierarchy.
   ============================================================================= */

/* =============================================================================
   CSS Variables - Editorial Palette
   ============================================================================= */

:root {
  /* Blueprint Theme - Technical Drawing Aesthetic */
  --color-blueprint-base: #082B5A;
  --color-blueprint-light: rgba(255, 255, 255, 0.9);
  --color-blueprint-white: #FFFFFF;
  --color-blueprint-grid: rgba(255, 255, 255, 0.15);

  /* Keep editorial colors for UI elements */
  --color-beige-base: #D4C9A8;
  --color-beige-light: #E8E0CC;
  --color-beige-dark: #C9B8A0;
  --color-red-accent: #E63946;
  --color-coral: #D97560;
  --color-peach: #E8B8A0;
  --color-teal: #5A8A8A;
  --color-line: #999999;
  --color-text-dark: #333333;
  --color-text-muted: #666666;
  --color-canvas: #0A0A1A;
  /* Blueprint background */
  --color-card: #F5F2E8;
  /* Light beige for cards and dropdowns */

  /* Typography */
  --font-mono: 'Fira Code', 'Courier New', 'Courier', Monaco, monospace;
  --font-size-tiny: 0.5rem;
  --font-size-small: 0.5625rem;
  --font-size-label: 0.6875rem;
  --font-size-body: 0.75rem;
  --letter-spacing-wide: 0.125rem;
  --letter-spacing-normal: 0.0625rem;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
}

/* =============================================================================
   Reset & Base
   ============================================================================= */

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-mono);
  background: var(--color-canvas);
  color: var(--color-text-dark);
}

#app {
  width: 100%;
  height: 100%;
}

/* =============================================================================
   Full-Screen Visualization Canvas
   ============================================================================= */

.explorer-app {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--color-canvas);
}

#viz {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

#viz svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* =============================================================================
   Status Panel (Temporary - will be replaced by NarrativePanel)
   ============================================================================= */

.status-panel {
  position: fixed;
  top: var(--spacing-md);
  left: var(--spacing-md);
  background-color: rgba(212, 201, 168, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  padding: var(--spacing-md);
  z-index: 100;
  font-family: var(--font-mono);
  max-width: 300px;
}

.status-panel h2 {
  font-size: var(--font-size-label);
  font-weight: bold;
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-text-dark);
  margin: 0 0 var(--spacing-sm) 0;
  padding-bottom: var(--spacing-xs);
  border-bottom: 1px solid var(--color-line);
}

.status-panel p {
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
  margin: var(--spacing-xs) 0;
}

/* =============================================================================
   Floating Control Panel - Editorial Style
   ============================================================================= */

.floating-panel {
  position: fixed;
  background-color: rgba(212, 201, 168, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  padding: var(--spacing-md);
  z-index: 100;
  font-family: var(--font-mono);
}

.floating-panel--top-left {
  top: var(--spacing-md);
  left: var(--spacing-md);
}

.floating-panel--top-right {
  top: var(--spacing-md);
  right: var(--spacing-md);
}

.floating-panel--bottom-left {
  bottom: var(--spacing-md);
  left: var(--spacing-md);
}

.floating-panel--bottom-right {
  bottom: var(--spacing-md);
  right: var(--spacing-md);
}

/* Panel Title */
.panel-title {
  font-family: var(--font-mono);
  font-size: var(--font-size-label);
  font-weight: bold;
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-text-dark);
  margin: 0 0 var(--spacing-md) 0;
  padding-bottom: var(--spacing-sm);
  border-bottom: 1px solid var(--color-line);
}

/* Section Headers */
.section-label {
  font-family: var(--font-mono);
  font-size: var(--font-size-small);
  font-weight: bold;
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: var(--spacing-md) 0 var(--spacing-xs) 0;
}

/* =============================================================================
   Editorial Buttons
   ============================================================================= */

.btn-editorial {
  font-family: var(--font-mono);
  font-size: var(--font-size-small);
  font-weight: bold;
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--color-line);
  background-color: transparent;
  color: var(--color-text-dark);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-editorial:hover {
  background-color: var(--color-beige-light);
  border-color: var(--color-text-dark);
}

.btn-editorial--active,
.btn-editorial:active {
  background-color: var(--color-red-accent);
  border-color: var(--color-red-accent);
  color: white;
}

/* Button Group - connected buttons */
.btn-group {
  display: flex;
}

.btn-group .btn-editorial {
  margin: 0;
}

.btn-group .btn-editorial:not(:first-child) {
  border-left: none;
}

.btn-group .btn-editorial:first-child {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.btn-group .btn-editorial:last-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

/* =============================================================================
   Editorial Select Dropdowns
   ============================================================================= */

.select-editorial {
  font-family: var(--font-mono);
  font-size: var(--font-size-small);
  letter-spacing: var(--letter-spacing-normal);
  padding: var(--spacing-xs) var(--spacing-sm);
  border: 1px solid var(--color-line);
  background-color: transparent;
  color: var(--color-text-dark);
  cursor: pointer;
  min-width: 140px;
}

.select-editorial:focus {
  outline: none;
  border-color: var(--color-text-dark);
}

/* =============================================================================
   Control Groups
   ============================================================================= */

.control-row {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--spacing-sm);
}

.control-section {
  margin-bottom: var(--spacing-md);
}

/* Divider */
.divider {
  width: 1px;
  height: 24px;
  background-color: var(--color-line);
  margin: 0 var(--spacing-xs);
}

/* =============================================================================
   Info Text
   ============================================================================= */

.info-text {
  font-family: var(--font-mono);
  font-size: var(--font-size-tiny);
  letter-spacing: var(--letter-spacing-normal);
  line-height: 1.8;
  color: var(--color-text-muted);
}

/* Error message */
.error-message {
  font-family: var(--font-mono);
  font-size: var(--font-size-small);
  color: var(--color-red-accent);
  padding: var(--spacing-sm);
  background: rgba(230, 57, 70, 0.1);
  border: 1px solid var(--color-red-accent);
}

/* =============================================================================
   Color Key / Legend Panel
   ============================================================================= */

.legend-panel {
  min-width: 160px;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.legend-color {
  width: 14px;
  height: 14px;
  border: 1px solid var(--color-line);
  flex-shrink: 0;
}

.legend-label {
  font-family: var(--font-mono);
  font-size: var(--font-size-tiny);
  color: var(--color-text-dark);
  letter-spacing: var(--letter-spacing-normal);
}

/* =============================================================================
   Node Styles (Visualization)
   ============================================================================= */

.node circle {
  cursor: pointer;
}

.node text {
  pointer-events: none;
  fill: var(--color-text-dark);
  font-family: var(--font-mono);
  font-size: 9px;
  text-anchor: middle;
  dominant-baseline: middle;
  opacity: 0;
  transition: opacity 0.2s;
}

.node:hover text {
  opacity: 1;
}

/* =============================================================================
   Link Styles
   ============================================================================= */

.link {
  fill: none;
  stroke: var(--color-teal);
  stroke-opacity: 0.5;
  stroke-width: 1;
  transition: stroke 0.15s, stroke-opacity 0.15s, stroke-width 0.15s;
}

/* =============================================================================
   Highlight States
   ============================================================================= */

circle.highlighted-source {
  stroke: var(--color-red-accent) !important;
  stroke-width: 4px !important;
  filter: drop-shadow(0 0 6px rgba(230, 57, 70, 0.6));
}

circle.highlighted-upstream {
  stroke: var(--color-teal) !important;
  stroke-width: 3px !important;
  filter: drop-shadow(0 0 5px rgba(90, 138, 138, 0.6));
}

circle.highlighted-downstream {
  stroke: var(--color-coral) !important;
  stroke-width: 3px !important;
  filter: drop-shadow(0 0 5px rgba(217, 117, 96, 0.6));
}

.dimmed {
  opacity: 0.35 !important;
  transition: none !important;
}

.dimmed circle {
  filter: none !important;
}

.highlighted-link {
  stroke: var(--color-red-accent) !important;
  stroke-width: 2px !important;
  stroke-opacity: 0.8 !important;
}

.dimmed-link {
  stroke-opacity: 0.5 !important;
}

/* =============================================================================
   Scene-Specific Styles
   ============================================================================= */

.node {
  transition: none;
}

.tree-scene .package-node,
.tree-scene .non-tree-module {
  opacity: 0.06;
}

.tree-link {
  transition: opacity 0.5s ease-in-out;
}

/* =============================================================================
   Tooltip - Matches Floating Panel Style (v2)
   ============================================================================= */

.psd3-tooltip {
  position: fixed;
  z-index: 1000;
  /* Match floating panel background and blur */
  background-color: rgba(212, 201, 168, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  /* Safari support */
  color: var(--color-text-dark);
  padding: var(--spacing-md);
  border: 1px solid var(--color-line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  font-family: var(--font-mono);
  font-size: var(--font-size-small);
  line-height: 1.6;
  max-width: 300px;
  pointer-events: none;
}

.tooltip-header {
  font-weight: bold;
  font-size: var(--font-size-label);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-text-dark);
  margin-bottom: var(--spacing-sm);
  padding-bottom: var(--spacing-xs);
  border-bottom: 1px solid var(--color-line);
  word-break: break-all;
}

.tooltip-package {
  font-size: var(--font-size-tiny);
  color: var(--color-text-muted);
  letter-spacing: var(--letter-spacing-normal);
  margin-bottom: var(--spacing-sm);
  padding-bottom: var(--spacing-xs);
  border-bottom: 1px solid var(--color-line);
}

.tooltip-metrics {
  margin-top: var(--spacing-xs);
}

.tooltip-metric {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
  font-size: var(--font-size-tiny);
  letter-spacing: var(--letter-spacing-normal);
}

.metric-label {
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.metric-value {
  color: var(--color-text-dark);
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}

/* =============================================================================
   Loading State
   ============================================================================= */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-family: var(--font-mono);
  font-size: var(--font-size-label);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* =============================================================================
   Call Graph Highlighting (Declaration Hover)
   ============================================================================= */

/* Source module - the module containing the hovered declaration (cyan) */
g.module-pack.highlight-source {
  filter: drop-shadow(0 0 12px rgba(125, 211, 252, 0.8));
}

g.module-pack.highlight-source circle {
  stroke: #7dd3fc !important;
  stroke-width: 3px !important;
}

/* Caller modules - modules that call this function (orange) */
g.module-pack.highlight-caller {
  filter: drop-shadow(0 0 10px rgba(249, 115, 22, 0.7));
}

g.module-pack.highlight-caller circle {
  stroke: #f97316 !important;
  stroke-width: 2.5px !important;
}

/* Callee modules - modules this function calls (green) */
g.module-pack.highlight-callee {
  filter: drop-shadow(0 0 10px rgba(74, 222, 128, 0.7));
}

g.module-pack.highlight-callee circle {
  stroke: #4ade80 !important;
  stroke-width: 2.5px !important;
}

/* Dimmed modules - unrelated during call graph highlight */
g.module-pack.highlight-dimmed {
  opacity: 0.15;
}

g.module-pack.highlight-dimmed circle {
  filter: none !important;
}

/* Dimmed links during call graph highlight */
line.highlight-dimmed {
  opacity: 0.1 !important;
}

/* =============================================================================
   Function-Level Call Graph Highlighting
   ============================================================================= */

/* Source function - the hovered declaration (cyan glow) */
circle.fn-highlight-source {
  stroke: #7dd3fc !important;
  stroke-width: 3px !important;
  filter: drop-shadow(0 0 8px rgba(125, 211, 252, 0.9));
}

/* Caller functions - functions that call the source (orange) */
circle.fn-highlight-caller {
  stroke: #f97316 !important;
  stroke-width: 2.5px !important;
  filter: drop-shadow(0 0 6px rgba(249, 115, 22, 0.8));
}

/* Callee functions - functions the source calls (green) */
circle.fn-highlight-callee {
  stroke: #4ade80 !important;
  stroke-width: 2.5px !important;
  filter: drop-shadow(0 0 6px rgba(74, 222, 128, 0.8));
}

/* Dimmed circles and links - unrelated during function highlight */
circle.fn-highlight-dimmed {
  opacity: 0.2 !important;
  filter: none !important;
}

line.fn-highlight-dimmed {
  opacity: 0.08 !important;
}

/* Function edge lines - connecting source to callers/callees */
.fn-edge {
  pointer-events: none;
}

.fn-edge-caller {
  stroke: #f97316;
  stroke-width: 2px;
  stroke-opacity: 0.7;
}

.fn-edge-callee {
  stroke: #4ade80;
  stroke-width: 2px;
  stroke-opacity: 0.7;
}

/* =============================================================================
   Narrative Panel - "What Is Being Shown"
   ============================================================================= */

.narrative-panel {
  max-width: 320px;
  min-width: 280px;
}

/* Larger title for narrative panel */
.narrative-panel .panel-title {
  font-size: 0.875rem;
  /* 14px */
  letter-spacing: var(--letter-spacing-wide);
  margin-bottom: var(--spacing-lg);
}

.narrative-hero {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  /* 14px - body text */
  line-height: 1.7;
  color: var(--color-text-dark);
  margin-bottom: var(--spacing-md);
}

.narrative-hero strong {
  color: var(--color-text-dark);
  font-weight: bold;
}

.narrative-module {
  color: var(--color-teal);
  font-weight: bold;
}

.narrative-path {
  font-size: 0.75rem;
  /* 12px */
  color: var(--color-text-muted);
}

.narrative-stat {
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  padding: 0 2px;
}

.narrative-stat.narrative-callee {
  color: #16a34a;
  /* green-600 */
}

.narrative-stat.narrative-caller {
  color: #ea580c;
  /* orange-600 */
}

.narrative-hint {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  /* 12px - subtext */
  line-height: 1.6;
  color: var(--color-text-muted);
  padding-top: var(--spacing-sm);
  border-top: 1px solid var(--color-line);
}

.narrative-hint em {
  font-style: normal;
  color: var(--color-text-dark);
  font-weight: bold;
}

.narrative-hint strong {
  color: var(--color-teal);
}

.narrative-nav {
  margin-top: var(--spacing-md);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.narrative-back {
  width: 100%;
  font-size: 0.75rem;
  padding: var(--spacing-sm) var(--spacing-md);
}

.narrative-back:hover:not(:disabled) {
  background-color: var(--color-beige-dark);
}

.narrative-back--disabled {
  opacity: 0.5;
  cursor: default;
  color: var(--color-text-muted);
}

.narrative-back--disabled:hover {
  background-color: transparent;
}

.narrative-project {
  width: 100%;
  font-size: 0.75rem;
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
}

.narrative-project:hover {
  background-color: var(--color-beige-dark);
}

.narrative-project::before {
  content: "Project: ";
  color: var(--color-text-muted);
  font-weight: normal;
}

/* =============================================================================
   View Icons (Overview Navigation)
   ============================================================================= */

.view-icons {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
}

.view-icon {
  width: 54px;
  height: 54px;
  padding: 2px;
  border: 1px solid var(--color-line);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-icon:hover {
  background: var(--color-beige-light);
  border-color: var(--color-text-dark);
}

.view-icon--active {
  border-color: var(--color-teal);
  border-width: 2px;
}

.view-icon-img {
  display: block;
  border-radius: 2px;
  object-fit: cover;
}

.narrative-project-wrapper {
  position: relative;
  width: 100%;
}

.project-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  margin-top: var(--spacing-xs);
}

.project-dropdown-item {
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.75rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.project-dropdown-item:hover {
  background-color: var(--color-beige);
}

.project-dropdown-item--active {
  background-color: var(--color-beige-dark);
  font-weight: 600;
}

/* =============================================================================
   Module Search
   ============================================================================= */

.module-search-wrapper {
  position: relative;
  margin-top: var(--spacing-sm);
}

.module-search-input {
  width: 100%;
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: var(--font-size-body);
  background-color: var(--color-beige-light);
  border: 1px solid var(--color-line);
  border-radius: 3px;
  color: var(--color-text-dark);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.module-search-input::placeholder {
  color: var(--color-text-muted);
  font-style: italic;
}

.module-search-input:focus {
  border-color: var(--color-teal);
  box-shadow: 0 0 0 2px rgba(90, 138, 138, 0.2);
}

.module-search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--color-card);
  border: 1px solid var(--color-line);
  border-top: none;
  border-radius: 0 0 3px 3px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.module-search-result {
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: var(--font-size-body);
  color: var(--color-text-dark);
  cursor: pointer;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: background-color var(--transition-fast);
}

.module-search-result:last-child {
  border-bottom: none;
}

.module-search-result:hover {
  background-color: var(--color-beige-base);
}

/* Keyboard-selected state (takes precedence over hover) */
.module-search-result--selected {
  background-color: var(--color-beige-light);
  outline: 2px solid var(--color-teal);
  outline-offset: -2px;
}

.module-search-result--selected:hover {
  background-color: var(--color-beige-light);
}

/* =============================================================================
   Header Search Overrides (compact input for header bar context)
   ============================================================================= */

.header-search-wrapper {
  position: relative;
  width: 200px;
}

.header-search-wrapper .module-search-input {
  height: 24px;
  padding: 2px 8px;
  font-size: 10px;
  background: rgba(255, 255, 255, 0.5);
  border-color: rgba(0, 0, 0, 0.2);
}

.header-search-wrapper .module-search-input:focus {
  background: rgba(255, 255, 255, 0.8);
}

.header-search-wrapper .module-search-dropdown {
  width: 380px;
  right: auto;
  font-size: 11px;
  z-index: 1000;
}

.header-search-wrapper .module-search-result {
  padding: 5px 8px;
}

/* =============================================================================
   Narrative Color Key
   ============================================================================= */

.narrative-color-key {
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--color-line);
}

.color-key-title {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  /* 10px */
  font-weight: bold;
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-sm);
}

.color-key-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  /* ~12 items comfortably */
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-line) transparent;
}

.color-key-items::-webkit-scrollbar {
  width: 6px;
}

.color-key-items::-webkit-scrollbar-track {
  background: transparent;
}

.color-key-items::-webkit-scrollbar-thumb {
  background: var(--color-line);
  border-radius: 3px;
}

.color-key-items::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-light);
}

.color-key-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.color-key-swatch {
  width: 12px;
  height: 12px;
  border: 1px solid var(--color-line);
  flex-shrink: 0;
}

.color-key-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  /* 11px */
  color: var(--color-text-dark);
  letter-spacing: var(--letter-spacing-normal);
}

/* Simplified color key for concept-based legends */
.color-key-concept {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.color-key-concept-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-key-concept-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--color-text-dark);
}

.color-key-concept-sublabel {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--color-text-light);
  font-style: italic;
}

.color-key-swatches {
  display: flex;
  gap: 3px;
}

.color-key-mini-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
}

.color-key-samples {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.color-key-sample {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* =============================================================================
   TangleJS-style Interactive Controls
   ============================================================================= */

/* Clickable control - has options */
.tangle-control {
  color: var(--color-blue-accent, #2563eb);
  cursor: pointer;
  border-bottom: 1px dashed currentColor;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tangle-control:hover {
  color: var(--color-text-dark);
  border-bottom-style: solid;
}

/* Non-interactive highlighted value */
.tangle-value {
  color: var(--color-text-dark);
  font-weight: 500;
}

/* Dropdown for control options */
.tangle-dropdown {
  background: var(--color-beige, #f5f5dc);
  border: 1px solid var(--color-line, #ccc);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  min-width: 120px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.tangle-dropdown-item {
  padding: var(--spacing-xs, 4px) var(--spacing-sm, 8px);
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.tangle-dropdown-item:hover {
  background-color: var(--color-beige-dark, #e8e8d0);
}

.tangle-dropdown-item--active {
  font-weight: bold;
  color: var(--color-blue-accent, #2563eb);
}

.tangle-dropdown-item--active::before {
  content: "• ";
}

/* =============================================================================
   Treemap Styles
   ============================================================================= */

/* Package labels - semi-transparent by default */
.treemap-package-label {
  pointer-events: none;
  user-select: none;
}

/* Show all labels fully on treemap hover */
#treemap-group:hover .treemap-package-label {
  opacity: 1.0 !important;
  transition: opacity 0.2s ease;
}

/* Individual package rect hover effect — stroke handled by HATS highlight classes */

.treemap-module:hover {
  stroke: #111;
  stroke-width: 0.3;
  transition: stroke 0.15s ease, stroke-width 0.15s ease;
}

/* =============================================================================
   Watermark Treemap Styles
   ============================================================================= */

/* Watermark package rects - enable hover interaction */
.watermark-package {
  cursor: pointer;
}

/* Watermark labels - semi-transparent by default, full opacity on hover via JS */
.watermark-package-label {
  pointer-events: none;
  user-select: none;
}

/* =============================================================================
   Call Graph Popup
   ============================================================================= */

/* Overlay background */
.call-graph-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-lg);
}

/* Popup content container */
.call-graph-content {
  background: var(--color-card);
  border: 2px solid var(--color-line);
  border-radius: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 1200px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
}

/* Header with title and close button */
.call-graph-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md);
  border-bottom: 2px solid var(--color-line);
  background: var(--color-beige-base);
}

.call-graph-header h3 {
  font-size: 0.875rem;
  font-weight: bold;
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-text-dark);
  margin: 0;
}

.call-graph-close {
  background: none;
  border: 2px solid var(--color-line);
  color: var(--color-text-dark);
  font-size: 1.5rem;
  font-weight: bold;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  line-height: 1;
  padding: 0;
}

.call-graph-close:hover {
  background: var(--color-beige-dark);
  border-color: var(--color-text-dark);
}

/* Body with three columns */
.call-graph-body {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 0;
  flex: 1;
  overflow: hidden;
}

.call-graph-column {
  display: flex;
  flex-direction: column;
  border-right: 2px solid var(--color-line);
  overflow: hidden;
}

.call-graph-column:last-child {
  border-right: none;
}

.call-graph-column h4 {
  font-size: 0.6875rem;
  font-weight: bold;
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: 0;
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--color-line);
  background: var(--color-beige-light);
}

/* Scrollable lists */
.call-graph-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-sm);
  font-size: 0.75rem;
  line-height: 1.6;
  scrollbar-width: thin;
  scrollbar-color: var(--color-line) transparent;
}

.call-graph-list::-webkit-scrollbar {
  width: 8px;
}

.call-graph-list::-webkit-scrollbar-track {
  background: transparent;
}

.call-graph-list::-webkit-scrollbar-thumb {
  background: var(--color-line);
  border-radius: 4px;
}

.call-graph-list::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

.call-graph-list-item {
  padding: var(--spacing-xs) var(--spacing-sm);
  margin-bottom: var(--spacing-xs);
  background: var(--color-beige-light);
  border-left: 3px solid var(--color-line);
  transition: var(--transition-fast);
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.call-graph-list-item:hover {
  background: var(--color-beige-base);
  border-left-color: var(--color-red-accent);
}

/* Clickable links in caller/callee lists */
.call-graph-link {
  cursor: pointer;
  color: var(--color-blue-link);
  font-weight: 500;
}

.call-graph-link:hover {
  background: var(--color-blue-light) !important;
  border-left-color: var(--color-blue-link) !important;
  text-decoration: underline;
}

/* Git metrics section */
.call-graph-git-metrics {
  background: var(--color-beige-light);
  border: 1px solid var(--color-line);
  border-radius: var(--border-radius);
  padding: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  font-size: 0.75rem;
  line-height: 1.6;
}

.git-metric {
  margin-bottom: var(--spacing-xs);
}

.git-metric:last-child {
  margin-bottom: 0;
}

.git-metric strong {
  color: var(--color-text-primary);
  margin-right: var(--spacing-xs);
}

/* Source code with proper styling */
.call-graph-source {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6875rem;
  line-height: 1.8;
  white-space: pre-wrap;
  margin: 0;
  padding: var(--spacing-sm);
  background: #fafafa;
  border-radius: var(--border-radius);
}

/* Source code column - scrollable with monospace */
.call-graph-code {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-md);
  font-size: 0.6875rem;
  line-height: 1.8;
  white-space: pre-wrap;
  font-family: 'Courier New', Courier, monospace;
  background: #fafafa;
  scrollbar-width: thin;
  scrollbar-color: var(--color-line) transparent;
}

.call-graph-code::-webkit-scrollbar {
  width: 8px;
}

.call-graph-code::-webkit-scrollbar-track {
  background: transparent;
}

.call-graph-code::-webkit-scrollbar-thumb {
  background: var(--color-line);
  border-radius: 4px;
}

.call-graph-code::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* Loading and error states */
.call-graph-loading,
.call-graph-error,
.call-graph-empty {
  color: var(--color-text-muted);
  font-style: italic;
  padding: var(--spacing-md);
  text-align: center;
}

.call-graph-error {
  color: var(--color-red-accent);
}

/* =============================================================================
   Neighborhood View Type Toggles
   ============================================================================= */

.view-type-toggles {
  display: flex;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-sm);
  padding-top: var(--spacing-sm);
  border-top: 1px solid var(--color-line);
}

.view-type-toggle {
  width: 42px;
  height: 42px;
  padding: 2px;
  border: 1px solid var(--color-line);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-type-toggle:hover {
  background: var(--color-beige-light);
  border-color: var(--color-text-dark);
}

.view-type-toggle--active {
  background: var(--color-teal);
  border-color: var(--color-teal);
}

.view-type-toggle--active svg path,
.view-type-toggle--active svg circle,
.view-type-toggle--active svg line,
.view-type-toggle--active svg rect {
  stroke: white;
  fill: none;
}

.view-type-toggle svg {
  width: 20px;
  height: 20px;
}

.view-type-toggle svg path,
.view-type-toggle svg circle,
.view-type-toggle svg line,
.view-type-toggle svg rect {
  stroke: var(--color-text-dark);
  fill: none;
  stroke-width: 1.5;
}

/* Image-based toggle icons */
.view-type-toggle-img {
  display: block;
  border-radius: 2px;
  object-fit: cover;
}

.view-type-toggle--active .view-type-toggle-img {
  box-shadow: 0 0 0 2px var(--color-teal);
}

/* =============================================================================
   Chord Diagram Styles
   ============================================================================= */

#chord-diagram {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#chord-diagram svg {
  width: 100%;
  height: 100%;
}

.chord-arc {
  pointer-events: all;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.chord-arc:hover {
  opacity: 0.8;
}

.chord-ribbon {
  fill-opacity: 0.6;
  stroke: none;
  transition: fill-opacity var(--transition-fast);
}

.chord-ribbon:hover {
  fill-opacity: 0.9;
}

.chord-label {
  font-family: var(--font-mono);
  /* font-size: var(--font-size-small); */
  fill: var(--color-blueprint-light);
  pointer-events: none;
}

/* =============================================================================
   Treemap Highlight Styles
   ============================================================================= */

/* The hovered node - bright and prominent */
.module-node.highlighted {
  stroke: white !important;
  stroke-width: 3px !important;
  fill: rgba(255, 255, 255, 0.2) !important;
}

/* Nodes this module depends on (imports) - green tint */
.module-node.is-target {
  stroke: #4ade80 !important;
  stroke-width: 2px !important;
  fill: rgba(74, 222, 128, 0.15) !important;
}

/* Nodes that depend on this module (importers) - orange tint */
.module-node.is-source {
  stroke: #fb923c !important;
  stroke-width: 2px !important;
  fill: rgba(251, 146, 60, 0.15) !important;
}

/* All other nodes - dimmed (optional, currently unused) */
.module-node.dimmed {
  stroke: rgba(255, 255, 255, 0.15) !important;
  stroke-width: 0.5px !important;
  fill: rgba(14, 76, 138, 0.5) !important;
}

/* Package rect highlighting */
.package-rect.highlighted {
  stroke: white !important;
  stroke-width: 2px !important;
}

.package-rect.is-target {
  stroke: #4ade80 !important;
  stroke-width: 2px !important;
}

.package-rect.is-source {
  stroke: #fb923c !important;
  stroke-width: 2px !important;
}

/* =============================================================================
   View Switcher Buttons
   ============================================================================= */

/* =============================================================================
   Project Selector
   ============================================================================= */

.project-selector {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
  padding-bottom: var(--spacing-sm);
  border-bottom: 1px solid var(--color-line);
}

.project-selector label {
  font-size: var(--font-size-small);
  font-weight: bold;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

.project-selector select,
select.project-dropdown {
  font-family: var(--font-mono);
  font-size: var(--font-size-small);
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--color-beige-light);
  border: 1px solid var(--color-line);
  color: var(--color-text-dark);
  cursor: pointer;
  min-width: 160px;
}

.project-selector select:focus,
select.project-dropdown:focus {
  outline: none;
  border-color: var(--color-teal);
}

/* =============================================================================
   View Switcher Buttons
   ============================================================================= */

.view-switcher {
  display: flex;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-sm);
}

.view-switcher button {
  font-family: var(--font-mono);
  font-size: var(--font-size-small);
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--color-beige-light);
  border: 1px solid var(--color-line);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.view-switcher button:hover {
  background: var(--color-beige-dark);
}

.view-switcher button.active {
  background: var(--color-text-dark);
  color: var(--color-beige-light);
  border-color: var(--color-text-dark);
}

/* Scope selector (for package-level views) */
.scope-selector {
  display: flex;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-sm);
}

.scope-selector button {
  font-family: var(--font-mono);
  font-size: var(--font-size-small);
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--color-beige-light);
  border: 1px solid var(--color-teal);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.scope-selector button:hover {
  background: var(--color-beige-dark);
}

.scope-selector button.active {
  background: var(--color-teal);
  color: var(--color-beige-light);
  border-color: var(--color-teal);
}

/* =============================================================================
   Tree View Elements
   ============================================================================= */

.tree-node {
  cursor: pointer;
}

.tree-link {
  pointer-events: none;
}

/* Tree view node states */
/* In-tree nodes: solid white at 0.5 opacity */
.module-node.in-tree {
  fill: rgba(255, 255, 255, 0.5) !important;
  stroke: rgba(255, 255, 255, 0.8) !important;
  stroke-width: 1.5px !important;
}

/* Dimmed nodes: faded but still visible */
.module-node.dimmed {
  stroke: rgba(255, 255, 255, 0.15) !important;
  stroke-width: 0.5px !important;
  fill: rgba(14, 76, 138, 0.3) !important;
  opacity: 0.4;
}

/* =============================================================================
   Synchronized Panel Hover Highlighting
   ============================================================================= */

/* Bubble Pack Highlighting */
.bubble-pack-node.bubble-highlighted {
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
}

.bubble-pack-node.bubble-highlighted circle {
  stroke: white !important;
  stroke-width: 3px !important;
}

.bubble-pack-node.bubble-dimmed {
  opacity: 0.3;
}

.bubble-link.bubble-dimmed {
  opacity: 0.15;
}

/* Chord Diagram Highlighting */
.chord-arc.chord-highlighted {
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
  stroke: white !important;
  stroke-width: 2px !important;
}

.chord-arc.chord-dimmed {
  opacity: 0.2;
}

.chord-ribbon.chord-connected {
  fill-opacity: 0.85 !important;
}

.chord-ribbon.chord-dimmed {
  opacity: 0.15;
}

/* Matrix Highlighting */
.matrix-cell.matrix-row-highlight,
.matrix-cell.matrix-col-highlight {
  fill-opacity: 0.9 !important;
  stroke: white !important;
  stroke-width: 1px !important;
}

.matrix-cell.matrix-highlighted {
  fill: #60a5fa !important;
  fill-opacity: 1 !important;
  stroke: white !important;
  stroke-width: 2px !important;
}

.matrix-cell.matrix-dimmed {
  opacity: 0.2;
}

.matrix-label.matrix-highlighted {
  fill: white !important;
  font-weight: bold;
}

.matrix-label.matrix-dimmed {
  opacity: 0.3;
}

/* =============================================================================
   Coordinated Highlighting (Generic Classes from PSD3)
   ============================================================================= */

/* Primary: The hovered element itself */
.bubble-pack-node.highlight-primary {
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
}

.bubble-pack-node.highlight-primary circle {
  stroke: white !important;
  stroke-width: 3px !important;
}

.chord-arc.highlight-primary {
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
  stroke: white !important;
  stroke-width: 2px !important;
}

.chord-ribbon.highlight-primary {
  fill-opacity: 0.9 !important;
}

.matrix-cell.highlight-primary {
  fill: #60a5fa !important;
  fill-opacity: 1 !important;
  stroke: white !important;
  stroke-width: 2px !important;
}

.matrix-label.highlight-primary {
  fill: white !important;
  font-weight: bold;
}

/* Related: Connected/related to the hovered element */
.chord-ribbon.highlight-related {
  fill-opacity: 0.85 !important;
}

.matrix-cell.highlight-related {
  fill-opacity: 0.9 !important;
  stroke: white !important;
  stroke-width: 1px !important;
}

/* Dimmed: Unrelated elements */
.bubble-pack-node.highlight-dimmed {
  opacity: 0.3;
}

.bubble-link.highlight-dimmed {
  opacity: 0.15;
}

.chord-arc.highlight-dimmed {
  opacity: 0.2;
}

.chord-ribbon.highlight-dimmed {
  opacity: 0.15;
}

.matrix-cell.highlight-dimmed {
  opacity: 0.2;
}

.matrix-label.highlight-dimmed {
  opacity: 0.3;
}

/* =============================================================================
   Module Treemap Hover Highlighting
   ============================================================================= */

/* Base treemap module styles with transitions */
.treemap-module {
  transition: opacity 0.15s ease-out;
}

.treemap-module rect {
  transition: fill 0.15s ease-out, stroke 0.15s ease-out, stroke-width 0.15s ease-out;
}

/* Primary: The hovered module - prominent border */
.treemap-module.highlight-primary rect {
  stroke: #2563eb !important;
  stroke-width: 3px !important;
  fill: #e0f2fe !important;
}

/* Related: Modules with import relationships - blue accent */
.treemap-module.highlight-related rect {
  stroke: #60a5fa !important;
  stroke-width: 2px !important;
  fill: #dbeafe !important;
}

/* Dimmed: Unrelated modules - faded */
.treemap-module.highlight-dimmed {
  opacity: 0.25;
}

.treemap-module.highlight-dimmed rect {
  fill: #e5e5e5 !important;
}

/* =============================================================================
   Galaxy Treemap Package Highlighting
   ============================================================================= */

/* Base package styles with transitions */
.treemap-package {
  transition: opacity 0.15s ease-out;
}

.treemap-package rect {
  transition: fill 0.15s ease-out, stroke 0.15s ease-out, stroke-width 0.15s ease-out;
}

.treemap-package circle {
  transition: fill 0.15s ease-out, stroke 0.15s ease-out, stroke-width 0.15s ease-out;
}

/* Ensure text labels stay white on blueprint theme during all highlight states */
.treemap-package text {
  fill: rgba(255, 255, 255, 0.5) !important;
  transition: fill 0.15s ease-out;
}

/* Highlight classes are on the cell content group (child of .treemap-package),
   not on .treemap-package itself — hover triggers only from circle/label area.
   CSS :has() propagates visual effects to sibling elements (rect, text). */

.treemap-package:has(.highlight-primary) text {
  fill: rgba(255, 255, 255, 0.95) !important;
}

.treemap-package:has(.highlight-related) text {
  fill: rgba(255, 255, 255, 0.8) !important;
}

.treemap-package:has(.highlight-dimmed) text {
  fill: rgba(255, 255, 255, 0.2) !important;
}

/* Primary: The hovered package - bright stroke for visibility on dark theme */
.treemap-package:has(.highlight-primary) rect {
  stroke: #ffc040 !important;
  stroke-width: 2px !important;
}

.treemap-package:has(.highlight-primary) circle {
  fill: #ffc040 !important;
  stroke: #fff !important;
  stroke-width: 2px !important;
}

/* Related: Packages with dependency relationships - blue accent (generic fallback) */
.treemap-package:has(.highlight-related) rect {
  stroke: #60a5fa !important;
  stroke-width: 1.5px !important;
}

.treemap-package:has(.highlight-related) circle {
  fill: #60a5fa !important;
  stroke: #fff !important;
  stroke-width: 1px !important;
}

/* Upstream: Dependencies (things the hovered package depends on) - green */
.treemap-package:has(.highlight-upstream) rect {
  stroke: #22c55e !important;
  stroke-width: 1.5px !important;
}

.treemap-package:has(.highlight-upstream) circle {
  fill: #22c55e !important;
  stroke: #fff !important;
  stroke-width: 1px !important;
}

.treemap-package:has(.highlight-upstream) text {
  fill: rgba(255, 255, 255, 0.9) !important;
}

/* Downstream: Dependents (things that depend on hovered package) - orange */
.treemap-package:has(.highlight-downstream) rect {
  stroke: #f97316 !important;
  stroke-width: 1.5px !important;
}

.treemap-package:has(.highlight-downstream) circle {
  fill: #f97316 !important;
  stroke: #fff !important;
  stroke-width: 1px !important;
}

.treemap-package:has(.highlight-downstream) text {
  fill: rgba(255, 255, 255, 0.9) !important;
}

/* Dimmed: Unrelated packages - faded */
.treemap-package:has(.highlight-dimmed) {
  opacity: 0.15;
}

.treemap-package:has(.highlight-dimmed) rect {
  fill: #1a2a4a !important;
}

.treemap-package:has(.highlight-dimmed) circle {
  fill: #3a4a6a !important;
}

/* Rect hover affordance - subtle lightening on dark midnight theme */
.treemap-package .package-rect:hover {
  fill: rgba(255, 255, 255, 0.06) !important;
  stroke: rgba(255, 255, 255, 0.8) !important;
  stroke-width: 1.5px !important;
  cursor: pointer;
}

/* =============================================================================
   Module Treemap Enriched Rect Hover Affordance
   ============================================================================= */

/* Subtle lightening on steel/blueprint background */
.treemap-module-enriched:hover .module-rect {
  fill: rgba(255, 255, 255, 0.08) !important;
  stroke: rgba(255, 255, 255, 0.6) !important;
  stroke-width: 1.5px !important;
}

/* =============================================================================
   Declaration Treemap Highlighting (ModuleOverview left panel)
   ============================================================================= */

/* Base transitions */
.treemap-declaration {
  transition: opacity 0.15s ease-out;
}

.treemap-declaration rect {
  transition: fill 0.15s ease-out, stroke 0.15s ease-out, stroke-width 0.15s ease-out;
}

/* Rect hover affordance */
.treemap-declaration .declaration-rect:hover {
  stroke: rgba(255, 255, 255, 0.5) !important;
  stroke-width: 1.5px !important;
}

/* Primary: The hovered declaration - blue border */
.treemap-declaration.highlight-primary .declaration-rect {
  stroke: #2563eb !important;
  stroke-width: 2px !important;
}

.treemap-declaration.highlight-primary .declaration-strip {
  opacity: 1 !important;
}

/* Related: Declarations with call relationships - amber border */
.treemap-declaration.highlight-related .declaration-rect {
  stroke: #f59e0b !important;
  stroke-width: 1.5px !important;
}

/* Dimmed: Unrelated declarations - faded */
.treemap-declaration.highlight-dimmed {
  opacity: 0.25;
}

/* Dependency links - glow when related */
.dependency-link.highlight-related {
  stroke-opacity: 0.8 !important;
  stroke-width: 1.5px !important;
}

.dependency-link.highlight-dimmed {
  stroke-opacity: 0.05 !important;
}

/* =============================================================================
   Package Set Swarm Highlighting (Beeswarm View)
   Note: Highlight classes are applied to .package-group (the <g> element),
   so selectors target .package-group.highlight-* .package-circle
   ============================================================================= */

/* Primary: The hovered package - white stroke for visibility */
.package-group.highlight-primary .package-circle {
  stroke: #fff !important;
  stroke-width: 3px !important;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
}

/* Related: Generic related highlight (fallback) - white stroke with blue glow */
.package-group.highlight-related .package-circle {
  stroke: #fff !important;
  stroke-width: 2.5px !important;
  filter: drop-shadow(0 0 6px rgba(33, 150, 243, 0.7));
}

/* Upstream: Dependencies of hovered - white stroke with green glow */
.package-group.highlight-upstream .package-circle {
  stroke: #fff !important;
  stroke-width: 2.5px !important;
  filter: drop-shadow(0 0 6px rgba(34, 197, 94, 0.7));
}

/* Downstream: Dependents of hovered - white stroke with blue glow */
.package-group.highlight-downstream .package-circle {
  stroke: #fff !important;
  stroke-width: 2.5px !important;
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.7));
}

/* Dimmed: Unrelated packages - reduced opacity */
.package-group.highlight-dimmed .package-circle {
  opacity: 0.2 !important;
  filter: none !important;
}

/* Package labels - hidden by default, shown on highlight */
.package-group .package-label {
  opacity: 0;
  transition: opacity 0.15s ease-in-out;
}

/* Show label for highlighted packages (primary, upstream, downstream) */
.package-group.highlight-primary .package-label,
.package-group.highlight-upstream .package-label,
.package-group.highlight-downstream .package-label {
  opacity: 1;
}

/* Hide label for dimmed packages */
.package-group.highlight-dimmed .package-label {
  opacity: 0;
}

/* =============================================================================
   Declaration Circle Highlighting (Enriched Module Treemap)
   ============================================================================= */

/* Base declaration circle styles with transitions */
.declaration-circle {
  transition: opacity 0.15s ease-out, stroke 0.15s ease-out, stroke-width 0.15s ease-out, transform 0.15s ease-out;
}

/* Primary: The hovered declaration */
.declaration-circle.highlight-primary {
  stroke: #fbbf24 !important;
  stroke-width: 3px !important;
  filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.5));
}

/* Related: Declarations that call or are called by the hovered one */
.declaration-circle.highlight-related {
  stroke: #60a5fa !important;
  stroke-width: 2px !important;
  opacity: 1 !important;
}

/* Dimmed: Unrelated declarations */
.declaration-circle.highlight-dimmed {
  opacity: 0.15 !important;
}

/* -----------------------------------------------------------------------------
   Dependency Links - Curved paths connecting related declarations
   ----------------------------------------------------------------------------- */

/* Base dependency link styles */
.dependency-link {
  transition: stroke 0.15s ease-out, stroke-width 0.15s ease-out, stroke-opacity 0.15s ease-out;
}

/* Related: Links connected to the hovered declaration - full brightness */
.dependency-link.highlight-related {
  stroke: #f59e0b !important;  /* Amber-500 */
  stroke-width: 1.5px !important;
  stroke-opacity: 1 !important;
}

/* Upstream: Link to a dependency of the hovered package - green */
.dependency-link.highlight-upstream {
  stroke: #22c55e !important;  /* Green-500 */
  stroke-width: 1.5px !important;
  stroke-opacity: 1 !important;
}

/* Downstream: Link from a dependent of the hovered package - orange */
.dependency-link.highlight-downstream {
  stroke: #f97316 !important;  /* Orange-500 */
  stroke-width: 1.5px !important;
  stroke-opacity: 1 !important;
}

/* Dimmed: Unrelated links - fade to near invisible */
.dependency-link.highlight-dimmed {
  stroke-opacity: 0 !important;
}

/* -----------------------------------------------------------------------------
   Module Circle Highlighting (BubblePackBeeswarm)
   ----------------------------------------------------------------------------- */

.module-circle-group {
  transition: opacity 0.15s ease-out;
}

.module-circle-group.highlight-primary .module-circle {
  stroke: #fbbf24 !important;
  stroke-width: 2px !important;
}

.module-circle-group.highlight-related .module-circle {
  stroke: #f59e0b !important;
  stroke-width: 1.5px !important;
  fill-opacity: 0.9 !important;
}

.module-circle-group.highlight-dimmed {
  opacity: 0.15;
}

/* =============================================================================
   Declaration Graph (callGraphTree) Hover Highlighting
   ============================================================================= */

.decl-node {
  transition: opacity 0.15s ease-out;
}

.decl-node.highlight-primary circle,
.decl-node.highlight-primary rect {
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.3));
}

.decl-node.highlight-primary text {
  font-weight: 700 !important;
  opacity: 1 !important;
}

.decl-node.highlight-related {
  opacity: 0.9;
}

.decl-node.highlight-dimmed {
  opacity: 0.15;
}

.decl-edge {
  transition: stroke-opacity 0.15s ease-out, stroke-width 0.15s ease-out;
}

.decl-edge.highlight-related {
  stroke-opacity: 0.8 !important;
  stroke-width: 2px !important;
}

.decl-edge.highlight-dimmed {
  stroke-opacity: 0.04 !important;
}

/* =============================================================================
   Concern Graph (concernClusteredTree) Hover Highlighting
   ============================================================================= */

.concern-node {
  transition: opacity 0.15s ease-out;
}

.concern-node.highlight-primary circle {
  r: 8px;
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.3));
}

.concern-node.highlight-primary text {
  opacity: 1 !important;
  font-weight: 600;
}

.concern-node.highlight-related text {
  opacity: 0.8 !important;
}

.concern-node.highlight-dimmed {
  opacity: 0.15;
}

.concern-edge {
  transition: stroke-opacity 0.15s ease-out, stroke-width 0.15s ease-out;
}

.concern-edge.highlight-related {
  stroke-opacity: 0.6 !important;
  stroke-width: 1.5px !important;
}

.concern-edge.highlight-dimmed {
  stroke-opacity: 0.03 !important;
}

/* =============================================================================
   Package Overview Layout (Beeswarm/CirclePack with Auxiliary Panels)
   ============================================================================= */

.package-overview-layout {
  display: flex;
  width: 100%;
  height: 100%;
  gap: var(--spacing-sm);
}

.package-overview-layout .main-panel {
  flex: 2;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

.package-overview-layout .auxiliary-panels {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  min-width: 320px;
  max-width: 420px;
  height: 100%;
  overflow: hidden;
}

.package-overview-layout .chord-viz,
.package-overview-layout .matrix-viz {
  flex: 1;
  min-height: 0;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  overflow: hidden;
}

.package-overview-layout .chord-viz svg,
.package-overview-layout .matrix-viz svg {
  width: 100%;
  height: 100%;
}

/* =============================================================================
   Treemap Controls (Visualization Parameter Panel)
   ============================================================================= */

.treemap-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.treemap-controls {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  z-index: 100;
  background-color: rgba(212, 201, 168, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--color-line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  padding: var(--spacing-sm) var(--spacing-md);
  font-family: var(--font-mono);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.treemap-controls .control-group {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.treemap-controls .control-label {
  font-size: var(--font-size-small);
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
  color: var(--color-text-muted);
  min-width: 45px;
}

.treemap-controls .control-btn {
  font-family: var(--font-mono);
  font-size: var(--font-size-tiny);
  font-weight: bold;
  letter-spacing: var(--letter-spacing-normal);
  text-transform: uppercase;
  padding: var(--spacing-xs) var(--spacing-sm);
  border: 1px solid var(--color-line);
  background-color: transparent;
  color: var(--color-text-dark);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.treemap-controls .control-btn:hover {
  background-color: var(--color-beige-light);
  border-color: var(--color-text-dark);
}

.treemap-controls .control-btn.active {
  background-color: var(--color-teal);
  border-color: var(--color-teal);
  color: white;
}

/* Connected button group */
.treemap-controls .control-group .control-btn:not(:first-of-type) {
  border-left: none;
}

#treemap-viz {
  flex: 1;
  width: 100%;
  height: 100%;
}

/* =============================================================================
   CSS-Based Tooltips (data-tooltip attribute)
   ============================================================================= */

/* Elements with data-tooltip show tooltip on hover */
[data-tooltip] {
  position: relative;
  cursor: pointer;
}

/* Tooltip content via ::after pseudo-element */
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 2000;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);

  /* Match floating panel style */
  background-color: rgba(212, 201, 168, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--color-text-dark);
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--color-line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);

  /* Typography */
  font-family: var(--font-mono);
  font-size: var(--font-size-small);
  line-height: 1.5;
  white-space: pre-line;
  text-align: left;
  max-width: 320px;
  min-width: 150px;

  /* Initially hidden */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease-in-out, visibility 0.15s ease-in-out;
}

/* Show tooltip on hover */
[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Arrow pointing down */
[data-tooltip]::before {
  content: '';
  position: absolute;
  z-index: 2001;
  left: 50%;
  bottom: calc(100% + 2px);
  transform: translateX(-50%);

  border-width: 6px;
  border-style: solid;
  border-color: rgba(212, 201, 168, 0.98) transparent transparent transparent;

  /* Initially hidden */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease-in-out, visibility 0.15s ease-in-out;
}

/* Show arrow on hover */
[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
}

/* For SVG elements, tooltip positioned based on element center */
/* BubblePack beeswarm label backgrounds — hidden until hover */
.package-bubble .label-bg {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.package-bubble:hover .label-bg {
  opacity: 1;
}

svg [data-tooltip]::after {
  left: 50%;
  bottom: auto;
  top: -12px;
  transform: translate(-50%, -100%);
}

svg [data-tooltip]::before {
  left: 50%;
  bottom: auto;
  top: -6px;
  transform: translate(-50%, -100%);
}

/* =============================================================================
   Dependency Neighborhood Overlay (DeclarationDetail left panel)
   ============================================================================= */

.neighborhood-node circle {
  transition: opacity 0.2s ease, stroke-width 0.2s ease;
}

.neighborhood-node:hover circle {
  stroke-width: 2.5px;
  filter: brightness(1.2);
}

.neighborhood-link {
  transition: opacity 0.2s ease;
}

.neighborhood-node text {
  pointer-events: none;
}

/* =============================================================================
   SigMap Sparkline Cells
   ============================================================================= */

.sigmap-cell {
  position: relative;
}

/* Fixed-position tooltip for full-size signature on hover */
.sigmap-tooltip {
  display: none;
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  padding: 12px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  pointer-events: none;
  white-space: nowrap;
  width: max-content;
  max-width: 90vw;
}

.sigmap-cell-sparkline:hover {
  z-index: 100;
}

/* Sigil tooltip override: fit-content in tooltip context */
.sigmap-tooltip .sig-full { width: fit-content; }

/* Instances section (CodeExplorer-specific, not in canonical sigil.css) */
.sig-class-instances { border-top: 1px dashed #c7d2fe; margin-top: 6px; padding-top: 4px; }
.sig-class-instances-header { font-size: 10px; font-weight: 600; color: #6366f1;
                              letter-spacing: 0.3px; padding: 2px 0 4px; }
.sig-class-instance-list { list-style: none; margin: 0; padding: 0;
                           display: flex; flex-wrap: wrap; gap: 3px; }
.sig-class-instance { display: inline; }
.sig-class-instance-name { font-family: 'Fira Code', 'SF Mono', monospace;
                           font-size: 10px; color: #4338ca;
                           background: #eef2ff; border: 1px solid #c7d2fe;
                           border-radius: 3px; padding: 1px 5px; }

/* =============================================================================
   PureScript Source Code Syntax Highlighting
   ============================================================================= */

.ps-source {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  background: #faf9f7;
  border: 1px solid #e8e6e0;
  border-radius: 4px;
  overflow: auto;
  padding: 8px 0;
}

.ps-line {
  display: flex;
  min-height: 1.7em;
  padding: 0 12px 0 0;
}

.ps-linenum {
  width: 3.5em;
  text-align: right;
  padding-right: 1em;
  color: #c0bdb8;
  user-select: none;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.ps-code {
  flex: 1;
  white-space: pre;
}

/* Focused declaration highlight */
.ps-focused {
  background: rgba(14, 76, 138, 0.04);
}

.ps-focused-accent {
  border-left: 3px solid;
  /* border-left-color set via inline style from kindColor */
  margin-right: 4px;
  flex-shrink: 0;
}

/* Token classes - restrained, print-inspired palette */
.ps-keyword {
  color: #1a1a2e;
  font-weight: 600;
}

.ps-type {
  color: #0E4C8A;
}

.ps-ident {
  color: #333;
}

.ps-operator {
  color: #8b7355;
}

.ps-string {
  color: #6b4226;
}

.ps-number {
  color: #6b4226;
}

.ps-comment {
  color: #a09a90;
  font-style: italic;
}

.ps-module {
  color: #888;
}

.ps-punct {
  color: #999;
}

/* Clickable identifiers */
a.ps-clickable {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
  cursor: pointer;
}

a.ps-clickable:hover {
  color: #0E4C8A;
  border-bottom-style: solid;
  background: rgba(14, 76, 138, 0.06);
}

/* =============================================================================
   Annotation Report View
   ============================================================================= */

.annotation-report {
  width: 100%;
  height: 100%;
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  font-family: var(--font-mono);
  background: #fff;
  overflow: hidden;
}

.annotation-report-filter-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 2px solid #e8e4d8;
  padding: 10px 24px;
  flex-shrink: 0;
}

.annotation-report-body {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-line) transparent;
}

.annotation-report-body::-webkit-scrollbar {
  width: 8px;
}

.annotation-report-body::-webkit-scrollbar-track {
  background: transparent;
}

.annotation-report-body::-webkit-scrollbar-thumb {
  background: var(--color-line);
  border-radius: 4px;
}

.annotation-report-module-link {
  font-weight: 700;
  font-size: 12px;
  color: var(--color-teal);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(90, 138, 138, 0.4);
  transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

.annotation-report-module-link:hover {
  color: #3a6a6a;
  text-decoration-color: var(--color-teal);
}

/* =============================================================================
   Anatomy Beeswarm — hover labels
   ============================================================================= */

.anatomy-package-group .anatomy-label {
  opacity: 0;
  transition: opacity 150ms ease;
  pointer-events: none;
}

.anatomy-package-group .anatomy-label-always {
  opacity: 1;
}

.anatomy-package-group:hover .anatomy-label {
  opacity: 1;
}

/* Module beeswarm — hover labels */
.module-node-group .module-label {
  opacity: 0;
  transition: opacity 150ms ease;
  pointer-events: none;
}

.module-node-group:hover .module-label {
  opacity: 1;
}

/* =============================================================================
   Namespace Tree — Filter Panel
   ============================================================================= */

.namespace-filter-panel {
  width: 240px;
  min-width: 240px;
  height: 100%;
  overflow-y: auto;
  padding: var(--spacing-sm) var(--spacing-md);
  border-right: 1px solid var(--color-line);
  background: var(--color-card);
  font-family: var(--font-mono);
  font-size: var(--font-size-small);
}

.namespace-filter-title {
  font-size: var(--font-size-label);
  font-weight: 600;
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-sm);
  padding-bottom: var(--spacing-xs);
  border-bottom: 1px solid var(--color-line);
}

.namespace-filter-group {
  margin-bottom: var(--spacing-sm);
}

.namespace-filter-group-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  margin-bottom: 2px;
  padding: 2px 0;
}

.namespace-filter-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.namespace-filter-group-label {
  font-weight: 600;
  color: var(--color-text-dark);
  flex: 1;
}

.namespace-filter-actions {
  font-size: var(--font-size-tiny);
}

.namespace-filter-action {
  cursor: pointer;
  color: var(--color-teal);
  text-decoration: none;
}

.namespace-filter-action:hover {
  text-decoration: underline;
}

.namespace-filter-items {
  padding-left: 2px;
}

.namespace-filter-checkbox {
  display: block;
  padding: 1px 0;
  cursor: pointer;
  color: var(--color-text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.namespace-filter-checkbox:hover {
  color: var(--color-teal);
}

.namespace-filter-checkbox input[type="checkbox"] {
  margin-right: 4px;
  vertical-align: middle;
}

/* =============================================================================
   Snapshot Management
   ============================================================================= */

.snapshot-management {
  padding: 32px;
  max-width: 900px;
  margin: 0 auto;
  font-family: var(--font-mono);
  color: var(--color-text-dark);
  height: 100%;
  overflow-y: auto;
}

.snapshot-management-inner {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.snapshot-header h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px 0;
}

.snapshot-subtitle {
  font-size: 13px;
  color: var(--color-text-muted);
  margin: 0;
}

.snapshot-create-section h3,
.snapshot-existing-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Commit Log */
.commit-log {
  border: 1px solid #ddd;
  border-radius: 4px;
  max-height: 400px;
  overflow-y: auto;
  background: #fafafa;
}

.commit-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 12px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  font-size: 13px;
  transition: background 0.1s;
}

.commit-row:hover {
  background: #f0f0f0;
}

.commit-row.selected {
  background: #e8f0ff;
}

.commit-row.loaded {
  opacity: 0.6;
  cursor: default;
}

.commit-radio {
  flex-shrink: 0;
  width: 16px;
  text-align: center;
  font-size: 14px;
}

.radio-empty { color: #ccc; }
.radio-selected { color: #0E4C8A; }
.commit-loaded-indicator { color: #5a8a5a; }

.commit-hash {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #0E4C8A;
  width: 60px;
}

.commit-message {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.commit-refs {
  margin-left: 6px;
}

.commit-ref-badge {
  display: inline-block;
  background: #0E4C8A;
  color: white;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 4px;
  font-weight: 500;
}

.commit-time {
  flex-shrink: 0;
  font-size: 11px;
  color: #999;
  width: 80px;
  text-align: right;
}

.commit-show-more {
  padding: 8px 12px;
  text-align: center;
  color: #0E4C8A;
  cursor: pointer;
  font-size: 13px;
}

.commit-show-more:hover {
  background: #f0f0f0;
}

.commit-loading {
  padding: 8px 12px;
  text-align: center;
  color: #999;
  font-size: 13px;
}

/* Create Controls */
.create-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.create-controls label {
  font-size: 13px;
  font-weight: 500;
}

.label-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.btn-create {
  padding: 6px 16px;
  background: #0E4C8A;
  color: white;
  border: none;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
  cursor: pointer;
}

.btn-create:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-create:hover:not(:disabled) {
  background: #0a3a6a;
}

/* Create Status */
.create-status {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.create-status.creating {
  background: #f0f4ff;
  color: #0E4C8A;
}

.create-status.success {
  background: #f0fff0;
  color: #2a6a2a;
}

.create-status.error {
  background: #fff0f0;
  color: #8a2a2a;
}

/* Existing Snapshots */
.existing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.delete-controls {
  display: flex;
  gap: 8px;
}

.btn-select, .btn-dismiss {
  padding: 4px 10px;
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}

.btn-select:hover, .btn-dismiss:hover {
  background: #e0e0e0;
}

.btn-delete {
  padding: 4px 10px;
  background: #fff0f0;
  color: #8a2a2a;
  border: 1px solid #dcc;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}

.btn-delete:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-delete:hover:not(:disabled) {
  background: #ffe0e0;
}

/* Snapshot List */
.snapshot-list {
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-top: 8px;
}

.snapshot-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  font-size: 13px;
}

.snapshot-row:last-child {
  border-bottom: none;
}

.snapshot-row.current {
  background: #f8f8ff;
}

.snapshot-row.selected-for-delete {
  background: #fff5f5;
}

.snapshot-checkbox {
  flex-shrink: 0;
  width: 20px;
}

.snapshot-info {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex: 1;
}

.snapshot-id {
  color: #999;
  font-size: 12px;
  width: 40px;
}

.snapshot-label {
  font-weight: 500;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.snapshot-hash {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #0E4C8A;
  width: 60px;
}

.snapshot-modules {
  color: #666;
  font-size: 12px;
  width: 90px;
  text-align: right;
}

.current-badge {
  font-size: 10px;
  background: #0E4C8A;
  color: white;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 500;
}

/* Delete Confirmation */
.delete-confirm {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
  background: #fff5f0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-confirm-delete {
  padding: 4px 12px;
  background: #E63946;
  color: white;
  border: none;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}

.btn-cancel {
  padding: 4px 12px;
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
}

.delete-confirm.done {
  background: #f0fff0;
  color: #2a6a2a;
}

/* =============================================================================
   Commit-Module Grid
   ============================================================================= */

.commit-module-grid {
  height: 100%;
  overflow-y: auto;
  font-family: var(--font-mono);
  color: var(--color-text-dark);
}

.cmg-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 32px 24px;
}

.cmg-header {
  margin-bottom: 16px;
}

.cmg-header h2 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px 0;
}

.cmg-subtitle {
  font-size: 12px;
  color: #666;
  margin: 0;
}

/* Controls bar — now uses shared .page-subnav + .filter-pill */

.cmg-control-sep {
  width: 1px;
  height: 14px;
  background: #ddd;
  margin: 0 6px;
}

.cmg-loading,
.cmg-error,
.cmg-empty {
  padding: 40px 0;
  text-align: center;
  color: #888;
  font-size: 13px;
}

.cmg-error { color: #8b0000; }

.cmg-grid-wrapper {
  overflow-x: auto;
}

.cmg-grid {
  display: grid;
  gap: 0;
  align-items: stretch;
}

/* Corner cells (top-left, above commit info columns) */
.cmg-corner {
  height: 80px;
  border-bottom: 1px solid #ccc;
}

/* Module name headers (rotated) */
.cmg-module-header {
  height: 80px;
  position: relative;
  border-bottom: 1px solid #ccc;
  cursor: pointer;
}

.cmg-module-header:hover,
.cmg-module-header.hovered {
  background: rgba(14, 76, 138, 0.06);
}

.cmg-module-label {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform-origin: bottom left;
  transform: rotate(-55deg);
  font-size: 9px;
  white-space: nowrap;
  color: #444;
}

/* Commit row cells */
.cmg-row-cell {
  height: 14px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #f0f0f0;
}

.cmg-row-cell.row-hovered {
  background: rgba(14, 76, 138, 0.04);
}

.cmg-commit-msg {
  font-size: 10px;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 8px;
  cursor: default;
}

.cmg-commit-time {
  font-size: 9px;
  color: #999;
  white-space: nowrap;
  padding-right: 4px;
  cursor: default;
}

/* Dot cells */
.cmg-dot {
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #f0f0f0;
}

.cmg-dot.col-hovered {
  background: rgba(14, 76, 138, 0.06);
}

.cmg-dot.row-hovered {
  background: rgba(14, 76, 138, 0.04);
}

.cmg-dot.col-hovered.row-hovered {
  background: rgba(14, 76, 138, 0.12);
}

.cmg-dot-fill {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #0E4C8A;
}

.cmg-dot.active.row-hovered .cmg-dot-fill,
.cmg-dot.active.col-hovered .cmg-dot-fill {
  background: #1a6bc4;
  box-shadow: 0 0 3px rgba(14, 76, 138, 0.4);
}

/* Operation status colors (A/M/D) */
.cmg-dot-fill.status-add {
  background: none;
  border: 1.5px solid #0E4C8A;
}

.cmg-dot-fill.status-delete {
  background: #c0392b;
}

.cmg-dot.active.row-hovered .cmg-dot-fill.status-add,
.cmg-dot.active.col-hovered .cmg-dot-fill.status-add {
  border-color: #1a6bc4;
  box-shadow: 0 0 3px rgba(14, 76, 138, 0.4);
  background: none;
}

.cmg-dot.active.row-hovered .cmg-dot-fill.status-delete,
.cmg-dot.active.col-hovered .cmg-dot-fill.status-delete {
  background: #e74c3c;
  box-shadow: 0 0 3px rgba(231, 76, 60, 0.4);
}

.cmg-load-more {
  margin-top: 16px;
  text-align: center;
}

.btn-load-more {
  background: none;
  border: 1px solid #ccc;
  padding: 6px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #666;
  cursor: pointer;
  border-radius: 3px;
}

.btn-load-more:hover {
  background: #f5f5f5;
  border-color: #999;
}

/* Frequency bars (column skyline) */
.cmg-bar-row {
  height: 40px !important;
}

.cmg-freq-bar {
  height: 40px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 2px;
  cursor: default;
}

.cmg-freq-bar.hovered {
  background: rgba(14, 76, 138, 0.06);
}

.cmg-freq-bar-fill {
  width: 8px;
  background: #0E4C8A;
  border-radius: 0 0 1px 1px;
  opacity: 0.6;
  min-height: 1px;
}

.cmg-freq-bar.hovered .cmg-freq-bar-fill {
  opacity: 1;
}

/* Breadth column (per-commit module count) */
.cmg-breadth-header {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-size: 9px;
  color: #999;
  padding-bottom: 4px;
}

.cmg-breadth {
  font-size: 9px;
  color: #aaa;
  text-align: center;
  justify-content: center;
}
/* Sparkline link hover effect */
.sparkline-link:hover {
  background: #f0ede6 !important;
}

/* =============================================================================
   Page Sub-Nav — Shared beige banner + filter pill buttons
   Used by: ModuleStructure, ModuleSignatures, CommitModuleGrid
   ============================================================================= */

/* Beige banner bar spanning full width of page content area */
.page-subnav {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  background: var(--color-beige-base);
  border-bottom: 1px solid #999;
  min-height: 40px;
}

/* Variant with content to left + right (justify between) */
.page-subnav--split {
  justify-content: space-between;
}

/* Title text inside the sub-nav */
.page-subnav__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-dark);
}

/* Muted stats / secondary text in sub-nav */
.page-subnav__stats {
  font-size: 10px;
  color: #665;
}

/* Right-aligned group of controls */
.page-subnav__controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Label before a group of filter buttons */
.page-subnav__label {
  font-size: 9px;
  color: #665;
  margin-right: 2px;
}

/* Filter bar below the sub-nav (kind filters, etc.) */
.page-filter-bar {
  display: flex;
  gap: 4px;
  padding: 6px 16px;
  flex-wrap: wrap;
}

/* Generic pill-shaped filter button */
.filter-pill {
  background: none;
  border: 1px solid #ccc;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: #666;
  cursor: pointer;
  border-radius: 2px;
  line-height: 1.4;
}

.filter-pill:hover {
  background: #f0f0f0;
  border-color: #999;
}

.filter-pill.active {
  background: #333;
  color: #fff;
  border-color: #333;
  font-weight: 600;
}

/* =============================================================================
   Git Blame View
   ============================================================================= */

.ps-blame-line {
  display: flex;
  min-height: 1.7em;
  padding: 0 12px 0 0;
  cursor: pointer;
  transition: filter 100ms ease;
}

.ps-blame-line:hover {
  filter: brightness(0.92);
}

.ps-blame-group-start {
  border-top: 1px solid rgba(0, 0, 0, 0.12);
}

