:root {
  --background: #f7f8fa;
  --surface: #ffffff;
  --surface-muted: #f3f4f6;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --sidebar: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-text: #cbd5e1;
  --green: #16a34a;
  --green-bright: #22c55e;
  --green-soft: #ecfdf3;
  --amber: #d97706;
  --amber-soft: #fff7ed;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --blue: #2563eb;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 24px 64px rgba(15, 23, 42, .18);
  --radius: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--background); }
body { margin: 0; min-height: 100vh; background: var(--background); color: var(--text); font-size: 16px; line-height: 1.5; }
body:has(dialog[open]) { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
.mono { font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; }
.muted { color: var(--muted); }

.logo-word { color: var(--text); font-size: 23px; font-weight: 760; letter-spacing: -.045em; }
.logo-word span { color: var(--green-bright); }
.logo-word.light { color: #f8fafc; }
.section-kicker { color: var(--green); font-size: 12px; font-weight: 750; letter-spacing: .1em; line-height: 1.2; text-transform: uppercase; }

.login-page { display: grid; grid-template-columns: minmax(420px, .9fr) minmax(520px, 1.1fr); min-height: 100vh; background: var(--surface); }
.login-panel { display: flex; flex-direction: column; justify-content: center; width: min(460px, 100%); margin: auto; padding: 48px; }
.login-brand { position: absolute; top: 36px; display: flex; align-items: center; gap: 12px; }
.product-tag { padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; font-weight: 650; }
.login-copy { margin-bottom: 28px; }
.login-copy h1 { margin: 10px 0 8px; font-size: clamp(30px, 4vw, 40px); line-height: 1.1; letter-spacing: -.04em; }
.login-copy p { margin: 0; color: var(--muted); }
.stack-form { display: grid; gap: 4px; }
.login-meta { display: flex; align-items: center; gap: 8px; margin: 24px 0 0; color: var(--muted); font-size: 13px; }
.login-visual { position: relative; display: grid; place-items: center; overflow: hidden; min-height: 100vh; background: var(--sidebar); color: #f8fafc; }
.signal-grid { position: absolute; inset: 0; opacity: .24; background-image: linear-gradient(rgba(148,163,184,.18) 1px, transparent 1px), linear-gradient(90deg, rgba(148,163,184,.18) 1px, transparent 1px); background-size: 54px 54px; mask-image: radial-gradient(circle at 50% 50%, black, transparent 78%); }
.visual-content { position: relative; width: min(620px, calc(100% - 80px)); }
.visual-content > p { margin: 0 0 18px; color: var(--green-bright); font-size: 12px; font-weight: 750; letter-spacing: .16em; }
.visual-content h2 { margin: 0; max-width: 560px; font-size: clamp(42px, 6vw, 72px); line-height: .98; letter-spacing: -.055em; }
.route-visual { display: flex; align-items: center; margin-top: 70px; }
.route-node { min-width: 105px; padding: 11px 14px; border: 1px solid #334155; border-radius: 9px; background: rgba(15,23,42,.72); color: #94a3b8; text-align: center; font-size: 13px; font-weight: 650; }
.route-node.active { border-color: var(--green-bright); color: #fff; box-shadow: 0 0 0 4px rgba(34,197,94,.09); }
.route-visual i { display: block; flex: 1; height: 1px; background: linear-gradient(90deg, #334155, var(--green-bright), #334155); }

.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; background: var(--sidebar); color: var(--sidebar-text); }
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; min-height: 65px; padding: 0 22px; border-bottom: 1px solid rgba(148,163,184,.14); }
.sidebar-version { color: #64748b; font-size: 11px; font-weight: 650; }
.sidebar-nav { padding: 18px 12px; }
.nav-label { margin: 4px 12px 8px; color: #64748b; font-size: 10px; font-weight: 750; letter-spacing: .13em; }
.nav-label-spaced { margin-top: 24px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 42px; margin: 2px 0; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: #94a3b8; cursor: pointer; font-size: 14px; font-weight: 600; text-align: left; transition: background .15s ease, color .15s ease; }
.nav-item:hover { background: rgba(30,41,59,.72); color: #f8fafc; }
.nav-item.active { background: var(--sidebar-hover); color: #fff; box-shadow: inset 3px 0 var(--green-bright); }
.nav-icon { display: grid; place-items: center; width: 20px; height: 20px; color: #64748b; font-size: 16px; }
.nav-item.active .nav-icon { color: var(--green-bright); }
.sidebar-footer { margin-top: auto; padding: 14px 12px; border-top: 1px solid rgba(148,163,184,.14); }
.vault-mini { display: flex; align-items: flex-start; gap: 10px; padding: 10px 11px; }
.vault-mini strong, .vault-mini small { display: block; }
.vault-mini strong { color: #e2e8f0; font-size: 13px; }
.vault-mini small { margin-top: 2px; color: #64748b; font-size: 11px; }
.sidebar-lock { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-top: 5px; padding: 9px 11px; border: 0; border-radius: 7px; background: transparent; color: #94a3b8; cursor: pointer; font-size: 13px; text-align: left; }
.sidebar-lock:hover { background: var(--sidebar-hover); color: #fff; }

.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 65px; padding: 0 30px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(12px); }
.breadcrumbs { display: flex; gap: 9px; align-items: center; color: var(--muted); font-size: 14px; }
.breadcrumbs b { color: #cbd5e1; font-weight: 400; }
.breadcrumbs strong { color: var(--text); }
.top-actions, .heading-actions { display: flex; align-items: center; gap: 9px; }
.health-pill { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 650; box-shadow: var(--shadow-sm); }
.health-pill i, .status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.health-pill.ok i, .status-dot.healthy { background: var(--green-bright); box-shadow: 0 0 0 3px rgba(34,197,94,.12); }
.content { width: min(1480px, 100%); margin: 0 auto; padding: 34px 36px 56px; }
.view { display: none; }
.view.active-view { display: block; animation: view-in .18s ease; }
@keyframes view-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.page-heading h1 { margin: 7px 0 4px; font-size: 30px; line-height: 1.15; letter-spacing: -.035em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 15px; }

.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; cursor: pointer; font-weight: 650; transition: border-color .15s ease, background .15s ease, transform .1s ease; }
.button { min-height: 38px; padding: 0 14px; border: 1px solid transparent; font-size: 14px; }
.button:disabled { cursor: not-allowed; opacity: .48; }
.button:active, .icon-button:active { transform: translateY(1px); }
.button.primary { background: var(--green); color: #fff; }
.button.primary:hover { background: #15803d; }
.button.outline { border-color: var(--line-strong); background: var(--surface); color: #334155; }
.button.outline:hover, .icon-button:hover { background: var(--surface-muted); border-color: #cbd5e1; }
.button.small { min-height: 31px; padding: 0 10px; font-size: 12px; }
.button.danger { border-color: #fecaca; background: #fff; color: var(--red); }
.full { width: 100%; }
.icon-button { width: 35px; height: 35px; padding: 0; border: 1px solid var(--line); background: var(--surface); color: #475569; font-size: 19px; }
.password-input { position: relative; display: block; }
.password-input input { width: 100%; padding-right: 66px; }
.password-toggle { position: absolute; inset: 5px 5px 5px auto; min-width: 52px; padding: 0 10px; border: 0; border-left: 1px solid var(--line); background: transparent; color: #475569; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.password-toggle:hover { color: var(--ink); }
.password-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }

.metrics-grid { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { min-height: 112px; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.metric small { display: block; min-height: 34px; color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1.35; }
.metric strong { display: block; margin-top: 8px; font-size: 28px; font-weight: 700; line-height: 1; letter-spacing: -.035em; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(310px, .75fr); gap: 18px; }
.surface { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.surface-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.surface-heading h2 { margin: 6px 0 0; font-size: 18px; letter-spacing: -.02em; }
.soft-badge { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.soft-badge.green { background: var(--green-soft); color: var(--green); }
.topology { display: grid; gap: 12px; padding: 18px 22px 22px; }
.transport-lane { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfd; }
.transport-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.transport-head strong { font-size: 14px; }
.transport-head code { color: var(--muted); font-size: 11px; }
.provider-nodes { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 8px; }
.provider-node { padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.provider-node strong, .provider-node small { display: block; }
.provider-node strong { font-size: 13px; }
.provider-node small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.guardrail-list { list-style: none; margin: 0; padding: 8px 22px 16px; }
.guardrail-list li { display: flex; gap: 13px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.guardrail-list li:last-child { border-bottom: 0; }
.guardrail-list b { color: var(--green); font: 700 11px/1.5 "Cascadia Code", monospace; }
.guardrail-list strong { font-size: 14px; }
.guardrail-list p { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.integration-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 18px; padding: 22px; border-left: 4px solid var(--green); }
.integration-hero h2 { margin: 6px 0 4px; font-size: 20px; }
.integration-hero p { margin: 0; color: var(--muted); font-size: 13px; }
.integration-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.integration-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, .75fr); gap: 18px; }
.integration-accounts { min-height: 180px; }
.integration-account { display: grid; grid-template-columns: minmax(180px, 1fr) 130px minmax(220px, 1.2fr); gap: 16px; align-items: center; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.integration-account:last-child { border-bottom: 0; }
.integration-account strong, .integration-account small { display: block; }
.integration-account strong { font-size: 13px; }
.integration-account small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.model-quota-list { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.model-quota-list span { display: inline-flex; align-items: center; gap: 6px; padding: 4px 7px; border-radius: 7px; background: var(--surface-muted); color: #475569; font-size: 10px; }
.model-quota-list b { max-width: 150px; overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.model-quota-list i { color: var(--green); font-style: normal; font-weight: 750; }
.integration-notice { margin: 14px 2px 0; color: var(--muted); font-size: 11px; }
.integration-notice code { color: #475569; }

.list-surface { overflow: hidden; }
.list-header { padding: 10px 18px; border-bottom: 1px solid var(--line); background: #fafafa; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.pool-toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) 220px 170px auto; gap: 12px; align-items: end; margin-bottom: 14px; padding: 14px 16px; }
.pool-toolbar label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: .03em; text-transform: uppercase; }
.pool-toolbar input, .pool-toolbar select { min-height: 38px; }
.selection-tools { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-height: 38px; }
.selection-tools strong { color: var(--muted); font-size: 12px; white-space: nowrap; }
.account-grid, .account-card { display: grid; grid-template-columns: 28px minmax(160px, 1.05fr) minmax(125px, .8fr) minmax(190px, 1fr) minmax(150px, .85fr) minmax(215px, auto); gap: 14px; align-items: center; }
.account-card { min-height: 82px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.account-card:last-child { border-bottom: 0; }
.account-card:hover { background: #fbfcfd; }
.account-card h3 { margin: 0 0 3px; font-size: 14px; }
.account-card p { margin: 0; font-size: 13px; }
.account-card small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.account-select { display: grid; place-items: center; }
input[type="checkbox"] { width: 16px; min-height: 16px; height: 16px; padding: 0; accent-color: var(--green); }
.capacity-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.capacity-head strong { font-size: 13px; }
.quota-track { height: 5px; margin: 7px 0 5px; overflow: hidden; border-radius: 999px; background: #e2e8f0; }
.quota-track i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.tag-list span { padding: 2px 6px; border-radius: 999px; background: #eef2f7; color: #64748b; font-size: 10px; }
.account-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.state-badge { display: inline-flex; align-items: center; gap: 6px; min-height: 23px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 700; vertical-align: middle; }
.state-badge::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.state-badge.active, .state-badge.completed { background: var(--green-soft); color: var(--green); }
.state-badge.retired { background: var(--surface-muted); color: var(--muted); }
.state-badge.attention, .state-badge.probing, .state-badge.queued { background: var(--amber-soft); color: var(--amber); }
.state-badge.failed, .state-badge.unhealthy, .state-badge.quarantined { background: var(--red-soft); color: var(--red); }

.route-list, .pipeline-list { display: grid; gap: 12px; }
.route-card { padding: 0; overflow: hidden; }
.route-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 18px 20px; }
.route-head h3 { margin: 0 0 4px; font-size: 16px; }
.route-head p { margin: 0; color: var(--muted); font-size: 12px; }
.route-head-actions { display: flex; gap: 7px; }
.target-list { border-top: 1px solid var(--line); }
.target { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; gap: 16px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); font-size: 13px; }
.target:last-child { border-bottom: 0; }
.pipeline-toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) 190px auto; gap: 12px; align-items: end; margin-bottom: 14px; padding: 13px 15px; }
.pipeline-toolbar label, .atom-toolbar label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.pipeline-toolbar input, .pipeline-toolbar select, .atom-toolbar input, .atom-toolbar select { min-height: 36px; }
.pipeline-fast-help { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-height: 36px; color: var(--muted); font-size: 11px; white-space: nowrap; }
kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: #fff; color: #475569; font: 600 10px ui-monospace, SFMono-Regular, Consolas, monospace; }
.pipeline-workbench { display: grid; grid-template-columns: minmax(245px, .34fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.pipeline-run-rail, .pipeline-inspector { min-width: 0; overflow: hidden; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 62px; padding: 12px 15px; border-bottom: 1px solid var(--line); }
.panel-title h2 { margin: 4px 0 0; font-size: 15px; }
.pipeline-list { max-height: 730px; overflow-y: auto; gap: 0; }
.pipeline-run-card { width: 100%; padding: 13px 14px; border: 0; border-bottom: 1px solid var(--line); background: #fff; color: var(--text); text-align: left; cursor: pointer; }
.pipeline-run-card:last-child { border-bottom: 0; }
.pipeline-run-card:hover { background: #fafcfb; }
.pipeline-run-card.is-selected { box-shadow: inset 3px 0 var(--green); background: var(--green-soft); }
.pipeline-run-head, .pipeline-run-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pipeline-run-head strong { max-width: 155px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.pipeline-run-meta { margin-top: 8px; color: var(--muted); font-size: 11px; }
.pipeline-run-meta b { color: #475569; font-weight: 650; }
.pipeline-run-source { display: block; margin-top: 6px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.pipeline-run-card time { display: block; margin-top: 6px; color: #94a3b8; font-size: 10px; }
.pipeline-empty-state { display: grid; min-height: 440px; place-content: center; justify-items: center; padding: 36px; color: var(--muted); text-align: center; }
.pipeline-empty-state > span { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--surface-muted); color: var(--green); font-size: 24px; }
.pipeline-empty-state h2 { margin: 13px 0 5px; color: var(--text); font-size: 17px; }
.pipeline-empty-state p { margin: 0; font-size: 12px; }
.inspector-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.inspector-header h2 { margin: 5px 0 3px; font-size: 18px; }
.inspector-header p { max-width: 620px; margin: 0; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.inspector-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.pipeline-phases { display: grid; grid-template-columns: repeat(6, minmax(74px, 1fr)); gap: 1px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: #fafafa; }
.pipeline-phase { position: relative; display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 1px 7px; align-items: center; min-height: 42px; padding: 7px 8px; border-radius: 7px; color: var(--muted); }
.pipeline-phase i { grid-row: 1 / 3; width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; }
.pipeline-phase strong { overflow: hidden; color: #64748b; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.pipeline-phase span { font-size: 9px; text-transform: uppercase; }
.pipeline-phase.is-done { background: var(--green-soft); }
.pipeline-phase.is-done i, .pipeline-phase.is-active i { background: var(--green); }
.pipeline-phase.is-done strong, .pipeline-phase.is-active strong { color: #166534; }
.pipeline-phase.is-active { box-shadow: inset 0 0 0 1px #86efac; background: #f0fdf4; }
.pipeline-phase.is-blocked { background: var(--red-soft); }
.pipeline-phase.is-blocked i { background: var(--red); }
.pipeline-phase.is-blocked strong { color: var(--red); }
.inspection-loading { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid #bfdbfe; background: #eff6ff; color: #1e3a8a; }
.inspection-loading strong { display: block; font-size: 12px; }
.inspection-loading p { margin: 3px 0 0; color: #475569; font-size: 10px; }
.spinner { width: 18px; height: 18px; border: 2px solid #bfdbfe; border-top-color: #2563eb; border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.inspection-notice { margin: 14px 18px; padding: 12px 13px; border: 1px solid #fde68a; border-radius: 9px; background: #fffbeb; color: #92400e; }
.inspection-notice strong { font-size: 12px; }
.inspection-notice p { margin: 4px 0 0; font-size: 11px; }
.atom-toolbar { display: grid; grid-template-columns: minmax(230px, 1fr) 165px 155px auto; gap: 10px; align-items: end; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.atom-result-count { align-self: center; justify-self: end; color: var(--muted); font-size: 11px; font-weight: 650; }
.atom-workspace { display: grid; grid-template-columns: 190px minmax(300px, 1fr) 275px; min-height: 410px; border-bottom: 1px solid var(--line); }
.function-pane, .atom-pane, .atom-detail-pane { min-width: 0; }
.atom-pane, .atom-detail-pane { border-left: 1px solid var(--line); }
.function-pane > header, .atom-pane > header, .atom-detail-pane > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 43px; padding: 9px 11px; border-bottom: 1px solid var(--line); background: #fafafa; }
.function-pane > header strong, .atom-pane > header strong, .atom-detail-pane > header strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.function-pane > header span, .atom-pane > header span { color: var(--muted); font-size: 10px; white-space: nowrap; }
.function-list { max-height: 505px; overflow-y: auto; }
.function-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; width: 100%; min-height: 54px; padding: 8px 10px; border: 0; border-bottom: 1px solid var(--line); background: #fff; color: var(--text); text-align: left; cursor: pointer; }
.function-row:hover { background: #fafcfb; }
.function-row.is-selected { box-shadow: inset 3px 0 var(--green); background: var(--green-soft); }
.function-row strong, .function-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.function-row strong { font-size: 11px; }
.function-row small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.function-row b { display: grid; place-items: center; min-width: 22px; height: 22px; border-radius: 999px; background: var(--surface-muted); color: var(--muted); font-size: 9px; }
.atom-table-wrap { max-height: 505px; overflow: auto; }
.atom-table { min-width: 500px; }
.atom-table th { position: sticky; top: 0; z-index: 1; padding: 8px 10px; }
.atom-table td { padding: 9px 10px; }
.atom-table tbody tr { cursor: pointer; }
.atom-table tbody tr:hover, .atom-table tbody tr.is-selected { background: var(--green-soft); }
.atom-table td code, .atom-table td small { display: block; }
.atom-table td code { max-width: 245px; overflow: hidden; color: #334155; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.atom-table td small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.atom-status { display: inline-flex; align-items: center; min-height: 21px; padding: 0 7px; border-radius: 999px; font-size: 9px; font-weight: 700; white-space: nowrap; }
.atom-status.consensus { background: var(--green-soft); color: var(--green); }
.atom-status.review { background: var(--red-soft); color: var(--red); }
.atom-status.pending { background: var(--amber-soft); color: var(--amber); }
.atom-status.scaffold { background: #eef2ff; color: #4f46e5; }
.icon-button.compact { width: 27px; height: 27px; min-height: 27px; font-size: 13px; }
.atom-detail { max-height: 505px; overflow-y: auto; padding: 12px; }
.atom-detail section { margin-bottom: 15px; }
.atom-detail h3 { margin: 7px 0 4px; font-size: 14px; }
.atom-detail h4 { margin: 0 0 7px; color: #475569; font-size: 10px; letter-spacing: .05em; text-transform: uppercase; }
.atom-detail p { margin: 4px 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.atom-detail code { display: block; overflow-wrap: anywhere; color: #475569; font-size: 9px; }
.atom-detail dl { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 6px 8px; margin: 0; font-size: 10px; }
.atom-detail dt { color: var(--muted); }
.atom-detail dd { margin: 0; overflow-wrap: anywhere; }
.atom-binding { margin-bottom: 5px; padding: 7px 8px; border-radius: 7px; background: var(--surface-muted); }
.atom-binding strong, .atom-binding small { display: block; font-size: 10px; }
.atom-binding code { margin: 2px 0; }
.atom-binding small { color: var(--muted); }
.model-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.model-compare > div { min-width: 0; padding: 7px; border: 1px solid var(--line); border-radius: 7px; }
.model-compare b, .model-compare span { display: block; font-size: 10px; }
.model-compare span { margin: 3px 0; color: var(--green); }
.authority-note { padding: 8px; border-left: 2px solid var(--green); background: var(--green-soft); color: #166534 !important; }
.inspector-lower-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr); gap: 18px; padding: 15px 18px 18px; }
.subsection-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.subsection-heading strong { font-size: 12px; }
.subsection-heading span { color: var(--muted); font-size: 10px; }
.pipeline-events { display: grid; gap: 7px; }
.pipeline-event { display: grid; grid-template-columns: 68px 8px minmax(0, 1fr); gap: 8px; align-items: start; font-size: 10px; }
.pipeline-event time { color: var(--muted); }
.pipeline-event > i { width: 7px; height: 7px; margin-top: 3px; border-radius: 50%; background: var(--green); }
.pipeline-event strong { font-size: 10px; }
.pipeline-event p { margin: 2px 0 0; color: var(--muted); font-size: 9px; }
.integrity-list { display: grid; }
.integrity-row { display: grid; grid-template-columns: 95px minmax(0, 1fr); gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 10px; }
.integrity-row:last-child { border-bottom: 0; }
.integrity-row span { color: var(--muted); }
.integrity-row code { overflow: hidden; color: #475569; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.compact-empty { padding: 20px 12px; font-size: 11px; }
.catalog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.catalog-column { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.catalog-column h2 { display: flex; justify-content: space-between; align-items: center; margin: 0; padding: 16px 18px; border-bottom: 1px solid var(--line); font-size: 15px; }
.catalog-count { display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--surface-muted); color: var(--muted); font-size: 11px; }
.catalog-item { padding: 13px 18px; border-bottom: 1px solid var(--line); }
.catalog-item:last-child { border-bottom: 0; }
.catalog-item strong, .catalog-item small { display: block; }
.catalog-item strong { font-size: 13px; }
.catalog-item small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.table-wrap { overflow: auto; }
table { width: 100%; min-width: 860px; border-collapse: collapse; }
th, td { padding: 13px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #fafafa; color: var(--muted); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
td { font-size: 12px; }
td code { color: #475569; font-size: 11px; white-space: pre-wrap; }
.empty { padding: 42px 22px; color: var(--muted); font-size: 14px; text-align: center; }

dialog { width: min(560px, calc(100vw - 32px)); max-height: min(760px, calc(100vh - 32px)); margin: auto; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog:not([open]) { display: none; }
dialog[open] { animation: dialog-in .15s ease; }
dialog::backdrop { background: rgba(15,23,42,.48); backdrop-filter: blur(3px); animation: backdrop-in .15s ease; }
@keyframes dialog-in { from { opacity: 0; transform: scale(.975) translateY(5px); } to { opacity: 1; transform: none; } }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
.dialog-form { display: flex; flex-direction: column; max-height: min(760px, calc(100vh - 32px)); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 7px 0 3px; font-size: 20px; line-height: 1.25; letter-spacing: -.025em; }
.dialog-header p { margin: 0; color: var(--muted); font-size: 13px; }
.dialog-close { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: 24px; line-height: 1; }
.dialog-close:hover { background: var(--surface-muted); color: var(--text); }
.dialog-body { overflow-y: auto; padding: 20px 24px 8px; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--line); background: #fafafa; }
.field { display: grid; gap: 6px; margin-bottom: 15px; color: #334155; font-size: 14px; font-weight: 650; }
.field small { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.45; }
.field small code { color: #475569; font-size: 11px; }
input, select, textarea { width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 9px; outline: 0; background: #fff; color: var(--text); font-size: 14px; }
textarea { padding: 10px 12px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: #94a3b8; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,.12); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { min-height: 20px; margin: 0 0 8px; color: var(--red); font-size: 13px; }
.kiro-auth-note { margin: 0 0 15px; padding: 13px 14px; border: 1px solid #bbf7d0; border-radius: 10px; background: #f0fdf4; }
.kiro-auth-note strong { color: #166534; font-size: 14px; }
.kiro-auth-note p { margin: 5px 0 9px; color: #475569; font-size: 13px; line-height: 1.5; }
.kiro-auth-note div { display: flex; flex-wrap: wrap; gap: 12px; }
.kiro-auth-note a { color: #15803d; font-size: 13px; font-weight: 650; text-decoration: none; }
.kiro-auth-note a:hover { text-decoration: underline; }
#toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: min(380px, calc(100vw - 48px)); padding: 11px 14px; border: 1px solid #bbf7d0; border-radius: 9px; background: #f0fdf4; color: #166534; box-shadow: 0 14px 34px rgba(15,23,42,.16); font-size: 13px; font-weight: 650; opacity: 0; pointer-events: none; transform: translateY(16px); transition: .18s ease; }
#toast.show { opacity: 1; transform: none; }

.lab-contract-notice { margin-bottom: 18px; padding: 16px 18px; border-left: 4px solid #f59e0b; background: #fffbeb; }
.lab-contract-notice.is-ready { border-left-color: var(--green); background: #f0fdf4; }
.lab-contract-notice strong { color: var(--text); font-size: 14px; }
.lab-contract-notice p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.lab-contract-notice code { color: #166534; font-size: 12px; }
.lab-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 18px; }
.lab-panel { min-width: 0; padding: 0; overflow: hidden; }
.lab-panel .surface-heading { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.lab-list { min-height: 180px; }
.lab-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.lab-row:last-child { border-bottom: 0; }
.lab-row > div:first-child { display: grid; min-width: 0; gap: 4px; }
.lab-row strong { overflow: hidden; color: var(--text); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.lab-row code { overflow: hidden; color: #64748b; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.lab-row small { color: var(--muted); font-size: 11px; }
.lab-row dl { display: grid; grid-template-columns: auto auto; gap: 2px 8px; margin: 0; font-size: 11px; }
.lab-row dt { color: var(--muted); }
.lab-row dd { margin: 0; color: #334155; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.lab-experiment-row { grid-template-columns: minmax(180px, 1fr) auto auto; }
.lab-row-actions { display: flex !important; grid-auto-flow: column; gap: 6px !important; }
.lab-preflight { display: flex !important; grid-column: 1 / -1; flex-wrap: wrap; gap: 7px !important; color: var(--muted); font-size: 12px; }
.lab-check { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 999px; background: #f1f5f9; color: #475569; }
.lab-check i { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: #cbd5e1; color: #fff; font-size: 10px; font-style: normal; }
.lab-check.ok { background: #f0fdf4; color: #166534; }
.lab-check.ok i { background: var(--green); }
.lab-check.failed { background: #fef2f2; color: #991b1b; }
.lab-check.failed i { background: var(--red); }
.lab-ack { display: flex; align-items: flex-start; gap: 9px; margin: 5px 0 18px; color: #334155; font-size: 13px; }
.lab-ack input { flex: 0 0 auto; width: 17px; min-height: 17px; margin-top: 1px; }

@media (max-width: 1180px) {
  .metrics-grid { grid-template-columns: repeat(4, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .integration-grid { grid-template-columns: 1fr; }
  .lab-grid { grid-template-columns: 1fr; }
  .pool-toolbar { grid-template-columns: 1fr 1fr; }
  .account-grid, .account-card { grid-template-columns: 28px 1.1fr 1fr 1fr; }
  .list-header.account-grid span:nth-child(n+5) { display: none; }
  .account-card > div:nth-child(5) { grid-column: 2 / 3; }
  .account-actions { grid-column: 3 / -1; justify-content: flex-start; }
  .atom-workspace { grid-template-columns: 175px minmax(300px, 1fr); }
  .atom-detail-pane { grid-column: 1 / -1; border-top: 1px solid var(--line); border-left: 0; }
  .atom-detail { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; max-height: none; }
  .atom-detail section { margin-bottom: 0; }
}

@media (max-width: 820px) {
  .login-page { display: block; background: var(--surface); }
  .login-panel { min-height: 100vh; padding: 34px 24px; }
  .login-brand { top: 24px; }
  .login-visual { display: none; }
  .app-shell { grid-template-columns: 76px minmax(0, 1fr); }
  .sidebar-brand { justify-content: center; padding: 0; }
  .sidebar-brand .logo-word { font-size: 0; }
  .sidebar-brand .logo-word::before { color: #fff; content: "R"; font-size: 22px; }
  .sidebar-version, .nav-label, .nav-item > span:last-child, .vault-mini div, .sidebar-lock { display: none; }
  .sidebar-nav { padding: 14px 10px; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-icon { font-size: 17px; }
  .vault-mini { justify-content: center; }
  .content { padding: 28px 22px 44px; }
  .topbar { padding: 0 22px; }
  .health-pill:first-child { display: none; }
  .catalog-grid { grid-template-columns: 1fr; }
  .integration-account { grid-template-columns: 1fr 120px; }
  .model-quota-list { grid-column: 1 / -1; justify-content: flex-start; }
  .pipeline-toolbar { grid-template-columns: 1fr 160px; }
  .pipeline-fast-help { display: none; }
  .pipeline-workbench { grid-template-columns: 1fr; }
  .pipeline-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: none; }
  .pipeline-run-card:nth-child(odd) { border-right: 1px solid var(--line); }
  .pipeline-run-rail { order: 0; }
  .pipeline-inspector { order: 1; }
  .atom-toolbar { grid-template-columns: 1fr 150px 145px; }
  .atom-result-count { grid-column: 1 / -1; justify-self: start; }
  .atom-detail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: auto 0 0; z-index: 30; width: 100%; height: 62px; border-top: 1px solid rgba(148,163,184,.2); }
  .sidebar-brand, .nav-label, .sidebar-footer { display: none; }
  .sidebar-nav { display: grid; grid-template-columns: repeat(8, 1fr); height: 100%; padding: 6px; }
  .nav-item { display: grid; place-items: center; min-height: 48px; margin: 0; border-radius: 7px; }
  .nav-item.active { box-shadow: inset 0 -2px var(--green-bright); }
  .nav-icon { font-size: 15px; }
  .workspace { padding-bottom: 68px; }
  .topbar { min-height: 56px; padding: 0 15px; }
  .breadcrumbs span, .breadcrumbs b { display: none; }
  .health-pill { padding: 0 8px; }
  .content { padding: 22px 15px 36px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 15px; margin-bottom: 20px; }
  .integration-hero { align-items: flex-start; flex-direction: column; }
  .integration-actions { width: 100%; }
  .integration-actions .button { flex: 1; }
  .integration-account { grid-template-columns: 1fr; }
  .model-quota-list { grid-column: auto; }
  .page-heading h1 { font-size: 26px; }
  .page-heading .button, .heading-actions { width: 100%; }
  .heading-actions .button { flex: 1; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .metric { min-height: 96px; }
  .pool-toolbar { grid-template-columns: 1fr; }
  .selection-tools { justify-content: space-between; }
  .list-header.account-grid { display: none; }
  .account-card.account-grid { grid-template-columns: 26px 1fr; gap: 10px; padding: 16px; }
  .account-card > div:not(.account-select) { grid-column: 2; }
  .account-actions { grid-column: 2 / -1; }
  .account-actions { grid-column: auto; }
  .route-head { flex-direction: column; }
  .route-head-actions { width: 100%; }
  .route-head-actions .button { flex: 1; }
  .target { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .dialog-header, .dialog-body, .dialog-footer { padding-left: 18px; padding-right: 18px; }
  .dialog-footer .button { flex: 1; }
  .pipeline-toolbar, .atom-toolbar { grid-template-columns: 1fr; }
  .pipeline-list { display: block; }
  .pipeline-run-card:nth-child(odd) { border-right: 0; }
  .inspector-header { flex-direction: column; }
  .inspector-actions { flex-wrap: wrap; justify-content: flex-start; }
  .pipeline-phases { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .atom-workspace { display: block; }
  .atom-pane, .atom-detail-pane { border-top: 1px solid var(--line); border-left: 0; }
  .function-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: none; }
  .function-row:nth-child(odd) { border-right: 1px solid var(--line); }
  .atom-detail { grid-template-columns: 1fr; }
  .inspector-lower-grid { grid-template-columns: 1fr; }
  .lab-row, .lab-experiment-row { grid-template-columns: 1fr; }
  .lab-row-actions { justify-content: flex-start; }
}

/* V3 Research Lab and pipeline workbench */
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.button { white-space: nowrap; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(22, 163, 74, .24); outline-offset: 2px; }

.section-tabs { display: flex; align-items: center; gap: 2px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.section-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 43px; padding: 0 15px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 650; }
.section-tab:hover { color: var(--text); }
.section-tab.is-active { border-bottom-color: var(--green); color: var(--text); }
.section-tab span { display: inline-grid; min-width: 22px; min-height: 20px; place-items: center; padding: 0 6px; border-radius: 999px; background: var(--surface-muted); color: var(--muted); font-size: 10px; }
.section-tab.is-active span { background: var(--green-soft); color: #166534; }
.lab-view-panel { display: none; }
.lab-view-panel.is-active { display: block; animation: view-in .16s ease; }
.dataset-status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.dataset-status-card { min-height: 88px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.dataset-status-card span { display: block; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.dataset-status-card strong { display: block; margin-top: 8px; font-size: 18px; }
.dataset-status-card small { display: block; margin-top: 4px; color: var(--muted); }
.dataset-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 14px; align-items: start; }
.dataset-composer { position: sticky; top: 82px; display: grid; gap: 15px; padding: 20px; }
.dataset-composer h2 { margin: 4px 0 5px; }
.dataset-composer p, .dataset-composer small { margin: 0; color: var(--muted); line-height: 1.5; }
.dataset-composer label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.dataset-composer input, .dataset-composer select { width: 100%; min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); }
.dataset-notice { margin-bottom: 10px; padding: 10px 12px; border-radius: 7px; background: var(--surface-muted); color: var(--muted); font-size: 12px; }
.dataset-notice.is-blocked { background: #fff7ed; color: #9a3412; }
.dataset-candidate-list, .dataset-order-list { display: grid; gap: 8px; }
.dataset-candidate { display: grid; grid-template-columns: 24px minmax(0, 1.4fr) minmax(0, 1fr) 112px; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.dataset-candidate:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.dataset-candidate strong, .dataset-order-row strong { display: block; }
.dataset-candidate code, .dataset-order-row code { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.dataset-candidate dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 8px; margin: 0; font-size: 11px; }
.dataset-candidate dt { color: var(--muted); }
.dataset-candidate dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dataset-orders-panel { margin-top: 14px; }
.dataset-order-card { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
.dataset-order-row { display: grid; grid-template-columns: minmax(0, 1.5fr) 120px 100px auto; gap: 12px; align-items: center; padding: 13px; }
.dataset-order-row p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.dataset-order-actions { display: flex; gap: 7px; justify-content: flex-end; }
.dataset-order-items { border-top: 1px solid var(--line); background: #fafafa; }
.dataset-order-item { display: grid; grid-template-columns: minmax(220px, 1.5fr) 110px 140px minmax(190px, auto); gap: 12px; align-items: center; min-height: 58px; padding: 9px 13px; border-bottom: 1px solid var(--line); }
.dataset-order-item:last-child { border-bottom: 0; }
.dataset-order-item strong, .dataset-order-item code, .dataset-order-item small { display: block; }
.dataset-order-item code { margin-top: 3px; color: var(--muted); font-size: 9px; }
.dataset-publication-state small, .dataset-publication-action small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.dataset-publication-action { justify-self: end; }
.lab-metrics-grid { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
.lab-panel .surface-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.lab-flow-card { overflow: hidden; }
.lab-flow { display: grid; grid-template-columns: repeat(6, minmax(110px, 1fr)); margin: 0; padding: 22px; list-style: none; }
.lab-flow li { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 9px; align-items: center; min-width: 0; }
.lab-flow li:not(:last-child)::after { position: absolute; top: 14px; right: 8px; left: 39px; height: 1px; background: #bbf7d0; content: ""; }
.lab-flow b { z-index: 1; display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid #86efac; border-radius: 50%; background: #f0fdf4; color: #15803d; font-size: 10px; }
.lab-flow span { z-index: 1; overflow: hidden; background: #fff; color: #334155; font-size: 12px; font-weight: 700; }
.lab-flow small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 500; }
.lab-experiment-detail { display: grid; gap: 12px; }
.lab-detail-nav { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; }
.lab-detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 19px 21px; border-bottom: 1px solid var(--line); }
.lab-detail-header h2 { margin: 6px 0 3px; font-size: 20px; letter-spacing: -.025em; }
.lab-detail-header code { color: var(--muted); font-size: 10px; }
.lab-detail-header > div:last-child { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.lab-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 18px 21px; }
.lab-detail-facts { display: grid; margin: 0; border: 1px solid var(--line); border-radius: 9px; }
.lab-detail-facts > div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 9px; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 10px; }
.lab-detail-facts > div:last-child { border-bottom: 0; }
.lab-detail-facts dt { color: var(--muted); }
.lab-detail-facts dd { margin: 0; overflow-wrap: anywhere; color: #334155; }
.lab-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 21px 18px; border-bottom: 1px solid var(--line); }
.lab-detail-actions .lab-preflight { flex-basis: 100%; }
.lab-detail-loading { display: flex; min-height: 360px; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 12px; }
.lab-run-section .surface-heading { padding: 15px 21px; }
.lab-run-section .surface-heading h3 { margin: 4px 0 0; font-size: 15px; }
.lab-run-table { overflow-x: auto; }
.lab-run-head, .lab-run-row { display: grid; grid-template-columns: minmax(260px, 1.5fr) 130px minmax(150px, 1fr) 120px 18px; gap: 12px; align-items: center; min-width: 850px; }
.lab-run-head { min-height: 35px; padding: 0 21px; border-bottom: 1px solid var(--line); background: #fafafa; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.lab-run-row { width: 100%; min-height: 61px; padding: 9px 21px; border: 0; border-bottom: 1px solid var(--line); background: #fff; color: #334155; cursor: pointer; text-align: left; }
.lab-run-row:last-child { border-bottom: 0; }
.lab-run-row:hover { background: #fafcfb; }
.lab-run-row strong, .lab-run-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lab-run-row strong { font-size: 11px; }
.lab-run-row small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.lab-run-row > span { min-width: 0; font-size: 10px; }
.lab-run-row > b { color: #94a3b8; font-size: 18px; }

.script-map-shell { overflow: hidden; }
.script-map-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 360px); align-items: end; gap: 24px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.script-map-toolbar h2 { margin: 5px 0 3px; font-size: 19px; letter-spacing: -.02em; }
.script-map-toolbar p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.script-map-toolbar label { display: grid; gap: 6px; color: #475569; font-size: 11px; font-weight: 700; }
.script-map-workspace { display: grid; grid-template-columns: minmax(190px, .65fr) minmax(340px, 1.5fr) minmax(210px, .75fr); min-height: 470px; }
.script-map-source, .script-map-selection { min-width: 0; padding: 17px; background: #fafafa; }
.script-map-source { border-right: 1px solid var(--line); }
.script-map-selection { border-left: 1px solid var(--line); }
.script-map-source .subsection-heading, .script-map-selection .subsection-heading { margin-bottom: 14px; }
.script-map-source-facts { display: grid; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.script-map-source-facts > div { display: grid; gap: 3px; padding: 10px; border-bottom: 1px solid var(--line); }
.script-map-source-facts > div:last-child { border-bottom: 0; }
.script-map-source-facts span { color: var(--muted); font-size: 10px; }
.script-map-source-facts strong { overflow: hidden; color: #334155; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.script-map-legend { margin-top: 14px; padding: 11px 12px; border-left: 3px solid var(--green); background: var(--green-soft); }
.script-map-legend strong { color: #166534; font-size: 11px; }
.script-map-legend p { margin: 3px 0 0; color: #475569; font-size: 10px; line-height: 1.5; }
.script-map-browser { min-width: 0; padding: 17px; }
.script-map-search { position: relative; display: grid; gap: 6px; color: #475569; font-size: 11px; font-weight: 700; }
.script-map-search input { padding-right: 42px; }
.script-map-search kbd { position: absolute; right: 10px; bottom: 11px; min-width: 20px; padding: 2px 5px; border: 1px solid var(--line-strong); border-radius: 4px; background: #f8fafc; color: var(--muted); font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; text-align: center; }
.script-map-results { display: grid; min-height: 380px; place-items: center; }
.script-map-results.has-map { display: block; min-height: 0; }
.script-map-empty { display: grid; max-width: 470px; justify-items: center; gap: 8px; padding: 34px 22px; color: var(--muted); text-align: center; }
.script-map-empty > span:not(.spinner) { display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: #fafafa; color: #64748b; font-size: 23px; }
.script-map-empty b { color: #334155; font-size: 14px; }
.script-map-empty p { margin: 0; font-size: 12px; line-height: 1.55; }
.script-map-empty small { color: #94a3b8; font-size: 10px; line-height: 1.5; }
.script-map-graph-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 49px; padding: 8px 2px; }
.script-map-graph-summary strong, .script-map-graph-summary small { display: block; }
.script-map-graph-summary strong { color: #334155; font-size: 11px; }
.script-map-graph-summary small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.script-map-graph-scroll { max-height: 310px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; background-color: #fbfcfd; background-image: radial-gradient(#cbd5e1 0.7px, transparent 0.7px); background-size: 15px 15px; }
.script-map-graph { display: block; min-width: 600px; }
.script-map-graph path { fill: none; stroke: #cbd5e1; stroke-width: 1.25; opacity: .65; }
.script-map-node { cursor: pointer; outline: none; }
.script-map-node rect { fill: #fff; stroke: #cbd5e1; stroke-width: 1.2; transition: .12s ease; }
.script-map-node circle { fill: #94a3b8; }
.script-map-node.tier-middle circle { fill: #0ea5e9; }
.script-map-node.tier-core circle { fill: var(--green); }
.script-map-node:hover rect, .script-map-node:focus rect { fill: #f0fdf4; stroke: #86efac; }
.script-map-node.is-active rect { fill: #dcfce7; stroke: var(--green); stroke-width: 2; }
.script-map-node text { pointer-events: none; }
.script-map-node .node-title { fill: #334155; font-size: 10px; font-weight: 750; }
.script-map-node .node-meta { fill: #64748b; font-size: 8px; }
.script-map-function-list { display: grid; max-height: 230px; margin-top: 11px; overflow-y: auto; border: 1px solid var(--line); border-radius: 9px; }
.script-map-function { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 9px; align-items: center; min-width: 0; min-height: 49px; padding: 7px 9px; border: 0; border-bottom: 1px solid var(--line); background: #fff; color: #334155; cursor: pointer; text-align: left; }
.script-map-function:last-child { border-bottom: 0; }
.script-map-function:hover { background: #fafcfb; }
.script-map-function.is-selected { background: #f0fdf4; }
.script-map-function.is-ineligible { cursor: not-allowed; opacity: .68; }
.script-map-function.is-ineligible:hover { background: #fff; }
.script-map-function-check { display: grid; width: 24px; height: 24px; place-items: center; border: 1px solid var(--line-strong); border-radius: 6px; color: #64748b; font-size: 12px; font-weight: 800; }
.script-map-function.is-selected .script-map-function-check { border-color: var(--green); background: var(--green); color: #fff; }
.script-map-function strong, .script-map-function small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.script-map-function strong { font-size: 10px; }
.script-map-function small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.script-map-function-state { padding: 4px 6px; border-radius: 999px; background: #f1f5f9; color: #64748b; font-size: 8px; font-weight: 700; }
.script-map-function-state.state-completed { background: #dcfce7; color: #15803d; }
.script-map-function-state.state-running, .script-map-function-state.state-queued { background: #eff6ff; color: #2563eb; }
.script-map-function-state.state-failed, .script-map-function-state.state-quarantined { background: #fef2f2; color: #dc2626; }
.script-map-function-state.state-eligible { background: #dcfce7; color: #15803d; }
.script-map-function-state.state-incomplete, .script-map-function-state.state-unsupported { background: #fff7ed; color: #c2410c; }
.script-map-function-empty { padding: 24px; color: var(--muted); font-size: 10px; text-align: center; }
.script-map-selection { display: flex; flex-direction: column; }
.script-map-selection-list { display: grid; flex: 1; align-content: start; gap: 7px; min-height: 190px; margin-bottom: 12px; }
.script-map-selection-list article { display: grid; grid-template-columns: minmax(0, 1fr) 26px; align-items: center; gap: 7px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.script-map-selection-list article strong, .script-map-selection-list article small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.script-map-selection-list article strong { color: #334155; font-size: 10px; }
.script-map-selection-list article small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.script-map-selection-list article button { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #94a3b8; cursor: pointer; font-size: 17px; }
.script-map-selection-list article button:hover { background: #fef2f2; color: var(--red); }
.script-map-selection-empty { padding: 16px 8px; color: var(--muted); font-size: 11px; line-height: 1.55; text-align: center; }
.script-map-selection > small { margin-top: 8px; color: var(--muted); font-size: 9px; line-height: 1.45; text-align: center; }
.selection-browser-button { justify-content: center; }
.experiment-selected-summary { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fafafa; color: #475569; font-size: 11px; font-weight: 500; }
.advanced-identities { margin-top: 2px; font-weight: 500; }
.advanced-identities summary { padding: 7px 0; color: #64748b; cursor: pointer; font-size: 11px; }
.advanced-identities label { display: grid; gap: 5px; padding-top: 4px; }

#experiment-dialog { width: min(720px, calc(100vw - 32px)); }
.experiment-stepper { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 24px; padding: 0; list-style: none; }
.experiment-stepper li { position: relative; display: grid; justify-items: center; gap: 6px; color: #94a3b8; font-size: 11px; font-weight: 650; }
.experiment-stepper li:not(:last-child)::after { position: absolute; top: 14px; left: calc(50% + 18px); width: calc(100% - 36px); height: 2px; background: var(--line); content: ""; }
.experiment-stepper b { z-index: 1; display: grid; width: 29px; height: 29px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: #fff; font-size: 11px; }
.experiment-stepper .is-active, .experiment-stepper .is-complete { color: #166534; }
.experiment-stepper .is-active b, .experiment-stepper .is-complete b { border-color: var(--green); background: var(--green); color: #fff; }
.experiment-stepper .is-complete:not(:last-child)::after { background: #86efac; }
.experiment-step { min-width: 0; margin: 0; padding: 0; border: 0; }
.experiment-step legend { padding: 0; color: var(--text); font-size: 18px; font-weight: 720; letter-spacing: -.02em; }
.experiment-step > p { margin: 4px 0 18px; color: var(--muted); font-size: 12px; }
.experiment-review { display: grid; margin: 0; border: 1px solid var(--line); border-radius: 10px; }
.experiment-review > div { display: grid; grid-template-columns: 145px minmax(0, 1fr); gap: 14px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.experiment-review > div:last-child { border-bottom: 0; }
.experiment-review dt { color: var(--muted); font-size: 11px; }
.experiment-review dd { margin: 0; overflow-wrap: anywhere; color: #334155; font-size: 11px; font-weight: 600; }
.experiment-review-note { margin-top: 14px; padding: 12px 14px; border-left: 3px solid var(--green); background: var(--green-soft); }
.experiment-review-note strong { color: #166534; font-size: 12px; }
.experiment-review-note p { margin: 3px 0 0; color: #475569; font-size: 11px; }
.experiment-footer { justify-content: flex-end; }

.pipeline-page-heading { margin-bottom: 22px; }
.automation-view-tabs { margin-bottom: 16px; }
.automation-view-panel { display: none; }
.automation-view-panel.is-active { display: block; animation: view-in .16s ease; }
.automation-flow-metrics { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
.automation-flow-board { overflow: hidden; }
.automation-flow-board .surface-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.automation-flow-lanes { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fafafa; }
.automation-lane { min-width: 0; padding: 14px; border-right: 1px solid var(--line); }
.automation-lane:last-child { border-right: 0; }
.automation-lane > header { display: grid; grid-template-columns: 27px minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-bottom: 10px; }
.automation-lane > header > b { display: grid; width: 27px; height: 27px; place-items: center; border: 1px solid #86efac; border-radius: 50%; background: #f0fdf4; color: #15803d; font-size: 9px; }
.automation-lane > header strong, .automation-lane > header small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.automation-lane > header strong { color: #334155; font-size: 11px; }
.automation-lane > header small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.automation-lane > header > span { display: grid; min-width: 22px; height: 22px; place-items: center; border-radius: 999px; background: #e2e8f0; color: #475569; font-size: 9px; font-weight: 750; }
.automation-lane > div { display: grid; gap: 6px; }
.automation-lane > div > button { display: grid; grid-template-columns: 7px minmax(0, 1fr); gap: 7px; align-items: center; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: #334155; cursor: pointer; text-align: left; }
.automation-lane > div > button:hover { border-color: #86efac; background: #f0fdf4; }
.automation-lane > div > button > i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.automation-lane > div strong, .automation-lane > div small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.automation-lane > div strong { font-size: 9px; }
.automation-lane > div small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.automation-lane > div > p { margin: 0; padding: 12px 4px; color: #94a3b8; font-size: 9px; text-align: center; }
.automation-flow-list-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 16px 18px 8px; }
.automation-flow-list-heading strong { color: #334155; font-size: 12px; }
.automation-flow-list-heading small { color: var(--muted); font-size: 9px; }
.automation-flow-list { padding: 0 18px 14px; }
.automation-flow-list > button { display: grid; grid-template-columns: minmax(210px, 1.5fr) 120px minmax(140px, .8fr) 16px; gap: 12px; align-items: center; width: 100%; min-height: 55px; padding: 8px 0; border: 0; border-bottom: 1px solid var(--line); background: #fff; color: #334155; cursor: pointer; text-align: left; }
.automation-flow-list > button:last-child { border-bottom: 0; }
.automation-flow-list > button:hover { background: #fafcfb; }
.automation-flow-list > button strong, .automation-flow-list > button small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.automation-flow-list > button strong { font-size: 10px; }
.automation-flow-list > button small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.automation-flow-list > button > b { color: #94a3b8; font-size: 17px; }
.pipeline-toolbar { grid-template-columns: minmax(280px, 1fr) 200px auto; margin-bottom: 12px; border-radius: 9px; box-shadow: none; }
.pipeline-index { overflow: hidden; border-radius: 9px; box-shadow: none; }
.pipeline-index-title { display: flex; align-items: center; justify-content: space-between; min-height: 67px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.pipeline-index-title h2 { margin: 4px 0 0; font-size: 17px; letter-spacing: -.02em; }
.pipeline-table { overflow-x: auto; }
.pipeline-table-head, .pipeline-table-row { display: grid; grid-template-columns: minmax(300px, 2fr) 145px minmax(155px, 1fr) minmax(145px, .9fr) 105px 82px 24px; gap: 14px; align-items: center; min-width: 1130px; }
.pipeline-table-head { min-height: 40px; padding: 0 18px; border-bottom: 1px solid var(--line); background: #fafafa; color: var(--muted); font-size: 10px; font-weight: 720; letter-spacing: .05em; text-transform: uppercase; }
.pipeline-list { display: block; max-height: none; }
.pipeline-table-row { width: 100%; min-height: 72px; padding: 10px 18px; border: 0; border-bottom: 1px solid var(--line); background: #fff; color: var(--text); cursor: pointer; text-align: left; }
.pipeline-table-row:last-child { border-bottom: 0; }
.pipeline-table-row:hover, .pipeline-table-row:focus-within { background: #fafcfb; }
.pipeline-table-row.is-selected { background: var(--green-soft); box-shadow: inset 3px 0 var(--green); }
.pipeline-table-row > span, .pipeline-table-row > time { min-width: 0; font-size: 11px; }
.pipeline-name-button { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 11px; align-items: center; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer; text-align: left; }
.pipeline-avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: #172b4d; color: #fff; font-size: 9px; font-style: normal; font-weight: 800; letter-spacing: .04em; }
.pipeline-name-button strong, .pipeline-name-button small, .pipeline-table-secondary strong, .pipeline-table-secondary small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pipeline-name-button strong { color: #172b4d; font-size: 13px; }
.pipeline-name-button small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.pipeline-table-secondary strong { color: #334155; font-size: 11px; font-weight: 650; }
.pipeline-table-secondary small { margin-top: 3px; color: #94a3b8; font-size: 9px; }
.pipeline-table-row time { color: #475569; }
.pipeline-duration { color: #334155; }
.pipeline-open { color: #94a3b8; font-size: 22px !important; text-align: right; }
.pipeline-open button { width: 24px; height: 28px; padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 22px; }
.pipeline-table-empty { display: grid; min-height: 270px; place-content: center; justify-items: center; color: var(--muted); text-align: center; }
.pipeline-table-empty > span { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; background: var(--surface-muted); color: var(--green); font-size: 20px; }
.pipeline-table-empty strong { margin-top: 10px; color: var(--text); font-size: 14px; }
.pipeline-table-empty p { margin: 3px 0 0; font-size: 11px; }

.pipeline-detail-header { display: flex; align-items: center; gap: 15px; margin-bottom: 12px; }
.pipeline-detail-context { display: flex; gap: 8px; min-width: 0; align-items: center; color: var(--muted); font-size: 12px; }
.pipeline-detail-context b { color: #cbd5e1; font-weight: 400; }
.pipeline-detail-context strong { overflow: hidden; color: #334155; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.pipeline-workbench { grid-template-columns: minmax(285px, 330px) minmax(0, 1fr); gap: 14px; }
.pipeline-run-rail { position: sticky; top: 78px; overflow: hidden; border-radius: 9px; box-shadow: none; }
.pipeline-inspector { overflow: hidden; border-radius: 9px; box-shadow: none; }
.pipeline-run-rail .inspector-header { display: grid; gap: 12px; padding: 17px 18px 14px; }
.pipeline-run-rail .inspector-header h2 { overflow-wrap: anywhere; font-size: 17px; }
.pipeline-run-rail .inspector-header p { white-space: normal; }
.pipeline-run-facts { display: grid; margin: 0; padding: 12px 18px; border-bottom: 1px solid var(--line); background: #fafafa; }
.pipeline-run-facts > div { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 8px; padding: 4px 0; font-size: 10px; }
.pipeline-run-facts dt { color: var(--muted); }
.pipeline-run-facts dd { margin: 0; overflow: hidden; color: #334155; text-overflow: ellipsis; white-space: nowrap; }
.pipeline-phases { display: grid; grid-template-columns: 1fr; gap: 0; padding: 15px 18px; background: #fff; }
.pipeline-phase { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; min-height: 54px; padding: 5px 0; background: transparent !important; box-shadow: none !important; }
.pipeline-phase:not(:last-child)::after { position: absolute; top: 34px; bottom: -5px; left: 13px; width: 2px; background: #e2e8f0; content: ""; }
.pipeline-phase.is-done:not(:last-child)::after { background: #86efac; }
.pipeline-phase i { z-index: 1; display: grid; grid-row: auto; width: 28px; height: 28px; place-items: center; border: 2px solid #cbd5e1; border-radius: 50%; background: #fff; color: #fff; font-size: 11px; font-style: normal; font-weight: 800; }
.pipeline-phase > span { display: block; padding-top: 1px; }
.pipeline-phase strong { display: block; color: #475569; font-size: 12px; }
.pipeline-phase small { display: block; margin-top: 2px; color: #94a3b8; font-size: 9px; text-transform: uppercase; }
.pipeline-phase.is-done i { border-color: var(--green); background: var(--green); }
.pipeline-phase.is-done strong, .pipeline-phase.is-active strong { color: #166534; }
.pipeline-phase.is-active i { border-color: var(--green); background: #fff; box-shadow: inset 0 0 0 5px #fff, inset 0 0 0 10px var(--green); }
.pipeline-phase.is-blocked i { border-color: var(--red); background: var(--red); }
.pipeline-phase.is-blocked strong { color: var(--red); }
.pipeline-phase-unknown { margin: 5px 0 0; padding: 9px 10px; border-left: 3px solid var(--red); background: var(--red-soft); color: #991b1b; font-size: 10px; line-height: 1.4; }
.pipeline-rail-actions { display: flex; flex-wrap: wrap; gap: 7px; padding: 13px 18px; border-top: 1px solid var(--line); background: #fafafa; }

.pipeline-tabs { display: flex; min-height: 51px; align-items: flex-end; gap: 20px; padding: 0 18px; border-bottom: 1px solid #334155; background: #151a1e; }
.pipeline-tab { min-height: 50px; padding: 0; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #b6c2cf; cursor: pointer; font-size: 12px; font-weight: 650; }
.pipeline-tab:hover { color: #fff; }
.pipeline-tab.is-active { border-bottom-color: #579dff; color: #579dff; }
.pipeline-tab-panel { display: none; }
.pipeline-tab-panel.is-active { display: block; }
.build-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 56px; padding: 9px 15px; border-bottom: 1px solid #2c333a; background: #151a1e; color: #f1f5f9; }
.build-toolbar > div { display: grid; gap: 2px; }
.build-toolbar strong { font-size: 12px; }
.build-toolbar span { color: #8c9bab; font-size: 9px; }
.build-toolbar input { width: min(240px, 32vw); min-height: 32px; border-color: #45515e; background: #20272d; color: #e2e8f0; font-size: 11px; }
.build-toolbar input::placeholder { color: #8c9bab; }
.pipeline-build-log { min-height: 590px; max-height: 780px; overflow: auto; background: #151a1e; color: #dfe1e6; font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; }
.build-log-row { border-bottom: 1px solid #2c333a; }
.build-log-summary { display: grid; grid-template-columns: 28px 8px minmax(150px, 1fr) minmax(100px, .6fr) 150px 16px; gap: 10px; align-items: center; width: 100%; min-height: 54px; padding: 8px 15px; border: 0; background: transparent; color: inherit; cursor: pointer; text-align: left; }
.build-log-summary:hover { background: #1d252c; }
.build-log-summary > i { width: 7px; height: 7px; border-radius: 50%; background: var(--green-bright); }
.build-log-summary strong { overflow: hidden; color: #dfe1e6; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.build-log-summary span, .build-log-summary time { overflow: hidden; color: #9fadbc; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.build-log-summary b { color: #9fadbc; font-size: 17px; transform: rotate(90deg); }
.build-log-summary[aria-expanded="false"] b { transform: none; }
.build-log-index { color: #579dff !important; }
.build-log-detail { padding: 0 44px 13px 61px; color: #b6c2cf; font-size: 10px; }
.build-log-detail code { color: #85b8ff; }
.build-log-detail pre { margin: 5px 0 0; overflow-wrap: anywhere; color: #b6c2cf; font: inherit; white-space: pre-wrap; }
.build-log-empty { display: grid; min-height: 260px; place-content: center; padding: 30px; color: #8c9bab; font-size: 11px; text-align: center; }

#pipeline-tab-evidence { background: #fff; }
.evidence-note { padding: 11px 12px; border-left: 3px solid #93c5fd; background: #eff6ff; color: #475569; font-size: 10px; line-height: 1.5; }
.pipeline-metric-grid { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: 12px; min-height: 430px; align-content: start; padding: 18px; }
.pipeline-metric-grid article { padding: 17px; border: 1px solid var(--line); border-radius: 10px; background: #fafafa; }
.pipeline-metric-grid span, .pipeline-metric-grid small { display: block; color: var(--muted); font-size: 10px; }
.pipeline-metric-grid strong { display: block; margin: 10px 0 5px; color: var(--text); font-size: 24px; letter-spacing: -.03em; }
.pipeline-artifact-list { display: grid; min-height: 430px; align-content: start; padding: 8px 18px 18px; }
.pipeline-artifact { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 11px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.artifact-icon { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 8px; background: var(--surface-muted); color: #94a3b8; }
.pipeline-artifact.is-recorded .artifact-icon { background: var(--green-soft); color: var(--green); }
.pipeline-artifact strong, .pipeline-artifact code, .pipeline-artifact small { display: block; }
.pipeline-artifact strong { font-size: 12px; }
.pipeline-artifact code { max-width: 560px; margin-top: 2px; overflow: hidden; color: #475569; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.pipeline-artifact small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.pipeline-control-list { display: grid; min-height: 430px; align-content: start; padding: 8px 18px 18px; }
.pipeline-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--line); }
.pipeline-control > div > strong { margin-right: 8px; font-size: 12px; }
.pipeline-control p { margin: 5px 0 3px; color: #475569; font-size: 10px; line-height: 1.45; }
.pipeline-control code { color: var(--muted); font-size: 9px; }
.pipeline-control .button:disabled { cursor: not-allowed; opacity: .48; }
.artifact-download { padding: 7px 10px; border: 1px solid #86efac; border-radius: 7px; background: var(--green-soft); color: #166534; font-size: 10px; font-weight: 800; text-decoration: none; }
.artifact-download:hover { border-color: var(--green); }

@media (max-width: 1180px) {
  .lab-flow { grid-template-columns: repeat(3, 1fr); row-gap: 18px; }
  .lab-flow li:nth-child(3)::after { display: none; }
  .script-map-workspace { grid-template-columns: 220px minmax(340px, 1fr); }
  .script-map-selection { grid-column: 1 / -1; border-top: 1px solid var(--line); border-left: 0; }
  .script-map-selection-list { grid-template-columns: repeat(3, minmax(0, 1fr)); min-height: auto; }
  .pipeline-workbench { grid-template-columns: minmax(260px, 300px) minmax(0, 1fr); }
  .build-log-summary { grid-template-columns: 28px 8px minmax(130px, 1fr) 100px 16px; }
  .build-log-summary time { display: none; }
}

@media (max-width: 900px) {
  .lab-metrics-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
  .dataset-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dataset-workspace { grid-template-columns: 1fr; }
  .dataset-composer { position: static; }
  .lab-detail-grid { grid-template-columns: 1fr; }
  .pipeline-workbench { grid-template-columns: 1fr; }
  .pipeline-run-rail { position: static; }
  .pipeline-phases { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .pipeline-phase { min-height: auto; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }
  .pipeline-phase::after { display: none; }
  .pipeline-rail-actions { border-top: 0; }
  .automation-flow-lanes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .automation-lane:nth-child(2) { border-right: 0; }
  .automation-lane:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 600px) {
  html { scroll-padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .workspace { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .sidebar { height: calc(62px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); }
  .accounts-heading-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .accounts-heading-actions .button { min-width: 0; width: 100%; padding-inline: 9px; font-size: 12px; }
  .accounts-heading-actions .button.primary { grid-column: 1 / -1; }
  .section-tabs { overflow-x: auto; }
  .section-tab { flex: 1 0 auto; }
  .lab-view-tabs { overflow-x: auto; scrollbar-width: none; }
  .lab-view-tabs::-webkit-scrollbar { display: none; }
  .lab-view-tabs .section-tab { flex: 0 0 auto; min-width: 0; gap: 4px; padding-inline: 12px; font-size: 11px; }
  .lab-view-tabs .section-tab span { display: none; }
  .dataset-candidate, .dataset-order-row { grid-template-columns: 24px minmax(0, 1fr); }
  .dataset-candidate dl, .dataset-candidate > .soft-badge, .dataset-order-row > .soft-badge { grid-column: 2; }
  .dataset-order-actions { grid-column: 2; justify-content: flex-start; }
  .dataset-order-item { grid-template-columns: minmax(0, 1fr) auto; }
  .dataset-publication-state, .dataset-publication-action { grid-column: 1 / -1; justify-self: start; }
  .lab-flow { grid-template-columns: 1fr 1fr; }
  .lab-flow li::after { display: none; }
  .experiment-stepper span { display: none; }
  .lab-detail-header { flex-direction: column; }
  .lab-detail-facts > div { grid-template-columns: 1fr; gap: 3px; }
  .experiment-review > div { grid-template-columns: 1fr; gap: 3px; }
  .experiment-footer { flex-wrap: wrap; }
  .experiment-footer .button { flex: 1; }
  .automation-flow-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .automation-flow-lanes { grid-template-columns: 1fr; }
  .automation-lane, .automation-lane:nth-child(2) { border-right: 0; border-bottom: 1px solid var(--line); }
  .automation-lane:last-child { border-bottom: 0; }
  .automation-flow-list-heading { align-items: flex-start; flex-direction: column; gap: 3px; }
  .automation-flow-list > button { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .automation-flow-list > button > span:nth-child(3) { grid-column: 1 / -1; }
  .automation-flow-list > button > b { display: none; }
  .script-map-toolbar { grid-template-columns: 1fr; }
  .script-map-workspace { display: block; min-height: 0; }
  .script-map-source, .script-map-selection { border: 0; border-bottom: 1px solid var(--line); }
  .script-map-browser { min-height: 370px; }
  .script-map-selection-list { grid-template-columns: 1fr; }
  .pipeline-detail-header { align-items: flex-start; flex-direction: column; }
  .pipeline-toolbar { grid-template-columns: minmax(0, 1fr); }
  .pipeline-toolbar select { width: 100%; min-width: 0; }
  .pipeline-table { overflow-x: visible; }
  .pipeline-table-head { display: none; }
  .pipeline-table-row { grid-template-columns: minmax(0, 1fr) auto; gap: 9px 12px; min-width: 0; padding: 14px 16px; }
  .pipeline-table-row > [role="cell"] { min-width: 0; }
  .pipeline-table-row > [role="cell"]:first-child { grid-column: 1; }
  .pipeline-table-row > [role="cell"]:nth-child(2) { grid-column: 2; justify-self: end; }
  .pipeline-table-row > .pipeline-table-secondary { display: grid; grid-column: 1 / -1; grid-template-columns: 70px minmax(0, 1fr); column-gap: 9px; }
  .pipeline-table-row > .pipeline-table-secondary::before { grid-row: 1 / 3; align-self: start; padding-top: 1px; }
  .pipeline-table-row > time, .pipeline-table-row > .pipeline-duration { display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: 10px; }
  .pipeline-table-row > time { grid-column: 1; }
  .pipeline-table-row > .pipeline-duration { grid-column: 2; justify-self: end; }
  .pipeline-table-row [data-label]::before { color: #94a3b8; content: attr(data-label); font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
  .pipeline-table-row > .pipeline-open { display: none; }
  .pipeline-phases { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pipeline-tabs { gap: 16px; overflow-x: auto; }
  .pipeline-tab { flex: 0 0 auto; }
  .build-toolbar { align-items: flex-start; flex-direction: column; }
  .build-toolbar label, .build-toolbar input { width: 100%; }
  .build-log-summary { grid-template-columns: 24px 7px minmax(120px, 1fr) 16px; }
  .build-log-summary > span:not(.build-log-index), .build-log-summary time { display: none; }
  .build-log-detail { padding-left: 52px; }
  .pipeline-metric-grid { grid-template-columns: 1fr; }
  .pipeline-artifact { grid-template-columns: 32px minmax(0, 1fr); }
  .pipeline-artifact > .soft-badge { grid-column: 2; justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
