/* ETL Design System
 * One file. Loaded before home.css.
 * Section 1: tokens. Section 2+: components (added in later tasks).
 */

:root {
  /* === BRAND === */
  --brand-50:  #eef2ff;
  --brand-100: #dbe6ff;
  --brand-200: #b6c8ff;
  --brand-500: #1f4fd6;   /* primary */
  --brand-600: #1438a8;   /* hover */
  --brand-700: #102b85;   /* press */

  /* === NEUTRALS === */
  --ink-900: #1a1f36;
  --ink-700: #425466;
  --ink-500: #6b7c93;
  --ink-300: #aab7c4;

  --line:        #e3e8ee;
  --line-strong: #c1c9d2;

  --surface:   #ffffff;
  --surface-2: #f6f9fc;
  --surface-3: #fafbfc;

  /* === SEMANTIC === */
  --success: #047857;
  --warn:    #b45309;
  --error:   #b91c1c;

  /* === SPACING === */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 48px;

  /* === RADIUS === */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;

  /* === SHADOW === */
  --shadow-1: 0 1px 1px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-2: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-3: 0 10px 15px -3px rgba(0,0,0,0.10), 0 4px 6px -4px rgba(0,0,0,0.05);

  /* === MOTION === */
  --motion-fast: 120ms;
  --motion-base: 180ms;
  --motion-slow: 240ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* === FONT STACKS === */
  --font-ui:   "Space Grotesk", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;
}

/* === BASE === */
*, *::before, *::after { box-sizing: border-box; }


/* === LAYOUT PRIMITIVES === */
.row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.field { display: flex; flex-direction: column; gap: var(--space-1); }

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2); height: 32px; padding: 0 14px;
  font-family: var(--font-ui); font-size: 13px; font-weight: 600; letter-spacing: 0.005em;
  border-radius: var(--radius-md); border: 1px solid transparent;
  cursor: pointer; transition: background var(--motion-fast) var(--ease),
                                border-color var(--motion-fast) var(--ease),
                                color var(--motion-fast) var(--ease),
                                box-shadow var(--motion-fast) var(--ease);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(31,79,214,0.18); }

.btn-primary {
  background: linear-gradient(180deg, #2858e0 0%, #1f4fd6 100%);
  color: #ffffff;
  border-color: var(--brand-700);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), var(--shadow-1);
}
.btn-primary:hover  { background: linear-gradient(180deg, #1f4fd6 0%, #1438a8 100%); }
.btn-primary:active { background: var(--brand-700); box-shadow: inset 0 1px 2px rgba(0,0,0,0.18); }

.btn-secondary {
  background: var(--surface); color: var(--ink-900);
  border-color: var(--line-strong); box-shadow: var(--shadow-1);
}
.btn-secondary:hover { background: var(--surface-3); border-color: var(--ink-500); }

.btn-ghost { background: transparent; color: var(--ink-700); }
.btn-ghost:hover { background: rgba(15,23,42,0.06); color: var(--ink-900); }

.btn-danger {
  background: var(--surface); color: var(--error);
  border-color: rgba(185,28,28,0.30);
}
.btn-danger:hover { background: rgba(185,28,28,0.06); border-color: var(--error); }

.btn-icon { width: 32px; padding: 0; }
.btn-icon svg { width: 14px; height: 14px; }

/* === FORM CONTROLS === */
.input, .select, .textarea {
  height: 32px; padding: 0 10px;
  font-family: var(--font-ui); font-size: 13px; color: var(--ink-900);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.04);
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-500); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(31,79,214,0.15);
}
.textarea {
  height: auto; min-height: 64px; padding: 8px 10px; resize: vertical;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.5;
}
.label { font-size: 12px; font-weight: 600; color: var(--ink-700); }
.help  { font-size: 11px; color: var(--ink-500); }

