/* =================================
   Materialization Planner - Three Column Layout
   ================================= */

/* Reset native browser input styling for all planner inputs */
.cube-search,
.combobox-search,
.filter-input {
  -webkit-appearance: none;
  appearance: none;
  box-shadow: none;
}

/* CSS Variables for theming */
:root {
  --planner-bg: #f8fafc;
  --planner-surface: #ffffff;
  --planner-surface-hover: #f1f5f9;
  --planner-border: #e2e8f0;
  --planner-text: #1e293b;
  --planner-text-muted: #64748b;
  --planner-text-dim: #94a3b8;

  --accent-primary: #3b82f6;
  --accent-preagg: #d97706;
  --accent-metric: #a2283e; /* Rose/pink - matches node_type__metric */
  --accent-dimension: #a96621; /* Golden orange - matches node_type__dimension */
  --accent-derived: #db2777;
  --accent-cube: #580076; /* Dark purple - matches node_type__cube */
  --accent-success: #059669;
  --accent-warning: #d97706;
  --accent-error: #dc2626;

  --font-display: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Full page layout */
.planner-page {
  height: calc(100vh - 90px);
  display: flex;
  flex-direction: column;
  background: var(--planner-bg);
  color: var(--planner-text);
  font-family: var(--font-body);
  overflow: hidden;
  border-top: 1px solid #eee;
}

/* Header */
.planner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--planner-surface);
  border-bottom: 1px solid var(--planner-border);
  flex-shrink: 0;
}

.planner-header-content h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--planner-text);
}

.planner-header-content p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--planner-text-muted);
}

.header-error {
  padding: 8px 16px;
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.3);
  border-radius: var(--radius-md);
  color: var(--accent-error);
  font-size: 13px;
}

.planner-error-banner {
  flex-shrink: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
}

/* Materialization Error Banner */
.materialization-error {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.25);
  border-radius: var(--radius-md);
  color: var(--accent-error);
  font-size: 12px;
  line-height: 1.5;
}

.materialization-error .error-content {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
}

.materialization-error .error-icon {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

.materialization-error .error-message {
  word-break: break-word;
}

.materialization-error .error-dismiss {
  background: none;
  border: none;
  color: var(--accent-error);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  opacity: 0.7;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

.materialization-error .error-dismiss:hover {
  opacity: 1;
}

/* Global error banner (outside form) */
.materialization-error.global-error {
  margin: 0 0 16px 0;
}

/* Workflow Success Banner */
.workflow-success {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: var(--radius-md);
  color: var(--accent-green, #22c55e);
  font-size: 12px;
  line-height: 1.5;
}

.workflow-success .success-content {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
}

.workflow-success .success-icon {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
  background: var(--accent-green, #22c55e);
  color: white;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.workflow-success .success-message {
  word-break: break-word;
}

.workflow-success .success-message strong {
  display: block;
  margin-bottom: 6px;
  color: var(--planner-text);
}

.workflow-success .workflow-url-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.workflow-success .workflow-url-list a {
  color: var(--accent-green, #22c55e);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.workflow-success .workflow-url-list a:hover {
  text-decoration: underline;
}

.workflow-success .success-dismiss {
  background: none;
  border: none;
  color: var(--accent-green, #22c55e);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  opacity: 0.7;
  transition: opacity 0.15s ease;
  flex-shrink: 0;
}

.workflow-success .success-dismiss:hover {
  opacity: 1;
}

/* Cube Card (matches pre-agg card styling) */
.preagg-summary-card.cube-card {
  /* border-color: rgba(88, 0, 118, 0.3); */
  background: linear-gradient(
    135deg,
    rgba(88, 0, 118, 0.04),
    var(--planner-bg)
  );
}

.preagg-summary-card.cube-card .preagg-summary-name.cube-name {
  color: var(--accent-cube, #580076);
}

.cube-workflow-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--planner-border);
}

/* Materialization Status Bar (compact) */
.materialization-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: linear-gradient(
    135deg,
    rgba(5, 150, 105, 0.06),
    var(--planner-bg)
  );
  border: 1px solid rgba(5, 150, 105, 0.25);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.status-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-bar-indicator {
  color: var(--accent-success, #059669);
  font-size: 12px;
  font-weight: bold;
}

.status-bar-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-success, #059669);
}

.status-bar-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
}

.status-bar-badge.badge-cube {
  background: rgba(88, 0, 118, 0.12);
  color: var(--accent-cube, #580076);
}

.status-bar-badge.badge-preagg {
  background: rgba(107, 114, 128, 0.12);
  color: var(--planner-text);
}

.status-bar-edit {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid var(--planner-border);
  background: var(--planner-surface);
  color: var(--planner-text);
}

.status-bar-edit:hover {
  background: var(--planner-surface-hover);
  border-color: var(--accent-primary);
}

/* Selection Summary Label */
.selection-summary-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--planner-text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Status Pill Badges */
.status-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.status-pill.status-active {
  background: rgba(5, 150, 105, 0.1);
  color: var(--accent-success, #059669);
}

.status-pill.status-not-set {
  background: rgba(107, 114, 128, 0.1);
  color: var(--planner-text-muted);
}

.status-pill.status-pending {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-warning, #f59e0b);
}

/* Pre-Aggregation Section Header */
.preagg-section-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--planner-text-muted);
  padding: 8px 0;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--planner-border);
}

/* =================================
   Three Column Layout
   ================================= */

.planner-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Left: Selection Panel */
.planner-selection {
  width: 20%;
  min-width: 200px;
  min-height: 0;
  background: var(--planner-surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Center: Graph */
.planner-graph {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--planner-bg);
  overflow: hidden;
}

.graph-header {
  padding: 12px 16px;
  background: var(--planner-surface);
  border-bottom: 1px solid var(--planner-border);
  flex-shrink: 0;
}

.graph-stats {
  font-size: 12px;
  color: var(--planner-text-muted);
  font-family: var(--font-display);
}

.graph-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--planner-text-muted);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--planner-border);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.graph-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  text-align: center;
}

.graph-empty .empty-icon {
  font-size: 48px;
  opacity: 0.3;
  margin-bottom: 16px;
}

.graph-empty h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--planner-text);
}

.graph-empty p {
  margin: 0;
  font-size: 14px;
  color: var(--planner-text-muted);
  max-width: 300px;
}

/* Vertical resizer between graph and details panels */
.vertical-resizer {
  width: 1px;
  background: var(--planner-border);
  cursor: col-resize;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: background 0.15s;
}

/* Wider invisible hit area */
.vertical-resizer::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -4px;
  right: -4px;
}

.vertical-resizer:hover,
.vertical-resizer:active {
  background: var(--accent-primary);
}

/* Right: Details Panel */
.planner-details {
  width: 40%;
  min-width: 280px;
  background: var(--planner-surface);
  overflow-y: auto;
}

/* =================================
   Selection Panel Styles
   ================================= */

.selection-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.resizable-sections {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Cube Preset Section */
.cube-preset-section {
  padding: 10px 12px;
  border-bottom: 1px solid var(--planner-border);
  background: var(--planner-bg);
  position: relative;
  flex-shrink: 0;
  z-index: 10; /* Create stacking context for dropdown */
}

.preset-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0; /* Allow children to shrink */
}

