/* ============================================================
   DataLab Bridge — Complete UI Stylesheet
   Design: Dark monochrome, minimalist, enterprise-grade
   ============================================================ */

/* ── Keyframes ─────────────────────────────────────────────── */

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

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

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

@keyframes skeletonShimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

/* ── Reset & Base ──────────────────────────────────────────── */

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

::selection {
  background: #333;
  color: #fff;
}

:focus-visible {
  outline: 1px solid #444;
  outline-offset: 2px;
}

/* ── Custom Scrollbars (webkit) ────────────────────────────── */

.datalab-page ::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.datalab-page ::-webkit-scrollbar-track {
  background: transparent;
}

.datalab-page ::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}

.datalab-page ::-webkit-scrollbar-thumb:hover {
  background: #444;
}

.datalab-page ::-webkit-scrollbar-corner {
  background: transparent;
}

/* Firefox scrollbar */
.datalab-page * {
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

/* ── 1. Page Container ─────────────────────────────────────── */

#datalab-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.datalab-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
  background: #0a0a0a;
  color: #e0e0e0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── 2. Top Header ─────────────────────────────────────────── */

.datalab-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 52px;
  padding: 0 20px;
  background: #111;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}

.datalab-header-title {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.datalab-header-subtitle {
  font-size: 12px;
  color: #666;
  margin-left: 4px;
}

.datalab-header-actions {
  display: none;
}

/* Topbar actions: always shown when datalab is active */
#header-actions.datalab-topbar-actions {
  display: flex !important;
  align-items: center;
  gap: 6px;
}
#header-actions.datalab-topbar-actions .datalab-btn {
  padding: 6px 10px;
  font-size: 12px;
}
#header-actions.datalab-topbar-actions .datalab-export-wrapper {
  position: relative;
  display: inline-block;
}
#header-actions.datalab-topbar-actions .datalab-export-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  display: none;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 4px;
  z-index: 1000;
  min-width: 180px;
}
#header-actions.datalab-topbar-actions .datalab-export-option {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: #ccc;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
}
#header-actions.datalab-topbar-actions .datalab-export-option:hover {
  background: #222;
}

/* ── 3. Tabs ───────────────────────────────────────────────── */

.datalab-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  height: 100%;
  margin-left: 24px;
  flex-shrink: 0;
}

.datalab-tab {
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 500;
  color: #888;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
  user-select: none;
}

.datalab-tab:hover {
  color: #ccc;
  background: #1a1a1a;
}

.datalab-tab.active {
  color: #fff;
  border-bottom-color: #fff;
}

.datalab-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 8px;
  font-size: 11px;
  font-weight: 600;
  color: #aaa;
  background: #222;
  border-radius: 9px;
}

/* ── Main Body (3 panels) ──────────────────────────────────── */

.datalab-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── 4. Sidebar ────────────────────────────────────────────── */

.datalab-sidebar {
  width: 260px;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  background: #0d0d0d;
  border-right: 1px solid #1a1a1a;
  overflow: hidden;
  flex-shrink: 0;
}

.datalab-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
}

.datalab-sidebar-header h3 {
  font-size: 12px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.datalab-dataset-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 16px;
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.datalab-dataset-item:hover {
  background: #161616;
}

.datalab-dataset-item.active {
  background: #1a1a1a;
  border-left-color: #fff;
}

.datalab-dataset-name {
  font-size: 13px;
  font-weight: 500;
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.datalab-dataset-item.active .datalab-dataset-name {
  color: #fff;
}

.datalab-dataset-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: #666;
}

.datalab-dataset-meta span {
  white-space: nowrap;
}

.datalab-dataset-date {
  font-size: 11px;
  color: #444;
}

/* ── Main Content ──────────────────────────────────────────── */

.datalab-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ── Discovery Bar (Guided Exploration) ───────────────────── */

.datalab-discovery-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #0a0a0a;
  border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
  overflow-x: auto;
  flex-wrap: nowrap;
}

.discovery-label {
  font-size: 12px;
  color: #555;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 4px;
}

.discovery-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: #111;
  border: 1px solid #222;
  border-radius: 8px;
  font-size: 12px;
  color: #aaa;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.discovery-btn:hover {
  border-color: #444;
  color: #fff;
  background: #1a1a1a;
}

.discovery-btn:active {
  background: #222;
}

.discovery-btn-icon {
  font-size: 14px;
  line-height: 1;
}

.discovery-btn-label {
  font-weight: 500;
}

.datalab-content {
  flex: 1;
  overflow: auto;
  padding: 0;
}

/* ── 12. Filter Bar ────────────────────────────────────────── */

.datalab-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #0d0d0d;
  border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
  overflow-x: auto;
  flex-wrap: nowrap;
}

.datalab-filter-bar-label {
  font-size: 12px;
  color: #666;
  white-space: nowrap;
  flex-shrink: 0;
}

.datalab-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: #222;
  border: none;
  border-radius: 20px;
  font-size: 12px;
  color: #ccc;
  white-space: nowrap;
  cursor: default;
  transition: background 0.15s ease;
  flex-shrink: 0;
  font-family: inherit;
}

.datalab-filter-chip:hover {
  background: #2a2a2a;
}

.datalab-filter-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 14px;
  line-height: 1;
  color: #666;
  background: none;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: color 0.15s ease;
  padding: 0;
}

.datalab-filter-chip-remove:hover {
  color: #fff;
}

.datalab-filter-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  color: #666;
  background: none;
  border: 1px dashed #333;
  border-radius: 20px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
}

.datalab-filter-add:hover {
  color: #aaa;
  border-color: #444;
}

/* ── 5. Data Table ─────────────────────────────────────────── */

.datalab-table-container {
  overflow: auto;
  flex: 1;
}

.datalab-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}

.datalab-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #161616;
  padding: 10px 12px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid #222;
  user-select: none;
}

.datalab-table th.sortable {
  cursor: pointer;
  transition: color 0.15s ease;
}

.datalab-table th.sortable:hover {
  color: #ccc;
}

.datalab-table th .sort-indicator {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  color: #444;
  transition: color 0.15s ease;
}

.datalab-table th.sort-asc .sort-indicator,
.datalab-table th.sort-desc .sort-indicator {
  color: #fff;
}

.datalab-table th .col-stats-inline {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: #444;
  text-transform: none;
  letter-spacing: 0;
  margin-top: 2px;
}

.datalab-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #1a1a1a;
  color: #ccc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.datalab-table td.numeric {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 13px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.datalab-table td.null-value {
  color: #444;
  font-style: italic;
}

.datalab-table tbody tr:nth-child(odd) {
  background: #0d0d0d;
}

.datalab-table tbody tr:nth-child(even) {
  background: #111;
}

.datalab-table tbody tr:hover {
  background: #1a1a1a;
}

.datalab-table tbody tr.selected {
  background: #222;
}

/* Row number column */
.datalab-table th.row-number,
.datalab-table td.row-number {
  width: 48px;
  min-width: 48px;
  text-align: right;
  color: #444;
  font-size: 11px;
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  padding-right: 12px;
  border-right: 1px solid #1a1a1a;
}

/* ── 19. Column Stats Tooltip ──────────────────────────────── */

.datalab-col-stats {
  position: absolute;
  z-index: 200;
  min-width: 180px;
  padding: 12px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.15s ease;
  pointer-events: none;
}

.datalab-col-stats h4 {
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #333;
}

.datalab-col-stats dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
}

.datalab-col-stats dt {
  font-size: 11px;
  color: #666;
}

.datalab-col-stats dd {
  font-size: 11px;
  color: #ccc;
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  text-align: right;
}

/* ── 6. Pagination ─────────────────────────────────────────── */

.datalab-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 10px 20px;
  background: #111;
  border-top: 1px solid #1a1a1a;
  flex-shrink: 0;
}

.datalab-pagination-info {
  font-size: 12px;
  color: #666;
  margin-right: auto;
}

.datalab-pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  font-size: 12px;
  font-family: inherit;
  color: #888;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.datalab-pagination-btn:hover {
  color: #fff;
  background: #222;
}

.datalab-pagination-btn.active {
  color: #fff;
  background: #2a2a2a;
  border-color: #333;
}

.datalab-pagination-btn:disabled {
  color: #333;
  cursor: not-allowed;
  background: transparent;
}

.datalab-pagination-ellipsis {
  font-size: 12px;
  color: #444;
  padding: 0 4px;
}

.datalab-pagination-size {
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid #222;
}

.datalab-pagination-size select {
  background: #1a1a1a;
  color: #aaa;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

/* ── 7. Insights Panel ─────────────────────────────────────── */

.datalab-insights {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  padding: 20px;
}

.datalab-insight-card {
  background: #111;
  border: 1px solid #222;
  border-radius: 8px;
  padding: 16px;
  border-left: 3px solid #444;
  transition: border-color 0.15s ease;
  animation: fadeIn 0.3s ease;
}

.datalab-insight-card:hover {
  border-color: #333;
}

.datalab-insight-card.severity-info {
  border-left-color: #4a9eff;
}

.datalab-insight-card.severity-warning {
  border-left-color: #f0a830;
}

.datalab-insight-card.severity-critical {
  border-left-color: #ef4444;
}

.datalab-insight-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.datalab-insight-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 8px;
}

.datalab-insight-card-title svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.datalab-insight-card-severity {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  flex-shrink: 0;
  margin-left: 12px;
  padding: 2px 8px;
  border-radius: 4px;
}

.severity-info .datalab-insight-card-severity {
  color: #4a9eff;
  background: rgba(74, 158, 255, 0.12);
}