/* === TABS === */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--line);
  padding: 0 var(--space-2);
  overflow-x: auto;
  background: var(--surface);
}
.tab {
  padding: 8px 14px; font-size: 12.5px; font-weight: 500;
  letter-spacing: 0.005em;
  color: var(--ink-500); border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  border-top-left-radius: var(--radius-sm);
  border-top-right-radius: var(--radius-sm);
  margin-bottom: -1px; cursor: pointer; white-space: nowrap;
  transition: color var(--motion-fast), background var(--motion-fast), border-color var(--motion-fast);
}
.tab:hover { color: var(--ink-900); background: var(--surface-2); }
.tab.active { color: var(--brand-500); border-bottom-color: var(--brand-500); font-weight: 600; background: transparent; }


/* === STATUS PILLS === */
.pill {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 1px 8px; border-radius: var(--radius-sm);
  font-size: 11px; font-weight: 600; line-height: 1.6; letter-spacing: 0.01em;
}
.pill-success { background: rgba(4,120,87,0.10);  color: var(--success); }
.pill-warn    { background: rgba(180,83,9,0.10);  color: var(--warn); }
.pill-error   { background: rgba(185,28,28,0.10); color: var(--error); }
.pill-neutral { background: rgba(107,124,147,0.10); color: var(--ink-500); }
.pill-running { background: rgba(31,79,214,0.10); color: var(--brand-500); }
.pill-running .dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(31,79,214,0.18);
  animation: ds-pulse 1.4s ease-in-out infinite;
}
@keyframes ds-pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }

/* === CARDS / PANELS === */
.panel, .card-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.panel { padding: var(--space-5); }
.card-shell { padding: var(--space-4) var(--space-5); }
.card-title { font-size: 15px; font-weight: 600; color: var(--ink-900); margin: 0 0 2px; }
.card-sub   { font-size: 12px; color: var(--ink-500); margin: 0 0 var(--space-3); }

/* === TABLES === */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th {
  text-align: left; padding: 8px 12px; background: var(--surface-2);
  font-size: 11px; font-weight: 600; color: var(--ink-500);
  text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
}
.table th:first-child { border-top-left-radius: var(--radius-sm); }
.table th:last-child  { border-top-right-radius: var(--radius-sm); }
.table td {
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  color: var(--ink-900); font-variant-numeric: tabular-nums;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(31,79,214,0.04); }
.table td.mono { font-family: var(--font-mono); font-size: 12px; color: var(--ink-700); }

/* === SIDEBAR PRIMITIVES === */
.ds-sidebar {
  width: 300px;
  background: var(--surface-2);
  border-right: 1px solid var(--line);
  box-shadow: none;
}
.ds-sidebar-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-500);
  cursor: pointer; user-select: none;
}
.ds-sidebar-list { display: flex; flex-direction: column; }
.ds-sidebar-list-row {
  display: flex; align-items: center; gap: 10px;
  height: 44px; padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px; color: var(--ink-900);
  cursor: pointer; transition: background var(--motion-fast);
}
.ds-sidebar-list-row:last-child { border-bottom: none; }
.ds-sidebar-list-row:hover { background: rgba(31,79,214,0.04); }
.ds-sidebar-list-row.is-active {
  background: var(--brand-50); color: var(--brand-500); font-weight: 600;
  box-shadow: inset 2px 0 0 var(--brand-500);
}
.ds-sidebar-list-row .icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--ink-500); }
.ds-sidebar-list-row.is-active .icon { color: var(--brand-500); }
.ds-sidebar-list-row .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-sidebar-list-row .meta { font-size: 11px; color: var(--ink-500); font-variant-numeric: tabular-nums; }

/* === BOTTOM-TAB STRIP === */
.ds-bottom-tab-strip {
  height: 38px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow-x: auto; overflow-y: hidden;
}
.ds-bottom-tab-content {
  background: var(--surface-2);
  padding: var(--space-4) var(--space-5);
  overflow: auto;
}

/* === RESIZE HANDLE === */
.ds-resize-handle {
  height: 6px; cursor: ns-resize; background: transparent;
  position: relative; transition: background var(--motion-fast);
}
.ds-resize-handle::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 32px; height: 1px; background: var(--line);
  transform: translate(-50%, -50%);
  transition: background var(--motion-fast), width var(--motion-fast);
}
.ds-resize-handle:hover { background: rgba(31,79,214,0.04); }
.ds-resize-handle:hover::after { background: var(--brand-500); width: 64px; }