.preset-button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--planner-elevated);
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-md);
  color: var(--planner-text);
  font-size: 11px;
  font-weight: 500;
  min-width: 0; /* Allow button to shrink for truncation */
  flex: 1;
  font-family: var(--font-display);
  cursor: pointer;
  transition: all 0.15s ease;
  flex: 1;
}

.preset-button:hover {
  background: var(--planner-surface);
  border-color: var(--accent-primary);
}

/* Loaded cube preset state */
.preset-button.has-preset {
  background: rgba(88, 0, 118, 0.1); /* Light purple - matches cube color */
  border-color: var(--accent-cube);
  color: var(--accent-cube);
}

.preset-button.has-preset:hover {
  background: rgba(88, 0, 118, 0.15);
  border-color: var(--accent-cube);
}

.preset-label {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset-icon {
  font-size: 12px;
  flex-shrink: 0;
}

.dropdown-arrow {
  margin-left: auto;
  font-size: 8px;
  opacity: 0.6;
}

.clear-all-btn {
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-md);
  color: var(--planner-text-muted);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.clear-all-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #dc2626;
}

.cube-dropdown {
  position: absolute;
  top: calc(100% - 1px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid var(--planner-border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 1000; /* High z-index to appear above everything */
  max-height: 300px;
  display: flex;
  flex-direction: column;
}

.cube-search {
  padding: 8px 12px;
  border: none;
  border-bottom: 1px solid var(--planner-border);
  background: transparent;
  color: var(--planner-text);
  font-size: 12px;
  outline: none;
}

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

.cube-list {
  overflow-y: auto;
  max-height: 250px;
}

.cube-option {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 8px 12px;
  padding-right: 32px;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s ease;
  position: relative;
}

.cube-option:hover {
  background: var(--planner-surface);
}

.cube-option.selected {
  background: rgba(88, 0, 118, 0.08);
}

.cube-option.selected:hover {
  background: rgba(88, 0, 118, 0.12);
}

.cube-option.selected .cube-name {
  color: var(--accent-cube);
}

.cube-selected-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-cube);
  font-size: 12px;
  font-weight: 600;
}

.cube-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--planner-text);
  font-family: var(--font-display);
}

.cube-info {
  font-size: 10px;
  color: var(--planner-text-muted);
}

.cube-empty {
  padding: 16px 12px;
  text-align: center;
  font-size: 11px;
  color: var(--planner-text-muted);
}

.selection-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

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

.section-header h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--planner-text);
}

.selection-count {
  font-size: 11px;
  color: var(--planner-text-dim);
}

.search-box {
  position: relative;
  padding: 8px 12px;
  flex-shrink: 0;
  max-height: 70px;
}

.search-box input {
  width: 100%;
  padding: 8px 12px;
  padding-right: 32px;
  background: var(--planner-bg);
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--planner-text);
  outline: none;
  transition: border-color 0.15s;
}

.search-box input:focus {
  border-color: var(--accent-primary);
}

.search-box input::placeholder {
  color: var(--planner-text-dim);
}

.clear-search {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--planner-text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.clear-search:hover {
  color: var(--planner-text);
}

.selection-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.namespace-group {
  margin-bottom: 4px;
}

.namespace-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.namespace-header:hover {
  background: var(--planner-surface-hover);
}

.expand-icon {
  font-size: 10px;
  color: var(--planner-text-dim);
  width: 12px;
}

.namespace-name {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--planner-text);
  font-family: var(--font-display);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.namespace-count {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--planner-text-dim);
}

.selected-badge {
  background: var(--accent-primary);
  color: white;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
}

.namespace-items {
  padding-left: 20px;
}

.namespace-actions {
  display: flex;
  gap: 8px;
  padding: 4px 12px 8px;
}

.select-all-btn {
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 11px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.select-all-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  text-decoration: underline;
}

.selection-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.selection-item:hover {
  background: var(--planner-surface-hover);
}

.selection-item input[type='checkbox'] {
  margin-top: 2px;
  accent-color: var(--accent-primary);
}

/* Incompatible metric (dims selected, this metric doesn't support them) */
.selection-item.metric-incompatible {
  opacity: 0.35;
}

/* Compatible badge shown next to metrics that match selected dims */
.metric-compatible-badge {
  margin-left: auto;
  font-size: 11px;
  color: var(--accent-success);
  font-weight: 600;
  flex-shrink: 0;
}

.item-name {
  font-size: 13px;
  color: var(--planner-text);
  word-break: break-word;
}

.dimension-item {
  align-items: flex-start;
}

.dimension-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dimension-full-name {
  font-size: 10px;
  color: var(--planner-text-muted);
  font-family: var(--font-display);
  word-break: break-all;
}

.dimension-path {
  font-size: 10px;
  color: var(--planner-text-dim);
  font-family: var(--font-display);
}

/* Dimension group (node-level header + items) */
.dim-group {
  margin-bottom: 4px;
}

.dim-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.dim-group-header:hover {
  background: var(--planner-surface-hover);
}

.dim-group-name {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--planner-text);
  font-family: var(--font-display);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dim-group-meta {
  font-size: 10px;
  font-weight: 400;
  color: var(--planner-text-muted);
  background: var(--planner-bg-subtle, rgba(0, 0, 0, 0.06));
  padding: 1px 5px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.dim-group-count {
  font-size: 11px;
  color: var(--planner-text-dim);
  flex-shrink: 0;
}

.dim-group-item {
  padding-left: 28px;
}

/* Role path sub-group (second level) */
.dim-role-group {
  padding-left: 20px;
}

.dim-role-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.dim-role-header:hover {
  background: var(--planner-surface-hover);
}

.dim-role-label {
  flex: 1;
  font-size: 11px;
  color: var(--planner-text-muted);
  font-family: var(--font-display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dim-role-item {
  padding-left: 22px;
}

.dim-filter-btn {
  opacity: 0;
  pointer-events: none;
  margin-left: auto;
  align-self: center;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--planner-text-dim);
  font-size: 10px;
  font-family: var(--font-display);
  padding: 0 2px;
  cursor: pointer;
  transition: opacity 0.1s, color 0.1s;
}

.dim-role-item:hover .dim-filter-btn {
  opacity: 1;
  pointer-events: auto;
}

.dim-filter-btn:hover {
  color: var(--accent-dimension);
}

/* Search result items (flat list) */
.search-result-item {
  padding: 8px 12px;
}

.search-result-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.item-namespace {
  font-size: 10px;
  color: var(--planner-text-dim);
  font-family: var(--font-display);
}

.section-divider {
  height: 1px;
  background: var(--planner-border);
  margin: 0;
  flex-shrink: 0;
}

.section-divider.draggable-divider {
  height: 5px;
  cursor: row-resize;
  background: var(--planner-border);
  transition: background 0.15s;
  position: relative;
}

.section-divider.draggable-divider:hover,
.section-divider.draggable-divider:active {
  background: var(--accent-primary);
}

.empty-list {
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--planner-text-dim);
}

.empty-list.hint {
  font-style: italic;
}

/* =================================
   Flow Graph Styles
   ================================= */

.compact-flow-container {
  flex: 1;
  position: relative;
  background: var(--planner-bg);
}

.compact-flow-container .react-flow__background {
  background: var(--planner-bg) !important;
}

.graph-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--planner-text-dim);
}

.graph-empty-state .empty-icon {
  font-size: 48px;
  opacity: 0.3;
  margin-bottom: 16px;
}

