/* Shared persisted theme. Loaded after the page-specific stylesheet. */
html[data-theme="dark"] {
  color-scheme: dark;
  color: #e6e6e6;
  background: #1e1e1e;
  --theme-bg: #1e1e1e;
  --theme-bg-soft: #252526;
  --theme-surface: #252526;
  --theme-surface-raised: #2d2d30;
  --theme-border: #3c3c3c;
  --theme-border-soft: #333333;
  --theme-text: #e6e6e6;
  --theme-muted: #b0b0b0;
  --theme-blue: #89d185;
  --theme-green: #89d185;
}

html[data-theme="dark"] body {
  color: var(--theme-text);
  background: var(--theme-bg);
}

html[data-theme="dark"] ::selection { color: #f0f0f0; background: #4f6547; }

/* The landing, docs, and account dialog are always dark (see site.css); they intentionally
   do not participate in the theme toggle, so no dark overrides are needed here. */

/* User workspace: all SPA pages and dialogs */
html[data-theme="dark"] .user-app {
  color-scheme: dark;
  color: var(--theme-text);
  background: var(--theme-bg);
  --pipeline-border: var(--theme-border);
  --pipeline-blue: #89d185;
}
html[data-theme="dark"] body.is-desktop-runtime #user-app::before { border-bottom-color: var(--theme-border); background: linear-gradient(to right, #171717 60px, #191919 60px); }

html[data-theme="dark"] .user-app * { border-color: var(--theme-border); }
html[data-theme="dark"] .user-app :is(h1, h2, h3, strong, label) { color: var(--theme-text); }
html[data-theme="dark"] .user-app :is(p, small) { color: var(--theme-muted); }
html[data-theme="dark"] .user-app :is(input, textarea, select) {
  border-color: var(--theme-border);
  color: var(--theme-text);
  background-color: #1e1e1e;
}
html[data-theme="dark"] .user-app :is(input, textarea)::placeholder { color: #9e9e9e; }
html[data-theme="dark"] .pipeline-version-menu-button { border-color: #454545; color: #d0d0d0; background: #2d2d30; }
html[data-theme="dark"] .pipeline-version-menu-button:hover, html[data-theme="dark"] .pipeline-version-menu-button[aria-expanded="true"] { border-color: #60765e; color: #f0f0f0; background: #303831; }
html[data-theme="dark"] .pipeline-version-menu-button small { border-color: #4a4a4a; color: #a8b2a8; }
html[data-theme="dark"] .pipeline-version-menu { border-color: #474747; color: var(--theme-text); background: #252526; box-shadow: 0 18px 44px rgba(0,0,0,.42); }
html[data-theme="dark"] .pipeline-version-menu > button small, html[data-theme="dark"] .pipeline-version-empty { color: #a8a8a8; }
html[data-theme="dark"] .pipeline-version-menu > button { color: #dedede; }
html[data-theme="dark"] .pipeline-version-menu > button:hover { background: #303831; }
html[data-theme="dark"] .pipeline-version-menu > button i { color: #a8c9a5; background: #303b31; }
html[data-theme="dark"] .pipeline-version-recent { border-color: #414141; }
html[data-theme="dark"] .pipeline-version-row { color: #a8a8a8; }
html[data-theme="dark"] .pipeline-version-row strong { color: #dedede; }
html[data-theme="dark"] .pipeline-version-row:hover { background: #303831; }
html[data-theme="dark"] .pipeline-version-row.is-active { color: #a8c9a5; background: #303b31; }
html[data-theme="dark"] .pipeline-version-row.is-active strong { color: #cbe1c9; }
html[data-theme="dark"] .save-pipeline-version-dialog { border-color: #4a4a4a; color: var(--theme-text); background: #1e1e1e; box-shadow: 0 30px 100px rgba(0,0,0,.58); }
html[data-theme="dark"] .save-version-close { border-color: #4a4a4a; color: #b8b8b8; background: rgba(45,45,48,.85); }
html[data-theme="dark"] .save-version-close:hover { color: #f0f0f0; background: #333333; }
html[data-theme="dark"] .save-version-content > span { color: #9fbd9c; }
html[data-theme="dark"] .save-version-content h2 { color: #f0f0f0; }
html[data-theme="dark"] .save-version-content > p { color: #b0b0b0; }
html[data-theme="dark"] .save-version-content label { color: #d0d0d0; }
html[data-theme="dark"] .save-version-content input { border-color: #555555; color: #eeeeee; background: #252526; }
html[data-theme="dark"] .save-version-content input:focus { border-color: #789276; box-shadow: 0 0 0 3px rgba(137,209,133,.1); }
html[data-theme="dark"] .save-version-actions button { border-color: #505050; color: #d0d0d0; background: #2d2d30; }
html[data-theme="dark"] .save-version-actions button[type="submit"] { border-color: #557255; color: #fff; background: #557255; }

html[data-theme="dark"] :is(
  .pipeline-sidebar,
  .pipeline-main,
  .pipeline-topbar,
  .pipeline-tabs,
  .pipeline-code-tabs,
  .block-detail-header,
  .block-detail-tabs,
  .connections-view-header,
  .source-detail-header,
  .source-detail-tabs,
  .run-block-inspector > header,
  .run-block-inspector > nav
) { background: var(--theme-bg-soft); }

html[data-theme="dark"] .user-app :is(
  .pipelines-list-view,
  .pipeline-workspace,
  .pipeline-code-files-view,
  .run-history-view,
  .compute-view,
  .scheduling-view,
  .key-vault-view,
  .settings-view,
  .recipes-view,
  .connections-view,
  .source-detail-view,
  .block-detail-view,
  .run-block-inspector,
  .code-folder-view,
  .source-workspace-tab
) { color: var(--theme-text); background: var(--theme-bg); }

html[data-theme="dark"] .user-app :is(
  .pipeline-catalog-panel,
  .pipeline-node,
  .block-code-activity,
  .block-detail-overview,
  .pipeline-source-builder,
  .run-detail-summary,
  .run-stages-panel,
  .run-log-panel,
  .compute-stats,
  .compute-panel,
  .compute-summary,
  .compute-blocks-panel,
  .compute-orchestration-panel,
  .scheduling-summary,
  .schedule-create-panel,
  .schedule-list-panel,
  .account-settings-panel,
  .settings-panel,
  .connections-table,
  .source-detail-stats,
  .source-identity-card,
  .source-tab-panel,
  .health-run-card,
  .maintained-access-card,
  .run-block-panel,
  .block-snapshot-viewer
) { color: var(--theme-text); background: var(--theme-surface); }

html[data-theme="dark"] body #user-app :is(.recipes-view, .recipes-table, .recipe-row, .recipe-detail-topbar, .recipe-chat-dock) { background-color: #191919; }
html[data-theme="dark"] body #user-app .recipe-row:is(:hover, :focus-visible) { background-color: #232323; }
html[data-theme="dark"] .recipe-row .pipeline-catalog-name > i { color: #a6d6a0; background: #29372f; }
html[data-theme="dark"] .recipe-row-runtime, html[data-theme="dark"] .recipe-node-kind { color: var(--theme-muted); background: var(--theme-surface-raised); }
html[data-theme="dark"] .recipe-detail-view { color: var(--theme-text); background: #1e1e1e; }
html[data-theme="dark"] .recipe-detail-topbar, html[data-theme="dark"] .recipe-detail-tabs, html[data-theme="dark"] .recipe-chat-dock { border-color: var(--theme-border); }
html[data-theme="dark"] .recipe-canvas { background-color: #1e1e1e; background-image: radial-gradient(#454545 .75px, transparent .75px); }
html[data-theme="dark"] .recipe-edges path { stroke: #666; }
html[data-theme="dark"] .recipe-pipeline-node { border-color: #454545; background: var(--theme-surface); }
html[data-theme="dark"] .recipe-pipeline-node:first-child { border-color: #5f7c5e; box-shadow: 0 0 0 2px rgba(137,209,133,.12); }
html[data-theme="dark"] .recipe-pipeline-node header { border-color: var(--theme-border); }
html[data-theme="dark"] .recipe-pipeline-node header strong { color: var(--theme-text); }
html[data-theme="dark"] .recipe-pipeline-node header small, html[data-theme="dark"] .recipe-pipeline-node footer { color: var(--theme-muted); }
html[data-theme="dark"] .recipe-chat-messages .pipeline-chat-welcome p { color: var(--theme-text); }
html[data-theme="dark"] .recipe-chat-note, html[data-theme="dark"] .recipe-chat-composer { border-color: var(--theme-border); background: var(--theme-surface-raised); }
html[data-theme="dark"] .recipe-model-picker { border-color: var(--theme-border); color: var(--theme-text); background: #252526; }
html[data-theme="dark"] .recipe-model-picker select { color: var(--theme-text); }
html[data-theme="dark"] .save-recipe-template { border-color: #557255; background: #557255; }
html[data-theme="dark"] .unsaved-recipe-content > p { color: var(--theme-muted); }
html[data-theme="dark"] .unsaved-recipe-content button { border-color: var(--theme-border); color: var(--theme-text); background: var(--theme-surface-raised); }
html[data-theme="dark"] .unsaved-recipe-content #discard-unsaved-recipe { color: #e39a91; }
html[data-theme="dark"] .unsaved-recipe-content #save-unsaved-recipe { border-color: #557255; color: #fff; background: #557255; }

html[data-theme="dark"] .user-app :is(
  .pipeline-catalog-toolbar,
  .pipeline-catalog-table-head,
  .pipeline-tabs,
  .block-code-changes,
  .pipeline-code-tabs,
  .run-history-table-head,
  .run-log-panel > header,
  .compute-panel > header,
  .compute-blocks-panel > header,
  .compute-orchestration-panel > header,
  .schedule-presets,
  .vault-table-head,
  .account-settings-panel > footer,
  .connections-table-head,
  .source-tab-panel > header,
  .run-block-data-panel > header,
  .block-snapshot-viewer > header
) { background: var(--theme-bg-soft); }

html[data-theme="dark"] .pipeline-canvas {
  background-color: #1e1e1e;
  background-image: radial-gradient(#454545 .75px, transparent .75px);
}
html[data-theme="dark"] .pipeline-edges path { stroke: #666666; }
html[data-theme="dark"] .pipeline-node header { border-color: var(--theme-border-soft); }
html[data-theme="dark"] .pipeline-node header strong { color: var(--theme-text); }
html[data-theme="dark"] .pipeline-node header small,
html[data-theme="dark"] .pipeline-node footer { color: var(--theme-muted); }
html[data-theme="dark"] body #user-app .pipeline-node { background: #191919; }
html[data-theme="dark"] .pipeline-node:hover { border-color: #75a774; }

html[data-theme="dark"] .user-app :is(
  .pipeline-catalog-row,
  .run-history-row,
  .vault-secret-row,
  .connections-row,
  .version-list > button,
  .health-check-list > button,
  .schedule-card
) { color: var(--theme-muted); background: var(--theme-surface); }
html[data-theme="dark"] .user-app :is(.pipeline-catalog-row, .pipeline-folder-browser-row, .run-history-row, .vault-secret-row, .connections-row, .version-list > button, .health-check-list > button):is(:hover, :focus-visible) { background: var(--theme-surface-raised); }
html[data-theme="dark"] .pipeline-folder-browser-row { border-color: var(--theme-border-soft); color: var(--theme-muted); background: var(--theme-surface); }
html[data-theme="dark"] .pipeline-folder-browser-row b { color: var(--theme-muted); background: var(--theme-surface-raised); }
html[data-theme="dark"] .pipeline-folder-browser-row b.is-active { color: #fff; background: rgba(73,145,79,.2); }
html[data-theme="dark"] .pipeline-browser-path button { color: #89d185; }
html[data-theme="dark"] .pipeline-browser-path button[aria-current="page"], html[data-theme="dark"] .pipeline-browser-path strong { color: var(--theme-muted); }
html[data-theme="dark"] .pipelines-list-page .pipeline-browser-path,
html[data-theme="dark"] .pipelines-list-page .pipeline-browser-path button { color: #fff; }
html[data-theme="dark"] .pipelines-list-page .pipeline-browser-path strong { color: #b8b8b8; }
html[data-theme="dark"] body #user-app .pipelines-list-page .pipeline-browser-path button[aria-current="page"] { color: #fff; }
html[data-theme="dark"] body #user-app .pipelines-list-page .pipeline-browser-heading > p { color: #b0b0b0; }
html[data-theme="dark"] .pipeline-breadcrumbs button.is-back-link { color: #fff; }
html[data-theme="dark"] .user-app .pipeline-breadcrumbs #workspace-section-name { color: #b8b8b8; }
html[data-theme="dark"] .pipelines-list-page #pipeline-folder-path-separator { color: #c0c4c9; }
html[data-theme="dark"] .pipeline-browser-header-actions > button { border-color: var(--theme-border); color: var(--theme-muted); background: var(--theme-surface-raised); }
html[data-theme="dark"] .pipeline-browser-header-actions > button:last-of-type { border-color: #4d684d; color: #a6d6a0; background: #29372f; }
html[data-theme="dark"] .pipeline-folder-tabs { border-color: var(--theme-border); background: var(--theme-bg-soft); }
html[data-theme="dark"] .pipeline-folder-tabs button { color: var(--theme-muted); }
html[data-theme="dark"] .pipeline-folder-tabs button.is-active { color: #fff; }
html[data-theme="dark"] .pipeline-folder-tabs button.is-active::after { background: #89d185; }
html[data-theme="dark"] :is(#create-folder-button, #pipeline-folder-new-pipeline) { border-color: rgba(137,209,133,.32); color: #fff; background: rgba(73,145,79,.2); box-shadow: inset 0 1px rgba(255,255,255,.05); }
html[data-theme="dark"] :is(#create-folder-button, #pipeline-folder-new-pipeline):hover { background: rgba(73,145,79,.4); }
html[data-theme="dark"] #delete-open-workspace { border-color: transparent; color: #e08a7f; background: transparent; }
html[data-theme="dark"] .pipeline-catalog-toolbar > button { border-color: #4d684d; color: #e7f3e4; background: #3f5948; }
html[data-theme="dark"] .pipeline-catalog-status.is-active { border-color: rgba(73,145,79,.32); color: #fff; background: rgba(73,145,79,.2); box-shadow: none; }
html[data-theme="dark"] .pipeline-catalog-status.is-inactive { border-color: rgba(177,76,68,.32); color: #fff; background: rgba(177,76,68,.2); box-shadow: none; }
html[data-theme="dark"] .run-history-row .run-status.succeeded { border-color: rgba(73,145,79,.54); background: rgba(73,145,79,.5); }
html[data-theme="dark"] .run-history-row .run-status.failed { border-color: rgba(177,76,68,.52); background: rgba(177,76,68,.48); }
html[data-theme="dark"] .run-history-row .run-status.running { border-color: rgba(58,110,170,.52); background: rgba(58,110,170,.48); }
html[data-theme="dark"] .pipeline-catalog-row-chevron { color: rgba(255,255,255,.3); }
html[data-theme="dark"] .pipeline-list-empty { color: var(--theme-muted); }
html[data-theme="dark"] .pipeline-list-empty strong { color: var(--theme-text); }
html[data-theme="dark"] .pipeline-sidebar { border-color: #2f2f2f; background: #191919; }
html[data-theme="dark"] body #user-app .pipelines-list-view { background-color: #191919; }
html[data-theme="dark"] body #user-app :is(.connections-view, .connections-view-header, .connections-table, .connection-row) { background-color: #191919; }
html[data-theme="dark"] body #user-app :is(.key-vault-view, .key-vault-heading, .vault-table, .vault-secret-row) { background-color: #191919; }
html[data-theme="dark"] body #user-app :is(.docs-view, .docs-heading) { background-color: #191919; }
html[data-theme="dark"] body #user-app .docs-heading { border-bottom-color: var(--theme-border); }
html[data-theme="dark"] body #user-app .docs-heading h2 { color: #fff; }
html[data-theme="dark"] body #user-app .docs-heading p { color: #b0b0b0; }
html[data-theme="dark"] body #user-app .docs-contents { border-right-color: var(--theme-border); background-color: #191919; }
html[data-theme="dark"] body #user-app .docs-contents button { color: var(--theme-muted); background: transparent; }
html[data-theme="dark"] body #user-app .docs-contents button:hover { color: #a6d6a0; background: transparent; }
html[data-theme="dark"] body #user-app .docs-contents button.is-active { border-top: 0; border-bottom: 0; border-left-color: #89d185; color: #fff; background: #242b25; }
html[data-theme="dark"] body #user-app .docs-toc-group.has-active-child .docs-toc-parent { color: #a6d6a0; }
html[data-theme="dark"] body #user-app :is(.docs-section h3, .docs-section h4, .docs-definitions dt, .docs-section p b, .docs-steps b) { color: var(--theme-text); }
html[data-theme="dark"] body #user-app :is(.docs-section p, .docs-definitions dd, .docs-steps span) { color: #b0b0b0; }
html[data-theme="dark"] body #user-app .docs-section a { color: #89d185; }
html[data-theme="dark"] body #user-app .docs-section code { color: #cfe6cd; background: #252526; }
html[data-theme="dark"] body #user-app :is(.docs-section + .docs-section, .docs-subsection + .docs-subsection, .docs-definitions > div, .docs-steps li) { border-color: var(--theme-border); }
html[data-theme="dark"] body #user-app .docs-eyebrow { color: #8fa28f; }
html[data-theme="dark"] body #user-app .docs-note { border-left-color: #527b55; color: #9e9e9e !important; background: linear-gradient(90deg, #202a22, transparent 72%); }
html[data-theme="dark"] body #user-app .docs-visual { border-color: var(--theme-border); color: var(--theme-muted); background: #202020; box-shadow: none; }
html[data-theme="dark"] body #user-app .docs-visual figcaption { color: #a8a8a8; }
html[data-theme="dark"] body #user-app .docs-layer-visual > div:not(.docs-mini-flow, .docs-visual-result),
html[data-theme="dark"] body #user-app .docs-node,
html[data-theme="dark"] body #user-app .docs-fake-table > b,
html[data-theme="dark"] body #user-app .docs-table-visual > small,
html[data-theme="dark"] body #user-app .docs-table-visual figcaption { border-color: var(--theme-border); color: var(--theme-text); background: #252525; }
html[data-theme="dark"] body #user-app .docs-mini-flow { color: #9cb59d; background: #242d25; }
html[data-theme="dark"] body #user-app .docs-mini-flow i { border-color: #455447; color: #c0d8bd; background: #303831; }
html[data-theme="dark"] body #user-app :is(.docs-node b, .docs-run-visual b, .docs-chain-visual b, .docs-visual-result b) { color: var(--theme-text); }
html[data-theme="dark"] body #user-app .docs-fake-table > span { border-color: var(--theme-border); color: #a8a8a8; background: #202020; }
html[data-theme="dark"] body #user-app .key-vault-heading { border-bottom-color: var(--theme-border); }
html[data-theme="dark"] body #user-app #key-vault-view .pipeline-catalog-table-head { background-color: #202020; }
html[data-theme="dark"] body #user-app .vault-secret-row:is(:hover, :focus-visible) { background-color: #232323; }
html[data-theme="dark"] body #user-app .key-vault-heading h2 { color: #fff; }
html[data-theme="dark"] body #user-app .key-vault-heading p { color: #b0b0b0; }
html[data-theme="dark"] body #user-app .key-vault-heading > button { border-color: rgba(137,209,133,.42); color: #fff; background: rgba(63,89,72,.5); }
html[data-theme="dark"] body #user-app .connections-view-header { border-bottom-color: var(--theme-border); }
html[data-theme="dark"] body #user-app #connections-view .pipeline-catalog-table-head { background-color: #202020; }
html[data-theme="dark"] body #user-app .connection-row:is(:hover, :focus-visible) { background-color: #232323; }
html[data-theme="dark"] body #user-app .connections-heading h2 { color: #fff; }
html[data-theme="dark"] body #user-app .connections-heading p { color: #b0b0b0; }
html[data-theme="dark"] body #user-app .connection-url { color: var(--theme-muted); }
html[data-theme="dark"] body #user-app .pipelines-list-page .pipeline-catalog-panel,
html[data-theme="dark"] body #user-app .pipelines-list-page .pipeline-catalog-panel > header { background: #1e1e1e; }
html[data-theme="dark"] body #user-app .pipelines-list-page:not(.is-folder-open) .pipeline-catalog-panel > header { border-bottom-color: var(--theme-border); }
html[data-theme="dark"] body #user-app .pipelines-list-page .pipeline-catalog-row { background: #191919; }
html[data-theme="dark"] body #user-app .pipelines-list-page .pipeline-catalog-row:is(:hover, :focus-visible) { background: #232323; }
html[data-theme="dark"] body #user-app .pipelines-list-page :is(.pipeline-folder-tabs, .pipeline-catalog-table-head) { background: #202020; }
html[data-theme="dark"] body #user-app :is(.folder-storage-panel, .workspace-pipeline-library) { color: var(--theme-text); background: #191919; }
html[data-theme="dark"] body #user-app .folder-mcp-panel { color: var(--theme-text); background: #191919; }
html[data-theme="dark"] .storage-resource-card { border-color: var(--theme-border); color: var(--theme-muted); background: var(--theme-surface); }
html[data-theme="dark"] .storage-resource-identity strong { color: var(--theme-text); }
html[data-theme="dark"] .storage-resource-identity small { color: var(--theme-muted); }
html[data-theme="dark"] :is(.storage-resource-details, .storage-resource-card > footer) { border-color: var(--theme-border-soft); background: var(--theme-bg-soft); }
html[data-theme="dark"] .storage-resource-details span { color: var(--theme-muted); }
html[data-theme="dark"] .storage-resource-details strong { color: #d1d1d1; }
html[data-theme="dark"] .storage-resource-icon { color: #a6d6a0; background: #34483a; }
html[data-theme="dark"] .storage-resource-status { border-color: #776b49; color: #e1c77f; background: #403923; }
html[data-theme="dark"] .storage-resource-endpoint { color: var(--theme-muted); }
html[data-theme="dark"] .storage-resource-actions button { border-color: var(--theme-border); color: var(--theme-muted); background: var(--theme-surface-raised); }
html[data-theme="dark"] :is(.storage-resource-actions button:last-of-type, #pipeline-folder-pipelines-panel #folder-schedule-form > footer #delete-folder-orchestration) { border-color: transparent; color: #e08a7f; background: transparent; }
html[data-theme="dark"] .pipeline-catalog-type.is-data-pipeline { border-color: rgba(86,150,213,.32); color: #fff; background: rgba(40,118,210,.2); }
html[data-theme="dark"] .pipeline-catalog-type.is-orchestration { border-color: rgba(217,142,65,.32); color: #fff; background: rgba(184,105,34,.2); }
html[data-theme="dark"] .storage-catalog-kind { border-color: rgba(86,157,103,.32); color: #fff; background: rgba(73,145,79,.2); }
html[data-theme="dark"] :is(.storage-catalog-relation, .folder-orchestration-cron) { color: var(--theme-muted); }
/* The resource workspace sits on the same #191919 ground as the catalogs around it. */
html[data-theme="dark"] :is(.storage-resource-workspace, .storage-table-view > header, .storage-sql-view > header, .storage-data-grid, .storage-query-status) { border-color: var(--theme-border); color: var(--theme-text); background: #191919; }
html[data-theme="dark"] .storage-grid-table th { border-color: var(--theme-border); color: var(--theme-muted); background: #202020; }
html[data-theme="dark"] :is(.storage-table-view > header strong, .storage-sql-view > header strong, .storage-data-empty strong) { color: var(--theme-text); }
html[data-theme="dark"] :is(.storage-table-view > header span, .storage-sql-view > header span, .storage-data-empty) { color: var(--theme-muted); }
html[data-theme="dark"] .storage-grid-table { color: var(--theme-muted); }html[data-theme="dark"] .storage-grid-table :is(th, td) { border-color: var(--theme-border-soft); }
html[data-theme="dark"] .storage-table-view > header button { border-color: var(--theme-border); color: var(--theme-text); background: var(--theme-surface-raised); }
html[data-theme="dark"] .storage-sql-view { background: #191919; }
html[data-theme="dark"] .storage-query-status.is-error { color: #ef9b91; background: #402828; }
html[data-theme="dark"] #pipeline-folder-pipelines-panel #folder-schedule-form :is(label, input) { color: var(--theme-text); }
html[data-theme="dark"] #pipeline-folder-pipelines-panel #folder-schedule-form input:not([type="checkbox"]) { border-color: var(--theme-border); color: var(--theme-text); background: #1e1e1e; color-scheme: dark; }
html[data-theme="dark"] #pipeline-folder-pipelines-panel #folder-schedule-form footer button { border-color: #4d684d; color: #e7f3e4; background: #3f5948; }
html[data-theme="dark"] :is(.pipeline-catalog-actions select, .pipeline-catalog-actions button) { border-color: var(--theme-border); color: var(--theme-muted); background: var(--theme-surface-raised); color-scheme: dark; }

html[data-theme="dark"] .user-app :is(#schedule-form input, .schedule-enabled-field, .schedule-presets button) { border-color: var(--theme-border); color: var(--theme-text); background: var(--theme-surface-raised); }
html[data-theme="dark"] .schedule-create-panel header code { color: var(--theme-muted); background: var(--theme-bg-soft); }
html[data-theme="dark"] .schedule-icon { color: #89d185; background: #29372f; }

/* Compute has several nested runtime cards that need their own dark surfaces. */
html[data-theme="dark"] .compute-heading { border-color: var(--theme-border); }
html[data-theme="dark"] .compute-heading p { color: #89d185; }
html[data-theme="dark"] .compute-heading h2,
html[data-theme="dark"] :is(.compute-summary, .compute-blocks-panel, .compute-orchestration-panel) h3,
html[data-theme="dark"] .compute-block-card header strong,
html[data-theme="dark"] .compute-block-usage strong { color: var(--theme-text); }
html[data-theme="dark"] :is(
  .compute-heading > div > span,
  .compute-summary span,
  .compute-summary small,
  .compute-blocks-panel p,
  .compute-orchestration-panel p,
  .compute-blocks-panel > header > span,
  .compute-block-card header small,
  .compute-block-usage > div > span,
  .compute-orchestration-panel form label > span
) { color: var(--theme-muted); }
html[data-theme="dark"] .compute-runtime-banner { border-color: #3f5948; background: #29372f; }
html[data-theme="dark"] .compute-runtime-icon { color: #a6d6a0; background: #34483a; }
html[data-theme="dark"] .compute-runtime-banner > div:nth-child(2) strong,
html[data-theme="dark"] .compute-runtime-banner > div:last-child strong { color: var(--theme-text); }
html[data-theme="dark"] .compute-runtime-banner :is(p, small) { color: #b7c3b8; }
html[data-theme="dark"] .compute-runtime-banner > div:last-child { border-color: #47604d; }
html[data-theme="dark"] .compute-runtime-banner > div:last-child span { color: #a6d6a0; }
html[data-theme="dark"] :is(.compute-summary, .compute-blocks-panel, .compute-orchestration-panel, .compute-block-card) { border-color: var(--theme-border); }
html[data-theme="dark"] :is(.compute-summary article + article, .compute-blocks-panel > header, .compute-orchestration-panel > header) { border-color: var(--theme-border-soft); }
html[data-theme="dark"] .compute-block-list { border-color: var(--theme-border-soft); background: var(--theme-bg); }
html[data-theme="dark"] .compute-block-card { color: var(--theme-text); background: var(--theme-surface); }
html[data-theme="dark"] .compute-block-usage { border-color: var(--theme-border-soft); background: var(--theme-bg-soft); }
html[data-theme="dark"] .compute-usage-track { background: #3c3c3c; }
html[data-theme="dark"] .compute-usage-track i { background: #6a9955; }
html[data-theme="dark"] .compute-allocation-form label,
html[data-theme="dark"] .compute-orchestration-panel form label { color: #c8c8c8; }
html[data-theme="dark"] :is(.compute-allocation-form, .compute-orchestration-panel) :is(input, select) { border-color: var(--theme-border); color: var(--theme-text); background: var(--theme-surface-raised); color-scheme: dark; }
html[data-theme="dark"] :is(.compute-allocation-form, .compute-orchestration-panel) :is(input, select):focus { border-color: #6a9955; box-shadow: 0 0 0 3px rgba(137,209,133,.1); }
html[data-theme="dark"] :is(.compute-allocation-form button, .compute-orchestration-panel form > button) { border-color: #4d684d; color: #e7f3e4; background: #3f5948; }
html[data-theme="dark"] :is(.compute-allocation-form button, .compute-orchestration-panel form > button):hover { border-color: #668166; background: #4f6b50; }
html[data-theme="dark"] :is(.compute-assigned, .compute-ready) { color: #a6d6a0; background: #29372f; }
html[data-theme="dark"] .compute-needs-key { color: #f0a8a0; background: #442d2d; }
html[data-theme="dark"] .compute-allocation-result { color: #a6d6a0; }
html[data-theme="dark"] :is(
  .compute-block-icon,
  .compute-block-icon.is-external_sources,
  .compute-block-icon.is-database_connector,
  .compute-block-icon.is-custom_code
) { color: #a6d6a0; background: #34483a; }

html[data-theme="dark"] .user-app :is(
  .pipeline-catalog-toolbar label,
  .toolbar-button,
  .canvas-tools button,
  .settings-panel button:not(.settings-signout),
  .source-detail-tabs button,
  .block-detail-tabs button,
  .pipeline-code-tabs button,
  .block-snapshot-controls > div,
  .run-block-data-controls > div
) { color: var(--theme-muted); background: var(--theme-surface-raised); }

html[data-theme="dark"] .user-app .settings-panel .settings-download { border-color: #668166; color: #f1faee; background: #4f6b50; }
html[data-theme="dark"] .user-app .settings-panel .settings-download:hover { border-color: #789378; background: #5b785b; }

html[data-theme="dark"] .user-app :is(
  .pipeline-catalog-name strong,
  .pipeline-breadcrumbs strong,
  .pipeline-title-row h1,
  .block-snapshot-table-wrap table
) { color: var(--theme-text); }

html[data-theme="dark"] body #user-app .pipeline-chat-dock { border-color: #3c3c3c; color: var(--theme-text); background: #191919; }
html[data-theme="dark"] .pipeline-chat-resizer { color: #879887; background: transparent; box-shadow: none; }
html[data-theme="dark"] .pipeline-chat-resizer span { border-color: #505950; background: #282d28; }
html[data-theme="dark"] .pipeline-chat-resizer:hover, html[data-theme="dark"] .pipeline-chat-resizer:focus-visible { color: #a8c3a5; background: transparent; box-shadow: none; }
html[data-theme="dark"] .pipeline-chat-resizer:hover span, html[data-theme="dark"] .pipeline-chat-resizer:focus-visible span, html[data-theme="dark"] .pipeline-main.is-chat-resizing .pipeline-chat-resizer span { border-color: #6d856c; background: #303a31; }
html[data-theme="dark"] .pipeline-chat-resizer:active, html[data-theme="dark"] .pipeline-main.is-chat-resizing .pipeline-chat-resizer { color: #bdd6ba; background: transparent; }
html[data-theme="dark"] body #user-app .user-chat-messages { background: #191919; scrollbar-color: #4a4a4a transparent; }
html[data-theme="dark"] .pipeline-chat-welcome { border: 1px solid #3c3c3c; border-radius: 12px; padding: 15px; background: #252526; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
html[data-theme="dark"] .pipeline-chat-welcome > p { color: var(--theme-muted); }
html[data-theme="dark"] .pipeline-chat-welcome > p strong { color: var(--theme-text); }
html[data-theme="dark"] .user-suggestions button { border-color: #3c3c3c; color: #cacaca; background: #2d2d30; }
html[data-theme="dark"] .user-suggestions button::after { color: #75a774; }
html[data-theme="dark"] .user-suggestions button:hover { border-color: #4d684d; color: #f0f0f0; background: #333333; }
html[data-theme="dark"] .user-message.is-user .message-bubble { max-width: 86%; }
html[data-theme="dark"] .user-chat-composer { margin: 0 12px 12px; border-color: #454545; background: #252526; box-shadow: 0 -8px 24px rgba(5, 9, 13, .16), 0 5px 18px rgba(0, 0, 0, .2); }
html[data-theme="dark"] .user-chat-composer:focus-within { border-color: #75a774; box-shadow: 0 0 0 3px rgba(137,209,133,.12), 0 -8px 24px rgba(5,9,13,.16); }
html[data-theme="dark"] .user-chat-composer textarea { color: #e6e6e6; background: transparent; }
html[data-theme="dark"] .user-chat-composer textarea::placeholder { color: #9e9e9e; }
html[data-theme="dark"] .message-content { color: var(--theme-text); }
html[data-theme="dark"] :is(.message-content h2, .message-content h3, .message-content strong) { color: var(--theme-text); }
html[data-theme="dark"] .message-content code { color: #e6e6e6; background: #333333; }
html[data-theme="dark"] .message-content pre { border-color: var(--theme-border); color: #e6e6e6; background: #1e1e1e; }
html[data-theme="dark"] .message-content blockquote { border-color: var(--theme-border); color: var(--theme-muted); }
html[data-theme="dark"] .message-content a { color: var(--theme-blue); text-decoration-color: rgba(137, 209, 133, .5); }
html[data-theme="dark"] .user-message.is-user .message-content { border-color: #4c604c; color: #f0f0f0; background: #2b342c; box-shadow: 0 4px 13px rgba(0,0,0,.1); }
html[data-theme="dark"] .user-message.is-streaming:not(.has-build-progress) .message-content:empty::after { color: var(--theme-muted); }
html[data-theme="dark"] .pipeline-build-progress { margin-top: 12px; border: 1px solid #3c3c3c; border-radius: 9px; padding: 10px 11px 7px; background: #1e1e1e; }
html[data-theme="dark"] .pipeline-build-progress > strong { color: var(--theme-text); }
html[data-theme="dark"] .pipeline-tool-activity { color: var(--theme-muted); }
html[data-theme="dark"] .pipeline-tool-activity + .pipeline-tool-activity { border-color: var(--theme-border-soft); }
html[data-theme="dark"] .pipeline-tool-activity i { border-color: var(--theme-border); border-top-color: var(--theme-muted); }
html[data-theme="dark"] .pipeline-tool-activity.is-complete i { color: #89d185; }
html[data-theme="dark"] .model-picker-button { border-color: #454545; color: #cacaca; background: #2d2d30; }
html[data-theme="dark"] .model-picker-button:hover { border-color: #565656; color: var(--theme-text); background: #333333; }
html[data-theme="dark"] .user-composer-footer button[type="submit"] { color: #f0f0f0; background: #4f6547; box-shadow: 0 3px 9px rgba(0,0,0,.28); }
html[data-theme="dark"] .user-composer-footer button[type="submit"]:hover { background: #607956; box-shadow: 0 5px 12px rgba(0,0,0,.34); }
html[data-theme="dark"] .source-confirmation-card { border-color: var(--theme-border); background: var(--theme-surface); }
html[data-theme="dark"] .source-confirmation-heading strong { color: var(--theme-text); }
html[data-theme="dark"] .source-confirmation-heading span { color: var(--theme-muted); }
html[data-theme="dark"] .source-confirmation-urls { border-color: var(--theme-border); background: var(--theme-bg-soft); }
html[data-theme="dark"] .source-confirmation-urls > div + div { border-color: var(--theme-border-soft); }
html[data-theme="dark"] .source-confirmation-urls strong { color: var(--theme-text); }
html[data-theme="dark"] .source-confirmation-urls code { color: var(--theme-muted); }
html[data-theme="dark"] .source-confirmation-open { border-color: var(--theme-border); color: var(--theme-text); background: var(--theme-surface-raised); }
html[data-theme="dark"] .source-confirmation-open:hover { background: var(--theme-surface); }
html[data-theme="dark"] .source-confirmation-actions button { border-color: var(--theme-border); color: var(--theme-text); background: var(--theme-surface-raised); }
html[data-theme="dark"] .source-confirmation-actions button:last-child { border-color: #4f6547; color: #f0f0f0; background: #4f6547; }
html[data-theme="dark"] .source-confirmation-actions button:last-child:hover:not(:disabled) { background: #465e49; }

@media (max-width: 840px) {
  html[data-theme="dark"] .user-message.is-user .message-bubble { max-width: 92%; }
  html[data-theme="dark"] .user-chat-composer { margin: 0 12px 12px; }
}

/* Source Library, source details, versions, and health checks */
html[data-theme="dark"] .connections-view { background: #1e1e1e; }
html[data-theme="dark"] .connections-view-header { border-color: #3c3c3c; background: #252526; }
html[data-theme="dark"] .connections-heading p { color: #b0b0b0; }
html[data-theme="dark"] .connections-heading h2 { color: #f0f0f0; }
html[data-theme="dark"] .catalog-filter-button { color: #8a8a8a; }
html[data-theme="dark"] .catalog-filter-button:hover, html[data-theme="dark"] .catalog-filter-button:focus-visible, html[data-theme="dark"] .catalog-filter-button[aria-expanded="true"], html[data-theme="dark"] .catalog-filter-button.is-filtered { color: #fff; }
html[data-theme="dark"] .catalog-filter-button.is-filtered::after { background: #89d185; }
html[data-theme="dark"] .catalog-filter-panel { border-color: var(--theme-border); background: #202020; }
html[data-theme="dark"] .catalog-filter-field > span { color: #9a9a9a; }
html[data-theme="dark"] .catalog-filter-field :is(input, select) { border-color: #465149; color: #e4e4e4; background: #2d2d30; }
html[data-theme="dark"] .catalog-filter-field :is(input, select):focus { border-color: #789276; box-shadow: 0 0 0 3px rgba(137,209,133,.1); }
html[data-theme="dark"] .catalog-filter-field input::placeholder { color: #8a8a8a; }
html[data-theme="dark"] .catalog-filter-clear { border-color: #505050; color: #d0d0d0; background: #2d2d30; }
html[data-theme="dark"] .catalog-filter-save { border-color: #557255; color: #fff; background: #557255; }
html[data-theme="dark"] .catalog-chip { color: #8a8a8a; }
html[data-theme="dark"] .catalog-chip:hover, html[data-theme="dark"] .catalog-chip:focus-visible, html[data-theme="dark"] .catalog-chip[aria-pressed="true"] { color: #fff; }
html[data-theme="dark"] .catalog-search > svg { stroke: #8a8a8a; }
html[data-theme="dark"] .catalog-search input { border-color: #465149; color: #e4e4e4; background: rgba(137,209,133,.05); }
html[data-theme="dark"] .catalog-search input::placeholder { color: #8a8a8a; }
html[data-theme="dark"] .catalog-search input:focus { border-color: #789276; box-shadow: 0 0 0 3px rgba(137,209,133,.1); }
html[data-theme="dark"] .connection-stat-icon { color: #89d185; background: #29372f; }
html[data-theme="dark"] .connections-stats > span { border-color: #454545; color: #b0b0b0; }
html[data-theme="dark"] .connections-stats strong { color: #e6e6e6; }
html[data-theme="dark"] .source-catalog-note { color: #b0b0b0; }
html[data-theme="dark"] .connections-table { border-color: #3c3c3c; background: #252526; box-shadow: 0 8px 24px rgba(0,0,0,.1); }
html[data-theme="dark"] .connections-table-head { border-color: #3c3c3c; color: #b0b0b0; background: #1e1e1e; }
html[data-theme="dark"] .connection-row { border-color: #3c3c3c; color: #dedede; background: #252526; }
html[data-theme="dark"] .connection-row:hover,
html[data-theme="dark"] .connection-row.is-selected { color: #f0f0f0; background: #2d2d30; }
html[data-theme="dark"] .connection-identity strong { color: #e6e6e6; }
html[data-theme="dark"] .connection-identity small { color: #b0b0b0; }
html[data-theme="dark"] .source-owner-label.user-generated { color: #cacaca; background: #333333; }
html[data-theme="dark"] .source-owner-label.pipechat-maintained { color: #89d185; background: #29372f; }
html[data-theme="dark"] .website-favicon.blue { color: #89d185; background: #29372f; }
html[data-theme="dark"] .website-favicon.violet { color: #c586c0; background: #352f38; }
html[data-theme="dark"] .website-favicon.green { color: #89d185; background: #29372f; }
html[data-theme="dark"] .connection-health { color: #89d185; }
html[data-theme="dark"] .source-link-state { color: #b0b0b0; }
html[data-theme="dark"] .source-link-state.is-linked { color: #89d185; }
html[data-theme="dark"] .row-menu { color: #89d185; }

html[data-theme="dark"] .source-detail-view { color: var(--theme-text); background: #1e1e1e; }
html[data-theme="dark"] .source-detail-header,
html[data-theme="dark"] .source-detail-tabs { border-color: #3c3c3c; background: #252526; }
html[data-theme="dark"] .back-to-pipeline { border-color: #454545; color: #cacaca; background: #2d2d30; }
html[data-theme="dark"] .back-to-pipeline:hover { border-color: #4d684d; color: #89d185; background: #2d2d30; }
html[data-theme="dark"] .user-app .source-detail-tabs button { color: #b8b8b8; background: transparent; }
html[data-theme="dark"] .user-app .source-detail-tabs button:hover { color: #e6e6e6; }
html[data-theme="dark"] .user-app .source-detail-tabs button.is-active { color: #89d185; background: transparent; }
html[data-theme="dark"] .source-identity-card,
html[data-theme="dark"] .source-detail-stats,
html[data-theme="dark"] .source-info-panel,
html[data-theme="dark"] .source-fields-panel,
html[data-theme="dark"] .health-summary-strip,
html[data-theme="dark"] .health-detail-view,
html[data-theme="dark"] .sample-data-panel,
html[data-theme="dark"] .validation-results,
html[data-theme="dark"] .code-folder-view,
html[data-theme="dark"] .maintained-access-card { border-color: #3c3c3c; background: #252526; }
html[data-theme="dark"] .source-identity-card a { color: #89d185; }
html[data-theme="dark"] .source-identity-card p { color: #b8b8b8; }
html[data-theme="dark"] .detail-health,
html[data-theme="dark"] .sync-success,
html[data-theme="dark"] .version-current { color: #89d185; background: #26352b; }
html[data-theme="dark"] .source-detail-stats article + article,
html[data-theme="dark"] .source-info-panel > header,
html[data-theme="dark"] .source-fields-panel > header,
html[data-theme="dark"] .source-info-panel dl > div,
html[data-theme="dark"] .sync-result > div + div,
html[data-theme="dark"] .health-summary-strip > span + span,
html[data-theme="dark"] .sample-data-panel > header,
html[data-theme="dark"] .validation-results > header { border-color: #3c3c3c; }
html[data-theme="dark"] .source-detail-stats span,
html[data-theme="dark"] .source-info-panel dt,
html[data-theme="dark"] .sync-result span,
html[data-theme="dark"] .source-fields-panel > header > span { color: #b0b0b0; }
html[data-theme="dark"] .source-detail-stats strong,
html[data-theme="dark"] .source-info-panel dd,
html[data-theme="dark"] .sync-result strong { color: #e6e6e6; }
html[data-theme="dark"] .sync-progress { background: #3c3c3c; }
html[data-theme="dark"] .sync-note { color: #9aab9f; }
html[data-theme="dark"] .source-field-list span { border-color: #454545; color: #d8d8d8; background: #2d2d30; }

html[data-theme="dark"] .source-workspace-tab { background: #1e1e1e; }
html[data-theme="dark"] .tab-page-heading { border-color: #3c3c3c; }
html[data-theme="dark"] .tab-page-heading p,
html[data-theme="dark"] .tab-page-heading span { color: #b0b0b0; }
html[data-theme="dark"] .version-list > button,
html[data-theme="dark"] .health-check-list > button { border-color: #3c3c3c; color: #dedede; background: #252526; }
html[data-theme="dark"] .version-list > button:hover,
html[data-theme="dark"] .health-check-list > button:hover { border-color: #4d684d; color: #f0f0f0; background: #2d2d30; }
html[data-theme="dark"] .version-badge { color: #89d185; background: #29372f; }
html[data-theme="dark"] .version-summary,
html[data-theme="dark"] .version-list small,
html[data-theme="dark"] .health-check-list small,
html[data-theme="dark"] .health-version,
html[data-theme="dark"] .health-duration { color: #b0b0b0; }
html[data-theme="dark"] .maintained-lock { color: #89d185; background: #29372f; }
html[data-theme="dark"] .maintained-access-copy p,
html[data-theme="dark"] .maintained-counts span { color: #b0b0b0; }
html[data-theme="dark"] .maintained-counts span { border-color: #454545; }
html[data-theme="dark"] .health-check-icon { color: #89d185; background: #29372f; }
html[data-theme="dark"] .health-check-icon.is-warning { color: #e2bd7f; background: #41341f; }
html[data-theme="dark"] .health-version b { color: #89d185; background: #29372f; }
html[data-theme="dark"] .health-detail-content { background: #1e1e1e; }
html[data-theme="dark"] .nested-view-heading,
html[data-theme="dark"] .source-code-viewer > header { border-color: #3c3c3c; color: #d8d8d8; background: #252526; }
html[data-theme="dark"] .nested-view-heading > button { border-color: #454545; color: #d0d0d0; background: #2d2d30; }
html[data-theme="dark"] .source-code-tree { border-color: #3c3c3c; background: #1e1e1e; }
html[data-theme="dark"] .code-tree-root { color: #e0e0e0; }
html[data-theme="dark"] .code-tree-folder,
html[data-theme="dark"] .source-code-tree > button { color: #b8b8b8; }
html[data-theme="dark"] .source-code-tree > button:hover,
html[data-theme="dark"] .source-code-tree > button.is-active { color: #a6d6a0; background: #333333; }
html[data-theme="dark"] .source-code-viewer > header > div span { color: #89d185; background: #29372f; }
html[data-theme="dark"] .sample-data-panel th { color: #b0b0b0; background: #1e1e1e; }
html[data-theme="dark"] .sample-data-panel td { border-color: #3c3c3c; color: #e0e0e0; }
html[data-theme="dark"] .validation-results > div span { color: #d0d0d0; }

@media (max-width: 620px) {
  html[data-theme="dark"] .connections-table { border: 0; background: transparent; box-shadow: none; }
  html[data-theme="dark"] .connection-row { border-color: #3c3c3c; background: #252526; box-shadow: 0 5px 16px rgba(0,0,0,.08); }
}

html[data-theme="dark"] :is(.pipeline-code-tree, .source-code-tree, .pipeline-block-source-file-layout nav, .code-folder-shell > aside) { background: #1e1e1e; }
html[data-theme="dark"] :is(.pipeline-code-viewer, .source-code-viewer, .pipeline-block-source-file-layout > section, .code-folder-shell > section) { background: var(--theme-surface); }
html[data-theme="dark"] :is(.pipeline-code-viewer pre, .source-code-viewer pre, .pipeline-block-source-file-layout pre, .block-snapshot-json, #run-block-data-json) { color: #e6e6e6; background: #1e1e1e; }
html[data-theme="dark"] :is(.block-snapshot-table-wrap, .sample-table-wrap) { background: var(--theme-surface); }
html[data-theme="dark"] .block-snapshot-table-wrap :is(th, tr > :first-child) { color: var(--theme-muted); background: var(--theme-bg-soft); }

html[data-theme="dark"] .run-inspection-navigation button { color: #d8d8d8; background: #333333; }
html[data-theme="dark"] .run-inspection-navigation > strong { color: #888888; }
html[data-theme="dark"] .run-inspection-navigation .run-status.succeeded { color: #a7e3bd; background: #193b2a; box-shadow: inset 0 0 0 1px #28583e; }
html[data-theme="dark"] .run-inspection-navigation .run-status.succeeded i { background: #55c987; }
html[data-theme="dark"] .node-run-output.is-succeeded { border-color: #4c604c; color: #f0f0f0; background: #2b342c; opacity: 1; }
html[data-theme="dark"] .node-run-output.is-succeeded:hover { border-color: #607860; color: #fff; background: #343f35; }
html[data-theme="dark"] .node-run-summary { background: rgba(37, 37, 38, .98); }
html[data-theme="dark"] .node-run-summary > code,
html[data-theme="dark"] .node-run-summary.is-running > code { color: #f0b47c; background: #2b2119; }
html[data-theme="dark"] .node-run-summary.is-succeeded > code { color: #f0f0f0; background: #2b342c; opacity: 1; }
html[data-theme="dark"] .node-run-summary.is-failed > code { color: #fff; background: #963d38; }
html[data-theme="dark"] .run-output-dialog { border-color: var(--theme-border); color: var(--theme-text); background: var(--theme-surface); }
html[data-theme="dark"] .run-output-dialog > header,
html[data-theme="dark"] .run-output-dialog-meta { border-color: var(--theme-border); background: var(--theme-bg-soft); }
html[data-theme="dark"] .run-output-dialog-meta strong { color: var(--theme-text); }
html[data-theme="dark"] .run-output-dialog > header > button { color: #d8d8d8; background: #333333; }
html[data-theme="dark"] .run-output-dialog-format { border-color: var(--theme-border); background: var(--theme-surface-raised); }
html[data-theme="dark"] .run-output-dialog-format button { color: var(--theme-muted); }
html[data-theme="dark"] .run-output-dialog-format button.is-active { color: var(--theme-text); background: #3a3a3d; box-shadow: none; }
html[data-theme="dark"] .run-output-dialog pre { color: #e6e6e6; background: #1e1e1e; }
html[data-theme="dark"] .run-output-dialog .block-snapshot-table-wrap th,
html[data-theme="dark"] .run-output-dialog .block-snapshot-table-wrap td { border-color: #343436; }
html[data-theme="dark"] .run-output-dialog .block-snapshot-table-wrap td > span { color: #f5f5f5; }
html[data-theme="dark"] .run-output-dialog .block-snapshot-table-wrap th { color: #d8d8d8; }
html[data-theme="dark"] .run-output-dialog .block-snapshot-table-wrap tr > :first-child { color: #a8a8a8; }

html[data-theme="dark"] .appearance-settings-panel { margin-top: 14px; }
.theme-toggle {
  display: inline-flex;
  min-width: 84px !important;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  border: 0 !important;
  padding: 0 !important;
  background: transparent !important;
}
.theme-toggle-track { position: relative; width: 34px; height: 19px; flex: 0 0 34px; border-radius: 999px; background: #c8ced5; transition: background .18s ease; }
.theme-toggle-track i { position: absolute; top: 3px; left: 3px; width: 13px; height: 13px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(25, 32, 40, .25); transition: transform .18s ease; }
.theme-toggle[aria-checked="true"] .theme-toggle-track { background: #4f6547; }
.theme-toggle[aria-checked="true"] .theme-toggle-track i { transform: translateX(15px); }
.theme-setting-value { min-width: 18px; color: #6c7580; font-size: .54rem; font-weight: 750; }
html[data-theme="dark"] .theme-toggle-track { background: #565656; }
html[data-theme="dark"] .theme-setting-value { color: var(--theme-muted); }

html[data-theme="dark"] :is(.block-picker-dialog, .vault-dialog, .create-pipeline-dialog, .pipeline-codex-dialog, .folder-orchestration-dialog, .storage-dialog) { border-color: var(--theme-border); color: var(--theme-text); background: var(--theme-surface); }
html[data-theme="dark"] :is(.block-picker-dialog, .vault-dialog, .create-pipeline-dialog, .pipeline-codex-dialog, .folder-orchestration-dialog, .storage-dialog) :is(header, footer) { border-color: var(--theme-border); background: var(--theme-bg-soft); }
html[data-theme="dark"] :is(.block-picker-dialog, .vault-dialog, .create-pipeline-dialog, .pipeline-codex-dialog, .folder-orchestration-dialog, .storage-dialog) :is(input, textarea, select) { border-color: var(--theme-border); color: var(--theme-text); background: #1e1e1e; color-scheme: dark; }
html[data-theme="dark"] .create-pipeline-type-picker legend,
html[data-theme="dark"] .create-pipeline-type-picker b { color: var(--theme-text); }
html[data-theme="dark"] .create-pipeline-type-picker small { color: var(--theme-muted); }
html[data-theme="dark"] .create-pipeline-type-picker label > span { border-color: var(--theme-border); background: var(--theme-bg-soft); }
html[data-theme="dark"] .create-pipeline-type-picker input:checked + span { border-color: #4c7398; background: #263646; box-shadow: none; }
html[data-theme="dark"] .create-pipeline-type-picker label:last-child input:checked + span { border-color: #805f37; background: #443421; box-shadow: none; }
html[data-theme="dark"] .create-pipeline-dialog form > .create-pipeline-note { border-left-color: #a87338; color: #d8b17f; background: #30271d; }
html[data-theme="dark"] .storage-dialog > header > div > span { color: #a6d6a0; background: #34483a; }
html[data-theme="dark"] .storage-dialog h2,
html[data-theme="dark"] :is(.storage-type-picker > div:first-child strong, .storage-type-picker label b, .storage-field-grid label, .storage-estimate-panel h3) { color: var(--theme-text); }
html[data-theme="dark"] :is(.storage-dialog header p, .storage-type-picker > div:first-child span, .storage-type-picker label small, .storage-field-grid label small, .storage-estimate-panel > p) { color: var(--theme-muted); }
html[data-theme="dark"] .storage-type-picker label > span { border-color: var(--theme-border); background: var(--theme-bg-soft); }
html[data-theme="dark"] .storage-type-picker input:checked + span { border-color: #668166; background: #29372f; box-shadow: 0 0 0 2px rgba(137,209,133,.06); }
html[data-theme="dark"] .storage-type-picker label i { color: #a6d6a0; background: #34483a; }
html[data-theme="dark"] .storage-config-layout { border-color: var(--theme-border); }
html[data-theme="dark"] .storage-field-grid select { background-color: #1e1e1e; background-image: linear-gradient(45deg, transparent 50%, #a3aaa5 50%), linear-gradient(135deg, #a3aaa5 50%, transparent 50%); background-position: calc(100% - 14px) 16px, calc(100% - 10px) 16px; background-repeat: no-repeat; background-size: 4px 4px, 4px 4px; }
html[data-theme="dark"] .storage-field-grid input[readonly] { color: var(--theme-muted); background: var(--theme-bg-soft); }
html[data-theme="dark"] .storage-estimate-panel { border-color: var(--theme-border); background: #202420; }
html[data-theme="dark"] .storage-draft-badge { color: #e1c77f; background: #403923; }
html[data-theme="dark"] .storage-estimate-panel dl,
html[data-theme="dark"] .storage-estimate-panel dl > div { border-color: var(--theme-border-soft); }
html[data-theme="dark"] .storage-estimate-panel dt { color: var(--theme-muted); }
html[data-theme="dark"] .storage-estimate-panel dd { color: var(--theme-text); }
html[data-theme="dark"] .storage-estimate-total { border-color: #4d684d; background: #29372f; }
html[data-theme="dark"] .storage-estimate-total span,
html[data-theme="dark"] .storage-estimate-total small { color: #a7bea9; }
html[data-theme="dark"] .storage-estimate-total strong { color: #c8e7c4; }
html[data-theme="dark"] .storage-connection-note b { color: #e1c77f; }
html[data-theme="dark"] .storage-dialog form > footer button { border-color: var(--theme-border); color: var(--theme-muted); background: var(--theme-surface-raised); }
html[data-theme="dark"] .storage-dialog form > footer button[type="submit"] { border-color: #668166; color: #fff; background: #3f5948; }
html[data-theme="dark"] .folder-chain-preview { color: var(--theme-muted); background: #29372f; }
html[data-theme="dark"] .folder-chain-preview strong { color: var(--theme-text); }
html[data-theme="dark"] .folder-chain-preview i { color: #a6d6a0; background: #34483a; }
html[data-theme="dark"] .folder-schedule-existing { border-color: var(--theme-border); }
html[data-theme="dark"] #folder-schedule-list article { border-color: var(--theme-border-soft); }
html[data-theme="dark"] #folder-schedule-list button { border-color: var(--theme-border); color: var(--theme-muted); background: var(--theme-surface-raised); }
html[data-theme="dark"] .block-picker-grid > button { border-color: var(--theme-border); color: var(--theme-text); background: var(--theme-surface-raised); }

/* Admin route: runner, sources, Pi editor, and dialogs. */
html[data-theme="dark"] .app-bar { border-color: var(--theme-border); background: rgba(37, 37, 38, .96); box-shadow: 0 1px 8px rgba(0, 0, 0, .2); }
html[data-theme="dark"] :is(.brand, .tab:hover, .tab.is-active) { color: var(--theme-text); }
html[data-theme="dark"] .tab:hover { background: var(--theme-surface); }
html[data-theme="dark"] .local-pill { border-color: var(--theme-border); color: var(--theme-muted); background: var(--theme-surface); }
html[data-theme="dark"] :is(.runner-view, .sources-view) { color: var(--theme-text); background: radial-gradient(circle at 10% 0%, rgba(197, 134, 192, .08), transparent 34rem), var(--theme-bg); }
html[data-theme="dark"] :is(.intro, .source-card p, .source-detail-description, .source-back) { color: var(--theme-muted); }
html[data-theme="dark"] :is(.panel, .result-panel, .source-card, .source-detail-card) { border-color: var(--theme-border); color: var(--theme-text); background: var(--theme-surface); box-shadow: 0 14px 42px rgba(0, 0, 0, .2); }
html[data-theme="dark"] :is(.panel input, .panel select, .source-build-controls select, .source-rule-test-form input, .source-rule-test-form select) { border-color: var(--theme-border); color: var(--theme-text); background: #1e1e1e; }
html[data-theme="dark"] :is(.source-build-panel, .source-rule-test-panel) { border-color: var(--theme-border); background: var(--theme-bg-soft); }
html[data-theme="dark"] .source-file-tree { border-color: var(--theme-border); background: var(--theme-surface); }

html[data-theme="dark"] .pi-view { color: var(--theme-text); background: var(--theme-bg); --line: var(--theme-border); }
html[data-theme="dark"] :is(.ide-toolbar, .files-pane, .editor-tabs, .editor-statusbar, .chat-pane, .chat-heading) { background: var(--theme-bg-soft); }
html[data-theme="dark"] :is(.editor-pane, .code-editor-wrap, .active-file-tab, #code-editor) { color: var(--theme-text); background: var(--theme-surface); }
html[data-theme="dark"] .line-numbers { color: #9e9e9e; background: #1e1e1e; }
html[data-theme="dark"] :is(.model-select, .save-button, .suggestions button, .chat-message.user .message-body, .chat-composer) { border-color: var(--theme-border); color: var(--theme-text); background: var(--theme-surface-raised); }
html[data-theme="dark"] :is(.tree-summary, .tree-file, .message-body, .welcome-message h2) { color: #dedede; }
html[data-theme="dark"] :is(.tree-summary:hover, .tree-file:hover, .icon-button:hover) { color: var(--theme-text); background: var(--theme-surface-raised); }
html[data-theme="dark"] .tree-file.is-active { color: #c586c0; background: #352f38; }
html[data-theme="dark"] .tool-activity { border-color: var(--theme-border); color: var(--theme-muted); background: #252526; }
html[data-theme="dark"] .tool-activity strong { color: var(--theme-text); }
html[data-theme="dark"] #chat-input { color: var(--theme-text); }
html[data-theme="dark"] :is(.auth-dialog, .workspace-dialog) { border-color: var(--theme-border); color: var(--theme-text); background: var(--theme-surface); }
html[data-theme="dark"] :is(.dialog-heading, .dialog-security) { border-color: var(--theme-border); background: var(--theme-bg-soft); }
html[data-theme="dark"] :is(.provider-row, .auth-prompt input, .auth-prompt select, .workspace-dialog-content input) { border-color: var(--theme-border); color: var(--theme-text); background: #1e1e1e; }

/* VS Code-inspired neutral finish. Keep controls and state accents out of the blue family. */
html[data-theme="dark"] {
  --theme-bg: #1e1e1e;
  --theme-bg-soft: #252526;
  --theme-surface: #252526;
  --theme-surface-raised: #2d2d30;
  --theme-border: #3c3c3c;
  --theme-border-soft: #333333;
  --theme-text: #e6e6e6;
  --theme-muted: #b0b0b0;
  --theme-blue: #89d185;
  --theme-green: #89d185;
  --pipeline-blue: #89d185;
}

html[data-theme="dark"] ::selection { color: #1e1e1e; background: #89d185; }
html[data-theme="dark"] :focus-visible { outline-color: #89d185; }

html[data-theme="dark"] :is(.rail-brand, .pipelines-list-heading p, .scheduling-heading p, .settings-heading p, .section-kicker, .hero-kicker) { color: #89d185; }
html[data-theme="dark"] :is(.rail-brand:hover, .workspace-nav button:hover, .canvas-tools button:hover) { color: #e6e6e6; background: #2d2d30; }
html[data-theme="dark"] .workspace-nav button.is-active,
html[data-theme="dark"] .workspace-nav button.is-active:hover { color: #fff; background: transparent; box-shadow: none; }
html[data-theme="dark"] .workspace-nav button:focus-visible { outline-color: #666666; }

html[data-theme="dark"] :is(
  .run-pipeline-button,
  .add-connection-button,
  .key-vault-heading > button,
  .compute-heading > button,
  .tab-page-heading > button,
  .pipeline-codex-content a,
  .pipeline-codex-content button,
  .vault-dialog-actions button:last-child,
  .create-pipeline-dialog form > div button:last-child
) { border-color: #4d684d; color: #e7f3e4; background: #3f5948; box-shadow: none; }
html[data-theme="dark"] :is(
  .run-pipeline-button,
  .add-connection-button,
  .key-vault-heading > button,
  .compute-heading > button,
  .tab-page-heading > button,
  .pipeline-codex-content a,
  .pipeline-codex-content button,
  .vault-dialog-actions button:last-child,
  .create-pipeline-dialog form > div button:last-child
):hover { border-color: #668166; color: #f1faee; background: #4f6b50; }

html[data-theme="dark"] :is(.pipeline-node.is-selected, .connection-row.is-selected) { border-color: #5f7c5e; box-shadow: 0 0 0 2px rgba(137,209,133,.12); }
html[data-theme="dark"] .pipeline-tabs [role="tab"] { color: #b0b0b0; }
html[data-theme="dark"] .pipeline-tabs [role="tab"].is-active { color: #89d185; }
html[data-theme="dark"] :is(.add-block-top-button, .pipeline-summary-bar button) { color: #89d185; }
html[data-theme="dark"] .pipeline-state.is-running { border-color: #4d684d; color: #89d185; background: #29372f; }
html[data-theme="dark"] .connection-help-toast { border-color: #4d684d; color: #a6d6a0; background: rgba(41,55,47,.97); box-shadow: 0 4px 12px rgba(0,0,0,.2); }
html[data-theme="dark"] :is(.node-port:hover, .node-port:focus-visible, .node-port.is-connecting) { background: #89d185; box-shadow: 0 0 0 2px rgba(137,209,133,.24); }
html[data-theme="dark"] :is(.external-icon, .source-icon, .compute-environment-icon, .vault-shield, .connection-stat-icon, .maintained-lock) { color: #89d185; background: #29372f; }
html[data-theme="dark"] :is(.enrichment-icon, .version-badge) { color: #c586c0; background: #352f38; }
html[data-theme="dark"] :is(.output-icon, .health-check-icon) { color: #89d185; background: #29372f; }
html[data-theme="dark"] :is(.website-favicon.blue, .website-favicon.violet, .website-favicon.green) { color: #89d185; background: #29372f; }

html[data-theme="dark"] :is(.pipeline-breadcrumbs button:hover, .pipeline-node footer > button, .source-identity-card a, .source-info-panel header button, .source-code-viewer > header button, .sample-data-panel header button) { color: #89d185; }
html[data-theme="dark"] :is(.pipeline-node footer > button:hover, .node-menu:hover, .node-menu[aria-expanded="true"]) { color: #a6d6a0; background: #29372f; }

html[data-theme="dark"] .theme-toggle[aria-checked="true"] .theme-toggle-track { background: #6a9955; }
html[data-theme="dark"] .user-composer-footer button[type="submit"] { color: #f1f1f1; background: #4f6547; box-shadow: none; }
html[data-theme="dark"] .user-composer-footer button[type="submit"]:hover { background: #607956; box-shadow: none; }
html[data-theme="dark"] .user-chat-composer:focus-within { border-color: #587256; box-shadow: 0 0 0 2px rgba(137,209,133,.12); }
html[data-theme="dark"] .user-message.is-user .message-content { border-color: #4c604c; color: #f0f0f0; background: #2b342c; }

html[data-theme="dark"] .pipeline-canvas { background-color: #1e1e1e; background-image: radial-gradient(#454545 .75px, transparent .75px); }
html[data-theme="dark"] .pipeline-edges path { stroke: #666666; }
html[data-theme="dark"] .pipeline-edges .connection-preview { stroke: #89d185; }

html[data-theme="dark"] :is(.source-owner-label.pipechat-maintained, .health-version b, .source-code-viewer > header > div span) { color: #89d185; background: #29372f; }
html[data-theme="dark"] .row-menu { color: #89d185; }
html[data-theme="dark"] .user-app .source-detail-tabs button.is-active { color: #89d185; }

html[data-theme="dark"] .app-bar { background: rgba(37,37,38,.97); }
html[data-theme="dark"] :is(.runner-view, .sources-view) { background: radial-gradient(circle at 10% 0%, rgba(197,134,192,.06), transparent 34rem), #1e1e1e; }
html[data-theme="dark"] :is(.primary, .source-rule-test-form button) { color: #e7f3e4; background: #3f5948; }
html[data-theme="dark"] :is(.primary, .source-rule-test-form button):hover:not(:disabled) { background: #4f6b50; }
html[data-theme="dark"] :is(.secondary, .source-url, .source-detail-website a, .source-back, .auth-link) { color: #89d185; }
html[data-theme="dark"] .secondary { background: #29372f; }
html[data-theme="dark"] .tab.is-active::after { background: #c586c0; }

/* Code Files chrome: tabs, explorer states, toolbars, and generated-source panels. */
html[data-theme="dark"] :is(.pipeline-code-files-view, .pipeline-code-shell) { color: #e6e6e6; background: #1e1e1e; }
html[data-theme="dark"] .pipeline-code-tree { border-color: #3c3c3c; background: #1e1e1e; }
html[data-theme="dark"] .pipeline-code-tree > header { border-color: #3c3c3c; color: #b0b0b0; }
html[data-theme="dark"] .pipeline-code-tree > header small { color: #9e9e9e; }
html[data-theme="dark"] .pipeline-code-root { color: #e6e6e6; }
html[data-theme="dark"] :is(.pipeline-code-folder, .pipeline-code-branch [data-pipeline-code-file]) { color: #c2c2c2; background: transparent; }
html[data-theme="dark"] :is(.pipeline-code-folder > span, .pipeline-code-branch [data-pipeline-code-file] > span) { color: #9e9e9e; }
html[data-theme="dark"] :is(.pipeline-code-folder:hover, .pipeline-code-branch [data-pipeline-code-file]:hover) { color: #e6e6e6; background: #2d2d30; }
html[data-theme="dark"] .pipeline-code-branch [data-pipeline-code-file].is-active { color: #e5e5e5; background: #29372f; box-shadow: inset 3px 0 #89d185; }
html[data-theme="dark"] .pipeline-code-branch [data-pipeline-code-file].is-active > span { color: #89d185; }

html[data-theme="dark"] .pipeline-code-viewer > header { --code-toolbar-bg: #252526; border-color: #3c3c3c; color: #cacaca; background: var(--code-toolbar-bg); }
html[data-theme="dark"] .pipeline-code-tabs { background: #252526; }
html[data-theme="dark"] .pipeline-code-tabs { scrollbar-color: #565656 transparent; }
html[data-theme="dark"] .pipeline-code-tabs::-webkit-scrollbar-thumb { background: #565656; }
html[data-theme="dark"] .pipeline-code-tab { border-color: #3c3c3c; color: #b0b0b0; background: #2d2d30; }
html[data-theme="dark"] .pipeline-code-tab.is-active { color: #e5e5e5; background: #1e1e1e; box-shadow: inset 0 2px #89d185; }
html[data-theme="dark"] .pipeline-code-tab > button:first-child { color: inherit; }
html[data-theme="dark"] .pipeline-code-tab > button:last-child { color: #b0b0b0; }
html[data-theme="dark"] .pipeline-code-tab > button:last-child:hover { color: #e6e6e6; background: #3c3c3c !important; }
html[data-theme="dark"] .pipeline-code-viewer > header .pipeline-code-actions button { border-color: #4a4a4a; color: #dedede; background: #2d2d30; }
html[data-theme="dark"] .pipeline-code-viewer > header .pipeline-code-actions button:hover { border-color: #5f7c5e; color: #f1f1f1; background: #333333; }

html[data-theme="dark"] .pipeline-block-source-files { border-color: #3c3c3c; background: #252526; }
html[data-theme="dark"] .pipeline-block-source-files > header { border-color: #3c3c3c; background: #252526; }
html[data-theme="dark"] .pipeline-block-source-files > header strong { color: #e6e6e6; }
html[data-theme="dark"] :is(.pipeline-block-source-files > header span, .pipeline-block-source-files > header small) { color: #b0b0b0; }
html[data-theme="dark"] .pipeline-block-source-file-layout nav { border-color: #3c3c3c; background: #1e1e1e; }
html[data-theme="dark"] .pipeline-block-source-file-layout nav button { color: #c2c2c2; background: transparent; }
html[data-theme="dark"] .pipeline-block-source-file-layout nav button:hover { color: #e6e6e6; background: #2d2d30; }
html[data-theme="dark"] .pipeline-block-source-file-layout nav .block-source-file-row.is-active { color: #e5e5e5; background: #29372f; box-shadow: inset 3px 0 #89d185; }
html[data-theme="dark"] .pipeline-block-source-file-layout > section > div { border-color: #3c3c3c; color: #cacaca; background: #252526; }

/* Shared syntax colors for every code-file viewer and the editable Pi workspace. */
.syntax-comment { color: #008000; font-style: italic; }
.syntax-string { color: #a31515; }
.syntax-keyword, .syntax-decorator { color: #af00db; }
.syntax-function { color: #795e26; }
.syntax-property, .syntax-constant { color: #001080; }
.syntax-type, .syntax-tag { color: #267f99; }
.syntax-number { color: #098658; }
.syntax-operator { color: #303030; }
.syntax-punctuation { color: #707070; }
.syntax-heading { color: #0451a5; font-weight: 700; }

html[data-theme="dark"] :is(.pipeline-code-viewer pre, .source-code-viewer pre, .pipeline-block-source-file-layout pre, .code-highlighter) { color: #e6e6e6; background: #1e1e1e; }
html[data-theme="dark"] .syntax-comment { color: #6a9955; }
html[data-theme="dark"] .syntax-string { color: #ce9178; }
html[data-theme="dark"] :is(.syntax-keyword, .syntax-decorator) { color: #c586c0; }
html[data-theme="dark"] .syntax-function { color: #dcdcaa; }
html[data-theme="dark"] .syntax-property { color: #9cdcfe; }
html[data-theme="dark"] :is(.syntax-type, .syntax-tag) { color: #4ec9b0; }
html[data-theme="dark"] .syntax-constant { color: #4fc1ff; }
html[data-theme="dark"] .syntax-number { color: #b5cea8; }
html[data-theme="dark"] .syntax-operator { color: #e6e6e6; }
html[data-theme="dark"] .syntax-punctuation { color: #808080; }
html[data-theme="dark"] .syntax-heading { color: #569cd6; }
html[data-theme="dark"] #code-editor { color: transparent; -webkit-text-fill-color: transparent; background: transparent; caret-color: #89d185; }
html[data-theme="dark"] #code-editor::selection { background: rgba(137,209,133,.24); }

/* Translucent code-change bubbles and the building pill need lighter ink on the dark surface;
   the tints stay semi-transparent so they read as bubbles rather than solid chips. */
html[data-theme="dark"] .block-code-changes .is-added { color: #89d185; border-color: rgba(137,209,133,.3); background: rgba(137,209,133,.16); }
html[data-theme="dark"] .block-code-changes .is-removed { color: #e08a7f; border-color: rgba(224,138,127,.3); background: rgba(224,138,127,.15); }
html[data-theme="dark"] .pipeline-building-indicator { color: #cfcfcf; border-color: rgba(207,207,207,.24); background: rgba(207,207,207,.1); }

html[data-theme="dark"] :is(#pipeline-folder-pipelines-panel #folder-schedule-form, #folder-chain-list, #pipeline-folder-pipelines-panel #folder-chain-list > article) { border-color: var(--theme-border); color: var(--theme-muted); background: var(--theme-surface); }
html[data-theme="dark"] :is( #pipeline-folder-pipelines-panel #folder-schedule-form > header strong, .folder-orchestration-step-builder > header strong, .folder-orchestration-flow-empty strong, #folder-chain-list > article > span:nth-child(2) strong) { color: var(--theme-text); }
html[data-theme="dark"] :is( #pipeline-folder-pipelines-panel #folder-schedule-form > header small, .folder-orchestration-step-builder > header small, .folder-orchestration-flow-empty, #folder-chain-list > article > span:nth-child(2) small) { color: var(--theme-muted); }
html[data-theme="dark"] :is(#pipeline-folder-pipelines-panel #folder-schedule-form > header, .folder-orchestration-step-builder > header, #pipeline-folder-pipelines-panel #folder-schedule-form > footer) { border-color: var(--theme-border); background: var(--theme-bg-soft); }
html[data-theme="dark"] :is(.folder-orchestration-flow-empty > i, #folder-chain-list > article > i) { color: #a6d6a0; background: #34483a; }
html[data-theme="dark"] .folder-orchestration-flow-empty { border-color: var(--theme-border); color: var(--theme-muted); background: #222a24; }
html[data-theme="dark"] #pipeline-folder-pipelines-panel #folder-schedule-form select { border-color: var(--theme-border); color: var(--theme-text); background-color: #1e1e1e; color-scheme: dark; }
html[data-theme="dark"] #add-folder-orchestration-step { border-color: #4d684d; color: #e1eee0; background: #34483a; }
html[data-theme="dark"] #folder-chain-list > article > b { color: #a6d6a0; background: #34483a; }
html[data-theme="dark"] #folder-chain-list > article > span:last-child button { border-color: var(--theme-border); color: var(--theme-muted); background: var(--theme-surface-raised); }
html[data-theme="dark"] #folder-chain-list > article > span:last-child button:last-child { color: #e08a7f; }

/* Keep the navigation rail on the same dark layer as open pipeline rows. */
html[data-theme="dark"] body #user-app > .pipeline-sidebar {
  border-right-color: #2f2f2f;
  background-color: #191919 !important;
  background-image: none;
}
/* The pipeline header and its tab row belong to the same rail layer. */
html[data-theme="dark"] body #user-app .pipeline-topbar,
html[data-theme="dark"] body #user-app .pipeline-tabs {
  background-color: #191919;
}
/* Run history sits on the same layers as the workspace lists. */
html[data-theme="dark"] body #user-app .run-history-view,
html[data-theme="dark"] body #user-app .run-history-row {
  background-color: #191919;
}
html[data-theme="dark"] body #user-app .run-history-row:is(:hover, :focus-visible) { background-color: #232323; }
html[data-theme="dark"] body #user-app .run-history-table-head { background-color: #202020; }
html[data-theme="dark"] body #user-app .pipelines-list-page .pipeline-catalog-panel,
html[data-theme="dark"] body #user-app .pipelines-list-page .pipeline-catalog-panel > header,
html[data-theme="dark"] body #user-app .pipelines-list-page .pipeline-folder-tabs {
  background-color: #191919;
}

/* Each MCP catalog row opens an individual storage-graph builder. */
html[data-theme="dark"] :is(.mcp-server-browser, #mcp-builder-workspace, .mcp-settings-view) {
  border-color: var(--theme-border);
  color: var(--theme-text);
  background: #191919;
}
html[data-theme="dark"] :is(.mcp-server-settings strong, .mcp-storage-node header strong, .mcp-server-node > div b, .mcp-canvas-empty strong) { color: var(--theme-text); }
html[data-theme="dark"] :is(.mcp-server-settings small, .mcp-storage-node header small, .mcp-server-node > div span, .mcp-server-node > footer) { color: var(--theme-muted); }
html[data-theme="dark"] :is(.mcp-server-settings input:not([type="checkbox"]), .mcp-server-settings select, .mcp-storage-node > footer select) {
  border-color: var(--theme-border);
  color: var(--theme-text);
  background: var(--theme-surface-raised);
  color-scheme: dark;
}
html[data-theme="dark"] .pipeline-browser-header-actions #mcp-add-connector { border-color: rgba(137,209,133,.32); color: #fff; background: rgba(73,145,79,.2); }
html[data-theme="dark"] .pipeline-browser-header-actions #mcp-add-connector:hover { border-color: rgba(137,209,133,.5); background: rgba(73,145,79,.4); }
html[data-theme="dark"] .mcp-connector-menu { border-color: #474747; background: #252526; box-shadow: 0 18px 44px rgba(0,0,0,.42); }
html[data-theme="dark"] .mcp-connector-menu button:hover { background: #2d2d30; }
html[data-theme="dark"] .mcp-connector-menu strong { color: var(--theme-text); }
html[data-theme="dark"] :is(.mcp-connector-menu small, .mcp-connector-menu p) { color: var(--theme-muted); }
html[data-theme="dark"] .mcp-connector-menu button[data-connect-external] { border-color: var(--theme-border); }
html[data-theme="dark"] .mcp-canvas-viewport,
html[data-theme="dark"] .mcp-chat-dock { border-color: var(--theme-border); background: #191919; }
html[data-theme="dark"] .mcp-canvas { background-color: #191919; background-image: radial-gradient(#454545 .75px, transparent .75px); }
html[data-theme="dark"] .mcp-server-brain { border-color: var(--theme-border); color: var(--theme-text); background: var(--theme-surface); }
html[data-theme="dark"] :is(.mcp-server-brain > header, .mcp-skill-editor) { border-color: var(--theme-border); background: var(--theme-bg-soft); }
html[data-theme="dark"] .mcp-server-brain strong { color: var(--theme-text); }
html[data-theme="dark"] :is(.mcp-server-brain small, .mcp-server-prompt, #mcp-skill-empty) { color: var(--theme-muted); }
html[data-theme="dark"] :is(.mcp-server-prompt textarea, .mcp-skill-row :is(input, textarea)) { border-color: var(--theme-border); color: var(--theme-text); background: var(--theme-surface-raised); }
html[data-theme="dark"] .mcp-skill-row { border-color: var(--theme-border); background: var(--theme-surface); }
html[data-theme="dark"] .mcp-skill-editor > header button { border-color: rgba(137,209,133,.32); color: #fff; background: rgba(73,145,79,.2); }
html[data-theme="dark"] :is(.mcp-server-settings, .mcp-storage-node, .mcp-server-node) {
  border-color: var(--theme-border);
  color: var(--theme-text);
  background: var(--theme-surface);
}
html[data-theme="dark"] :is(.mcp-server-settings > header, .mcp-server-settings > footer, .mcp-server-node > header) { border-color: var(--theme-border); background: var(--theme-bg-soft); }
html[data-theme="dark"] :is(.mcp-storage-node > header, .mcp-storage-node > footer, .mcp-server-node > footer) { border-color: var(--theme-border-soft); }
html[data-theme="dark"] .mcp-server-node { border-color: #8065a4; box-shadow: 0 0 0 3px rgba(128,101,164,.12); }
html[data-theme="dark"] .mcp-canvas-empty { border-color: var(--theme-border); color: var(--theme-muted); background: rgba(37,37,38,.82); }
html[data-theme="dark"] .mcp-catalog-transport { color: #fff; }
html[data-theme="dark"] .mcp-catalog-endpoint { color: var(--theme-muted); }
html[data-theme="dark"] .docs-mcp-visual > div { border-color: var(--theme-border); background: #252525; }

/* Orchestration keeps the pipeline builder's layers and contrast in dark mode. */
html[data-theme="dark"] :is(.orchestration-builder-view, .orchestration-builder-tabs) {
  border-color: var(--theme-border);
  color: var(--theme-text);
  background: #191919;
}
html[data-theme="dark"] .orchestration-builder-topbar {
  border-color: var(--theme-border);
  background: #191919;
}
html[data-theme="dark"] .orchestration-builder-title nav { color: var(--theme-muted); }
html[data-theme="dark"] .orchestration-builder-tabs button.is-active { color: #89d185; }
html[data-theme="dark"] .orchestration-builder-title nav button.is-back-link { color: #fff; }
html[data-theme="dark"] .orchestration-builder-title nav #orchestration-builder-breadcrumb-name { color: #b8b8b8; }
html[data-theme="dark"] .orchestration-builder-title nav strong { color: var(--theme-text); }
html[data-theme="dark"] .orchestration-schedule-dialog input:not([type="checkbox"]) {
  border-color: var(--theme-border);
  color: var(--theme-text);
  background: #1e1e1e;
  color-scheme: dark;
}
html[data-theme="dark"] .orchestration-builder-tabs button.is-active::after { background: #89d185; }
html[data-theme="dark"] .orchestration-canvas-viewport,
html[data-theme="dark"] .orchestration-chat-dock { border-color: var(--theme-border); }
html[data-theme="dark"] .orchestration-run-history-view { color: var(--theme-text); background: #191919; }
html[data-theme="dark"] .orchestration-run-history-table.pipeline-catalog-table { border-color: var(--theme-border); }
html[data-theme="dark"] .orchestration-run-history-table .pipeline-catalog-table-head { background: #202020; }
html[data-theme="dark"] .orchestration-run-history-row { border-color: var(--theme-border-soft); color: var(--theme-muted); background: #191919; }
html[data-theme="dark"] .orchestration-run-history-row .pipeline-catalog-name small { color: var(--theme-muted); }
html[data-theme="dark"] .orchestration-canvas-viewport { background: #1e1e1e; }
html[data-theme="dark"] .orchestration-chat-dock { color: var(--theme-text); background: #191919; }
html[data-theme="dark"] .orchestration-canvas {
  background-color: #1e1e1e;
  background-image: radial-gradient(#454545 .75px, transparent .75px);
}
html[data-theme="dark"] :is(.orchestration-schedule-dialog, .orchestration-pipeline-node) {
  border-color: var(--theme-border);
  color: var(--theme-text);
  background: var(--theme-surface);
}
html[data-theme="dark"] :is(.orchestration-schedule-dialog > header, .orchestration-schedule-dialog form > footer) {
  border-color: var(--theme-border);
  background: var(--theme-bg-soft);
}
html[data-theme="dark"] :is(.orchestration-schedule-dialog h2, .orchestration-schedule-dialog header p strong, .orchestration-pipeline-node header strong, .orchestration-canvas-empty strong) { color: var(--theme-text); }
html[data-theme="dark"] :is(.orchestration-schedule-dialog header p, .orchestration-schedule-dialog form label small, .orchestration-schedule-dialog form > footer, .orchestration-pipeline-node header small, .orchestration-pipeline-node > footer) { color: var(--theme-muted); }
html[data-theme="dark"] .orchestration-pipeline-node > header { border-color: var(--theme-border-soft); }
html[data-theme="dark"] .orchestration-pipeline-node.is-start { border-color: #9b6c39; box-shadow: 0 0 0 2px rgba(209,134,56,.12); }
html[data-theme="dark"] .orchestration-pipeline-node > footer > button { color: #efb56f; background: rgba(209,134,56,.2); }
html[data-theme="dark"] .orchestration-pipeline-node > footer > button:hover { background: rgba(209,134,56,.35); }
html[data-theme="dark"] .orchestration-pipeline-dialog { border-color: var(--theme-border); color: var(--theme-text); background: var(--theme-surface); }
html[data-theme="dark"] :is(.orchestration-pipeline-dialog > header, .orchestration-pipeline-dialog > footer, .orchestration-pipeline-table-head) { border-color: var(--theme-border); background: var(--theme-bg-soft); }
html[data-theme="dark"] .orchestration-pipeline-dialog h2,
html[data-theme="dark"] .orchestration-pipeline-option strong,
html[data-theme="dark"] .orchestration-pipeline-dialog-empty strong { color: var(--theme-text); }
html[data-theme="dark"] :is(.orchestration-pipeline-dialog header p, .orchestration-pipeline-option small, .orchestration-pipeline-dialog > footer, .orchestration-pipeline-dialog-empty) { color: var(--theme-muted); }
html[data-theme="dark"] .orchestration-pipeline-option { border-color: var(--theme-border); color: var(--theme-muted); }
html[data-theme="dark"] .orchestration-pipeline-option:hover { background: var(--theme-surface-raised); }
html[data-theme="dark"] .orchestration-pipeline-option > button { border-color: #486b8d; color: #9bc5eb; background: rgba(40,105,170,.2); }
html[data-theme="dark"] .orchestration-pipeline-option > button:disabled { border-color: #486957; color: #91c8a6; background: rgba(39,122,80,.2); }
html[data-theme="dark"] .orchestration-canvas-empty { border-color: var(--theme-border); color: var(--theme-muted); background: rgba(37,37,38,.8); }
html[data-theme="dark"] .orchestration-canvas-edges path { stroke: #687f93; }
html[data-theme="dark"] .orchestration-canvas-edges .orchestration-connection-preview { stroke: #64a4df; }
html[data-theme="dark"] .orchestration-canvas-edges .orchestration-arrow-head { fill: #687f93; }
html[data-theme="dark"] .orchestration-connection-help { border-color: #486b8d; color: #9bc5eb; background: rgba(29,45,61,.96); }

@media (prefers-reduced-motion: reduce) {
  .theme-toggle-track, .theme-toggle-track i { transition: none; }
}