/* === HOME (SaaS-style landing) === */
.sidebar-brand-row {
  display: flex; align-items: stretch; gap: 6px; margin: 0 0 12px;
}
.sidebar-home {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 0; padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-ui);
  text-align: left;
  box-shadow: var(--shadow-1);
  transition: border-color var(--motion-fast), background var(--motion-fast);
}
.sidebar-home:hover { border-color: var(--brand-500); background: var(--brand-50); }
.sidebar-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--ink-700);
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: border-color var(--motion-fast), background var(--motion-fast),
              color var(--motion-fast);
}
.sidebar-icon-btn:hover {
  border-color: var(--brand-500);
  background: var(--brand-50);
  color: var(--brand-500);
}
.sidebar-home-icon {
  display: inline-flex; width: 28px; height: 28px;
  align-items: center; justify-content: center;
  background: var(--brand-500); color: #fff;
  border-radius: var(--radius-sm); flex-shrink: 0;
}
.sidebar-home-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sidebar-home-text strong { font-size: 13px; font-weight: 600; color: var(--ink-900); }
.sidebar-home-text > span { font-size: 11px; color: var(--ink-500); }

body.home-mode .pipeline-run,
body.home-mode #chart_container,
body.home-mode #notebook_workspace,
body.home-mode #settings_workspace,
body.home-mode .footer,
body.home-mode .zoom-controls { display: none !important; }
body.home-mode .content { padding: 0; }

/* Storage Library docs page — full-screen, hides the canvas like home. */
body.docs-mode .pipeline-run,
body.docs-mode #chart_container,
body.docs-mode #home_workspace,
body.docs-mode #notebook_workspace,
body.docs-mode #settings_workspace,
body.docs-mode #sql_workspace,
body.docs-mode .footer,
body.docs-mode .zoom-controls { display: none !important; }
body.docs-mode .content { padding: 0; }

/* Pre-boot home view — set by the inline <head> script before JS runs,
   so a refresh with no open pipeline shows only the ETL Studio with no
   flash of the canvas. Mirrors body.home-mode. Cleared by JS once
   showHomeView()/hideHomeView() owns the view. */
html[data-boot="home"] .pipeline-run,
html[data-boot="home"] #chart_container,
html[data-boot="home"] #notebook_workspace,
html[data-boot="home"] #settings_workspace,
html[data-boot="home"] .footer,
html[data-boot="home"] .zoom-controls { display: none !important; }
html[data-boot="home"] .content { padding: 0; }
html[data-boot="home"] #home_workspace { display: block !important; }

body.settings-mode .pipeline-run,
body.settings-mode #chart_container,
body.settings-mode #notebook_workspace,
body.settings-mode #home_workspace,
body.settings-mode .footer,
body.settings-mode .zoom-controls { display: none !important; }
body.settings-mode .content { padding: 0; }

.settings-workspace {
  width: 100%; height: 100%; overflow-y: auto;
  background: var(--surface-2);
  padding: 32px 40px 48px;
  font-family: var(--font-ui);
}
.settings-card {
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.settings-card-row {
  display: flex; align-items: flex-end; gap: 12px;
  flex-wrap: wrap;
}
.settings-card-row--col {
  flex-direction: column; align-items: stretch; gap: 6px;
}
.settings-row-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.settings-card .nb-spark-log {
  max-height: 280px;
  font-size: 12px;
}
.settings-card .nb-spark-status {
  font-size: 13px;
  color: var(--ink-700);
}

.home-workspace {
  width: 100%; height: 100%; overflow-y: auto;
  background: var(--surface-2);
  padding: 32px 40px 48px;
  font-family: var(--font-ui);
}
.home-hero {
  margin-bottom: 28px;
  padding: 32px 32px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--brand-50) 0%, var(--surface) 70%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.home-hero-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--brand-500); margin-bottom: 8px;
}
.home-hero-title { margin: 0 0 6px; font-size: 26px; font-weight: 600; color: var(--ink-900); }
.home-hero-sub { margin: 0; font-size: 13.5px; color: var(--ink-700); max-width: 640px; }