/* Compact Nodes */
.compact-node {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--planner-surface);
  border: 2px solid var(--planner-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 160px;
  box-shadow: var(--shadow-sm);
}

.compact-node:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.compact-node.selected {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.compact-node-icon {
  font-size: 16px;
  opacity: 0.7;
}

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

.compact-node-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--planner-text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compact-node-meta {
  display: flex;
  gap: 8px;
  font-size: 10px;
  color: var(--planner-text-dim);
}

.compact-node-badge {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(219, 39, 119, 0.15);
  color: var(--accent-derived);
  font-weight: 600;
}

/* Pre-agg Node */
.compact-node-preagg {
  border-color: rgba(217, 119, 6, 0.4);
}

.compact-node-preagg:hover {
  border-color: var(--accent-preagg);
}

.compact-node-preagg .compact-node-icon {
  color: var(--accent-preagg);
}

.compact-node-preagg.selected {
  border-color: var(--accent-preagg);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2);
}

/* Metric Node */
.compact-node-metric {
  border-color: rgba(162, 40, 62, 0.4); /* Matches --accent-metric */
}

.compact-node-metric:hover {
  border-color: var(--accent-metric);
}

.compact-node-metric .compact-node-icon {
  color: var(--accent-metric);
}

.compact-node-metric.selected {
  border-color: var(--accent-metric);
  box-shadow: 0 0 0 3px rgba(162, 40, 62, 0.2); /* Matches --accent-metric */
}

/* Derived Metric */
.compact-node-derived {
  border-color: rgba(219, 39, 119, 0.4);
}

.compact-node-derived:hover {
  border-color: var(--accent-derived);
}

.compact-node-derived .compact-node-icon {
  color: var(--accent-derived);
}

/* Component Node */
.compact-node-component {
  border-color: rgba(34, 197, 94, 0.4);
}

.compact-node-component:hover {
  border-color: #22c55e;
}

.compact-node-component .compact-node-icon {
  color: #22c55e;
}

.compact-node-component.selected {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

/* Node Handles */
.compact-node .react-flow__handle {
  width: 8px;
  height: 8px;
  border: 2px solid var(--planner-surface);
  background: var(--planner-text-dim);
}

.compact-node-preagg .react-flow__handle {
  background: var(--accent-preagg);
}

.compact-node-component .react-flow__handle {
  background: #22c55e;
}

.compact-node-metric .react-flow__handle {
  background: var(--accent-metric);
}

/* Graph Legend */
.graph-legend {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  gap: 16px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-md);
  font-size: 11px;
  color: var(--planner-text-muted);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.legend-dot.preagg {
  background: var(--accent-preagg);
}

.legend-dot.component {
  background: #22c55e;
}

.legend-dot.metric {
  background: var(--accent-metric);
}

.legend-dot.derived {
  background: var(--accent-derived);
}

/* =================================
   Details Panel Styles
   ================================= */

.details-panel {
  height: 100%;
  overflow-y: auto;
}

.details-panel-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.empty-hint {
  text-align: center;
  padding: 48px 24px;
}

.empty-hint .empty-icon {
  font-size: 40px;
  opacity: 0.2;
  margin-bottom: 16px;
}

.empty-hint h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--planner-text);
}

.empty-hint p {
  margin: 0;
  font-size: 12px;
  color: var(--planner-text-dim);
}

/* Details Header */
.details-header {
  padding: 16px;
  background: var(--planner-bg);
  border-bottom: 1px solid var(--planner-border);
}

.details-type-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.details-type-badge.preagg {
  background: rgba(217, 119, 6, 0.15);
  color: var(--accent-preagg);
}

.details-type-badge.metric {
  background: rgba(162, 40, 62, 0.15); /* Matches --accent-metric */
  color: var(--accent-metric);
}

.details-type-badge.derived {
  background: rgba(219, 39, 119, 0.15);
  color: var(--accent-derived);
}

.details-type-badge.overview {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-primary);
}

.details-close {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-sm);
  color: var(--planner-text-muted);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s;
}

.details-close:hover {
  background: var(--planner-surface-hover);
  color: var(--planner-text);
}

.details-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--planner-text);
  font-family: var(--font-display);
}

.details-full-name {
  margin: 0;
  font-size: 11px;
  color: var(--planner-text-dim);
  font-family: var(--font-display);
  word-break: break-all;
}

/* Info row below title - shows metrics count, materialization status, dialect, freshness */
.details-info-row {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--planner-text-dim);
  font-family: var(--font-display);
}

.info-materialized {
  color: #7c3aed;
  font-weight: 500;
}

.info-base-tables {
  color: #d97706;
  font-weight: 500;
}

/* SQL pane info row */
.sql-pane-info {
  font-size: 11px;
  color: var(--planner-text-dim);
  flex: 1;
}

.sql-pane-info .info-materialized {
  color: #7c3aed;
  font-weight: 500;
}

/* SQL info inline (next to Optimized/Raw toggle) */
.sql-info-inline {
  font-size: 11px;
  color: var(--planner-text-dim);
  margin-left: auto;
  margin-right: 1em;
}

/* Details Sections */
.details-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--planner-border);
}

.details-section-full {
  padding: 14px 0;
}

.details-section-full > .section-title,
.details-section-full > .section-header-row {
  padding: 0 16px;
}

.details-section .section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--planner-text-muted);
}

.section-icon {
  font-size: 12px;
  opacity: 0.6;
}

.section-icon.cube-icon {
  color: var(--accent-cube, #580076);
  opacity: 1;
}

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

/* Aggregability Badge */
.details-aggregability-section {
  text-align: center;
}

.aggregability-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.aggregability-full {
  background: rgba(5, 150, 105, 0.1);
  color: var(--accent-success);
  border: 1px solid rgba(5, 150, 105, 0.2);
}

.aggregability-limited {
  background: rgba(217, 119, 6, 0.1);
  color: var(--accent-warning);
  border: 1px solid rgba(217, 119, 6, 0.2);
}

.aggregability-none {
  background: rgba(220, 38, 38, 0.1);
  color: var(--accent-error);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

/* Grain Pills */
.grain-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.grain-pill {
  display: inline-block;
  padding: 5px 8px;
  background: var(--planner-bg);
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-display);
  color: var(--planner-text);
}

.details-section .empty-text {
  font-size: 12px;
  color: var(--planner-text-dim);
  font-style: italic;
}

/* Metrics List */
.metrics-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.related-metric {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--planner-bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--planner-border);
}

.related-metric .metric-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-metric);
}

.related-metric .derived-badge {
  font-size: 9px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(219, 39, 119, 0.15);
  color: var(--accent-derived);
  font-weight: 600;
}

/* Components Table */
.components-table-wrapper {
  overflow-x: auto;
}

.details-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.details-table th {
  padding: 8px 12px;
  background: var(--planner-bg);
  color: var(--planner-text-muted);
  font-weight: 600;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
  border-bottom: 1px solid var(--planner-border);
}

.details-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--planner-border);
  vertical-align: top;
}

.details-table tr:hover td {
  background: rgba(59, 130, 246, 0.03);
}

/* Highlighted component row - when clicking a component in the graph */
.details-table tr.component-row-highlighted {
  animation: highlightFade 2s ease-out;
}

.details-table tr.component-row-highlighted td {
  background: rgb(240 246 59 / 15%);
  border-top: 1px solid rgba(59, 130, 246, 0.3);
  border-bottom: 1px solid rgba(59, 130, 246, 0.3);
}