.severity-warning .datalab-insight-card-severity {
  color: #f0a830;
  background: rgba(240, 168, 48, 0.12);
}

.severity-critical .datalab-insight-card-severity {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

.datalab-insight-card-body {
  font-size: 13px;
  color: #aaa;
  line-height: 1.5;
}

.datalab-insight-card-body p + p {
  margin-top: 8px;
}

.datalab-insight-card-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #1a1a1a;
}

.datalab-insight-card-metric {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 12px;
  color: #666;
}

.datalab-insight-card-metric strong {
  color: #ccc;
  font-weight: 600;
}

.datalab-insight-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.datalab-stat-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 11px;
  color: #999;
}

/* ── 8. Correlation Heatmap ────────────────────────────────── */

.datalab-heatmap {
  padding: 20px;
}

.datalab-heatmap-grid {
  display: grid;
  gap: 1px;
  background: #1a1a1a;
  border: 1px solid #222;
  border-radius: 8px;
  overflow: hidden;
}

.datalab-heatmap-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 11px;
  color: #ccc;
  transition: opacity 0.15s ease;
}

.datalab-heatmap-cell:hover {
  opacity: 0.8;
}

/* Correlation strength (grayscale) */
.datalab-heatmap-cell[data-strength="0"] { background: #111; color: #444; }
.datalab-heatmap-cell[data-strength="1"] { background: #1a1a1a; }
.datalab-heatmap-cell[data-strength="2"] { background: #222; }
.datalab-heatmap-cell[data-strength="3"] { background: #2a2a2a; }
.datalab-heatmap-cell[data-strength="4"] { background: #333; }
.datalab-heatmap-cell[data-strength="5"] { background: #444; color: #fff; }
.datalab-heatmap-cell[data-strength="6"] { background: #555; color: #fff; }
.datalab-heatmap-cell[data-strength="7"] { background: #666; color: #fff; }
.datalab-heatmap-cell[data-strength="8"] { background: #888; color: #fff; }
.datalab-heatmap-cell[data-strength="9"] { background: #aaa; color: #000; }
.datalab-heatmap-cell[data-strength="10"] { background: #ccc; color: #000; }

.datalab-heatmap-label {
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 500;
  color: #888;
  background: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.datalab-heatmap-label.x-axis {
  justify-content: center;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  padding: 8px 0;
}

.datalab-heatmap-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  justify-content: center;
}

.datalab-heatmap-legend-label {
  font-size: 11px;
  color: #666;
}

.datalab-heatmap-legend-bar {
  display: flex;
  width: 200px;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(to right, #111, #333, #666, #aaa, #ccc);
}

/* ── 9. Charts Container ──────────────────────────────────── */

.datalab-chart-container {
  background: #111;
  border: 1px solid #222;
  border-radius: 8px;
  padding: 16px;
  margin: 20px;
  position: relative;
}

.datalab-chart-container canvas {
  display: block;
  width: 100%;
  height: auto;
}

/* ── Viz Action Buttons ─────────────────────────────────── */

.datalab-viz-actions {
  display: flex;
  gap: 8px;
  padding: 0 20px 12px;
}

.datalab-viz-actions .datalab-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ── Saved Visualizations ───────────────────────────────── */

.datalab-saved-viz {
  padding: 0 20px 20px;
}

.datalab-saved-viz-header {
  font-size: 12px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-top: 12px;
  border-top: 1px solid #1a1a1a;
}

.datalab-saved-viz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.datalab-saved-viz-card {
  background: #111;
  border: 1px solid #222;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s;
  position: relative;
}

.datalab-saved-viz-card:hover {
  border-color: #444;
}

.datalab-saved-viz-thumb {
  width: 100%;
  height: 120px;
  overflow: hidden;
  background: #0a0a0a;
}

.datalab-saved-viz-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.datalab-saved-viz-nothumb {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #444;
  font-size: 12px;
}

.datalab-saved-viz-info {
  padding: 8px 10px;
}

.datalab-saved-viz-name {
  font-size: 13px;
  font-weight: 600;
  color: #ccc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.datalab-saved-viz-meta {
  font-size: 11px;
  color: #555;
  margin-top: 2px;
}

.datalab-saved-viz-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}

.datalab-saved-viz-card:hover .datalab-saved-viz-actions {
  opacity: 1;
}

.datalab-btn-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  border: 1px solid #333;
  border-radius: 6px;
  color: #aaa;
  cursor: pointer;
  padding: 0;
}

.datalab-btn-icon:hover {
  background: #222;
  color: #fff;
  border-color: #555;
}

.datalab-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.datalab-chart-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.datalab-chart-subtitle {
  font-size: 12px;
  color: #666;
  margin-top: 2px;
}

.datalab-chart-actions {
  display: flex;
  gap: 8px;
}

.datalab-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 16px;
  padding: 20px;
}

/* ── 10. AI Chat Panel ─────────────────────────────────────── */

.datalab-chat {
  width: 380px;
  min-width: 380px;
  display: flex;
  flex-direction: column;
  background: #0d0d0d;
  border-left: 1px solid #1a1a1a;
  flex-shrink: 0;
  min-height: 0;
  overflow: hidden;
  transition: transform 0.3s ease, margin-right 0.3s ease, opacity 0.3s ease;
}

.datalab-chat.collapsed {
  transform: translateX(380px);
  margin-right: -380px;
  opacity: 0;
  pointer-events: none;
}

.datalab-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
}

.datalab-chat-tabs {
  display: none;
  align-items: center;
  gap: 0;
  padding: 0 8px;
  background: #080808;
  border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.datalab-chat-tabs::-webkit-scrollbar {
  display: none;
}

.datalab-chat-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  font-size: 11px;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.datalab-chat-tab:hover {
  color: #aaa;
}

.datalab-chat-tab.active {
  color: #fff;
  border-bottom-color: #fff;
}

.datalab-chat-tab-title {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.datalab-chat-tab-close {
  background: none;
  border: none;
  color: #444;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
}

.datalab-chat-tab-close:hover {
  color: #fff;
  background: #333;
}

.datalab-chat-tab-add {
  background: none;
  border: none;
  color: #444;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 10px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.datalab-chat-tab-add:hover {
  color: #fff;
  background: #222;
}

.datalab-chat-header h3 {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.datalab-chat-header-status {
  font-size: 11px;
  color: #444;
}

.datalab-chat-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

.datalab-chat-toggle:hover {
  color: #fff;
  background: #222;
}

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

.datalab-chat-message {
  max-width: 95%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.5;
  border-radius: 16px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  animation: fadeIn 0.2s ease;
}

.datalab-chat-message.user {
  align-self: flex-end;
  background: var(--bg-user, #1a1a1a);
  color: var(--text, #e0e0e0);
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}

.datalab-chat-message.assistant {
  align-self: flex-start;
  background: var(--bg-message, #161616);
  color: var(--text, #ccc);
  border-bottom-left-radius: 4px;
}

.datalab-chat-message.assistant code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  background: #222;
  padding: 1px 5px;
  border-radius: 3px;
}

.datalab-chat-message.assistant pre {
  background: #111;
  border: 1px solid #222;
  border-radius: 6px;
  padding: 10px;
  margin: 8px 0;
  overflow-x: auto;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.4;
}

.datalab-chat-message.assistant pre code {
  background: none;
  padding: 0;
}

.datalab-chat-message-time {
  display: block;
  font-size: 10px;
  color: #444;
  margin-top: 4px;
}

.datalab-chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  background: #161616;
  border-radius: 12px 12px 12px 4px;
}

.datalab-chat-typing span {
  display: block;
  width: 6px;
  height: 6px;
  background: #444;
  border-radius: 50%;
  animation: pulse 1.2s ease infinite;
}

.datalab-chat-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.datalab-chat-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

/* Evidence blocks */
.evidence-blocks {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.evidence-block {
  background: #0d0d0d;
  border: 1px solid #222;
  border-radius: 8px;
  overflow: hidden;
}

.evidence-summary {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  color: #999;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.evidence-summary:hover {
  color: #ccc;
  background: #111;
}

.evidence-icon {
  font-size: 13px;
}

.evidence-subtitle {
  color: #666;
  font-size: 11px;
  font-style: italic;
  margin-left: 4px;
}

.evidence-n {
  background: #1a1a1a;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  color: #888;
}

.evidence-p {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
}

.evidence-p.sig {
  background: #1a2a1a;
  color: #6c6;
}

.evidence-p.ns {
  background: #2a1a1a;
  color: #a88;
}

.evidence-content {
  padding: 8px 12px 12px;
  border-top: 1px solid #1a1a1a;
}

.evidence-table-wrap {
  overflow-x: auto;
  max-height: 240px;
  overflow-y: auto;
}

.evidence-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
}

.evidence-table th {
  background: #141414;
  padding: 4px 8px;
  text-align: left;
  color: #888;
  font-weight: 600;
  border-bottom: 1px solid #222;
  position: sticky;
  top: 0;
  white-space: nowrap;
}

.evidence-table td {
  padding: 3px 8px;
  color: #aaa;
  border-bottom: 1px solid #111;
  white-space: nowrap;
}

.evidence-table tr:hover td {
  background: #141414;
}

.evidence-table .null {
  color: #444;
  font-style: italic;
}

.evidence-more {
  color: #555;
  font-size: 11px;
  margin: 4px 0 0;
}

.evidence-error {
  color: #a66;
  font-size: 12px;
  padding: 4px 0;
}

.evidence-raw {
  font-size: 11px;
  background: #0a0a0a;
  padding: 8px;
  border-radius: 4px;
  color: #888;
  overflow-x: auto;
  max-height: 200px;
}

.evidence-chart {
  padding: 4px 0;
}

/* Stat grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
}

.stat-item {
  background: #111;
  padding: 6px 8px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 10px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 13px;
  color: #ccc;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  font-weight: 600;
}

.stat-ci {
  margin-top: 6px;
  font-size: 11px;
  color: #888;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
}

.evidence-test-summary {
  margin-top: 8px;
  padding: 8px 10px;
  background: #111;
  border-radius: 6px;
  font-size: 12px;
  color: #aaa;
  font-family: 'SF Mono', 'Cascadia Code', monospace;
}

.evidence-test-summary .sig {
  color: #6c6;
  font-weight: 600;
}

.evidence-test-summary .ns {
  color: #a88;
}

.evidence-empty {
  color: #555;
  font-size: 12px;
}

.datalab-chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid #1a1a1a;
  flex-shrink: 0;
}

.datalab-chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  background: var(--input-bg, #111);
  border: 1px solid #444;
  border-radius: 24px;
  padding: 4px 4px 4px 12px;
}

.datalab-chat-input {
  flex: 1;
  min-height: 36px;
  max-height: 120px;
  padding: 8px 4px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text, #e0e0e0);
  background: transparent;
  border: none;
  resize: none;
  outline: none;
  line-height: 1.4;
}

.datalab-chat-input::placeholder {
  color: #555;
}

.datalab-chat-input:focus {
  outline: none;
}

.datalab-chat-send {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.datalab-chat-send:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.datalab-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px 4px;
}

.datalab-chat-suggestion {
  padding: 5px 10px;
  font-size: 12px;
  font-family: inherit;
  color: #888;
  background: #161616;
  border: 1px solid #222;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.datalab-chat-suggestion:hover {
  color: #ccc;
  border-color: #333;
  background: #1a1a1a;
}

/* ── 11. Upload Modal ──────────────────────────────────────── */

.datalab-upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  animation: fadeIn 0.2s ease;
}

.datalab-upload-modal {
  display: none;
}

.datalab-upload-modal.active {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
}

.datalab-upload-modal-content {
  width: 520px;
  max-width: 90vw;
  background: #111;
  border: 1px solid #222;
  border-radius: 12px;
  overflow: hidden;
}

.datalab-upload-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #1a1a1a;
}

.datalab-upload-modal-header h2 {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.datalab-upload-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: #666;
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

.datalab-upload-modal-close:hover {
  color: #fff;
  background: #222;
}

.datalab-upload-modal-body {
  padding: 20px;
}

/* Upload tabs */
.datalab-upload-tabs {
  display: flex;
  border-bottom: 1px solid #222;
  padding: 0 20px;
  gap: 0;
}
.datalab-upload-tab {
  background: none;
  border: none;
  color: #666;
  font-size: 13px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  font-family: inherit;
}
.datalab-upload-tab:hover {
  color: #aaa;
}
.datalab-upload-tab.active {
  color: #fff;
  border-bottom-color: #fff;
}
.datalab-upload-tab-content {
  padding: 24px;
}

/* Upload zone */
.datalab-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  border: 2px dashed #333;
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  padding: 32px;
  text-align: center;
}
.datalab-upload-zone:hover,
.datalab-upload-zone.dragover {
  border-color: #555;
  background: #0d0d0d;
}
.datalab-upload-zone-icon {
  color: #444;
  margin-bottom: 16px;
}
.datalab-upload-zone-title {
  color: #999;
  font-size: 14px;
  margin: 0 0 4px;
}
.datalab-upload-zone-divider {
  color: #444;
  font-size: 12px;
  margin: 8px 0 16px;
}
.datalab-upload-zone-hint {
  color: #444;
  font-size: 11px;
  margin: 16px 0 0;
}

/* CBS search */
.datalab-cbs-search {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.datalab-cbs-search-row {
  display: flex;
  gap: 8px;
}
.datalab-cbs-input {
  flex: 1;
  background: #0d0d0d;
  border: 1px solid #333;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.datalab-cbs-input:focus {
  border-color: #555;
}
.datalab-cbs-input::placeholder {
  color: #555;
}
.datalab-cbs-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
}
.datalab-cbs-results::-webkit-scrollbar { width: 4px; }
.datalab-cbs-results::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }
.datalab-cbs-result-item {
  background: #0d0d0d;
  border: 1px solid #222;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.datalab-cbs-result-item:hover {
  border-color: #444;
  background: #111;
}
.datalab-cbs-result-title {
  color: #eee;
  font-size: 13px;
  font-weight: 500;
  margin: 0 0 4px;
}
.datalab-cbs-result-meta {
  color: #666;
  font-size: 11px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.datalab-cbs-result-desc {
  color: #777;
  font-size: 12px;
  margin: 6px 0 0;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.datalab-cbs-loading {
  text-align: center;
  color: #666;
  font-size: 13px;
  padding: 32px 0;
}
.datalab-cbs-empty {
  text-align: center;
  color: #555;
  font-size: 13px;
  padding: 32px 0;
}

/* CBS detail / import view */
.datalab-cbs-detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.datalab-cbs-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.datalab-cbs-detail-back {
  background: none;
  border: 1px solid #333;
  color: #999;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}
.datalab-cbs-detail-back:hover {
  border-color: #555;
  color: #fff;
}
.datalab-cbs-detail-title {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  margin: 0;
}
.datalab-cbs-detail-info {
  color: #666;
  font-size: 12px;
  margin: 4px 0 0;
}
.datalab-cbs-dim-section {
  background: #0d0d0d;
  border: 1px solid #1a1a1a;
  border-radius: 10px;
  padding: 14px 16px;
}
.datalab-cbs-dim-title {
  color: #aaa;
  font-size: 12px;
  font-weight: 500;
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.datalab-cbs-dim-select {
  width: 100%;
  background: #111;
  border: 1px solid #333;
  color: #fff;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  max-height: 120px;
}
.datalab-cbs-import-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.datalab-cbs-import-row label {
  color: #888;
  font-size: 12px;
  min-width: 100px;
}

.datalab-upload-dropzone {
  display: none; /* old class, replaced by .datalab-upload-zone */
}

.datalab-upload-progress {
  margin-top: 16px;
  padding: 0 24px 24px;
}

.datalab-upload-progress-filename {
  font-size: 13px;
  color: #ccc;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.datalab-upload-progress-bar {
  width: 100%;
  height: 4px;
  background: #222;
  border-radius: 2px;
  overflow: hidden;
}

.datalab-upload-progress-fill {
  height: 100%;
  background: #fff;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.datalab-upload-progress-percent {
  font-size: 12px;
  color: #666;
  margin-top: 6px;
  text-align: right;
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
}

.datalab-upload-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid #1a1a1a;
}

/* ── 13. Buttons ───────────────────────────────────────────── */

.datalab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all 0.15s ease;
  line-height: 1;
}

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

/* Primary */
.datalab-btn-primary {
  background: #fff;
  color: #000;
  border-color: #fff;
}

.datalab-btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}

.datalab-btn-primary:active:not(:disabled) {
  opacity: 0.8;
}

/* Secondary */
.datalab-btn-secondary {
  background: #222;
  color: #fff;
  border-color: #333;
}

.datalab-btn-secondary:hover:not(:disabled) {
  background: #2a2a2a;
  border-color: #444;
}

.datalab-btn-secondary:active:not(:disabled) {
  background: #333;
}

/* Ghost */
.datalab-btn-ghost {
  background: transparent;
  color: #888;
  border-color: transparent;
}

.datalab-btn-ghost:hover:not(:disabled) {
  color: #fff;
  background: #1a1a1a;
}

.datalab-btn-ghost:active:not(:disabled) {
  background: #222;
}

/* Prompt mode tabs */
.datalab-prompt-tab.active {
  background: #222;
  color: #fff;
  border-color: #444;
}

/* Small variant */
.datalab-btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 5px;
}

/* Icon only */
.datalab-btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
}

.datalab-btn-icon.datalab-btn-sm {
  width: 28px;
  height: 28px;
}

/* ── 14. Empty States ──────────────────────────────────────── */

.datalab-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  animation: fadeIn 0.3s ease;
}

.datalab-empty-icon {
  font-size: 48px;
  color: #333;
  margin-bottom: 16px;
}

.datalab-empty-icon svg {
  width: 48px;
  height: 48px;
  stroke: #333;
}

.datalab-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: #888;
  margin-bottom: 8px;
}

.datalab-empty-text {
  font-size: 13px;
  color: #666;
  max-width: 320px;
  line-height: 1.5;
  margin-bottom: 20px;
}

/* ── 15. Loading States ────────────────────────────────────── */

.datalab-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.datalab-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid #222;
  border-top-color: #888;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.datalab-spinner-lg {
  width: 36px;
  height: 36px;
  border-width: 3px;
}

/* Skeleton screens */
.datalab-skeleton {
  background: linear-gradient(90deg, #1a1a1a 25%, #222 50%, #1a1a1a 75%);
  background-size: 400px 100%;
  animation: skeletonShimmer 1.6s ease infinite;
  border-radius: 4px;
}

.datalab-skeleton-text {
  height: 14px;
  margin-bottom: 8px;
}

.datalab-skeleton-text:last-child {
  width: 60%;
}

.datalab-skeleton-heading {
  height: 20px;
  width: 40%;
  margin-bottom: 16px;
}

.datalab-skeleton-row {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #1a1a1a;
}

.datalab-skeleton-cell {
  height: 16px;
  flex: 1;
}

.datalab-skeleton-card {
  height: 120px;
  border-radius: 8px;
}

/* Loading overlay */
.datalab-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.7);
  z-index: 50;
}

/* ── 16. Status Bar ────────────────────────────────────────── */

.datalab-status-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 28px;
  padding: 0 16px;
  font-size: 12px;
  color: #666;
  background: #0a0a0a;
  border-top: 1px solid #1a1a1a;
  flex-shrink: 0;
  user-select: none;
}

.datalab-status-bar-item {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.datalab-status-bar-item strong {
  color: #aaa;
  font-weight: 500;
}

.datalab-status-bar-separator {
  width: 1px;
  height: 12px;
  background: #222;
}

.datalab-status-bar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

/* ── Forms / Inputs ────────────────────────────────────────── */

.datalab-input {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  color: #e0e0e0;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s ease;
}

.datalab-input::placeholder {
  color: #444;
}

.datalab-input:focus {
  border-color: #444;
}

.datalab-input-sm {
  padding: 5px 8px;
  font-size: 12px;
}

.datalab-select {
  appearance: none;
  width: 100%;
  padding: 8px 32px 8px 12px;
  font-size: 13px;
  font-family: inherit;
  color: #e0e0e0;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.15s ease;
}

.datalab-select:focus {
  border-color: #444;
}

.datalab-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #888;
  margin-bottom: 6px;
}

/* ── Search bar ────────────────────────────────────────────── */

.datalab-search {
  position: relative;
}

.datalab-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #444;
  pointer-events: none;
}

.datalab-search .datalab-input {
  padding-left: 32px;
}

/* ── Context Menu ──────────────────────────────────────────── */

.datalab-context-menu {
  position: fixed;
  z-index: 500;
  min-width: 180px;
  background: #161616;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 4px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.1s ease;
}

.datalab-context-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  color: #ccc;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s ease;
}

.datalab-context-menu-item:hover {
  background: #222;
}

.datalab-context-menu-item:disabled {
  color: #444;
  cursor: not-allowed;
}

.datalab-context-menu-item-icon {
  width: 16px;
  color: #666;
  flex-shrink: 0;
}

.datalab-context-menu-item-shortcut {
  margin-left: auto;
  font-size: 11px;
  color: #444;
}

.datalab-context-menu-divider {
  height: 1px;
  background: #222;
  margin: 4px 0;
}

/* ── Tooltips ──────────────────────────────────────────────── */

.datalab-tooltip {
  position: absolute;
  z-index: 600;
  padding: 6px 10px;
  font-size: 12px;
  color: #ccc;
  background: #222;
  border: 1px solid #333;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  animation: fadeIn 0.1s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ── Dropdown / Popover ────────────────────────────────────── */

.datalab-dropdown {
  position: absolute;
  z-index: 300;
  min-width: 200px;
  background: #161616;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 4px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.15s ease;
}

.datalab-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  color: #ccc;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s ease;
}

.datalab-dropdown-item:hover {
  background: #222;
}

.datalab-dropdown-item.active {
  color: #fff;
}

.datalab-dropdown-divider {
  height: 1px;
  background: #222;
  margin: 4px 0;
}

.datalab-dropdown-header {
  padding: 8px 14px 4px;
  font-size: 11px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Tags / Badges ─────────────────────────────────────────── */

.datalab-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 10px;
  background: #222;
  color: #aaa;
}

.datalab-badge-outline {
  background: transparent;
  border: 1px solid #333;
  color: #888;
}

.datalab-type-badge {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  font-size: 10px;
  padding: 1px 6px;
  background: #1a1a1a;
  color: #666;
  border-radius: 3px;
}

/* ── Dividers ──────────────────────────────────────────────── */

.datalab-divider {
  height: 1px;
  background: #222;
  margin: 8px 0;
}

.datalab-divider-vertical {
  width: 1px;
  background: #222;
  align-self: stretch;
  margin: 0 8px;
}

/* ── Resizer handle (between panels) ──────────────────────── */

.datalab-resizer {
  width: 4px;
  cursor: col-resize;
  background: transparent;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.datalab-resizer:hover,
.datalab-resizer.active {
  background: #333;
}

/* ── Data type icons in headers ────────────────────────────── */

.datalab-dtype {
  display: inline-block;
  font-size: 10px;
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  color: #444;
  margin-left: 6px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* ── Column resize handle ──────────────────────────────────── */

.datalab-table th {
  position: relative;
}

.datalab-col-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  cursor: col-resize;
  background: transparent;
  transition: background 0.15s ease;
}

.datalab-col-resize-handle:hover,
.datalab-col-resize-handle.active {
  background: #444;
}

/* ── Notification / Toast ──────────────────────────────────── */

.datalab-toast-container {
  position: fixed;
  bottom: 40px;
  right: 20px;
  z-index: 900;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.datalab-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  font-size: 13px;
  color: #ccc;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  animation: fadeIn 0.2s ease;
}

.datalab-toast-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.datalab-toast-close:hover {
  color: #fff;
}

/* ── Responsive / Media Queries ────────────────────────────── */

@media (max-width: 1200px) {
  .datalab-chat {
    width: 320px;
    min-width: 320px;
  }
  .datalab-chat.build-split {
    width: 600px;
    min-width: 600px;
  }
  .datalab-chat.collapsed {
    transform: translateX(320px);
    margin-right: -320px;
  }
}

@media (max-width: 960px) {
  .datalab-sidebar {
    width: 220px;
    min-width: 220px;
  }
  .datalab-chat {
    position: fixed;
    right: 0;
    top: 52px;
    bottom: 28px;
    z-index: 200;
    width: 380px;
    border-left: 1px solid #222;
    box-shadow: -8px 0 24px rgba(0, 0, 0, 0.4);
  }
  .datalab-chat.build-split {
    width: 90vw;
    min-width: 90vw;
  }
  .datalab-chat.collapsed {
    transform: translateX(100%);
    margin-right: 0;
  }
}

@media (max-width: 768px) {
  .datalab-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 28px;
    z-index: 200;
    width: 260px;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.4);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .datalab-sidebar.open {
    transform: translateX(0);
  }
  .datalab-header {
    height: auto;
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 0;
  }
  .datalab-header-top {
    width: 100%;
    min-width: 0;
  }
  .datalab-header-title {
    max-width: 140px;
  }
  .datalab-dataset-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }
  .datalab-dataset-title .datalab-title-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #header-actions.datalab-topbar-actions {
    gap: 4px;
  }
  .datalab-tabs {
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    height: 36px;
  }
  .datalab-tabs::-webkit-scrollbar {
    display: none;
  }
  .datalab-tab {
    padding: 0 12px;
    font-size: 12px;
  }
  .datalab-insights {
    grid-template-columns: 1fr;
  }
  .datalab-charts-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Utility Classes ───────────────────────────────────────── */

.datalab-mono {
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
}

.datalab-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.datalab-flex {
  display: flex;
}

.datalab-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.datalab-gap-sm { gap: 4px; }
.datalab-gap-md { gap: 8px; }
.datalab-gap-lg { gap: 16px; }

.datalab-text-muted {
  color: #666;
}

.datalab-text-secondary {
  color: #888;
}

.datalab-text-sm {
  font-size: 12px;
}

.datalab-text-xs {
  font-size: 11px;
}

.datalab-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.datalab-hidden {
  display: none !important;
}

/* ── Export Button & Dropdown ─────────────────────────────── */

.datalab-export-btn {
  background: #1a1a1a;
  color: #aaa;
  border: 1px solid #333;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: inherit;
  line-height: 1.4;
}

.datalab-export-btn:hover {
  background: #222;
  color: #ddd;
  border-color: #444;
}

.datalab-export-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 180px;
  background: #111;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 4px 0;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.datalab-export-option {
  display: block;
  width: 100%;
  padding: 8px 16px;
  background: none;
  border: none;
  color: #aaa;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
}