.home-section { margin-bottom: 24px; }
.home-section-header {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px;
}
.home-section-header h2 {
  margin: 0; font-size: 11px; font-weight: 700; color: var(--ink-700);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.home-section-header .help { color: var(--ink-500); font-size: 12px; }

.home-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.home-action {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-md);
  cursor: pointer; box-shadow: var(--shadow-1);
  font-family: var(--font-ui); color: var(--ink-900);
  transition: border-color var(--motion-fast), background var(--motion-fast),
              box-shadow var(--motion-fast);
}
.home-action:hover {
  border-color: var(--brand-500);
  background: var(--brand-50);
  box-shadow: var(--shadow-2);
}
.home-action-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-md);
  background: var(--brand-50); color: var(--brand-500);
  flex-shrink: 0;
}
.home-action-text { display: flex; flex-direction: column; line-height: 1.25; }
.home-action-text strong { font-size: 13px; font-weight: 600; color: var(--ink-900); }
.home-action-text .help { font-size: 11px; color: var(--ink-500); margin-top: 2px; }

.home-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}
.home-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 18px 18px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.home-card-head { display: flex; align-items: center; gap: 10px; }
.home-card-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius-md);
  background: var(--brand-50); color: var(--brand-500);
}
.home-card h3 {
  margin: 0; font-size: 11px; font-weight: 700; color: var(--ink-700);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.home-card-count {
  font-size: 30px; font-weight: 700; color: var(--ink-900); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.home-card-desc { margin: 0; font-size: 12px; color: var(--ink-500); flex: 1; }
.home-card-cta { align-self: flex-start; margin-top: 4px; height: 28px; padding: 0 10px; font-size: 12px; }

/* === CANVAS GRID === */
.ds-canvas-grid {
  background:
    radial-gradient(circle at center, rgba(15,23,42,0.05) 1px, transparent 1px) 0 0 / 16px 16px,
    var(--surface-2);
}


/* === SIDEBAR (PHASE 1 — promotion alias) ===
 * Added to sidebar element to override legacy gradient background.
 * After Phase 1 completes, the legacy .sidebar visual rules are deleted
 * and this can be folded back into a plain .sidebar selector.
 */
.sidebar-v2 {
  background: var(--surface-2) !important;
  box-shadow: none !important;
  border-right: 1px solid var(--line);
}

/* Headers/search inside the new sidebar */
.sidebar-v2 .sidebar-header h3 {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-900);
  margin: 0;
}
.sidebar-v2 .sidebar-subtitle {
  color: var(--ink-500);
  font-size: 12px;
  font-weight: 500;
}
.sidebar-v2 .sidebar-search {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.04);
}
.sidebar-v2 .sidebar-search input {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--ink-900);
  background: transparent;
  border: none;
}
.sidebar-v2 .sidebar-search input::placeholder { color: var(--ink-500); }
.sidebar-v2 .sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink-700);
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  white-space: nowrap;
  transition: background var(--motion-fast), color var(--motion-fast),
              border-color var(--motion-fast);
}
.sidebar-v2 .sidebar-toggle:hover {
  background: var(--surface-3);
  border-color: var(--ink-500);
  color: var(--ink-900);
  transform: none;
}
.sidebar-v2 .sidebar-toggle:active {
  background: var(--surface-2);
}
.sidebar-v2 .sidebar-toggle--floating {
  height: 32px;
  padding: 0 14px;
  font-size: 12.5px;
  color: #ffffff;
  background: linear-gradient(180deg, #2858e0 0%, #1f4fd6 100%);
  border-color: var(--brand-700);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), var(--shadow-2);
}
.sidebar-v2 .sidebar-toggle--floating:hover {
  background: linear-gradient(180deg, #1f4fd6 0%, #1438a8 100%);
  border-color: var(--brand-700);
  color: #ffffff;
}

/* Section <details> wrapping each panel */
.sidebar-v2 .ds-sidebar-section {
  border-bottom: 1px solid var(--line);
}
.sidebar-v2 .ds-sidebar-section:last-child { border-bottom: none; }
.sidebar-v2 .ds-sidebar-section > summary {
  list-style: none;
  outline: none;
}
.sidebar-v2 .ds-sidebar-section > summary::-webkit-details-marker { display: none; }
.sidebar-v2 .ds-sidebar-section > summary::after {
  content: "▸";
  display: inline-block;
  margin-left: var(--space-2);
  font-size: 9px;
  color: var(--ink-500);
  transition: transform var(--motion-fast);
}
.sidebar-v2 .ds-sidebar-section[open] > summary::after { transform: rotate(90deg); }

/* "+ New" inline ghost button inside section header */
.sidebar-v2 .ds-sidebar-section-header .new-btn {
  height: 24px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--brand-500);
  cursor: pointer;
  font-family: var(--font-ui);
  transition: background var(--motion-fast);
}
.sidebar-v2 .ds-sidebar-section-header .new-btn:hover { background: var(--brand-50); }