@keyframes highlightFade {
  0% {
    background: rgba(59, 130, 246, 0.3);
  }
  100% {
    background: rgba(59, 130, 246, 0.15);
  }
}

.comp-name-cell code {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--accent-preagg);
  background: rgba(217, 119, 6, 0.1);
  padding: 2px 5px;
  border-radius: 3px;
}

.comp-expr-cell code {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--planner-text-muted);
  word-break: break-all;
}

.agg-func,
.merge-func {
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--planner-text-dim);
}

/* SQL Section */
.details-sql-section {
  border-bottom: none;
}

/* SQL View Toggle */
.sql-view-toggle {
  display: flex;
  gap: 2px;
  background: #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 2px;
}

.sql-toggle-btn {
  padding: 4px 10px;
  background: transparent;
  color: #64748b;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.sql-toggle-btn:hover:not(.active):not(:disabled) {
  color: #334155;
  background: rgba(255, 255, 255, 0.5);
}

.sql-toggle-btn.active {
  background: white;
  color: var(--accent-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.sql-toggle-btn:disabled {
  cursor: wait;
  opacity: 0.7;
}

/* Copy SQL button (for PreAggDetailsPanel) */
.copy-sql-btn {
  padding: 5px 10px;
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.copy-sql-btn:hover {
  background: #2563eb;
}

/* Scan Estimate Banner */
.scan-estimate-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 16px 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.4;
}

.scan-estimate-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

.scan-estimate-content {
  flex: 1;
}

.scan-estimate-header {
  margin-bottom: 8px;
}

.scan-estimate-header strong {
  font-weight: 600;
}

.scan-estimate-sources {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.scan-source-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  font-family: var(--font-display);
}

.scan-source-name {
  flex: 1;
  color: var(--planner-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scan-source-size {
  flex-shrink: 0;
  font-weight: 600;
  opacity: 0.9;
}

/* Scan estimate warning levels */
.scan-estimate-ok {
  background: rgba(5, 150, 105, 0.08);
  border: 1px solid rgba(5, 150, 105, 0.2);
  color: var(--accent-success);
}

.scan-estimate-warning {
  background: rgba(217, 119, 6, 0.08);
  border: 1px solid rgba(217, 119, 6, 0.25);
  color: var(--accent-warning);
}

.scan-estimate-critical {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.25);
  color: var(--accent-error);
}

.sql-code-wrapper {
  padding: 0 16px 16px;
}

.sql-code-wrapper pre {
  margin: 0 !important;
}

/* Formula Display (for metric details) */
.formula-display {
  padding: 10px;
  background: var(--planner-bg);
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-sm);
}

.formula-display code {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--accent-primary);
  word-break: break-all;
}

/* Component Tags */
.component-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.component-tag {
  padding: 5px 8px;
  background: rgba(217, 119, 6, 0.1);
  color: var(--accent-preagg);
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-family: var(--font-display);
}

/* Pre-agg Sources */
.preagg-sources {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.preagg-source-item {
  padding: 8px 10px;
  background: var(--planner-bg);
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-sm);
}

.preagg-source-name {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-preagg);
  margin-bottom: 2px;
}

.preagg-source-full {
  font-size: 10px;
  color: var(--planner-text-dim);
  font-family: var(--font-display);
}

/* =================================
   Query Overview Panel Styles
   ================================= */

.preagg-summary-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preagg-summary-card {
  padding: 12px;
  background: var(--planner-bg);
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-md);
}

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

.preagg-summary-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-preagg);
  font-family: var(--font-display);
}

.aggregability-pill {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
}

.aggregability-pill.aggregability-full {
  background: rgba(5, 150, 105, 0.1);
  color: var(--accent-success);
}

.aggregability-pill.aggregability-limited {
  background: rgba(217, 119, 6, 0.1);
  color: var(--accent-warning);
}

.aggregability-pill.aggregability-none {
  background: rgba(220, 38, 38, 0.1);
  color: var(--accent-error);
}

.preagg-summary-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.preagg-summary-row {
  display: flex;
  gap: 8px;
  font-size: 11px;
}

.preagg-summary-row .label {
  color: var(--planner-text-dim);
  min-width: 60px;
}

.preagg-summary-row .value {
  color: var(--planner-text);
  font-family: var(--font-display);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Scan estimate styling */
.preagg-summary-row .value.scan-estimate {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.scan-estimate-icon {
  font-size: 12px;
  display: inline-block;
  min-width: 14px;
  text-align: center;
}

.scan-estimate-hint {
  font-size: 10px;
  color: var(--planner-text-dim);
  font-style: italic;
  font-weight: 400;
}

.scan-estimate-low {
  color: #059669;
}

.scan-estimate-medium {
  color: #d97706;
}

.scan-estimate-high {
  color: #dc2626;
}

.scan-estimate-critical {
  color: #991b1b;
}

.scan-estimate-unavailable {
  color: var(--planner-text-dim);
  font-style: italic;
}

.preagg-summary-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--planner-border);
  font-size: 11px;
  color: var(--planner-text-muted);
}

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

/* Pre-agg/Cube action buttons row */
.preagg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--planner-border);
}

.status-indicator.status-materialized {
  color: var(--accent-success);
}

.status-indicator.status-not-materialized {
  color: var(--planner-text-dim);
}

.status-indicator.status-stale {
  color: var(--accent-warning);
}

/* Metrics & Dimensions Summary Grid */
.selection-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.selection-summary-column .section-title {
  margin-bottom: 8px;
}

.selection-summary-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 150px;
  overflow-y: auto;
}

.selection-summary-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--planner-bg);
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.15s ease;
}

.selection-summary-item.clickable:hover {
  background: var(--planner-surface-hover);
  border-color: var(--accent-primary);
  text-decoration: none;
}

.selection-summary-item.clickable.metric:hover {
  border-color: var(--accent-metric);
}

.selection-summary-item.clickable.dimension:hover {
  border-color: var(--accent-dimension);
}

.selection-summary-item.metric {
  border-left: 3px solid var(--accent-metric);
}

.selection-summary-item.dimension {
  border-left: 3px solid var(--accent-dimension);
}

.selection-summary-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--planner-text);
  font-family: var(--font-display);
}

.selection-summary-item.metric .selection-summary-name {
  color: var(--accent-metric);
}

.selection-summary-item.dimension .selection-summary-name {
  color: var(--accent-dimension);
}

/* =================================
   React Flow Overrides
   ================================= */

.react-flow__controls {
  background: var(--planner-surface) !important;
  border: 1px solid var(--planner-border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-md) !important;
}

.react-flow__controls-button {
  background: transparent !important;
  border-bottom-color: var(--planner-border) !important;
  color: var(--planner-text-muted) !important;
}

.react-flow__controls-button:hover {
  background: var(--planner-surface-hover) !important;
  color: var(--planner-text) !important;
}

.react-flow__minimap {
  background: var(--planner-surface) !important;
  border: 1px solid var(--planner-border) !important;
  border-radius: var(--radius-md) !important;
}

/* Scrollbar styling */
.selection-list::-webkit-scrollbar,
.details-panel::-webkit-scrollbar,
.planner-details::-webkit-scrollbar {
  width: 6px;
}

.selection-list::-webkit-scrollbar-track,
.details-panel::-webkit-scrollbar-track,
.planner-details::-webkit-scrollbar-track {
  background: transparent;
}