.datalab-export-option:hover {
  background: #1a1a1a;
  color: #fff;
}

/* ── Saved Views ──────────────────────────────────────────── */

.datalab-views-dropdown {
  display: inline-flex;
  align-items: center;
  margin-left: 12px;
  gap: 4px;
}

.datalab-views-select {
  background: #111;
  color: #aaa;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.datalab-views-select:hover {
  border-color: #555;
  color: #ccc;
}

.datalab-views-select:focus {
  border-color: #666;
}

.datalab-view-item {
  display: inline-flex;
  align-items: center;
}

.datalab-save-view-btn {
  margin-left: auto;
  font-size: 11px;
  padding: 3px 10px;
  background: #1a1a1a;
  color: #888;
  border: 1px solid #333;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.datalab-save-view-btn:hover {
  background: #222;
  color: #ccc;
  border-color: #555;
}

/* ── Aggregatie View ──────────────────────────────────────── */

.datalab-aggregate-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  padding: 16px;
  background: #0f0f0f;
  border-bottom: 1px solid #333;
}

.datalab-aggregate-control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.datalab-aggregate-label {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.datalab-aggregate-select {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  color: #aaa;
  padding: 6px 10px;
  font-size: 13px;
  min-width: 160px;
  outline: none;
}

.datalab-aggregate-select:focus {
  border-color: #555;
}

.datalab-aggregate-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.datalab-metric-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  color: #aaa;
}