/* Per-section count badge (uses .pill .pill-neutral) — extra spacing */
.sidebar-v2 .ds-sidebar-section-header .count {
  font-size: 10px;
  letter-spacing: 0;
}


/* === Ingest section list rows (buttons that act like rows) ===
 * The Ingest section uses <button id="import_activity" class="create_operator ds-sidebar-list-row">.
 * Reset button defaults so they render the same as <div> rows.
 */
.sidebar-v2 .ds-sidebar-list-row.create_operator {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--ink-900);
  margin: 0;
}
.sidebar-v2 .ds-sidebar-list-row.create_operator:last-child { border-bottom: none; }
.sidebar-v2 .ds-sidebar-list-row.create_operator:hover { background: rgba(31,79,214,0.04); }
.sidebar-v2 .ds-sidebar-list-row.create_operator .icon {
  width: 18px; height: 18px;
}
.sidebar-v2 .ds-sidebar-list-row.create_operator .icon svg {
  width: 100%; height: 100%;
}

/* === Larger tap targets for "+ New" + section header === */
.sidebar-v2 .ds-sidebar-section-header {
  padding: 12px 14px;
  min-height: 40px;
}
.sidebar-v2 .ds-sidebar-section-header .new-btn {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  background: var(--brand-50);
  color: var(--brand-500);
  border: 1px solid transparent;
}
.sidebar-v2 .ds-sidebar-section-header .new-btn:hover {
  background: var(--brand-100);
  border-color: var(--brand-200);
}

/* === Drop the legacy gradient styling on Ingest <details> chrome === */
.sidebar-v2 details.ds-sidebar-section {
  background: transparent;
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 0;
  box-shadow: none;
  overflow: visible;
}
.sidebar-v2 details.ds-sidebar-section > summary {
  list-style: none;
}
.sidebar-v2 details.ds-sidebar-section > summary::-webkit-details-marker { display: none; }

/* Override legacy .activity-group rule that may still apply if class is present */
.sidebar-v2 .activity-group-content {
  display: block;
  gap: 0;
  padding: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}


/* === Sections as distinct white cards (clearer separation) ===
 * The sidebar-v2 background is var(--surface-2) (light gray).
 * Each <details> section sits on top as a white card with a hairline border.
 * 8px vertical gap between cards makes the separation obvious at a glance.
 */
.sidebar-v2 .sidebar-buttons {
  gap: 8px;
  padding: 8px;
}

.sidebar-v2 details.ds-sidebar-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 0;
  box-shadow: var(--shadow-1);
}

/* Header sits on the white card */
.sidebar-v2 .ds-sidebar-section-header {
  background: var(--surface);
  color: var(--ink-700);
  font-weight: 700;
  border-bottom: 1px solid var(--line);
}
.sidebar-v2 details.ds-sidebar-section:not([open]) .ds-sidebar-section-header {
  border-bottom-color: transparent;
}
.sidebar-v2 .ds-sidebar-section-header:hover {
  background: var(--surface-3);
}

/* List inside a card has no extra border-bottom on the last row (the card border handles it) */
.sidebar-v2 details.ds-sidebar-section .ds-sidebar-list .ds-sidebar-list-row:last-child {
  border-bottom: none;
}