.selection-list::-webkit-scrollbar-thumb,
.details-panel::-webkit-scrollbar-thumb,
.planner-details::-webkit-scrollbar-thumb {
  background: var(--planner-border);
  border-radius: 3px;
}

.selection-list::-webkit-scrollbar-thumb:hover,
.details-panel::-webkit-scrollbar-thumb:hover,
.planner-details::-webkit-scrollbar-thumb:hover {
  background: var(--planner-text-dim);
}

/* =================================
   Materialization Status Section
   ================================= */

/* Status Header - Compact row with status + expand toggle */
.materialization-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  margin-top: 8px;
  background: var(--planner-bg);
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.materialization-header.clickable {
  cursor: pointer;
}

.materialization-header.clickable:hover {
  background: var(--planner-surface-hover);
  border-color: var(--accent-primary);
}

.materialization-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.status-indicator {
  font-size: 10px;
  line-height: 1;
}

.status-text {
  font-weight: 500;
  color: var(--planner-text);
}

.status-separator {
  color: var(--planner-text-dim);
  margin: 0 2px;
}

.schedule-summary {
  color: var(--planner-text-muted);
  font-size: 10px;
}

/* Status Colors */
.status-not-planned {
  color: var(--planner-text-dim);
}

.status-materialized {
  color: var(--accent-success);
}

.status-compatible {
  color: var(--accent-warning);
}

.status-compatible-materialized {
  color: var(--accent-success);
}

/* Compatible pre-agg note */
.compatible-preagg-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-sm);
  font-size: 11px;
  line-height: 1.5;
  color: var(--planner-text-muted);
}

.compatible-preagg-note .note-icon {
  flex-shrink: 0;
}

.compatible-preagg-note strong {
  color: var(--planner-text);
  font-weight: 600;
}

.status-pending {
  color: var(--accent-warning);
}

.status-running {
  color: var(--accent-primary);
}

.status-failed {
  color: var(--accent-error);
}

/* Expand Toggle Button */
.expand-toggle {
  background: transparent;
  border: none;
  padding: 2px 6px;
  font-size: 10px;
  color: var(--planner-text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.expand-toggle:hover {
  background: var(--planner-border);
  color: var(--planner-text);
}

/* Expandable Materialization Details */
.materialization-details {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--planner-surface);
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-sm);
  animation: slideDown 0.15s ease-out;
}

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

/* Config Rows */
.materialization-config {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.config-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}

.config-label {
  color: var(--planner-text-muted);
  min-width: 70px;
}

.config-value {
  color: var(--planner-text);
  font-weight: 500;
}

.config-value.config-mono {
  font-family: var(--font-display);
  font-size: 10px;
  background: var(--planner-bg);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.run-status {
  font-size: 10px;
}

.run-status.success {
  color: var(--accent-success);
}

.run-status.failed {
  color: var(--accent-error);
}

/* Workflow Links */
.workflow-links {
  display: flex;
  flex-direction: row;
  gap: 4px;
}

.workflow-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent-primary);
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease;
}

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

.workflow-link .link-icon {
  font-size: 10px;
  opacity: 0.7;
}

/* Action Buttons */
.materialization-actions {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--planner-border);
}

.action-btn {
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid var(--planner-border);
  background: var(--planner-surface);
  color: var(--planner-text);
}

.action-btn:hover {
  background: var(--planner-surface-hover);
}

.action-btn-primary {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.action-btn-primary:hover {
  background: #2563eb;
  border-color: #2563eb;
}

.action-btn-primary:disabled {
  background: #93c5fd;
  border-color: #93c5fd;
  cursor: not-allowed;
  opacity: 0.8;
}

.action-btn-secondary {
  background: transparent;
  border-color: var(--planner-border);
  color: var(--planner-text-muted);
}

.action-btn-danger {
  background: transparent;
  border-color: #ef4444;
  color: #ef4444;
}

.action-btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #dc2626;
  color: #dc2626;
}

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

.action-btn-secondary:hover {
  background: var(--planner-surface-hover);
  color: var(--planner-text);
}

.action-btn-small {
  padding: 4px 10px;
  font-size: 10px;
}

/* =================================
   Plan Materialization CTA
   ================================= */

.plan-materialization-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  margin: 12px 0;
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.08) 0%,
    rgba(139, 92, 246, 0.08) 100%
  );
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.plan-materialization-cta:hover {
  border-color: rgba(59, 130, 246, 0.4);
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.12) 0%,
    rgba(139, 92, 246, 0.12) 100%
  );
}

.cta-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cta-icon {
  font-size: 24px;
  filter: grayscale(0%);
}

.cta-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cta-text strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--planner-text);
}

.cta-text span {
  font-size: 12px;
  color: var(--planner-text-muted);
}

.plan-materialization-cta .action-btn-primary {
  flex-shrink: 0;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
}

/* =================================
   Materialization Config Form
   ================================= */

.materialization-config-form {
  margin-top: 8px;
  background: var(--planner-surface);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-sm);
  overflow: hidden;
  animation: slideDown 0.15s ease-out;
}

.config-form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(59, 130, 246, 0.1);
  border-bottom: 1px solid var(--planner-border);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-primary);
}

.config-close-btn {
  background: transparent;
  border: none;
  font-size: 16px;
  color: var(--planner-text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.config-form-note {
  padding: 8px 12px;
  background: rgba(217, 119, 6, 0.1);
  border-bottom: 1px solid rgba(217, 119, 6, 0.2);
  font-size: 10px;
  color: var(--accent-warning);
  line-height: 1.4;
}

.config-close-btn:hover {
  color: var(--planner-text);
}

.config-form-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.config-form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.config-form-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--planner-text-muted);
}

.config-form-options {
  display: flex;
  gap: 12px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--planner-text);
  cursor: pointer;
}

.radio-option input[type='radio'] {
  margin: 0;
  accent-color: var(--accent-primary);
}

.radio-option.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.radio-option.disabled input[type='radio'] {
  cursor: not-allowed;
}

.option-hint {
  font-size: 10px;
  color: var(--planner-text-dim);
  font-style: italic;
  margin-left: 4px;
}

.partition-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  color: #065f46;
  background: #f5fffa;
  border: 1px solid #a7f3d0;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.config-form-input {
  padding: 6px 10px;
  font-size: 11px;
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-sm);
  background: var(--planner-bg);
  color: var(--planner-text);
  font-family: var(--font-display);
}

.config-form-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.config-form-input::placeholder {
  color: var(--planner-text-dim);
}

.config-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--planner-border);
  background: var(--planner-bg);
}

.action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Loading Spinner */
.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-rotate 0.75s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}

@keyframes spinner-rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Partition Setup Inline Form */
.partition-setup-link {
  background: none;
  border: none;
  color: var(--accent-primary);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  margin-left: 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
}

.partition-setup-link:hover {
  background: rgba(59, 130, 246, 0.1);
  text-decoration: underline;
}

.partition-setup-form {
  margin: 8px 0;
  padding: 10px;
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
}

.partition-setup-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: #a16207;
  margin-bottom: 8px;
}

.partition-setup-icon {
  font-size: 12px;
}

.partition-setup-error {
  padding: 6px 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  color: #dc2626;
  font-size: 11px;
  margin-bottom: 8px;
}

.partition-setup-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.partition-setup-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.partition-setup-row label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #a16207;
}