.datalab-metric-checkbox input[type="checkbox"] {
  accent-color: #4a9eff;
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.datalab-metric-checkbox label {
  cursor: pointer;
  white-space: nowrap;
}

.datalab-aggregate-fn-select {
  background: #111;
  border: 1px solid #333;
  border-radius: 3px;
  color: #888;
  padding: 2px 6px;
  font-size: 11px;
  outline: none;
}

.datalab-aggregate-fn-select:focus {
  border-color: #555;
}

.datalab-aggregate-table {
  /* Inherits from .datalab-table */
}

.datalab-aggregate-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.datalab-aggregate-table th.sortable:hover {
  background: #222;
}

/* ── Popover ─────────────────────────────────────────────── */

.datalab-popover {
  position: fixed;
  z-index: 200;
  min-width: 220px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.15s ease;
}

.datalab-popover-content {
  padding: 12px;
}

.datalab-popover-title {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #333;
}

.datalab-popover-table {
  width: 100%;
  font-size: 12px;
}

.datalab-popover-table td {
  padding: 3px 0;
}

/* ── Filter Dropdown ─────────────────────────────────────── */

.datalab-filter-dropdown {
  position: fixed;
  z-index: 200;
  min-width: 220px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.15s ease;
}

.datalab-filter-dropdown-content {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Viz Controls ────────────────────────────────────────── */

.datalab-viz {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.datalab-viz-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 16px;
  background: #0f0f0f;
  border-bottom: 1px solid #1a1a1a;
}

.datalab-viz-control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── Viz Style Panel ────────────────────────────────────── */

.datalab-viz-style-panel {
  border-bottom: 1px solid #1a1a1a;
  background: #0a0a0a;
}

.datalab-viz-style-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  color: #888;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: color 0.15s;
}

.datalab-viz-style-toggle:hover {
  color: #ccc;
}

.datalab-viz-style-chevron {
  margin-left: auto;
  transition: transform 0.2s;
}

.datalab-viz-style-body {
  padding: 0 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.datalab-viz-style-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.datalab-viz-color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.datalab-viz-color-input {
  width: 32px;
  height: 28px;
  border: 1px solid #333;
  border-radius: 4px;
  background: #111;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.datalab-viz-color-input::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.datalab-viz-color-input::-webkit-color-swatch {
  border: none;
  border-radius: 2px;
}

.datalab-viz-presets {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.datalab-viz-preset {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  padding: 0;
}

.datalab-viz-preset:hover {
  transform: scale(1.15);
}

.datalab-viz-preset.active {
  border-color: #fff;
}

.datalab-viz-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.datalab-viz-slider {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: #333;
  border-radius: 2px;
  outline: none;
}

.datalab-viz-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  border: none;
}

.datalab-viz-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  border: none;
}

.datalab-viz-slider-val {
  font-size: 11px;
  color: #888;
  min-width: 30px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.datalab-viz-check-row {
  display: flex;
  gap: 16px;
}

.datalab-viz-check {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #aaa;
  cursor: pointer;
}

.datalab-viz-check input[type="checkbox"] {
  accent-color: #fff;
}

.datalab-viz-label {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Rename Input ────────────────────────────────────────── */

.datalab-rename-input {
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 4px;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  padding: 2px 8px;
  outline: none;
  width: 240px;
}

/* ── Sidebar Footer ──────────────────────────────────────── */

.datalab-sidebar-footer {
  padding: 12px 16px;
  font-size: 11px;
  color: #555;
  border-top: 1px solid #1a1a1a;
  flex-shrink: 0;
}

/* ── Header Top ──────────────────────────────────────────── */

.datalab-header-top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 300px;
}

/* ── Dataset Title ───────────────────────────────────────── */

.datalab-dataset-title {
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  min-width: 0;
  overflow: hidden;
  flex-shrink: 1;
}

.datalab-title-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

/* ── Dataset List ────────────────────────────────────────── */

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

/* ── Dataset Delete Button ───────────────────────────────── */

.datalab-dataset-delete {
  margin-left: auto;
  opacity: 0;
  transition: opacity 0.15s;
}

.datalab-dataset-item:hover .datalab-dataset-delete {
  opacity: 1;
}

/* ============================================================
   Audit Trail
   ============================================================ */

.datalab-audit-trail {
  padding: 20px;
  max-width: 900px;
}

.datalab-audit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #222;
}

.datalab-audit-timeline {
  position: relative;
  padding-left: 24px;
}

.datalab-audit-timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #222;
}

