.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 48px;
  height: 26px;
  padding: 2px;
  border: 1px solid #e2daf1;
  border-radius: 100px;
  background: #f2edf9;
}
.theme-thumb {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  color: #7955c5;
  box-shadow: 0 1px 3px #31234e23;
  transition: transform .24s ease;
}
.theme-thumb svg { width: 13px; height: 13px; }
.theme-toggle[aria-pressed="true"] .theme-thumb { transform: translateX(21px); }

:root[data-theme="dark"] {
  color-scheme: dark;
  color: #c9d1d9;
  --line: #30363d;
  --dark-bg: #0d1117;
  --dark-panel: #161b22;
  --dark-raised: #21262d;
  --dark-hover: #292e36;
  --dark-muted: #8b949e;
  --dark-accent: #58a6ff;
  --dark-primary: #1f6feb;
}
[data-theme="dark"] body { background: var(--dark-bg); }
[data-theme="dark"] :is(.site-page, #listview, .editor-side-panel) { background: var(--dark-bg); }
[data-theme="dark"] :is(.top, .library, .canvas-head, footer, dialog, #inspector, #context-menu, .menu-panel) {
  background: var(--dark-panel);
  border-color: var(--line);
}
[data-theme="dark"] :is(.scenario-card, #run-form, .list-row, .lib-item, .canvas-tools, #minimap) {
  background: var(--dark-panel);
  border-color: var(--line);
  color: inherit;
}
[data-theme="dark"] .scenario-card:hover { border-color: var(--dark-accent); }
[data-theme="dark"] :is(.modal-copy, .field, .panel-note, .connection small, .connection-title, .lib-tip, .group h3, .run-step-title small, .scenario-label small, .demo-columns, footer, .breadcrumb, .canvas-tools) {
  color: var(--dark-muted);
}
[data-theme="dark"] :is(.site-link, .breadcrumb a, .run-form-head button) { color: var(--dark-accent); }
[data-theme="dark"] :is(.list-row small, .run-step-body, .panel-ports strong, .run-finding strong) { color: #c9d1d9; }
[data-theme="dark"] :is(.search, .field input, .field textarea, .field select, .demo-row input, .demo-row select, kbd, .run-file, .run-finding) {
  background-color: var(--dark-raised);
  border-color: var(--line);
  color: #c9d1d9;
}
[data-theme="dark"] .field select::picker(select) { background: var(--dark-raised); color: #c9d1d9; border-color: var(--line); }
[data-theme="dark"] .field select::picker-icon { color: var(--dark-accent); }
[data-theme="dark"] .field option:checked { color: var(--dark-accent); background: #1f3350; }
[data-theme="dark"] .field option:hover { background: var(--dark-hover); }
[data-theme="dark"] :is(#scenario-total, .panel-ports span) {
  background: var(--dark-raised);
  border-color: var(--line);
  color: var(--dark-muted);
}
[data-theme="dark"] :is(.run-form-head button:hover, .canvas-tools button:hover, .canvas-tools .tool-on, #scenario-menu[open] summary, .menu-panel :is(button, a):hover) {
  color: var(--dark-accent);
  background: var(--dark-hover);
  border-color: var(--line);
}
[data-theme="dark"] .home-hero { background: radial-gradient(ellipse at 105% 0%, #624789 0%, #342956 51%, #252039 100%); }
[data-theme="dark"] :is(.avatar, .theme-toggle) { background: var(--dark-raised); color: var(--dark-accent); border-color: var(--line); }
[data-theme="dark"] .theme-thumb { background: var(--dark-hover); color: #e6edf3; }
[data-theme="dark"] .scenario-icon { background: #1f3350; color: var(--dark-accent); }
[data-theme="dark"] #canvas { background-color: var(--dark-bg); background-image: radial-gradient(#30363d .9px, transparent 1px); }
[data-theme="dark"] #minimap svg { background: var(--dark-raised); border-color: var(--line); }
[data-theme="dark"] :is(.node, .port) { background: var(--dark-panel); color: #e6edf3; }
[data-theme="dark"] .node { border-color: color-mix(in srgb, var(--port), #30363d 52%); }
[data-theme="dark"] :is(.node.selected, .node.in-selection) { border-color: var(--dark-accent); background: #172335; }
[data-theme="dark"] .node-meta { border-color: var(--line); color: var(--dark-muted); }
[data-theme="dark"] .node-category { color: color-mix(in srgb, var(--tone), white 46%); }
[data-theme="dark"] .wire-line { stroke: #768390; }
[data-theme="dark"] :is(.wire:hover .wire-line, .wire.context-active .wire-line) { stroke: var(--dark-accent); }
[data-theme="dark"] :is(.run-step, .run-step-body, .connection, .context-heading, #context-menu hr) { border-color: var(--line); }
[data-theme="dark"] :is(.run-step summary:hover, .run-step[open] summary, #context-menu button:hover, #context-menu button:focus-visible, .lib-item:hover) {
  background: var(--dark-hover);
  color: #e6edf3;
}
[data-theme="dark"] :is(.context-label small, #context-menu button > i, #scenario-menu summary) { color: var(--dark-muted); }
[data-theme="dark"] .run-status[data-state="done"] { color: #9ce4cd; background: #1b423d; }
[data-theme="dark"] .run-status[data-state="halted"], [data-theme="dark"] .run-warning { color: #ffd190; background: #493420; }
[data-theme="dark"] .run-status[data-state="skipped"] { color: var(--dark-muted); background: var(--dark-raised); }
[data-theme="dark"] :is(.danger, #context-menu .danger-item, #context-menu .danger-item i) { color: #ff9ead; }
[data-theme="dark"] :is(.integration-configure) {
  background: var(--dark-raised);
  border-color: var(--line);
  color: var(--dark-accent);
}
[data-theme="dark"] :is(.editor, .site-page, dialog:not(#interface-tour)) .run-start {
  background: var(--dark-primary);
}
[data-theme="dark"] :is(.editor, .site-page, dialog:not(#interface-tour)) .run-start:not(.editor-save:not(.has-changes)):enabled:hover {
  background: #388bfd;
}
@media (prefers-reduced-motion: no-preference) {
  :root[data-theme-transition]::view-transition-old(root) { animation: none; }
  :root[data-theme-transition]::view-transition-new(root) { animation: theme-reveal .42s ease-out both; }
  @keyframes theme-reveal {
    from { clip-path: circle(0 at var(--theme-x) var(--theme-y)); }
    to { clip-path: circle(150vmax at var(--theme-x) var(--theme-y)); }
  }
}
@media (prefers-reduced-motion: reduce) {
  .theme-thumb { transition: none; }
}

.section-rail {
  --rail-bg: #fff;
  --rail-text: #555968;
  --rail-active: #6942ae;
  --rail-tint: #f1ebfb;
  display: flex;
  flex: 0 0 164px;
  flex-direction: column;
  gap: 4px;
  padding: 22px 9px;
  border-right: 1px solid var(--line);
  background: var(--rail-bg);
}
.section-rail :is(a,.rail-help) {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 9px;
  border-radius: 8px;
  color: var(--rail-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 550;
}
.section-rail :is(a,.rail-help):hover, .section-rail [aria-current] { color: var(--rail-active); background: var(--rail-tint); }
.section-rail [aria-current] { box-shadow: inset 3px 0 var(--rail-active); }
.reference-page .page-content { max-width: 880px; }
.reference-page h1 { font-size: clamp(26px, 4vw, 40px); letter-spacing: -.04em; }
.reference-page .page-content > p { margin: 10px 0 25px; }
.reference-page :is(details, article) { padding: 20px; margin: 10px 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.reference-page summary { cursor: pointer; font-weight: 650; }
.reference-page small { display: block; font-size: 12px; color: #7554a9; margin-bottom: 6px; }
.reference-page summary small { display: inline-block; margin-right: 12px; }
.reference-page h2 { font-size: 24px; }
.reference-page h3 { margin: 22px 0 5px; font-size: 15px; }
.reference-page details p { margin-top: 12px; }
.reference-page :is(p, li) { line-height: 1.6; }
.reference-page ol { padding-left: 22px; }
.reference-page a { display: inline-block; margin-top: 12px; color: #6741a5; }
[data-theme="dark"] .section-rail { --rail-bg: var(--dark-bg); --rail-text: #c9d1d9; --rail-active: var(--dark-accent); --rail-tint: #172335; }
[data-theme="dark"] .reference-page :is(details, article) { background: var(--dark-panel); }
[data-theme="dark"] .reference-page small { color: var(--dark-muted); }
[data-theme="dark"] .reference-page a { color: var(--dark-accent); }
@media (max-width: 1100px) {
  .section-rail { flex-basis: 52px; padding-inline: 4px; }
  .section-rail :is(a,.rail-help) { justify-content: center; }
  .section-rail span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
@media (max-width: 680px) {
  .section-rail { flex-basis: 47px; padding: 8px 1px; }
  .section-rail :is(a,.rail-help) { min-height: 44px; }
  .workspace .library.open { max-width: 100%; }
  #scenarios { overflow: auto; }
  #scenarios > .page-content { height: auto; min-height: 100%; }
}
.reference-page .page-content { max-width: 1180px; }
.data-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th,.data-table td { padding: 14px; text-align: left; border-bottom: 1px solid var(--line); }
.data-table th { font-size: 12px; white-space: nowrap; }
.data-table tr:last-child td { border: 0; }
.data-table small,.service-row small { display: block; margin: 5px 0 0; }
.data-table a { margin: 0; }
#runs .data-table { table-layout: fixed; min-width: 62rem; }
#runs .data-table :is(th,td) { padding-inline: 16px; }
#runs .data-table td { overflow-wrap: anywhere; }
#runs .data-table th:nth-child(2) { width: 12%; }
#runs .data-table :is(th,td):nth-child(2) { text-align: center; }
#runs .data-table th:nth-child(3) { width: 17%; }
#runs .data-table th:nth-child(4) { width: 12%; }
#runs .data-table :is(th,td):nth-child(4) { text-align: center; }
#runs .data-table th:nth-child(5) { width: 13%; }
#runs .data-table th:nth-child(6) { width: 17rem; }
#runs .data-table :is(th,td):nth-child(6) { padding-inline-end: 28px; }
#runs .run-pipeline-meta { display: flex; align-items: baseline; gap: .38em; white-space: nowrap; }
.run-pipeline-meta .run-project { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.run-pipeline-meta .run-trigger { flex-shrink: 0; max-width: 65%; overflow: hidden; text-overflow: ellipsis; }
.run-started-at, .run-duration { white-space: nowrap; font-variant-numeric: tabular-nums; }
.run-source-link { display: inline-flex; gap: .3em; align-items: baseline; max-width: 100%; }
.run-source-link span:first-child { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.text-action { padding: 0; text-align: left; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.run-pill { display: inline-block; white-space: nowrap; padding: 4px 9px; border-radius: 20px; font-size: 12px; }
.run-pill.done { color: #165842; background: #dcf4e9; }
.run-pill.error { color: #86283f; background: #ffe5ec; }
.run-pill.running { color: #77511b; background: #fff0d0; }
.finding-filters,.service-row { display: flex; flex-wrap: wrap; gap: 12px; }
.finding-filters .field { flex: 1 1 130px; min-width: 0; }
.filter-field { position: relative; }
.reference-page details.filter-menu { margin: 0; padding: 0; border: 0; background: transparent; }
.filter-menu > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px;
  min-height: 36px; color: inherit; font-size: 13px; background: #fff;
}
.filter-menu > summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-menu > summary::after {
  content: ''; flex: 0 0 6px; height: 6px; margin: -3px 2px 0 0;
  border-right: 1px solid currentColor; border-bottom: 1px solid currentColor;
  transform: rotate(45deg);
}
.filter-menu[open] > summary::after { transform: rotate(225deg); margin-top: 3px; }
.filter-options {
  position: absolute; top: calc(100% + 4px); inset-inline-start: 0; z-index: 5;
  width: max-content; min-width: 100%; max-width: min(248px,100%); max-height: 240px;
  overflow: auto; padding: 5px; background: #fff; color: inherit;
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px #2428461c;
}
.filter-options label {
  display: flex; align-items: center; gap: 8px; padding: 7px; border-radius: 5px;
  font-size: 13px; cursor: pointer; overflow-wrap: anywhere;
}
.filter-options label:hover, .filter-options label:focus-within { background: var(--filter-hover,#f1ecf8); }
.filter-options input[type="checkbox"] { width: 15px; height: 15px; margin: 0; flex: 0 0 15px; accent-color: #8140ce; }
.history-actions { display: flex; gap: 8px; margin-top: 12px; }
#user-filter-options { flex: 2 1 270px; }
[data-theme="dark"] :is(.filter-menu > summary,.filter-options) {
  background: var(--dark-panel); color: #c9d1d9; --filter-hover: var(--dark-hover);
}

.service-row { justify-content: space-between; align-items: center; }
.service-group { margin-top: 22px; }

.integration-grid {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 14px;
  margin-top: 22px;
}
.reference-page .integration-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  margin: 0;
  padding: 18px;
}
.integration-card-heading { display: flex; align-items: center; gap: 11px; }
.integration-card-heading h2 { font-size: 17px; }
.integration-logo {
  display: grid;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid #e8e5ee;
  border-radius: 12px;
  background: #fff;
}
.integration-logo img { display: block; object-fit: contain; }
.integration-logo-built-in { color: #7045b6; background: #f5efff; }
.integration-logo-built-in svg { width: 22px; height: 22px; }
[data-theme="dark"] .integration-logo-built-in {
  color: #79c0ff; background: #172335; border-color: #2d4667;
}
.integration-state {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 12px 0 16px;
  color: var(--dark-muted,var(--muted));
  font-size: 13px;
  overflow-wrap: anywhere;
}
.integration-state::before {
  content: "";
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  align-self: flex-start;
  margin-top: 8px;
  border-radius: 50%;
  background: #8f899e;
}
.integration-state[data-state="enabled"]::before { background: #168765; }
.integration-card .service-actions { margin-top: auto; }
@media (max-width: 800px) { .integration-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 520px) { .integration-grid { grid-template-columns: 1fr; } }

.patch-preview {
  max-width: 100%; margin: 8px 0 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px;
  white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 4; line-height: 1.55; font-size: 12px;
  background: var(--patch-bg,#f6f8fa); color: var(--patch-ink,#24292f);
}
.patch-added { background: var(--patch-add-bg,#dafbe1); color: var(--patch-add-ink,#116329); }
.patch-removed { background: var(--patch-remove-bg,#ffebe9); color: var(--patch-remove-ink,#a40e26); }
.patch-hunk { color: var(--patch-hunk,#0550ae); }
.patch-header { color: var(--patch-header,#57606a); font-weight: 600; }
[data-theme="dark"] {
  --patch-bg:#0d1117; --patch-ink:#c9d1d9; --patch-add-bg:#16321f; --patch-add-ink:#7ee787;
  --patch-remove-bg:#392020; --patch-remove-ink:#ffb4ad; --patch-hunk:#79c0ff; --patch-header:#8b949e;
}
#modal:has(.finding-details,.inspection-report) { width: min(875px, 94vw); max-width: 94vw; overflow-wrap: anywhere; }
.report-location { font-size: 13px; line-height: 1.5; color: var(--dark-muted,var(--muted)); overflow-wrap: anywhere; }
.report-finding { display: grid; gap: 5px; padding: 13px 0; border-top: 1px solid var(--line); }
.report-finding h4 { margin: 0; font-size: 15px; }
.report-finding:first-of-type { margin-top: 9px; }
.report-diff > summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.report-narrative { white-space: pre-wrap; overflow-wrap: anywhere; }
#modal-body h3 { margin: 16px 0 6px; }
.account-menu { position: relative; z-index: 12; }
#profile-button {
  display: grid; place-items: center; width: 38px; height: 38px; list-style: none; cursor: pointer;
  border-radius: 50%; background: #7244ba; color: white; font-size: 16px; font-weight: 650;
}
#profile-button::-webkit-details-marker { display: none; }
#profile-button:hover, .account-menu[open] #profile-button { background: #593293; }
.account-menu .menu-panel {
  width: max-content;
  min-width: min(210px, calc(100vw - 24px));
  max-width: min(320px, calc(100vw - 24px));
  top: calc(100% + 8px);
  z-index: 6;
}
.account-menu .menu-panel button { color: #b52d48; font-weight: 600; }
[data-theme="dark"] .account-menu .menu-panel button { color: #ff9cae; }
#login {
  --login-muted: #646478;
  display: grid; grid-template-columns: minmax(350px, .87fr) minmax(0, 1.13fr);
  min-height: 100dvh; height: auto; padding: 14px; background: #faf9fd; color: #242236;
}
.login-column {
  width: min(100%, 550px); justify-self: center; display: grid; grid-template-rows: auto 1fr;
  gap: 32px; padding: clamp(22px, 3.6vw, 58px);
}
.login-brand { display: inline-flex; align-items: center; gap: 10px; width: fit-content; color: inherit; text-decoration: none; font-size: 22px; font-weight: 750; letter-spacing: -1px; }
.login-content { width: min(100%, 390px); align-self: center; padding-block: 32px; }
.login-content h1 { margin: 0; font-size: clamp(36px, 3.9vw, 58px); line-height: 1.05; letter-spacing: -.06em; font-weight: 680; outline: none; }
#profile-note { color: var(--login-muted); margin: 18px 0 32px; font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
#profile-form .field { margin: 0 0 15px; font-weight: 600; font-size: 13px; gap: 8px; color: inherit; }
#profile-form input { min-height: 48px; font-weight: 400; border-radius: 9px; padding: 12px 14px; }
.login-action { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 13px 16px; min-height: 47px; border-radius: 9px; color: white; background: #6146bc; font-weight: 600; }
.login-action:hover { background: #5137a6; }
.login-art {
  position: relative; isolation: isolate; display: grid; place-items: center; overflow: hidden; border-radius: 20px;
  background: radial-gradient(ellipse at 20% 80%, #514077 0%, transparent 54%), radial-gradient(ellipse at 85% 20%, #393556 0%, transparent 52%), #191625;
}
.login-art::before { content: ''; position: absolute; inset: 0; background: radial-gradient(#d1c4ff25 .85px, transparent 1px) 0 0/18px 18px; }
[data-theme="dark"] #login { background: var(--dark-bg); color: #f1eef9; --login-muted: var(--dark-muted); }
@media (max-width: 760px) {
  #login { grid-template-columns: 1fr; grid-template-rows: auto auto; padding: 10px; }
  .login-column { padding: 20px clamp(12px, 5vw, 36px) 24px; gap: 20px; }
  .login-content { width: 100%; padding-block: 20px; }
  .login-art { border-radius: 14px; }

}
.ai-placeholder { font: 13px/1.6 ui-monospace, monospace; }

.template-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(270px,100%),1fr)); gap: 18px; margin-top: 24px; }
.reference-page .template-card { display: flex; flex-direction: column; min-width: 0; margin: 0; padding: 0; overflow: hidden; border-radius: 14px; --template-inset: 18px; }
.template-map {
  display: grid; place-items: center; padding: 8px 12px; background-color: var(--map-bg,#f7f7fc);
  background-image: radial-gradient(var(--map-dot,#d9d8e5) .8px,transparent .9px); background-size: 12px 12px;
}
.template-card .template-map { height: 145px; border-bottom: 1px solid var(--line); }
.template-map svg { width: 100%; height: 100%; min-height: 0; }
.mini-block { fill: var(--tint); stroke: var(--rim); }
.mini-links { stroke: var(--wire-color,#aaa9bd); stroke-width: 1.5; fill: none; }
.template-map text { fill: var(--map-text,#55596e); font: 600 8px Inter,"Segoe UI",sans-serif; }
.template-copy { flex: 1; padding: 18px var(--template-inset) 0; }
.template-copy h2 { font-size: 18px; line-height: 1.25; }
.template-copy p { margin: 7px 0 0; font-size: 14px; line-height: 1.5; color: var(--dark-muted,var(--muted)); }
.template-footer { padding: 14px var(--template-inset) 17px; }
.template-setup { margin: 0; font-size: 12px; font-weight: 600; color: var(--dark-muted,var(--muted)); }
.template-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.template-preview { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: inherit; font-weight: 600; font-size: 13px; }
.template-preview:hover { border-color: #9883d3; }
[data-theme="dark"] .template-map { --map-bg:#0d1117; --map-dot:#30363d; --map-text:#c9d1d9; --wire-color:#768390; }

.source-picker { min-width: 0; margin: 15px 0 10px; padding: 0; border: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0,1fr); gap: 6px; }
.source-picker legend { padding: 0 0 7px; font-size: 12px; color: var(--dark-muted,var(--muted)); }
.source-picker label { position: relative; display: grid; justify-items: center; gap: 6px; padding: 11px 2px 8px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; font-size: 12px; font-weight: 600; }
.source-picker input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.source-picker label:has(:checked) { border-color: #9976d7; color: var(--choice-text,#6642a4); background: var(--choice-fill,#f1ebfc); }
.source-picker label:focus-within,.source-drop:focus-within { outline: 2px solid #9879da; outline-offset: 2px; }
.source-picker svg { width: 19px; height: 19px; }
.source-drop,.source-sample { display: grid; justify-items: center; align-content: center; text-align: center; gap: 4px; }
.source-drop,.source-pane { min-height: 116px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; margin: 0 0 9px; }
.source-drop { position: relative; border-style: dashed; border-color: #aca1c4; cursor: pointer; }
.source-drop:hover { background: var(--choice-fill,#f8f5fd); }
.source-drop input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.source-drop svg,.source-sample svg { width: 26px; height: 26px; color: var(--choice-text,#7857a9); margin-bottom: 4px; }
.source-drop strong,.source-sample strong { max-width: 100%; overflow-wrap: anywhere; font-size: 13px; }
.source-drop span,.source-sample span { color: var(--dark-muted,var(--muted)); font-size: 12px; }
.field.source-pane { display: grid; align-content: center; }
[data-theme="dark"] #run-form { --choice-fill:#172335; --choice-text:#79c0ff; }
.horizontal-flow .node .port.in { left: -5px; top: calc(50% - 4.5px); }
.horizontal-flow .node .port.out { left: auto; right: -5px; top: calc(50% - 4.5px); bottom: auto; }
.horizontal-flow .node[data-split="true"] .out[data-branch="main"] { left: auto; top: calc(25% - 4.5px); }
.horizontal-flow .node[data-split="true"] .out[data-branch="below"] { left: auto; top: calc(75% - 4.5px); }
.horizontal-flow .branch-labels { inset: 0 auto 0 calc(100% + 6px); flex-direction: column; width: max-content; justify-content: space-around; }
.horizontal-flow .branch-labels b { width: auto; text-align: left; margin: -16px 0 0; }


.layout-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.layout-bar > span { font-size: 12px; margin-right: 5px; color: var(--dark-muted,var(--muted)); }
.layout-bar button,.report-format { display: inline-flex; align-items: center; gap: 5px; padding: 6px 8px; color: inherit; font-size: 12px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; }
.layout-bar svg { width: 15px; height: 15px; }
.layout-bar [data-direction="vertical"] svg { transform: rotate(90deg); }
.layout-bar button[aria-pressed="true"],.report-format:has(:checked) { background: var(--selected-fill,#eeeafb); color: var(--selected-ink,#593eaa); border-color: var(--selected-border,#c1b3e5); }
[data-theme="dark"] { --selected-fill:#172335; --selected-ink:#79c0ff; --selected-border:#2f5c8f; }
.report-export { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.report-format { position: relative; border-color: var(--line); font-weight: 600; padding: 6px; }
.report-format input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.report-format:focus-within { outline: 2px solid #9278d4; }
.report-export button { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; }
.report-export button[data-run-preview] { width: auto; }
#runs .report-export button[data-run-preview] { padding-inline: 8px; font-size: 12px; }
.report-export button:hover { background: var(--selected-fill,#eeeafb); }
.report-export svg { width: 17px; height: 17px; }
@media(max-width:520px) { .layout-bar { padding: 5px; } .layout-bar > span { display: none; } }

.section-rail { overflow-y: auto; }
.admin-nav { display: grid; gap: 4px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 14px; }
.admin-nav-title { padding: 0 8px 4px; color: var(--rail-text); font-size: 11px; font-weight: 650; }
.account-identity { display: grid; gap: 3px; padding: 6px 9px 10px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.account-identity small { color: var(--dark-muted,var(--muted)); }
.admin-heading,.account-operations { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.admin-filters,#audit-content { margin: 22px 0 14px; }
.account-operations { padding-top: 14px; margin-top: 16px; border-top: 1px solid var(--line); }
.account-operations .danger { margin: 0; }
.admin-error { color: var(--error-color,#ae284a); font-size: 13px; margin: 8px 0; }
.admin-error:empty { display: none; }
[data-theme="dark"] { --error-color:#ffa2bc; }
#admin-demo-login { display: block; margin: 16px auto 0; font-size: 13px; }
@media(max-width:1100px) { .admin-nav-title { display: none; } }

#audit .data-table :is(th,td):nth-child(4) { text-align: center; }
#findings .finding-search { flex: 1 1 230px; max-width: 290px; margin-inline-start: auto; }
#findings .finding-grouping select { border-color: var(--line); font-weight: 600; }
.finding-group { border: 1px solid var(--line); border-radius: 12px; margin-block: 0 10px; overflow: hidden; }
.finding-group summary, .finding-row { display: flex; align-items: center; gap: 9px; }
.finding-group summary { cursor: pointer; list-style: none; padding: 10px 12px; flex-wrap: wrap; }
.finding-group summary::-webkit-details-marker { display: none; }
.finding-group summary i, .finding-row i { display: grid; flex: none; }
.finding-group summary svg, .finding-row svg { width: 15px; height: 15px; }
.finding-group[open] summary > i { transform: rotate(90deg); }
.finding-group[open] summary { border-bottom: 1px solid var(--line); }
.finding-group time, .finding-group-counts, .finding-row-content small, .finding-row-project {
  font-size: 12px;
  line-height: 1.4;
  color: var(--dark-muted, var(--muted));
}
.finding-group-counts {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-inline-start: auto;
  font-variant-numeric: tabular-nums;
}
.finding-total { color: inherit; font-weight: 600; white-space: nowrap; }
.finding-severity { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.finding-severity::before {
  content: '';
  width: 6px;
  height: 6px;
  align-self: center;
  border-radius: 50%;
  background: var(--severity-dot, currentColor);
}
.finding-severity[data-severity="Critical"] { --severity-dot: #c45871; }
.finding-severity[data-severity="High"] { --severity-dot: #bc754e; }
.finding-severity[data-severity="Medium"] { --severity-dot: #ad8b42; }
.finding-severity[data-severity="Low"] { --severity-dot: #6984b3; }
.finding-rows { list-style: none; margin: 0; padding: 4px 0; }
.finding-row { text-align: start; width: 100%; padding: 7px 12px; border-radius: 0; color: inherit; }
.finding-row:hover { background: color-mix(in srgb, currentColor 5%, transparent); }
.finding-row .finding-severity { flex: 0 0 100px; font-size: 12px; color: var(--dark-muted, var(--muted)); }
.finding-row-content { flex: 1; min-width: 0; display: grid; gap: 2px; overflow-wrap: anywhere; }
.finding-type { border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; flex: none; font-size: 11px; }
@media (max-width: 580px) {
  #findings .finding-search { max-width: none; margin-inline-start: 0; }
  .finding-row .finding-severity { flex-basis: auto; font-size: 11px; }
  .finding-group-counts { margin-inline-start: 0; }
  .finding-row-project { display: none; }
}
.audit-ip { white-space: nowrap; font-variant-numeric: tabular-nums; }

.rail-help { margin-top: auto; border: 0; background: transparent; cursor: pointer; text-align: left; }
.trigger-automation { margin-block: 14px; }
.trigger-automation h3 { margin: 0 0 8px; font-size: 13px; }
.node-targets .check-field span { overflow-wrap: anywhere; min-width: 0; }
.node-targets .integration-configure { align-self: flex-start; margin-top: 6px; }
.canvas-actions .editor-save { flex: none; }
.canvas-actions .editor-save:not(.has-changes) { background: transparent; color: inherit; box-shadow: inset 0 0 0 1px var(--line); }
.service-actions, .tour-card footer, .tour-heading { display: flex; align-items: center; gap: 8px; }
.service-actions { flex-wrap: wrap; }
#llm-provider { max-width: 100%; font: inherit; font-size: 13px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; color: inherit; background: transparent; }
#interface-tour { position: fixed; inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; border: 0; margin: 0; padding: 0; overflow: clip; background: transparent; color: inherit; }
[data-theme="dark"] #interface-tour { background: transparent; }
#interface-tour { box-shadow: none; border-radius: 0; }
#interface-tour::backdrop { background: transparent; }
.tour-spot { position: fixed; border: 2px solid var(--dark-accent,#9c7cdc); border-radius: 10px; box-shadow: 0 0 0 200vmax rgb(0 0 0 / 42%); pointer-events: none; transition: left .18s ease, top .18s ease, width .18s ease, height .18s ease; }
.tour-card { position: fixed; width: min(330px, calc(100% - 20px)); max-height: calc(100% - 20px); overflow: auto; padding: 16px 20px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 10px 40px #17102440; }
[data-theme="dark"] .tour-card { background: var(--dark-bg); }
.tour-heading, .tour-card footer { justify-content: space-between; }
#interface-tour footer { position: static; padding: 0; height: auto; border: 0; background: transparent; }
.tour-heading small { font: 12px var(--mono); color: #7955c5; }
[data-theme="dark"] .tour-heading small { color: var(--dark-accent); }
.tour-card h2 { font-size: 20px; margin: 7px 0; }
.tour-card p { font-size: 14px; line-height: 1.5; margin: 0 0 16px; }
.tour-card button:disabled { opacity: .45; }
.tour-skip { color: var(--dark-muted,var(--muted)); padding: 6px 4px; font-size: 13px; }
.tour-skip:hover { color: inherit; text-decoration: underline; }
.ci-config textarea { font: 12px/1.5 var(--mono); resize: vertical; }
.ci-config pre { white-space: pre-wrap; overflow-wrap: anywhere; }
#modal:has(.ci-config) { width: min(630px, 94vw); max-width: 94vw; }
@media (prefers-reduced-motion: reduce) { .tour-spot { transition: none; } }
@media (max-width: 850px) {
  .canvas-head { flex-wrap: wrap; height: auto; gap: 6px; padding-block: 6px; }
  .canvas-actions { flex-wrap: wrap; }
}

.hook-buttons { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
#modal:has(#hook-form, #hook-connections, #service-connections, #service-form, #llm-connections, #llm-form) { width:min(610px,94vw); max-width:94vw; }
.hook-connection-list {
  max-height: min(55dvh,420px);
  overflow-y: auto;
  scrollbar-gutter: stable;
  list-style: none;
  margin: 0 0 16px;
  padding: 0 6px 0 0;
}
.hook-profile {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.hook-profile > div:first-child { min-width: 0; }
.hook-profile small { display: block; margin-top: 4px; color: var(--dark-muted,var(--muted)); font-size: 12px; }
.hook-result { flex-basis: 100%; font-size: 13px; }
.hook-result:empty { display: none; }
.llm-model-field:has(input:placeholder-shown:not(:focus)) { opacity: .7; }
.llm-profile-info { padding-inline-start: 14px; }
.llm-profile-title { position: relative; display: flex; align-items: center; gap: 8px; }
.llm-profile-title strong[aria-current="true"]::before {
  content: "";
  position: absolute;
  inset-inline-start: -14px;
  top: .45em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dark-accent,#7b39d3);
}
.llm-check { flex: 0 0 24px; }
.llm-check-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
}
.llm-check-mark > svg { display: block; width: 17px; height: 17px; }
.llm-check-mark > span { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.llm-check[data-state="pending"] { color: var(--dark-accent,#7b39d3); }
.llm-check[data-state="success"] { color: var(--llm-success,#167346); }
.llm-check[data-state="error"], [data-llm-error] { color: var(--llm-error,#b42335); }
[data-theme="dark"] #llm-connections { --llm-success: #7adea6; --llm-error: #ffa2ad; }
.llm-check[data-state="error"] .llm-check-mark {
  background: color-mix(in srgb,currentColor 13%,transparent);
}
.llm-check-announcement {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (prefers-reduced-motion: no-preference) {
  .llm-check-mark > span { animation: llm-dot 960ms ease-in-out infinite; }
  .llm-check-mark > span:nth-child(2) { animation-delay: 120ms; }
  .llm-check-mark > span:nth-child(3) { animation-delay: 240ms; }
  .llm-check:is([data-state="success"],[data-state="error"]) .llm-check-mark {
    animation: llm-result 240ms ease-out both;
  }
}
@keyframes llm-dot {
  0%, 60%, 100% { opacity: .35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
@keyframes llm-result {
  from { opacity: 0; transform: scale(.65); }
  to { opacity: 1; transform: scale(1); }
}
:is(#hook-connections,#service-connections) > .modal-copy { margin-bottom: 14px; }
.hook-fields { display:grid; grid-template-columns:repeat(auto-fit,minmax(175px,1fr)); gap:0 12px; }
.hook-fields:has(> [hidden]):not(:has(> :not([hidden]))) { display:none; }
.hook-details { margin:12px 0; padding:10px 12px; border:1px solid var(--line); border-radius:8px; }
.hook-details summary { cursor:pointer; font-weight:600; font-size:14px; }
.hook-details small { font-size:12px; }
.hook-details pre,.hook-details textarea { font:12px/1.55 var(--mono); white-space:pre-wrap; overflow-wrap:anywhere; }
.hook-details pre { max-height:190px; overflow:auto; padding:10px; background:var(--dark-bg,#f6f4fa); border-radius:6px; }
.hook-details textarea { width:100%; resize:vertical; padding:8px; color:inherit; background:transparent; border:1px solid var(--line); border-radius:5px; }
.hook-vars { display:flex; gap:5px; flex-wrap:wrap; margin-top:6px; }
.hook-vars button { padding:3px 6px; font:12px var(--mono); }
.hook-buttons { justify-content:flex-end; margin-top:14px; }
.hook-buttons .danger { margin:0 auto 0 0; }

.automation-connection { padding: 12px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.sourcecraft-hook-settings { margin-top: 8px; }
.sourcecraft-hook-settings summary { cursor: pointer; font-size: 13px; font-weight: 600; }
#assistantview, #assistant-chat { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; }
#assistant-chat { flex: 1; }
#assistantview .run-form-head button { display: grid; place-items: center; }
#assistantview .run-form-head button svg { width: 16px; height: 16px; }
#assistantview .admin-error { margin: 0; overflow-wrap: anywhere; }
.assistant-messages { display: flex; flex-direction: column; flex: 1 1 0; gap: 10px; min-height: 0; overflow-y: auto; }
.assistant-message { flex-shrink: 0; }
.assistant-message { align-self: flex-start; margin: 0; max-width: 90%; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 12px; }
.assistant-message.user { align-self: flex-end; background: color-mix(in srgb,var(--dark-accent,#9363db) 14%,transparent); }
.assistant-message p { margin: 0; }
.assistant-message .assistant-undo { margin-top: 8px; }
.assistant-form { display: grid; justify-items: start; gap: 8px; }
.assistant-form .field { width: 100%; min-width: 0; margin: 0; }
.assistant-form textarea { min-height: 55px; max-height: 24vh; resize: vertical; }
.assistant-scheme-link { display: inline-block; margin-top: 8px; color: var(--dark-accent,#6841ab); }
.assistant-undo { display: inline-flex; align-items: center; gap: 5px; }
.assistant-undo svg { width: 15px; height: 15px; }
@media (prefers-reduced-motion: no-preference) {
  .assistant-node-enter { animation: flow-enter .36s ease-out var(--assistant-delay) both; }
  .assistant-wire-enter .wire-line { stroke-dasharray: 1; animation: flow-draw .36s ease-out var(--assistant-delay) both; }
  .assistant-wire-signal {
    fill: none; stroke: var(--dark-accent,#9363db); stroke-width: 3; stroke-linecap: round;
    stroke-dasharray: .045 1.1; pointer-events: none;
    animation: flow-travel .48s ease-in-out var(--assistant-delay) both;
  }
}
.graph-node-exit, .graph-wire-exit { pointer-events: none; }
.graph-node-exit { animation: graph-node-leave .26s ease-in .07s both; }
.graph-wire-exit { stroke-dasharray: 1; animation: graph-wire-retract .24s ease-in both; }
@keyframes graph-node-leave { to { opacity: 0; transform: translateY(5px) scale(.98); } }
@keyframes graph-wire-retract { from { stroke-dashoffset: 0; } to { stroke-dashoffset: 1; opacity: .1; } }
@media (max-width: 740px) {
  .editor-body #assistantview { flex: 0 0 min(48%, 360px); max-height: 48%; }
}
.automation-connection + .modal-copy { margin-top: 12px; }