.partition-setup-row select,
.partition-setup-row input[type='text'] {
  padding: 6px 8px;
  font-size: 12px;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  background: white;
  color: var(--planner-text);
}

.partition-setup-row select:focus,
.partition-setup-row input[type='text']:focus {
  outline: none;
  border-color: #fbbf24;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.15);
}

.partition-setup-row .readonly-value {
  font-size: 12px;
  font-family: var(--font-display);
  color: var(--planner-text);
  padding: 2px 0;
}

.partition-setup-row-inline {
  flex-direction: row;
  gap: 10px;
}

.partition-setup-row-inline .partition-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.partition-setup-row-inline .partition-field:first-child {
  flex: 0 0 auto;
}

.partition-setup-row-inline .partition-field select,
.partition-setup-row-inline .partition-field input[type='text'] {
  width: 100%;
}

.partition-setup-hint {
  font-size: 10px;
  color: #ca8a04;
  font-style: italic;
}

/* Multi-node partition setup */
.partition-node-section {
  padding: 8px;
  background: white;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.partition-node-section:last-child {
  margin-bottom: 0;
}

.partition-node-header {
  margin-bottom: 6px;
}

.partition-node-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #a16207;
}

.partition-node-icon {
  font-size: 11px;
}

.partition-node-done .partition-node-name {
  color: #166534;
}

.partition-node-done .partition-node-icon {
  color: #22c55e;
}

.partition-node-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.partition-node-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.partition-node-form .partition-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.partition-node-form .partition-field:first-child {
  flex: 1;
}

.partition-node-form .partition-field-small {
  flex: 0 0 auto;
}

.partition-node-form .partition-field label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #a16207;
}

.partition-node-form .partition-field select,
.partition-node-form .partition-field input[type='text'] {
  padding: 4px 6px;
  font-size: 11px;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  background: white;
  color: var(--planner-text);
}

.partition-node-form .partition-field select:focus,
.partition-node-form .partition-field input[type='text']:focus {
  outline: none;
  border-color: #fbbf24;
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.15);
}

.partition-node-form .partition-field input[type='text'] {
  width: 80px;
}

.partition-set-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  background: #eab308;
  border: 1px solid #ca8a04;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.partition-set-btn:hover:not(:disabled) {
  background: #ca8a04;
}

.partition-set-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.partition-setup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid #fde68a;
}

.partition-setup-actions .button-secondary {
  padding: 5px 10px;
  font-size: 11px;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-sm);
  color: var(--planner-text);
  cursor: pointer;
  transition: background 0.15s ease;
}

.partition-setup-actions .button-secondary:hover {
  background: #f3f4f6;
}

.partition-setup-actions .button-primary {
  padding: 5px 10px;
  font-size: 11px;
  background: #ffefd0;
  border: 1px solid #cccccc;
  border-radius: var(--radius-sm);
  color: #a96621;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.partition-setup-actions .button-primary:hover:not(:disabled) {
  background: #ffe4b3;
}

.partition-setup-actions .button-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Backfill Modal */
.backfill-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.backfill-modal {
  background: var(--planner-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 400px;
  max-width: 90vw;
}

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

.backfill-modal-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--planner-text);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--planner-text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--planner-text);
}

.backfill-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.backfill-description {
  font-size: 13px;
  color: var(--planner-text);
  margin: 0;
}

.backfill-steps {
  margin: 0;
  padding-left: 20px;
  font-size: 12px;
  color: var(--planner-text-muted);
}

.backfill-steps li {
  margin-bottom: 6px;
}

.backfill-form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.backfill-form-row label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--planner-text-muted);
}

.backfill-form-row input[type='date'] {
  padding: 8px 12px;
  font-size: 12px;
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-sm);
  background: var(--planner-bg);
  color: var(--planner-text);
  font-family: var(--font-base);
}

.backfill-form-row input[type='date']:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Simple date inputs for cube backfill */
.backfill-date-inputs {
  display: flex;
  gap: 16px;
  margin-top: 16px;
}

.date-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.date-input-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--planner-text-muted);
}

.date-input-group input[type='date'] {
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-sm);
  background: var(--planner-surface);
  color: var(--planner-text);
}

.date-input-group input[type='date']:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.backfill-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--planner-border);
  background: var(--planner-bg);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Toast Message */
.toast-message {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--planner-surface);
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 12px;
  color: var(--planner-text);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1001;
  animation: slideInUp 0.3s ease;
}

.toast-message a {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
}

.toast-message a:hover {
  text-decoration: underline;
}

.toast-close {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--planner-text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.toast-close:hover {
  color: var(--planner-text);
}

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

/* Workflow link button style */
a.action-btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

/* Section-level config form */
.section-level-config {
  margin: 12px 0;
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-md);
  background: rgba(59, 130, 246, 0.03);
}

.section-level-config .config-form-header {
  background: rgba(59, 130, 246, 0.08);
  border-bottom: 1px solid rgba(59, 130, 246, 0.15);
}

/* Config form section (for grouped fields like Backfill) */
.config-form-section {
  background: var(--planner-bg);
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 4px 0;
}

.config-form-section-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--planner-text-muted);
  margin-bottom: 10px;
}

/* Backfill date range */
.backfill-range {
  display: flex;
  gap: 16px;
}

.backfill-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.backfill-field label {
  font-size: 10px;
  color: var(--planner-text-muted);
}

.backfill-field input[type='date'],
.backfill-field select {
  padding: 6px 10px;
  font-size: 11px;
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-sm);
  background: var(--planner-surface);
  color: var(--planner-text);
}

.backfill-field input[type='date']:focus,
.backfill-field select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Checkbox option */
.checkbox-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--planner-text);
  cursor: pointer;
}

.checkbox-option input[type='checkbox'] {
  margin: 0;
  accent-color: var(--accent-primary);
}

/* Config form select */
.config-form-select {
  padding: 6px 10px;
  font-size: 11px;
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-sm);
  background: var(--planner-surface);
  color: var(--planner-text);
  cursor: pointer;
}

.config-form-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Config form hint */
.config-form-hint {
  display: block;
  font-size: 10px;
  color: var(--planner-text-dim);
  margin-top: 4px;
  font-style: italic;
}

/* Config form section divider */
.config-form-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 12px 0;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--planner-text-muted);
}

.config-form-divider::before,
.config-form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--planner-border);
}

/* Druid cube config section */
.druid-cube-config {
  background: linear-gradient(
    135deg,
    rgba(236, 72, 153, 0.03) 0%,
    rgba(168, 85, 247, 0.03) 100%
  );
  border-color: rgba(168, 85, 247, 0.2);
  margin-top: 8px;
}

/* Druid cube preview */
.druid-cube-preview {
  background: var(--planner-surface);
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 12px;
}

.druid-cube-preview .preview-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--planner-text-muted);
  margin-bottom: 8px;
}

.druid-cube-preview .preview-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.druid-cube-preview .preview-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.druid-cube-preview .preview-source {
  color: var(--planner-text);
  font-weight: 500;
}

.druid-cube-preview .preview-grain {
  color: var(--planner-text-muted);
  font-size: 10px;
}

.druid-cube-preview .preview-info {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--planner-border);
  font-size: 10px;
  color: var(--planner-text-dim);
  font-style: italic;
}

.druid-cube-preview .info-icon {
  flex-shrink: 0;
}

/* Existing cube name display */
.existing-cube-name {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--planner-surface);
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-sm);
}