.datalab-audit-entry {
  position: relative;
  margin-bottom: 16px;
}

.datalab-audit-entry-dot {
  position: absolute;
  left: -20px;
  top: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #444;
  border: 2px solid #0a0a0a;
}

.datalab-audit-entry-content {
  background: #111;
  border: 1px solid #1a1a1a;
  border-radius: 8px;
  padding: 12px 16px;
}

.datalab-audit-entry-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.datalab-audit-step {
  color: #555;
  font-size: 11px;
  font-weight: 600;
  font-family: monospace;
}

.datalab-audit-action {
  color: #e0e0e0;
  font-size: 13px;
  font-weight: 600;
}

.datalab-audit-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.audit-source-copilot {
  background: #1a1a2e;
  color: #888;
  border: 1px solid #2a2a3e;
}

.audit-source-manual {
  background: #1a1a1a;
  color: #666;
  border: 1px solid #333;
}

.datalab-audit-time {
  color: #444;
  font-size: 11px;
  margin-left: auto;
  font-family: monospace;
}

.datalab-audit-details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.datalab-audit-detail {
  font-size: 11px;
  color: #888;
  background: #0a0a0a;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #1a1a1a;
}

/* ---------------------------------------------------------------------------
   Deep Research Mode
   --------------------------------------------------------------------------- */

/* Mode dropdown */
.datalab-mode-wrapper {
  position: relative;
  flex-shrink: 0;
}

.datalab-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 10px;
  background: transparent;
  color: #777;
  border: 1px solid #333;
  border-radius: 16px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.datalab-mode-btn:hover {
  color: #fff;
  border-color: #555;
  background: #1a1a1a;
}

.datalab-mode-btn.mode-active {
  color: #fff;
  border-color: #555;
  background: #1a1a1a;
}

.datalab-mode-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.datalab-mode-label {
  line-height: 1;
}

.datalab-mode-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #111;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 4px;
  min-width: 160px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.datalab-mode-menu.open {
  display: block;
}

.datalab-mode-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  border-radius: 8px;
  color: #888;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.1s ease;
}

.datalab-mode-option:hover {
  background: #1a1a1a;
  color: #fff;
}

.datalab-mode-option.active {
  color: #fff;
  background: #1a1a1a;
}

.datalab-mode-option svg {
  flex-shrink: 0;
  opacity: 0.6;
}

.datalab-mode-option.active svg {
  opacity: 1;
}

/* Input wrapper mode indicators */
.datalab-chat-input-wrapper.mode-deep_research {
  border-color: #444;
}
.datalab-chat-input-wrapper.mode-plan {
  border-color: #444;
}
.datalab-chat-input-wrapper.mode-spar {
  border-color: #444;
}

/* Mode badges on user messages */
.mode-badge-plan {
  color: #aaa !important;
  border-color: #444 !important;
}
.mode-badge-spar {
  color: #aaa !important;
  border-color: #444 !important;
}

.deep-research-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #888;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 2px 6px;
  margin-right: 6px;
  vertical-align: middle;
}

.deep-research-loading .deep-research-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #888;
  font-size: 12px;
}

.deep-research-spinner {
  animation: deep-research-spin 2s linear infinite;
}

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

/* Research Plan */
.deep-research-plan {
  background: #0d0d0d;
  border: 1px solid #222;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 12px;
}

.deep-research-plan-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #888;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.deep-research-plan-summary {
  color: #aaa;
  margin-bottom: 10px;
  line-height: 1.4;
}