/* === Stronger hover affordance on rows (clickability) === */
.sidebar-v2 .ds-sidebar-list-row {
  cursor: pointer;
  transition: background var(--motion-fast), padding-left var(--motion-fast);
}
.sidebar-v2 .ds-sidebar-list-row:hover {
  background: var(--brand-50);
  padding-left: 16px;     /* subtle 2px indent on hover */
}
.sidebar-v2 .ds-sidebar-list-row.is-active {
  background: var(--brand-50);
}

/* The "+ New" button stands out a little more inside the white card */
.sidebar-v2 .ds-sidebar-section-header .new-btn {
  background: var(--brand-500);
  color: #ffffff;
  border-color: var(--brand-500);
  font-weight: 600;
}
.sidebar-v2 .ds-sidebar-section-header .new-btn:hover {
  background: var(--brand-600);
  border-color: var(--brand-600);
}


/* === List area inside each section gets a subtle gray drawer so rows pop ===
 * Section card: --surface (white)
 *   ├── Header: --surface (white) — sits on the card
 *   └── List drawer: --surface-2 (light gray) — items live here, visually distinct
 * Hover: brightens row back to --brand-50 (light blue) — clear "you can click this"
 */
.sidebar-v2 details.ds-sidebar-section .ds-sidebar-list,
.sidebar-v2 details.ds-sidebar-section .activity-group-content {
  background: var(--surface-2);
  padding: 4px 0;
}

/* Rows inside the gray drawer — stay transparent so the drawer color shows through.
 * The hairline divider becomes lighter so it doesn't fight with the gray.
 */
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row {
  background: transparent;
  border-bottom: 1px solid rgba(15, 23, 42, 0.04);
}
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row:last-child {
  border-bottom: none;
}

/* Hover lifts the row to white-blue so it clearly stands out as the focus item */
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row:hover {
  background: var(--brand-50);
}

/* Active row stays prominent: brand-50 fill + 2px left bar */
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row.is-active {
  background: var(--brand-50);
  box-shadow: inset 3px 0 0 var(--brand-500);
}

/* Ingest buttons (which are <button>s with .ds-sidebar-list-row) need the same treatment */
.sidebar-v2 .ds-sidebar-list-row.create_operator {
  background: transparent;
  border-bottom-color: rgba(15, 23, 42, 0.04);
}


/* === MORE distinct rows: white tiles on a stronger gray drawer ===
 * Each row gets its own white background so it reads as a physical tile.
 * Rows are separated by ~3px of the gray drawer showing through (no more hairline dividers).
 */
.sidebar-v2 details.ds-sidebar-section .ds-sidebar-list,
.sidebar-v2 details.ds-sidebar-section .activity-group-content {
  background: #edf1f7;            /* stronger drawer gray */
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row,
.sidebar-v2 .ds-sidebar-list-row.create_operator {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  height: auto;
  min-height: 44px;
  box-shadow: var(--shadow-1);
}

/* Last-row hairline reset is no longer needed (rows are tiles, not bordered list rows) */
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row:last-child {
  border-bottom: 1px solid var(--line);
}

/* Hover: visibly lift to brand-tinted */
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row:hover,
.sidebar-v2 .ds-sidebar-list-row.create_operator:hover {
  background: var(--brand-50);
  border-color: var(--brand-200);
  padding-left: 12px;             /* cancel the indent we added before */
  box-shadow: var(--shadow-2);
}

/* Active tile: solid brand fill with white text */
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row.is-active {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #ffffff;
  box-shadow: var(--shadow-2);
}
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row.is-active .icon,
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row.is-active .label,
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row.is-active .meta {
  color: #ffffff;
}
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row.is-active .pill {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}


/* === Subtle active state (override the solid brand fill from the previous pass) === */
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row.is-active {
  background: var(--brand-50);
  border-color: var(--brand-200);
  color: var(--brand-700);
  box-shadow: var(--shadow-1);
}
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row.is-active::before {
  content: "";
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--brand-500);
  border-radius: 0 2px 2px 0;
}
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row.is-active {
  position: relative;
}
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row.is-active .icon { color: var(--brand-500); }
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row.is-active .label { color: var(--brand-700); font-weight: 600; }
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row.is-active .meta { color: var(--ink-500); }
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row.is-active .pill {
  background: rgba(31,79,214,0.10);
  color: var(--brand-500);
}