.existing-cube-name .cube-badge {
  font-size: 14px;
}

.existing-cube-name code {
  font-size: 12px;
  font-weight: 500;
  color: var(--planner-text);
}

/* Cube name input group (namespace.name) */
.cube-name-input-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.cube-name-input-group .namespace-input {
  flex: 1;
  min-width: 100px;
}

.cube-name-input-group .namespace-separator {
  color: var(--planner-text-muted);
  font-weight: 600;
  font-size: 14px;
  padding: 0 2px;
}

.cube-name-input-group .name-input {
  flex: 1.5;
  min-width: 120px;
}

/* =================================
   Selected Chips (Metrics & Dimensions)
   ================================= */

.selected-chips-container {
  padding: 6px 10px;
  border-bottom: 1px solid var(--planner-border);
  background: var(--planner-bg);
}

.selected-chips-wrapper {
  max-height: 54px; /* ~2 rows of chips */
  overflow: hidden;
  transition: max-height 0.2s ease;
}

.selected-chips-wrapper.expanded {
  max-height: 200px;
  overflow-y: auto;
}

.selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chips-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 4px;
  padding: 2px 6px;
  background: transparent;
  border: none;
  color: var(--planner-text-muted);
  font-size: 9px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  transition: color 0.15s ease;
}

.chips-toggle:hover {
  color: var(--accent-primary);
}

.chips-toggle-icon {
  font-size: 8px;
}

/* Combobox-style input: chips + search combined */
.combobox-input {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 10px;
  background: var(--planner-bg);
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-md);
  margin: 8px 12px;
  min-height: 32px;
  cursor: text;
  transition: border-color 0.15s;
}

.combobox-input:focus-within {
  border-color: var(--accent-primary);
}

.combobox-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.combobox-chips.collapsed {
  max-height: 56px; /* ~2 rows */
  overflow-y: auto;
  transition: max-height 0.2s ease;
}

.combobox-chips.expanded {
  max-height: 200px;
  overflow-y: auto;
  transition: max-height 0.2s ease;
}

.combobox-input-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.combobox-search {
  flex: 1;
  min-width: 60px;
  border: none;
  background: transparent;
  outline: none;
  font-size: 12px;
  color: var(--planner-text);
  padding: 2px 0;
}

.combobox-search::placeholder {
  color: var(--planner-text-dim);
}

.combobox-action {
  flex-shrink: 0;
  padding: 2px 8px;
  background: transparent;
  border: none;
  color: var(--planner-text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: color 0.15s;
}

.combobox-action:hover {
  color: var(--accent-primary);
}

.chips-toggle-inline {
  flex-shrink: 0;
  padding: 2px 6px;
  background: var(--planner-bg-hover, #f1f5f9);
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-sm);
  color: var(--planner-text-muted);
  font-size: 9px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  align-self: center;
}

.chips-toggle-inline:hover {
  background: var(--planner-border);
  color: var(--planner-text);
}

.selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 4px 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
  font-family: var(--font-display);
  transition: all 0.12s ease;
  white-space: nowrap;
  max-width: 260px;
}

.selected-chip .chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* Allow the label to shrink below its content width so the ellipsis applies
     within the chip's max-width instead of overflowing the panel. */
  min-width: 0;
}

/* Start-clipping label: ellipsis on the LEFT so the distinguishing end of a
   long, common-prefixed name stays visible ("…erience_f__cart_initiation").
   direction: rtl moves the ellipsis to the start; the inner <bdi> keeps the
   text in normal reading order. Text stays a single node for accessibility. */
.chip-label-clip {
  display: inline-block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: rtl;
}

.chip-label-clip .chip-label-inner {
  direction: ltr;
  unicode-bidi: bidi-override;
}

/* Metrics: Pink (matches node_type__metric background #fad7dd) */
.selected-chip.metric-chip {
  background: #fad7dd;
  color: #a2283e;
  border: 1px solid rgba(162, 40, 62, 0.3);
}

.selected-chip.metric-chip:hover {
  background: #f5c4cd;
  border-color: rgba(162, 40, 62, 0.5);
}

/* Dimensions: Golden orange (matches node_type__dimension background #ffefd0) */
.selected-chip.dimension-chip {
  background: #ffefd0;
  color: #a96621;
  border: 1px solid rgba(169, 102, 33, 0.3);
}

.selected-chip.dimension-chip:hover {
  background: #ffe4b3;
  border-color: rgba(169, 102, 33, 0.5);
}

.chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 2px;
  color: inherit;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.12s ease;
}

.chip-remove:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.08);
}

.metric-chip .chip-remove:hover {
  background: rgba(239, 68, 68, 0.15);
}

.dimension-chip .chip-remove:hover {
  background: rgba(217, 119, 6, 0.15);
}

/* =================================
   Filters Section
   ================================= */

.filters-section {
  min-height: 0;
  overflow-y: auto;
}

/* Dimensions can be dragged onto the Filters section to start a filter. */
.draggable-dim {
  cursor: grab;
}

.draggable-dim:active {
  cursor: grabbing;
}

.filters-section.drop-active {
  outline: 2px dashed var(--node_type__dimension, #a96621);
  outline-offset: -4px;
  background: rgba(169, 102, 33, 0.06);
}

.filter-drop-hint {
  padding: 6px 12px;
  font-size: 11px;
  font-style: italic;
  color: #a96621;
}

.filter-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px 4px 10px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-display);
  color: var(--accent-primary);
  max-width: 100%;
}

.filter-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Filter chip text doubles as a click-to-edit button. */
.filter-chip-edit {
  display: flex;
  min-width: 0;
  align-items: center;
  padding: 0;
  background: transparent;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.filter-chip-edit:hover {
  text-decoration: underline;
}

.filter-chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 2px;
  color: var(--accent-primary);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
  transition: all 0.12s ease;
}

.filter-chip-remove:hover {
  opacity: 1;
  background: rgba(59, 130, 246, 0.15);
}

.filter-input-container {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
}

.filter-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--planner-bg);
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-family: var(--font-display);
  color: var(--planner-text);
  outline: none;
  transition: border-color 0.15s;
}

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

.filter-input::placeholder {
  color: var(--planner-text-dim);
  font-family: var(--font-body);
}

.filter-add-btn {
  padding: 8px 16px;
  background: var(--accent-primary);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.filter-add-btn:hover:not(:disabled) {
  background: #2563eb;
}

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

/* =================================
   Engine Selection
   ================================= */

.engine-run-section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  flex-shrink: 0;
}

.engine-section {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--planner-border);
  background: var(--planner-bg);
  flex-shrink: 0;
}

.engine-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.engine-pills {
  display: flex;
  gap: 4px;
}

.engine-pill {
  padding: 4px 10px;
  border: 1px solid var(--planner-border);
  border-radius: 12px;
  background: transparent;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s ease;
}

.engine-pill:hover {
  border-color: #059669;
  color: #059669;
}

.engine-pill.active {
  background: #059669;
  border-color: #059669;
  color: white;
  font-weight: 500;
}

/* =================================
   Run Query Section
   ================================= */

.run-query-section {
  padding: 16px 12px;
  background: var(--planner-bg);
  flex-shrink: 0;
}

.run-query-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.run-query-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.4);
  transform: translateY(-1px);
}

.run-query-btn:disabled {
  background: #9ca3af;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.run-query-btn .run-icon {
  font-size: 12px;
}