.deep-research-plan-hypotheses {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.deep-research-hypothesis {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  background: #111;
  border-radius: 6px;
  border-left: 3px solid #333;
}

.deep-research-hypothesis.prio-high { border-left-color: #fff; }
.deep-research-hypothesis.prio-med { border-left-color: #666; }
.deep-research-hypothesis.prio-low { border-left-color: #333; }

.hypothesis-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #222;
  color: #888;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.hypothesis-text {
  color: #ccc;
  flex: 1;
  line-height: 1.3;
}

.hypothesis-method {
  color: #555;
  font-size: 11px;
  flex-shrink: 0;
  max-width: 160px;
  text-align: right;
}

.deep-research-plan-quality {
  color: #666;
  font-size: 11px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #1a1a1a;
}

/* Deep research response styling */
.deep-research-response,
.mode-response-deep_research,
.mode-response-plan,
.mode-response-spar {
  border-left: 2px solid #333;
  padding-left: 12px;
}

/* ===== SCRIPT / NOTEBOOK TAB ===== */

.script-container {
  padding: 16px 20px 40px;
  max-width: 1200px;
}

/* Schema reference bar */
.script-schema-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #0d0d0d;
  border: 1px solid #1a1a1a;
  border-radius: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  font-size: 12px;
}
.script-schema-label {
  color: #666;
  white-space: nowrap;
}
.script-schema-label strong {
  color: #aaa;
  font-family: 'SF Mono', 'Fira Code', monospace;
}
.script-schema-cols {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}
.script-schema-col {
  padding: 2px 8px;
  background: #111;
  border: 1px solid #222;
  border-radius: 4px;
  color: #888;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  cursor: default;
}
.script-schema-col-num { color: #aaa; }
.script-schema-col-date { color: #999; }
.script-schema-rows {
  color: #555;
  white-space: nowrap;
  font-size: 11px;
}

/* Cell */
.script-cell {
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.script-cell:focus-within {
  border-color: #333;
}
.script-cell-running {
  border-color: #333;
}
.script-cell-error {
  border-color: #444;
}

/* Cell header */
.script-cell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #0d0d0d;
  border-bottom: 1px solid #151515;
}
.script-cell-num {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  color: #444;
}
.script-cell-actions {
  display: flex;
  gap: 4px;
}

/* Buttons */
.script-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  transition: all 0.15s;
}
.script-btn:hover {
  color: #fff;
  background: #1a1a1a;
}
.script-btn-run {
  color: #888;
  font-size: 12px;
}
.script-btn-run:hover {
  color: #fff;
}
.script-btn-delete {
  font-size: 16px;
  color: #444;
}
.script-btn-delete:hover {
  color: #999;
}
.script-btn-add {
  color: #555;
  font-size: 12px;
  padding: 8px 16px;
  border: 1px dashed #222;
  border-radius: 8px;
  width: 100%;
  transition: all 0.15s;
}
.script-btn-add:hover {
  color: #aaa;
  border-color: #444;
  background: #0d0d0d;
}

/* Editor */
.script-editor-wrap {
  padding: 0;
}
.script-editor {
  width: 100%;
  min-height: 60px;
  padding: 12px 16px;
  background: transparent;
  color: #ccc;
  border: none;
  outline: none;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: none;
  overflow: hidden;
  tab-size: 2;
  box-sizing: border-box;
}
.script-editor::placeholder {
  color: #333;
}

/* Spinner */
.script-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid #333;
  border-top-color: #888;
  border-radius: 50%;
  animation: scriptSpin 0.6s linear infinite;
}
@keyframes scriptSpin {
  to { transform: rotate(360deg); }
}

/* Result */
.script-result {
  border-top: 1px solid #151515;
}
.script-result-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px;
  font-size: 11px;
  color: #555;
  background: #080808;
}
.script-result-warn {
  color: #888;
}
.script-result-time {
  margin-left: auto;
  color: #444;
}
.script-result-empty {
  padding: 16px;
  text-align: center;
  color: #444;
  font-size: 12px;
}
.script-result-error {
  padding: 10px 14px;
  font-size: 12px;
  color: #ccc;
  background: #1a0a0a;
  border-top: 1px solid #2a1515;
  font-family: 'SF Mono', 'Fira Code', monospace;
  white-space: pre-wrap;
}

/* Result table */
.script-result-table-wrap {
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
}
.script-result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}
.script-result-table th {
  position: sticky;
  top: 0;
  background: #0d0d0d;
  padding: 6px 12px;
  text-align: left;
  font-weight: 600;
  color: #888;
  border-bottom: 1px solid #1a1a1a;
  white-space: nowrap;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.script-result-table td {
  padding: 5px 12px;
  color: #aaa;
  border-bottom: 1px solid #0d0d0d;
  white-space: nowrap;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.script-result-table tbody tr:hover td {
  background: #111;
}
.script-result-table td.null-val {
  color: #333;
  font-style: italic;
}

.script-add-cell {
  margin-top: 8px;
}

/* Script layout with chat panel */
.datalab-content:has(.script-layout) {
  overflow: hidden;
}
.script-layout {
  display: flex;
  height: 100%;
  min-height: 0;
}
.script-cells-panel {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}
.script-chat-open .script-cells-panel {
  flex: 1;
}

/* Script Chat Panel */
.script-chat-panel {
  width: 360px;
  min-width: 360px;
  border-left: 1px solid #1a1a1a;
  display: flex;
  flex-direction: column;
  background: #080808;
  height: 100%;
}
.script-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #1a1a1a;
  flex-shrink: 0;
}
.script-chat-title {
  font-size: 12px;
  font-weight: 600;
  color: #888;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.script-chat-close {
  background: none;
  border: none;
  color: #555;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}
.script-chat-close:hover {
  color: #fff;
  background: #1a1a1a;
}

/* Messages area */
.script-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.script-chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
  text-align: center;
  flex: 1;
}
.script-chat-empty p {
  color: #555;
  font-size: 13px;
  margin: 0;
}
.script-chat-empty-sub {
  color: #383838 !important;
  font-size: 11px !important;
  max-width: 240px;
}

/* Message bubbles */
.script-chat-msg {
  font-size: 13px;
  line-height: 1.5;
  animation: fadeIn 0.15s ease;
}
.script-chat-msg-user {
  color: #ccc;
  padding: 8px 12px;
  background: #111;
  border-radius: 10px;
  border: 1px solid #1a1a1a;
  align-self: flex-end;
  max-width: 90%;
  word-wrap: break-word;
}
.script-chat-msg-assistant {
  color: #999;
  padding: 4px 0;
}
.script-chat-msg-assistant .dl-codeblock {
  margin: 6px 0;
  font-size: 11px;
}
.script-chat-msg-assistant .dl-h1,
.script-chat-msg-assistant .dl-h2,
.script-chat-msg-assistant .dl-h3,
.script-chat-msg-assistant .dl-h4 {
  font-size: 13px;
  color: #aaa;
  margin: 8px 0 4px;
}

/* SQL block with insert button */
.script-chat-sql-block {
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  border-radius: 8px;
  margin: 8px 0;
  overflow: hidden;
}
.script-chat-sql-code {
  margin: 0;
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.5;
  overflow-x: auto;
  background: transparent;
}
.script-chat-sql-code code {
  color: #aaa;
  font-family: 'SF Mono', 'Fira Code', monospace;
}
.script-chat-insert-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  padding: 6px 12px;
  background: #0d0d0d;
  border: none;
  border-top: 1px solid #1a1a1a;
  color: #666;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.script-chat-insert-btn:hover {
  background: #151515;
  color: #fff;
}

/* Typing indicator */
.script-chat-typing {
  color: #555;
  font-size: 12px;
  font-style: italic;
  animation: pulse 1.5s infinite;
}

/* Input area */
.script-chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 10px 12px;
  border-top: 1px solid #1a1a1a;
  flex-shrink: 0;
}
.script-chat-input {
  flex: 1;
  background: #0d0d0d;
  border: 1px solid #1a1a1a;
  border-radius: 8px;
  padding: 8px 10px;
  color: #ccc;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  min-height: 36px;
  max-height: 100px;
  line-height: 1.4;
}
.script-chat-input::placeholder {
  color: #383838;
}
.script-chat-input:focus {
  outline: none;
  border-color: #333;
}
.script-chat-send {
  background: #1a1a1a;
  border: 1px solid #222;
  border-radius: 8px;
  padding: 8px 10px;
  color: #888;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.script-chat-send:hover {
  background: #222;
  color: #fff;
}
.script-chat-send:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Toggle button */
.script-chat-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #111;
  border: 1px solid #222;
  border-radius: 20px;
  color: #888;
  font-size: 12px;
  cursor: pointer;
  z-index: 100;
  transition: all 0.15s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.script-chat-toggle:hover {
  background: #1a1a1a;
  color: #fff;
  border-color: #333;
}
.script-chat-toggle.active {
  background: #1a1a1a;
  border-color: #333;
  padding: 8px 10px;
}
.script-chat-toggle.active span {
  display: none;
}

/* ── 15. Chat Body Layout (with build panel support) ───────── */

.datalab-chat-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.datalab-chat-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.datalab-chat.build-split {
  width: 720px;
  min-width: 720px;
}

.datalab-chat.build-split .datalab-chat-main {
  flex: 1;
  min-width: 280px;
}

/* ── 16. Thinking Blocks ───────────────────────────────────── */

.dl-thinking-block {
  background: #0f0e08;
  border-radius: 8px;
  margin: 6px 0;
  font-size: 13px;
  color: #c8a830;
  border-left: 3px solid #c8a830;
}

.dl-thinking-header {
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
  user-select: none;
}

.dl-thinking-header::before {
  content: '\25BC ';
  font-size: 10px;
}

.dl-thinking-block.collapsed .dl-thinking-header::before {
  content: '\25B6 ';
}

.dl-thinking-content {
  padding: 0 10px 8px;
  font-style: italic;
  white-space: pre-wrap;
  max-height: 40vh;
  overflow-y: auto;
  line-height: 1.5;
  font-size: 12px;
  word-break: break-word;
}

.dl-thinking-block.collapsed .dl-thinking-content {
  display: none;
}

/* ── 17. Activity Log (inline tool tracking) ───────────────── */

.dl-activity-log {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 8px 0;
}

.dl-activity-item {
  font-size: 11px;
  color: #666;
  padding: 3px 0;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.dl-activity-tool {
  color: #999;
  font-weight: 600;
}

/* ── 18. Markdown formatting in chat ───────────────── */

.dl-h1 {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin: 16px 0 8px;
  line-height: 1.3;
}

.dl-h2 {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  margin: 14px 0 6px;
  line-height: 1.3;
}

.dl-h3 {
  font-size: 15px;
  font-weight: 600;
  color: #eee;
  margin: 12px 0 4px;
  line-height: 1.3;
}

.dl-h4 {
  font-size: 13px;
  font-weight: 600;
  color: #ddd;
  margin: 10px 0 4px;
  line-height: 1.3;
}

.dl-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 12px;
  line-height: 1.4;
}

.dl-table th {
  text-align: left;
  padding: 6px 10px;
  border-bottom: 2px solid #333;
  color: #ccc;
  font-weight: 600;
  white-space: nowrap;
}

.dl-table td {
  padding: 5px 10px;
  border-bottom: 1px solid #1a1a1a;
  color: #aaa;
}

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

.dl-codeblock {
  background: #111;
  padding: 10px 12px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 12px;
  margin: 8px 0;
  line-height: 1.5;
}

.dl-codeblock code {
  background: none;
  padding: 0;
}

.dl-inline-code {
  background: #1a1a1a;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.dl-list {
  margin: 6px 0;
  padding-left: 20px;
}