/* === "+ New" buttons — soft & stylish, not solid-fill harsh === */
.sidebar-v2 .ds-sidebar-section-header .new-btn {
  height: 26px;
  padding: 0 10px 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-500);
  background: rgba(31, 79, 214, 0.06);
  border: 1px solid rgba(31, 79, 214, 0.14);
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast), transform var(--motion-fast);
}
.sidebar-v2 .ds-sidebar-section-header .new-btn:hover {
  background: var(--brand-50);
  border-color: var(--brand-200);
  color: var(--brand-600);
}
.sidebar-v2 .ds-sidebar-section-header .new-btn:active {
  transform: scale(0.97);
  background: var(--brand-100);
}



/* === Ingest activity buttons get a distinct, button-y outline ===
 * These are <button id="import_activity"> etc — actions that ADD a node to the canvas,
 * not existing items. Visual hint: brand-tinted border so users see them as "buttons" not "rows".
 */
.sidebar-v2 .ds-sidebar-list-row.create_operator {
  background: var(--surface) !important;
  border: 1px solid rgba(31, 79, 214, 0.22) !important;
  border-radius: var(--radius-md) !important;
  color: var(--brand-700);
  font-weight: 500;
  box-shadow: 0 1px 0 rgba(31,79,214,0.04), var(--shadow-1);
  cursor: pointer;
}
.sidebar-v2 .ds-sidebar-list-row.create_operator .icon {
  color: var(--brand-500);
}
.sidebar-v2 .ds-sidebar-list-row.create_operator .label {
  color: var(--brand-700);
}
.sidebar-v2 .ds-sidebar-list-row.create_operator:hover {
  background: var(--brand-50) !important;
  border-color: var(--brand-300) !important;
  box-shadow: var(--shadow-2);
  padding-left: 12px;            /* override the row-hover indent so buttons don't shift */
}
.sidebar-v2 .ds-sidebar-list-row.create_operator:active {
  transform: scale(0.99);
  box-shadow: inset 0 1px 2px rgba(31,79,214,0.10);
}


/* === Ingest activity buttons — hard outline + bold label === */
.sidebar-v2 .ds-sidebar-list-row.create_operator {
  background: var(--surface) !important;
  border: 1.5px solid var(--brand-500) !important;
  border-radius: var(--radius-md) !important;
  color: var(--brand-700);
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 2px rgba(31,79,214,0.10);
  cursor: pointer;
}
.sidebar-v2 .ds-sidebar-list-row.create_operator .label {
  color: var(--brand-700);
  font-weight: 700;
}
.sidebar-v2 .ds-sidebar-list-row.create_operator:hover {
  background: var(--brand-50) !important;
  border-color: var(--brand-600) !important;
  box-shadow: 0 4px 8px rgba(31,79,214,0.18);
}
.sidebar-v2 .ds-sidebar-list-row.create_operator:active {
  transform: scale(0.99);
  background: var(--brand-100) !important;
  box-shadow: inset 0 1px 2px rgba(31,79,214,0.18);
}


/* === Notebook / pipeline / dataflow / trigger list items — match the Ingest button outline ===
 * Same hard outline + bold label so users see every row as a distinct, clickable item.
 * Slightly less assertive than create_operator (line-strong instead of brand-500) to preserve
 * the "actions vs items" hierarchy.
 */
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row:not(.create_operator) {
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-md);
  font-weight: 600;
}
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row:not(.create_operator) .label {
  font-weight: 600;
  color: var(--ink-900);
}
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row:not(.create_operator):hover {
  background: var(--brand-50);
  border-color: var(--brand-300);
}
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row:not(.create_operator).is-active {
  background: var(--brand-50);
  border-color: var(--brand-500);
}
.sidebar-v2 .ds-sidebar-list .ds-sidebar-list-row:not(.create_operator).is-active .label {
  color: var(--brand-700);
}