.run-query-btn .spinner.small {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

.run-hint {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  color: var(--planner-text-dim);
  text-align: center;
}

/* =================================
   Results View
   ================================= */

.results-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--planner-bg);
  overflow: hidden;
}

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

.back-to-plan-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-md);
  color: var(--planner-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.back-to-plan-btn:hover {
  background: var(--planner-surface-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.back-arrow {
  font-size: 16px;
}

.results-summary {
  display: flex;
  align-items: center;
  gap: 16px;
}

.results-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--planner-text);
}

.results-time {
  font-size: 12px;
  color: var(--planner-text-muted);
  font-family: var(--font-display);
}

.results-loading-text {
  font-size: 13px;
  color: var(--accent-primary);
  font-weight: 500;
}

.results-error-text {
  font-size: 13px;
  color: var(--accent-error);
  font-weight: 500;
}

/* Two-pane layout: SQL (top 1/3) + Results (bottom 2/3) */
.results-panes {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* SQL Pane - top 1/3 */
.sql-pane {
  flex: 0 0 33.333%;
  display: flex;
  flex-direction: column;
  background: var(--planner-surface);
  min-height: 80px;
  max-height: 33.333%;
}

/* Horizontal resizer between SQL pane and results pane */
.horizontal-resizer {
  height: 1px;
  background: var(--planner-border);
  cursor: row-resize;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  transition: background 0.15s;
}

/* Wider invisible hit area */
.horizontal-resizer::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -4px;
  bottom: -4px;
}

.horizontal-resizer:hover,
.horizontal-resizer:active {
  background: var(--accent-primary);
}

.sql-pane-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--planner-bg);
  border-bottom: 1px solid var(--planner-border);
  flex-shrink: 0;
}

.sql-pane-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--planner-text);
}

.sql-pane-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.sql-dialect-badge {
  padding: 2px 8px;
  background: var(--accent-primary);
  color: white;
  font-size: 10px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  margin-left: 8px;
  vertical-align: middle;
}

.sql-cube-badge {
  padding: 2px 8px;
  background: rgba(88, 0, 118, 0.1);
  color: var(--accent-cube);
  font-size: 10px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(88, 0, 118, 0.3);
  text-decoration: none;
  cursor: pointer;
}

.sql-cube-badge:hover {
  background: rgba(88, 0, 118, 0.2);
  text-decoration: underline;
}

.sql-freshness {
  padding: 2px 8px;
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  font-size: 10px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(245, 158, 11, 0.3);
  cursor: help;
}

.sql-pane-content {
  flex: 1;
  overflow: auto;
}

.sql-pane-content pre {
  margin: 0 !important;
  height: 100% !important;
}

.sql-pane-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--planner-text-dim);
  font-size: 13px;
}

/* Results Pane - bottom 2/3 */
.results-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.results-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px 20px;
  color: var(--planner-text-muted);
}

.results-loading .loading-spinner.large {
  width: 48px;
  height: 48px;
  border-width: 4px;
}

.loading-hint {
  font-size: 12px;
  color: var(--planner-text-dim);
}

.results-error {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px 20px;
  text-align: center;
}

.results-error .error-icon {
  font-size: 48px;
  color: var(--accent-error);
}

.results-error h3 {
  margin: 0;
  font-size: 18px;
  color: var(--planner-text);
}

.results-error .error-message {
  margin: 0;
  font-size: 14px;
  color: var(--accent-error);
  max-width: 400px;
  word-break: break-word;
}

.copy-btn {
  padding: 4px 12px;
  background: var(--accent-primary);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.copy-btn:hover:not(:disabled) {
  background: #2563eb;
}

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

.copy-btn.copied {
  background: var(--accent-success);
}

/* Results Table Section */
.results-table-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--planner-surface);
  overflow: hidden;
  min-height: 0;
}

.table-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--planner-bg);
  border-bottom: 1px solid var(--planner-border);
  flex-shrink: 0;
}

.table-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--planner-text);
}

.table-count {
  font-size: 11px;
  color: var(--planner-text-muted);
}

.table-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-left: auto;
}

.filter-chip.small {
  padding: 2px 8px;
  font-size: 10px;
}

.results-table-wrapper {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.table-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--planner-text-muted);
}

.table-empty p {
  margin: 0;
  font-size: 14px;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.results-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 12px;
  background: #f8fafc;
  color: var(--planner-text);
  font-weight: 600;
  text-align: left;
  border-bottom: 2px solid var(--planner-border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.results-table th:hover {
  background: #f1f5f9;
}

.results-table th.sorted {
  background: rgba(59, 130, 246, 0.08);
}

.results-table th .col-header-content {
  display: flex;
  align-items: center;
  gap: 6px;
}

.results-table th .sort-arrows {
  display: inline-flex;
  flex-direction: column;
  font-size: 8px;
  line-height: 1;
  color: var(--planner-text-dim);
  opacity: 0.4;
}

.results-table th:hover .sort-arrows {
  opacity: 0.7;
}

.results-table th .sort-arrow {
  line-height: 0.8;
}

.results-table th .sort-arrow.active {
  color: var(--planner-primary);
  opacity: 1;
}

.results-table th .col-type {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: var(--planner-text-dim);
  font-family: var(--font-display);
}

.results-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--planner-border);
  color: var(--planner-text);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.results-table tr:hover td {
  background: rgba(59, 130, 246, 0.03);
}

.null-value {
  color: var(--planner-text-dim);
  font-style: italic;
  font-size: 11px;
}

/* Filters Info in Results */
.results-filters-info {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--planner-surface);
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-md);
}

.filters-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--planner-text-muted);
  margin-bottom: 8px;
}

.filters-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filters-list .filter-chip {
  padding: 4px 10px;
}

/* =================================
   Results View - Tab bar & Chart
   ================================= */

.results-tabs-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 0;
  border-bottom: 1px solid var(--planner-border);
  background: var(--planner-surface);
  flex-shrink: 0;
}

.results-tabs {
  display: flex;
  gap: 2px;
}

.results-tab {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--planner-text-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}

.results-tab:hover:not(.disabled) {
  color: var(--planner-text);
}

.results-tab.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

.results-tab.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.results-tabs-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding-bottom: 6px;
}

/* Chart wrapper - fills remaining height */
.results-chart-wrapper {
  flex: 1;
  overflow: hidden;
  min-height: 0;
  padding: 16px 8px 8px;
  display: flex;
  align-items: stretch;
}

/* KPI cards */
.kpi-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  padding: 8px;
}

.kpi-card {
  background: var(--planner-surface);
  border: 1px solid var(--planner-border);
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  min-width: 160px;
  text-align: center;
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--planner-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--planner-text);
  font-family: var(--font-display);
  line-height: 1.1;
}

.kpi-type {
  font-size: 10px;
  color: var(--planner-text-dim);
  margin-top: 6px;
}

.chart-no-data {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  color: var(--planner-text-muted);
  font-size: 13px;
}

/* =================================
   Small Multiples
   ================================= */

.small-multiples {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
}

.small-multiple {
  flex-shrink: 0;
  height: 220px;
  padding: 0 0 8px 0;
  border-bottom: 1px solid var(--planner-border);
}

.small-multiple:last-child {
  border-bottom: none;
}

.small-multiple-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--planner-text-muted);
  padding: 8px 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.small-multiple-chart {
  height: 188px;
}