.dl-list li {
  margin: 2px 0;
  line-height: 1.5;
  color: #bbb;
}

.dl-hr {
  border: none;
  border-top: 1px solid #222;
  margin: 12px 0;
}

.dl-blockquote {
  border-left: 3px solid #333;
  padding: 4px 12px;
  margin: 8px 0;
  color: #999;
  font-style: italic;
}

/* ── 19. Notes tab ───────────────── */

.dl-notes-container {
  padding: 16px;
  max-width: 720px;
}

.dl-notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.dl-notes-title {
  font-size: 16px;
  font-weight: 600;
  color: #eee;
  margin: 0;
}

.dl-notes-new-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.dl-notes-empty {
  text-align: center;
  padding: 60px 20px;
  color: #666;
  font-size: 13px;
}

.dl-notes-empty p {
  margin: 8px 0 0;
}

.dl-notes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dl-note-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  background: #111;
  border: 1px solid #222;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.dl-note-card:hover {
  border-color: #444;
}

.dl-note-card-content {
  flex: 1;
  min-width: 0;
}

.dl-note-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #ddd;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dl-note-card-preview {
  font-size: 12px;
  color: #777;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dl-note-card-meta {
  font-size: 11px;
  color: #555;
  margin-top: 6px;
}

.dl-note-card-delete {
  background: none;
  border: none;
  color: #555;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}

.dl-note-card:hover .dl-note-card-delete {
  opacity: 1;
}

.dl-note-card-delete:hover {
  color: #c44;
}

/* Note Editor */

.dl-note-editor {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 400px;
}

.dl-note-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid #222;
  flex-shrink: 0;
}

.dl-note-title-input {
  flex: 1;
  background: none;
  border: none;
  color: #eee;
  font-size: 15px;
  font-weight: 600;
  padding: 4px 8px;
  outline: none;
  border-bottom: 1px solid transparent;
}

.dl-note-title-input:focus {
  border-bottom-color: #444;
}

.dl-note-editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.dl-note-save-status {
  font-size: 11px;
  color: #666;
  transition: color 0.2s;
}

.dl-note-save-status.saved {
  color: #6a6;
}

.dl-note-delete-btn {
  color: #777;
}

.dl-note-delete-btn:hover {
  color: #c44 !important;
}

.dl-note-format-bar {
  border-top: none;
  border-bottom: 1px solid #222;
  padding: 4px 8px;
}

.dl-note-editor-body {
  flex: 1;
  overflow-y: auto;
  background: #0a0a0a;
  padding: 24px 32px;
}

.dl-note-content {
  min-height: 300px;
  max-width: 720px;
  margin: 0 auto;
  outline: none;
  color: #ddd;
  font-size: 15px;
  line-height: 1.7;
  font-family: 'Inter', -apple-system, sans-serif;
}

.dl-note-content:empty::before {
  content: 'Schrijf je notitie...';
  color: #444;
  pointer-events: none;
}

.dl-note-content h1,
.dl-note-content h2,
.dl-note-content h3 {
  color: #fff;
  margin: 16px 0 8px;
}

.dl-note-content blockquote {
  border-left: 3px solid #444;
  padding-left: 16px;
  color: #888;
  margin: 12px 0;
}

.dl-note-content a {
  color: #888;
  text-decoration: underline;
}

.dl-note-content hr {
  border: none;
  border-top: 1px solid #333;
  margin: 16px 0;
}

.dl-note-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 12px 0;
}

/* Selection floating toolbar */

.dl-note-sel-toolbar {
  position: absolute;
  z-index: 9999;
  transform: translateX(-50%);
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 2px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  white-space: nowrap;
}

.dl-note-sel-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: #ccc;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.dl-note-sel-btn:hover {
  background: #282828;
  color: #fff;
}

/* Note action buttons on chat messages */

.dl-msg-actions {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.15s;
}

.datalab-chat-message:hover .dl-msg-actions {
  opacity: 1;
}

.dl-msg-action-btn {
  background: none;
  border: 1px solid #333;
  color: #666;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.15s, border-color 0.15s;
}

.dl-msg-action-btn:hover {
  color: #ccc;
  border-color: #555;
}

/* Note picker dropdown */

.dl-note-picker-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.55);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dl-note-picker {
  background: #151515;
  border: 1px solid #333;
  border-radius: 14px;
  padding: 8px;
  min-width: 300px;
  max-width: 400px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0,0,0,0.6);
}

.dl-note-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 6px;
}

.dl-note-picker-title {
  font-size: 13px;
  color: #888;
  font-weight: 600;
}

.dl-note-picker-close {
  background: none;
  border: none;
  color: #666;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.dl-note-picker-close:hover { color: #ccc; }

.dl-note-picker-list {
  overflow-y: auto;
  max-height: 50vh;
  padding: 2px 0;
}

.dl-note-picker-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: #ccc;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dl-note-picker-item:hover {
  background: #222;
}

.dl-note-picker-new {
  color: #888;
  border-top: 1px solid #222;
  margin-top: 4px;
  padding-top: 10px;
  border-radius: 0 0 8px 8px;
}

/* ── 20. Presentatie tab ───────────────── */

.dlp-container { padding: 16px; max-width: 720px; }

.dlp-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 8px;
}
.dlp-title { font-size: 16px; font-weight: 600; color: #eee; margin: 0; }
.dlp-header-actions { display: flex; gap: 8px; }

.dlp-empty {
  text-align: center; padding: 60px 20px; color: #666; font-size: 13px;
}

.dlp-list { display: flex; flex-direction: column; gap: 8px; }

.dlp-card {
  display: flex; align-items: center; gap: 12px;
  background: #111; border: 1px solid #222; border-radius: 10px;
  padding: 10px 14px; cursor: pointer; transition: border-color 0.15s;
}
.dlp-card:hover { border-color: #444; }

.dlp-card-thumb {
  width: 96px; height: 54px; border-radius: 6px; overflow: hidden;
  background: #000; flex-shrink: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.dlp-card-thumb img { width: 100%; height: 100%; object-fit: cover; }

.dlp-card-info { flex: 1; min-width: 0; }
.dlp-card-name { font-size: 14px; font-weight: 600; color: #ddd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlp-card-meta { font-size: 11px; color: #555; margin-top: 2px; }

.dlp-card-delete {
  background: none; border: none; color: #555; font-size: 18px;
  cursor: pointer; padding: 0 4px; opacity: 0; transition: opacity 0.15s;
}
.dlp-card:hover .dlp-card-delete { opacity: 1; }
.dlp-card-delete:hover { color: #c44; }

/* Editor layout */

.dlp-editor { display: flex; flex-direction: column; height: 100%; }

.dlp-editor-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-bottom: 1px solid #222; flex-shrink: 0;
}
.dlp-name-input {
  flex: 1; background: none; border: none; color: #eee;
  font-size: 15px; font-weight: 600; padding: 4px 8px; outline: none;
  border-bottom: 1px solid transparent;
}
.dlp-name-input:focus { border-bottom-color: #444; }

.dlp-editor-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.dlp-save-status { font-size: 11px; color: #666; }
.dlp-save-status.saved { color: #6a6; }

/* Main: slides + chat side by side */

.dlp-main {
  display: flex; flex: 1; overflow: hidden; min-height: 0;
}

.dlp-slides {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}

.dlp-slide-item {
  display: flex; align-items: center; gap: 10px;
  background: #111; border: 1px solid #222; border-radius: 10px;
  padding: 8px 10px; transition: border-color 0.15s;
}
.dlp-slide-item:hover { border-color: #333; }

.dlp-slide-preview {
  width: 154px; height: 86px; border-radius: 6px; overflow: hidden;
  position: relative; flex-shrink: 0; font-size: 0;
}

.dlp-slide-info { flex: 1; min-width: 0; }
.dlp-slide-num { font-size: 11px; color: #555; font-weight: 600; }
.dlp-slide-title { font-size: 12px; color: #999; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dlp-slide-actions { display: flex; flex-direction: column; gap: 2px; opacity: 0; transition: opacity 0.15s; }
.dlp-slide-item:hover .dlp-slide-actions { opacity: 1; }

.dlp-slide-action {
  background: none; border: none; color: #555; font-size: 10px;
  cursor: pointer; padding: 2px 4px; border-radius: 4px;
}
.dlp-slide-action:hover { color: #ccc; background: #222; }
.dlp-slide-delete:hover { color: #c44; }

.dlp-add-slide {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: none; border: 1px dashed #333; border-radius: 10px;
  color: #666; font-size: 12px; padding: 16px; cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.dlp-add-slide:hover { border-color: #555; color: #aaa; }

/* Chat panel */

.dlp-chat {
  width: 320px; flex-shrink: 0; border-left: 1px solid #1a1a1a;
  display: flex; flex-direction: column; background: #0a0a0a;
}

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

.dlp-chat-welcome {
  text-align: center; padding: 40px 16px; color: #666;
}

.dlp-chat-msg { display: flex; }
.dlp-chat-msg.user { justify-content: flex-end; }

.dlp-chat-bubble {
  max-width: 90%; padding: 8px 12px; border-radius: 12px;
  font-size: 13px; line-height: 1.5; word-break: break-word;
}
.dlp-chat-bubble.user { background: #222; color: #ddd; }
.dlp-chat-bubble.assistant { background: #111; color: #bbb; }

.dlp-chat-input-area {
  display: flex; gap: 6px; padding: 8px 12px;
  border-top: 1px solid #1a1a1a; align-items: flex-end;
}

.dlp-chat-input {
  flex: 1; background: #111; border: 1px solid #222; border-radius: 8px;
  color: #ccc; font-size: 13px; padding: 8px 10px; resize: none;
  outline: none; font-family: inherit; max-height: 100px;
}
.dlp-chat-input:focus { border-color: #444; }

.dlp-chat-send {
  background: #222; border: none; color: #888; border-radius: 8px;
  width: 36px; height: 36px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.dlp-chat-send:hover { background: #333; color: #ccc; }

/* Slides block in chat */

.dlp-slides-block {
  background: #0d0d0d; border: 1px solid #222; border-radius: 8px;
  padding: 10px; margin: 6px 0;
}

.dlp-apply-btn {
  display: flex; align-items: center; gap: 6px;
  background: #222; border: 1px solid #333; color: #ccc;
  border-radius: 6px; padding: 6px 12px; cursor: pointer;
  font-size: 12px; width: 100%; justify-content: center;
  transition: background 0.15s;
}
.dlp-apply-btn:hover { background: #333; }

/* Presentation picker modal */

.dlp-picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dlp-picker {
  background: #111;
  border: 1px solid #222;
  border-radius: 12px;
  width: 380px;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

.dlp-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #1a1a1a;
}

.dlp-picker-title {
  font-size: 14px;
  font-weight: 600;
  color: #ccc;
}

.dlp-picker-close {
  background: none;
  border: none;
  color: #555;
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.dlp-picker-close:hover { color: #aaa; }

.dlp-picker-section {
  padding: 6px 8px;
  border-bottom: 1px solid #1a1a1a;
}
.dlp-picker-section:last-child { border-bottom: none; }

.dlp-picker-label {
  font-size: 11px;
  color: #555;
  padding: 4px 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dlp-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  color: #bbb;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.dlp-picker-item:hover { background: #1a1a1a; color: #fff; }

.dlp-picker-new { color: #999; }
.dlp-picker-new:hover { color: #fff; }

.dlp-dots { animation: dlp-dots-anim 1.2s infinite; }
@keyframes dlp-dots-anim {
  0% { content: '.'; }
  33% { content: '..'; }
  66% { content: '...'; }
}

/* Fullscreen presentation */

.dlp-fullscreen {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: #000; z-index: 10000; display: flex;
  align-items: center; justify-content: center;
}

.dlp-fs-slide {
  width: 1920px; height: 1080px; position: relative;
  transform-origin: center center;
  transform: scale(min(calc(100vw / 1920), calc(100vh / 1080)));
}

.dlp-fs-counter {
  position: fixed; bottom: 16px; right: 20px;
  color: #555; font-size: 14px; z-index: 10001;
}

.dlp-fs-close {
  position: fixed; top: 12px; right: 16px;
  background: none; border: none; color: #555;
  font-size: 28px; cursor: pointer; z-index: 10001;
}
.dlp-fs-close:hover { color: #fff; }

/* Chat-to-slide button */

.dl-msg-slide-btn {
  background: none; border: 1px solid #333; color: #666;
  border-radius: 6px; width: 28px; height: 28px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0; transition: color 0.15s, border-color 0.15s;
}
.dl-msg-slide-btn:hover { color: #ccc; border-color: #555; }

/* Mobile responsiveness */

@media (max-width: 768px) {
  .dlp-main { flex-direction: column; }
  .dlp-chat { width: 100%; border-left: none; border-top: 1px solid #1a1a1a; max-height: 40vh; }
  .dlp-slide-preview { width: 100px; height: 56px; }
  .dlp-header { flex-direction: column; align-items: flex-start; }
}
}

.dl-activity-tool::before {
  content: '\25B8 ';
  color: #555;
}

.dl-activity-result {
  color: #777;
  font-size: 10px;
  background: #111;
  padding: 1px 6px;
  border-radius: 3px;
}

.dl-response-text {
  margin-top: 4px;
}

.dl-inline-chart {
  margin: 12px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #1a1a1a;
}

.dl-inline-chart canvas {
  display: block;
  width: 100%;
  height: auto;
}

/* ── 18. DataLab Build Panel ───────────────────────────────── */

.datalab-build-panel {
  display: none;
  flex-direction: column;
  width: 0;
  border-left: 1px solid #1a1a1a;
  background: #080808;
  flex-shrink: 0;
  overflow: hidden;
  transition: width 0.25s ease;
}

.datalab-build-panel.open {
  display: flex;
  width: 50%;
}

/* Build panel toggle button */
#datalab-build-btn.active {
  background: #1a1a1a;
  color: #fff;
}

.dlb-btn-dot {
  display: none;
  position: absolute;
  top: 2px;
  right: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c8a830;
}

.dlb-btn-dot.active {
  display: block;
  animation: dlbPulse 1.2s ease infinite;
}

@keyframes dlbPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Status bar */
.dlb-status {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #0a0a0a;
  border-bottom: 1px solid #111;
  color: #999;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dlb-status.active {
  display: flex;
}

.dlb-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8a7a30;
  flex-shrink: 0;
  animation: dlbPulse 1.2s ease infinite;
}

.dlb-status-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tabs */
.dlb-tabs {
  display: flex;
  align-items: center;
  background: #050505;
  border-bottom: 1px solid #111;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.dlb-tabs::-webkit-scrollbar {
  display: none;
}

.dlb-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 11px;
  color: #555;
  cursor: pointer;
  border-right: 1px solid #111;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.dlb-tab:hover {
  color: #aaa;
  background: #0a0a0a;
}

.dlb-tab.active {
  background: #0d0d0d;
  color: #ccc;
}

.dlb-tab-icon {
  font-size: 9px;
  font-weight: 700;
  color: #555;
  background: #111;
  padding: 1px 4px;
  border-radius: 3px;
  font-family: monospace;
}

.dlb-tab.active .dlb-tab-icon {
  color: #c8a830;
  background: #1a1808;
}

.dlb-tab-name {
  text-transform: capitalize;
}

.dlb-tab-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c8a830;
  animation: dlbPulse 1s ease infinite;
}

/* Viewer */
.dlb-viewer {
  flex: 1;
  overflow-y: auto;
  background: #080808;
  position: relative;
}

.dlb-tool-view {
  display: none;
  padding: 12px;
}

.dlb-tool-view.active {
  display: block;
}

.dlb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  gap: 8px;
  opacity: 0.5;
}

.dlb-empty-title {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.dlb-empty-sub {
  font-size: 11px;
  color: #333;
  text-align: center;
  max-width: 200px;
}

/* Section styling */
.dlb-section {
  margin-bottom: 12px;
}

.dlb-section-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #555;
  padding: 4px 0 6px;
  border-bottom: 1px solid #111;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dlb-json {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 11px;
  line-height: 1.5;
  color: #888;
  background: #0a0a0a;
  border-radius: 6px;
  padding: 8px 10px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 300px;
  overflow-y: auto;
}

.dlb-result-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #666;
  font-size: 12px;
  padding: 8px;
}

.dlb-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid #333;
  border-top-color: #888;
  border-radius: 50%;
  animation: dlbSpin 0.8s linear infinite;
}

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

.dlb-result-n {
  font-size: 10px;
  color: #888;
  background: #111;
  padding: 1px 6px;
  border-radius: 3px;
}

.dlb-result-p {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
}

.dlb-result-p.sig {
  color: #8a8;
  background: rgba(80, 120, 80, 0.15);
}

.dlb-result-p.ns {
  color: #a88;
  background: rgba(120, 80, 80, 0.1);
}

.dlb-result-err {
  font-size: 10px;
  color: #a66;
  background: rgba(120, 60, 60, 0.15);
  padding: 1px 6px;
  border-radius: 3px;
}

/* ── Clickable charts & tables preview modal ───────────────── */

#datalab-chat-messages .evidence-chart,
#datalab-chat-messages .dl-inline-chart,
#datalab-chat-messages .evidence-table-wrap,
#datalab-chat-messages table.dl-table {
  position: relative;
}

.dl-expand-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  background: rgba(0,0,0,0.7);
  border: 1px solid #444;
  border-radius: 6px;
  color: #999;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  z-index: 5;
  padding: 0;
}
#datalab-chat-messages .evidence-chart:hover .dl-expand-btn,
#datalab-chat-messages .dl-inline-chart:hover .dl-expand-btn,
#datalab-chat-messages .evidence-table-wrap:hover .dl-expand-btn,
#datalab-chat-messages table.dl-table:hover .dl-expand-btn {
  opacity: 1;
}
.dl-expand-btn:hover {
  background: rgba(0,0,0,0.9);
  color: #fff;
  border-color: #666;
}

.dl-preview-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: dlPreviewFadeIn 0.15s ease;
}
@keyframes dlPreviewFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.dl-preview-modal {
  background: #151515;
  border: 1px solid #333;
  border-radius: 16px;
  padding: 20px;
  max-width: 700px;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}

.dl-preview-close-btn {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  color: #666;
  font-size: 24px;
  cursor: pointer;
  z-index: 1;
  line-height: 1;
}
.dl-preview-close-btn:hover { color: #ccc; }

.dl-preview-content {
  margin-top: 8px;
  margin-bottom: 16px;
}
.dl-preview-content canvas {
  display: block;
}
.dl-preview-content .evidence-table-wrap,
.dl-preview-content table {
  max-height: 60vh;
  overflow: auto;
}
.dl-preview-content table {
  width: 100%;
}

.dl-preview-actions {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #222;
}

.dl-preview-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: #222;
  border: 1px solid #333;
  border-radius: 10px;
  color: #ccc;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.dl-preview-action-btn:hover {
  background: #2a2a2a;
  border-color: #555;
  color: #fff;
}
.dl-preview-action-btn svg {
  flex-shrink: 0;
}
