:root {
  --bg: #0b0d0f;
  --bg-raised: #101316;
  --panel: #14181c;
  --panel-strong: #181d22;
  --panel-soft: #111519;
  --line: #272d33;
  --line-strong: #343c44;
  --text: #f3f5f6;
  --muted: #959fa8;
  --muted-strong: #bcc3c8;
  --accent: #e8ff63;
  --accent-dim: rgba(232, 255, 99, .12);
  --accent-ink: #111500;
  --blue: #72a7ff;
  --blue-dim: rgba(114, 167, 255, .13);
  --violet: #b49cff;
  --violet-dim: rgba(180, 156, 255, .14);
  --orange: #ffad68;
  --orange-dim: rgba(255, 173, 104, .13);
  --red: #ff7474;
  --red-dim: rgba(255, 116, 116, .12);
  --green: #6ee7a2;
  --green-dim: rgba(110, 231, 162, .12);
  --yellow: #f5d769;
  --yellow-dim: rgba(245, 215, 105, .12);
  --sidebar-width: 250px;
  --topbar-height: 68px;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 60px rgba(0, 0, 0, .3);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.5; }
button, input, textarea, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
::selection { color: var(--accent-ink); background: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 1000; top: 8px; left: 8px; transform: translateY(-160%); padding: 10px 14px; border-radius: 8px; color: var(--accent-ink); background: var(--accent); text-decoration: none; font-weight: 800; }
.skip-link:focus { transform: translateY(0); }
.is-hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: .92em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-shell { min-height: 100vh; }
.topbar { position: fixed; z-index: 50; inset: 0 0 auto 0; height: var(--topbar-height); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--line); background: rgba(11,13,15,.91); backdrop-filter: blur(18px); }
.brand-wrap, .topbar-actions, .brand, .identity-button, .system-state, .command-trigger { display: flex; align-items: center; }
.brand-wrap { gap: 10px; }
.brand { gap: 11px; text-decoration: none; }
.brand > span:last-child { display: grid; line-height: 1.05; }
.brand strong { font-size: 15px; letter-spacing: .01em; }
.brand small { margin-top: 5px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.brand-mark { position: relative; display: grid; grid-template-columns: repeat(2, 8px); gap: 3px; width: 27px; height: 27px; padding: 4px; border: 1px solid #4a5229; border-radius: 7px; background: var(--accent-dim); transform: rotate(45deg); }
.brand-mark span { border-radius: 2px; background: var(--accent); }
.topbar-actions { gap: 10px; }
.system-state { gap: 8px; padding-right: 12px; color: var(--muted-strong); font-size: 12px; }
.status-dot { display: inline-block; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 99px; background: var(--muted); box-shadow: 0 0 0 4px rgba(149,159,168,.08); }
.status-dot--success { background: var(--green); box-shadow: 0 0 0 4px var(--green-dim); }
.status-dot--warning { background: var(--yellow); box-shadow: 0 0 0 4px var(--yellow-dim); }
.status-dot--danger { background: var(--red); box-shadow: 0 0 0 4px var(--red-dim); }
.status-dot--neutral { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }
.command-trigger, .identity-button, .icon-button { border: 1px solid var(--line); background: var(--panel-soft); cursor: pointer; }
.command-trigger { gap: 8px; min-height: 38px; padding: 0 10px; border-radius: 9px; color: var(--muted-strong); font-size: 12px; }
kbd { padding: 2px 6px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--muted); background: #0d1012; font: 10px/1.5 "SFMono-Regular", Consolas, monospace; }
.identity-button { gap: 9px; min-width: 190px; min-height: 44px; padding: 4px 9px 4px 5px; border-radius: 11px; text-align: left; }
.identity-button:hover, .command-trigger:hover, .icon-button:hover { border-color: var(--line-strong); background: var(--panel-strong); }
.avatar { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 9px; color: var(--accent-ink); background: var(--accent); font-size: 12px; font-weight: 900; }
.identity-copy { display: grid; flex: 1; min-width: 0; line-height: 1.1; }
.identity-copy strong, .identity-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity-copy strong { font-size: 12px; }
.identity-copy small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.icon-button { display: inline-grid; place-items: center; width: 35px; height: 35px; padding: 0; border-radius: 9px; font-size: 18px; }
.mobile-nav-toggle { display: none; }

.sidebar { position: fixed; z-index: 40; inset: var(--topbar-height) auto 0 0; display: flex; flex-direction: column; justify-content: space-between; width: var(--sidebar-width); padding: 18px 13px 14px; border-right: 1px solid var(--line); background: #0d1012; overflow-y: auto; }
.sidebar nav { display: grid; gap: 3px; }
.nav-label { margin: 8px 10px 7px; color: #626d75; font-size: 9px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.nav-label--secondary { margin-top: 23px; }
.nav-item { display: flex; align-items: center; min-height: 42px; gap: 11px; padding: 0 10px; border: 1px solid transparent; border-radius: 9px; color: var(--muted-strong); text-decoration: none; font-size: 12px; font-weight: 650; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.nav-item:hover { color: var(--text); background: var(--panel-soft); }
.nav-item.is-active { color: var(--text); border-color: #2f3721; background: linear-gradient(90deg, var(--accent-dim), rgba(232,255,99,.03)); }
.nav-item.is-active .nav-icon { color: var(--accent); }
.nav-icon { display: inline-grid; place-items: center; width: 19px; color: #75808a; font-size: 16px; }
.nav-count { margin-left: auto; min-width: 22px; padding: 1px 6px; border-radius: 99px; color: var(--muted); background: var(--panel-strong); text-align: center; font-size: 10px; }
.nav-count--attention:not(:empty) { color: var(--yellow); background: var(--yellow-dim); }
.sidebar-foot { display: grid; gap: 10px; }
.runtime-card { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-soft); }
.runtime-card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.runtime-card strong { display: block; font-size: 12px; }
.runtime-card small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.docs-link { display: flex; justify-content: space-between; padding: 8px 6px; color: var(--muted); font-size: 11px; text-decoration: none; }
.docs-link:hover { color: var(--text); }

main { min-height: 100vh; margin-left: var(--sidebar-width); padding: calc(var(--topbar-height) + 35px) 34px 50px; }
.page { display: none; max-width: 1580px; margin: 0 auto; }
.page.is-active { display: block; animation: page-in .18s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 26px; margin-bottom: 27px; }
.page-header--hero { align-items: center; min-height: 135px; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 9px; font-weight: 850; letter-spacing: .19em; text-transform: uppercase; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { max-width: 850px; margin: 0; font-size: clamp(27px, 3.1vw, 44px); line-height: 1.06; letter-spacing: -.035em; }
h2 { margin: 0; font-size: 16px; letter-spacing: -.012em; }
h3 { margin: 0; font-size: 13px; }
.lede { max-width: 780px; margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.page-actions, .toolbar-actions, .modal-actions, .form-actions { display: flex; align-items: center; gap: 9px; }
.button { min-height: 39px; padding: 0 15px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--text); background: var(--panel-strong); cursor: pointer; font-size: 11px; font-weight: 780; letter-spacing: .015em; transition: transform .12s ease, background .12s ease, border-color .12s ease; }
.button:hover { transform: translateY(-1px); border-color: #4a545e; }
.button:active { transform: translateY(0); }
.button:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.button--primary { color: var(--accent-ink); border-color: var(--accent); background: var(--accent); }
.button--primary:hover { background: #f0ff8b; }
.button--secondary { background: transparent; }
.button--danger { color: var(--red); border-color: rgba(255,116,116,.32); background: var(--red-dim); }
.button--small { min-height: 33px; padding: 0 11px; font-size: 10px; }
.text-button, .text-link { padding: 0; border: 0; color: var(--muted-strong); background: none; cursor: pointer; font-size: 10px; font-weight: 700; text-decoration: none; }
.text-button:hover, .text-link:hover { color: var(--accent); }

.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 1px 0 rgba(255,255,255,.015) inset; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 69px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.panel-header .eyebrow { margin-bottom: 5px; color: var(--muted); }
.panel-header.compact { min-height: 53px; padding: 10px 13px; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.metric-card { position: relative; min-height: 116px; padding: 17px; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; right: -35px; bottom: -52px; width: 115px; height: 115px; border: 1px solid rgba(232,255,99,.09); border-radius: 50%; }
.metric-card__top { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; font-weight: 740; text-transform: uppercase; letter-spacing: .08em; }
.metric-card__icon { display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid var(--line); border-radius: 8px; color: var(--accent); background: var(--accent-dim); font-size: 13px; }
.metric-card strong { display: block; margin-top: 15px; font-size: 28px; line-height: 1; letter-spacing: -.03em; }
.metric-card small { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; }
.overview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.panel--span-2 { grid-column: span 2; }

.table-shell { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 15px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
td { font-size: 11px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr[data-selectable] { cursor: pointer; }
tbody tr[data-selectable]:hover { background: rgba(255,255,255,.018); }
.status-badge, .kind-badge, .version-pill, .effect-badge, .role-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 99px; font-size: 9px; font-weight: 780; white-space: nowrap; }
.status-badge::before { content: ""; width: 5px; height: 5px; border-radius: 99px; background: currentColor; }
.status-badge--completed, .status-badge--succeeded, .status-badge--available, .status-badge--approved { color: var(--green); background: var(--green-dim); }
.status-badge--running, .status-badge--starting, .status-badge--pending { color: var(--blue); background: var(--blue-dim); }
.status-badge--waiting_approval, .status-badge--waiting_reconciliation, .status-badge--requires_attention, .status-badge--retry { color: var(--yellow); background: var(--yellow-dim); }
.status-badge--failed, .status-badge--rejected, .status-badge--expired, .status-badge--cancelled, .status-badge--completed_with_errors, .status-badge--outcome_unknown, .status-badge--still_unknown { color: var(--red); background: var(--red-dim); }
.status-badge--waiting_input, .status-badge--skipped, .status-badge--neutral { color: var(--muted-strong); background: rgba(149,159,168,.1); }
.stack-list, .decision-list { display: grid; }
.stack-item { display: flex; align-items: flex-start; gap: 12px; padding: 14px 17px; border-bottom: 1px solid var(--line); }
.stack-item:last-child { border-bottom: 0; }
.stack-item__icon { display: grid; place-items: center; flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px; color: var(--yellow); background: var(--yellow-dim); }
.stack-item__body { min-width: 0; flex: 1; }
.stack-item strong { display: block; font-size: 11px; }
.stack-item small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.graph-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.graph-mini-card { min-width: 0; padding: 17px; background: var(--panel); cursor: pointer; }
.graph-mini-card:hover { background: var(--panel-strong); }
.graph-mini-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.graph-mini-card h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.graph-mini-card p { margin: 7px 0 13px; color: var(--muted); font-size: 10px; }
.mini-graph { position: relative; height: 49px; }
.mini-node { position: absolute; top: 12px; width: 25px; height: 25px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--panel-soft); }
.mini-node:nth-child(1) { left: 0; }.mini-node:nth-child(2) { left: 34%; }.mini-node:nth-child(3) { right: 0; }
.mini-node::after { content: ""; position: absolute; z-index: -1; top: 11px; left: 24px; width: calc((100vw - 250px) / 16); max-width: 68px; height: 1px; background: var(--line-strong); }
.mini-node:last-child::after { display: none; }
.assurance-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.assurance-list li { display: flex; gap: 13px; padding: 14px 17px; border-bottom: 1px solid var(--line); }
.assurance-list li:last-child { border-bottom: 0; }
.assurance-list > li > span { color: var(--accent); font: 9px/1.4 "SFMono-Regular", Consolas, monospace; }
.assurance-list strong, .assurance-list small { display: block; }
.assurance-list strong { font-size: 11px; }.assurance-list small { margin-top: 3px; color: var(--muted); font-size: 9px; }

.empty-state { display: grid; place-items: center; min-height: 260px; padding: 36px; text-align: center; }
.empty-state--compact { min-height: 180px; padding: 24px 18px; }
.empty-state strong { font-size: 12px; }
.empty-state p { max-width: 300px; margin: 7px auto 0; color: var(--muted); font-size: 10px; }
.empty-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 13px; color: var(--accent); background: var(--accent-dim); font-size: 20px; }
.loading-block { display: grid; gap: 10px; padding: 18px; }
.loading-block span { height: 11px; border-radius: 5px; background: linear-gradient(90deg, var(--panel-strong), #22282e, var(--panel-strong)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.loading-block span:nth-child(2) { width: 74%; }.loading-block span:nth-child(3) { width: 48%; }
@keyframes shimmer { to { background-position: -200% 0; } }

.studio-layout { display: grid; grid-template-columns: 225px minmax(480px, 1fr) 275px; gap: 12px; min-height: calc(100vh - 205px); }
.studio-list, .inspector { align-self: stretch; overflow: hidden; }
.studio-workspace { display: grid; grid-template-rows: auto minmax(520px, 1fr); gap: 12px; min-width: 0; }
.studio-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; padding: 9px 12px; }
.breadcrumbs { display: flex; align-items: center; min-width: 0; gap: 7px; color: var(--muted); font-size: 10px; }
.breadcrumbs strong { max-width: 220px; overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.version-pill { color: var(--accent); background: var(--accent-dim); }
.segmented-control { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-soft); }
.segmented-control button { min-height: 27px; padding: 0 10px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; cursor: pointer; font-size: 9px; font-weight: 750; }
.segmented-control button.is-active { color: var(--text); background: var(--panel-strong); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.save-state { color: var(--muted); font-size: 9px; }
.search-field { display: flex; align-items: center; gap: 8px; margin: 11px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: var(--panel-soft); }
.search-field input { min-width: 0; width: 100%; height: 35px; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 10px; }
.search-field--wide { width: min(430px, 100%); margin: 0; }
.resource-list { overflow-y: auto; }
.resource-item { position: relative; display: grid; gap: 5px; padding: 12px 13px; border: 0; border-bottom: 1px solid var(--line); color: var(--text); background: transparent; cursor: pointer; text-align: left; width: 100%; }
.resource-item:hover { background: rgba(255,255,255,.018); }
.resource-item.is-selected { background: var(--accent-dim); }
.resource-item.is-selected::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 2px; border-radius: 3px; background: var(--accent); }
.resource-item__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.resource-item strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.resource-item small { color: var(--muted); font-size: 9px; }
.resource-meta { display: flex; gap: 8px; color: var(--muted); font-size: 8px; }
.studio-canvas { position: relative; min-width: 0; overflow: hidden; }
.graph-canvas { position: absolute; inset: 0; overflow: auto; background-color: #111519; background-image: radial-gradient(#30373d 0.65px, transparent 0.65px); background-size: 20px 20px; }
.graph-canvas svg { display: block; min-width: 100%; min-height: 100%; }
.graph-edge { fill: none; stroke: #3e4850; stroke-width: 1.5; }
.graph-edge--error { stroke: var(--red); stroke-dasharray: 5 5; opacity: .8; }
.graph-edge--control { stroke: var(--orange); stroke-dasharray: 3 4; }
.graph-edge-label { fill: #77828b; font-size: 9px; font-family: ui-monospace, monospace; }
.graph-node { cursor: pointer; filter: drop-shadow(0 9px 15px rgba(0,0,0,.22)); }
.graph-node rect.node-body { fill: #181d22; stroke: #343c44; stroke-width: 1; rx: 10; }
.graph-node:hover rect.node-body, .graph-node.is-selected rect.node-body { stroke: var(--accent); stroke-width: 1.5; }
.graph-node .node-stripe { fill: var(--blue); }
.graph-node--agent .node-stripe, .graph-node--model-step .node-stripe { fill: var(--violet); }
.graph-node--activity .node-stripe { fill: var(--orange); }
.graph-node--approval .node-stripe { fill: var(--yellow); }
.graph-node--sink .node-stripe { fill: var(--green); }
.graph-node text { pointer-events: none; fill: var(--text); font-size: 11px; font-weight: 700; }
.graph-node .node-kind { fill: #84909a; font-size: 8px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.graph-port { fill: #0e1113; stroke: #5a6670; }
.canvas-legend { position: absolute; right: 12px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 12px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: rgba(14,17,19,.9); font-size: 8px; backdrop-filter: blur(10px); }
.canvas-legend span { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--blue); }.legend-dot--model { background: var(--violet); }.legend-dot--effect { background: var(--orange); }.legend-dot--approval { background: var(--yellow); }
.editor-head { display: flex; align-items: center; justify-content: space-between; height: 42px; padding: 0 13px; border-bottom: 1px solid var(--line); color: var(--muted); font: 9px/1.2 "SFMono-Regular", Consolas, monospace; }
.code-editor { display: block; width: 100%; height: calc(100% - 42px); min-height: 500px; padding: 19px; resize: none; border: 0; outline: 0; color: #dce4e8; background: #0f1214; font: 11px/1.7 "SFMono-Regular", Consolas, monospace; tab-size: 2; }
.inspector-section { padding: 15px; border-bottom: 1px solid var(--line); }
.inspector-section:last-child { border-bottom: 0; }
.inspector-section__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.inspector-section h3 { color: var(--muted); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.inspector-title { display: flex; gap: 10px; align-items: center; }
.node-symbol { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--accent); background: var(--accent-dim); font-weight: 900; }
.definition-list { display: grid; }
.definition-row { display: grid; grid-template-columns: minmax(100px, .6fr) 1fr; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.definition-row:last-child { border-bottom: 0; }
.definition-row dt { color: var(--muted); font-size: 9px; }.definition-row dd { margin: 0; min-width: 0; font-size: 10px; overflow-wrap: anywhere; }
.config-preview { max-height: 220px; overflow: auto; padding: 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted-strong); background: #0f1214; white-space: pre-wrap; font: 9px/1.6 "SFMono-Regular", Consolas, monospace; }
.findings-view { height: 100%; overflow: auto; padding: 15px; }
.finding { display: grid; grid-template-columns: auto 1fr; gap: 11px; padding: 12px; margin-bottom: 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-soft); }
.finding__mark { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: var(--yellow); background: var(--yellow-dim); font-weight: 900; }
.finding--error .finding__mark { color: var(--red); background: var(--red-dim); }
.finding strong { display: block; font: 9px/1.4 "SFMono-Regular", Consolas, monospace; }
.finding p { margin: 4px 0; color: var(--muted-strong); font-size: 10px; }
.finding small { color: var(--muted); font: 8px/1.4 "SFMono-Regular", Consolas, monospace; }

.split-panels, .approval-layout, .settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.resource-table { overflow-x: auto; }
.resource-table .resource-row { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(90px,.65fr) auto; gap: 14px; align-items: center; min-height: 70px; padding: 12px 17px; border-bottom: 1px solid var(--line); }
.resource-table .resource-row:last-child { border-bottom: 0; }
.resource-row__primary { min-width: 0; }
.resource-row__primary strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.resource-row__primary small, .resource-row__meta small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.resource-row__meta { min-width: 0; }

.run-layout { display: grid; grid-template-columns: 265px minmax(0, 1fr); gap: 14px; min-height: 650px; }
.run-list-panel { overflow: hidden; }
.run-detail-panel { min-width: 0; overflow: hidden; }
.run-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 18px; border-bottom: 1px solid var(--line); }
.run-detail-title { min-width: 0; }
.run-detail-title h2 { display: flex; align-items: center; gap: 10px; }
.run-detail-title p { margin: 6px 0 0; color: var(--muted); font-size: 9px; }
.run-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.run-summary-item { padding: 13px 15px; background: var(--panel); }
.run-summary-item small, .run-summary-item strong { display: block; }
.run-summary-item small { color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .08em; }
.run-summary-item strong { margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.run-detail-tabs { display: flex; gap: 3px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.run-detail-tabs button { padding: 6px 10px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; font-size: 9px; font-weight: 700; }
.run-detail-tabs button.is-active { color: var(--text); background: var(--panel-strong); }
.run-tab-panel { max-height: 610px; overflow: auto; }
.node-run-list { display: grid; }
.node-run-row { display: grid; grid-template-columns: 28px minmax(0, 1.25fr) .75fr auto; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.node-run-row:last-child { border-bottom: 0; }
.node-run-index { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font: 8px/1 ui-monospace, monospace; }
.node-run-row strong, .node-run-row small { display: block; }.node-run-row strong { font-size: 10px; }.node-run-row small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.event-timeline { position: relative; padding: 10px 17px 18px 36px; }
.event-timeline::before { content: ""; position: absolute; top: 17px; bottom: 18px; left: 22px; width: 1px; background: var(--line); }
.event-item { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 10px 0 10px 5px; }
.event-item::before { content: ""; position: absolute; top: 16px; left: -18px; width: 7px; height: 7px; border: 2px solid var(--panel); border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 1px var(--line-strong); }
.event-item strong { display: block; font-size: 9px; }.event-item p { margin: 4px 0 0; color: var(--muted); font: 8px/1.5 ui-monospace, monospace; }.event-item time { color: var(--muted); font-size: 8px; }
.artifact-list { display: grid; }
.artifact-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.artifact-row strong { display: block; font: 9px/1.4 ui-monospace, monospace; }.artifact-row small { color: var(--muted); font-size: 8px; }

.decision-card { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.decision-card:last-child { border-bottom: 0; }
.decision-card__top, .decision-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.decision-card h3 { margin-top: 12px; }
.decision-card p { margin: 6px 0 13px; color: var(--muted); font-size: 10px; }
.decision-card__meta { display: flex; flex-wrap: wrap; gap: 8px 12px; color: var(--muted); font: 8px/1.4 ui-monospace, monospace; }
.decision-card__foot { margin-top: 14px; }

.usage-budget-banner { display: flex; align-items: center; gap: 10px; min-height: 47px; margin-bottom: 15px; padding: 11px 15px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--muted-strong); background: var(--panel-soft); font-size: 10px; }
.usage-budget-banner strong { color: var(--text); }
.usage-filterbar { display: flex; align-items: flex-end; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); }
.usage-filterbar label { min-width: 145px; }
.usage-filter-actions { display: flex; align-items: center; margin-left: auto; }
.usage-table th:not(:first-child), .usage-table td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.usage-table td:first-child { max-width: 360px; overflow-wrap: anywhere; }

.inventory-filterbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px; border-bottom: 1px solid var(--line); }
select, input, textarea { border: 1px solid var(--line-strong); border-radius: 9px; color: var(--text); background: var(--panel-soft); }
select { min-height: 36px; padding: 0 30px 0 10px; font-size: 10px; }
.inventory-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.primitive-card { min-width: 0; min-height: 190px; padding: 17px; background: var(--panel); }
.primitive-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kind-badge { color: var(--blue); background: var(--blue-dim); }
.primitive-card h3 { margin-top: 14px; font-family: ui-monospace, monospace; }
.primitive-card p { min-height: 44px; margin: 8px 0; color: var(--muted); font-size: 9px; }
.primitive-card__meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.effect-badge { color: var(--muted-strong); background: rgba(149,159,168,.09); }
.effect-badge--external-read { color: var(--violet); background: var(--violet-dim); }.effect-badge--external-write, .effect-badge--destructive { color: var(--orange); background: var(--orange-dim); }
.primitive-digest { display: block; margin-top: 13px; overflow: hidden; color: #66717a; text-overflow: ellipsis; white-space: nowrap; font: 8px/1.4 ui-monospace, monospace; }

.settings-grid .panel { padding-bottom: 4px; }
.settings-grid .definition-list, .settings-grid > .panel > p, .settings-grid form { margin: 0 18px 18px; }
.topology { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 175px; padding: 24px; overflow-x: auto; }
.topology > div { display: grid; place-items: center; min-width: 120px; min-height: 75px; padding: 12px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--panel-soft); text-align: center; }
.topology span, .topology small { display: block; }.topology span { font-size: 10px; font-weight: 750; }.topology small { margin-top: 5px; color: var(--muted); font-size: 8px; }.topology i { color: var(--accent); font-style: normal; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-span-2 { grid-column: span 2; }
label { display: grid; gap: 6px; color: var(--muted-strong); font-size: 9px; font-weight: 680; }
label input, label textarea, label select { width: 100%; padding: 10px 11px; outline: 0; }
label input:focus, label textarea:focus, label select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
label textarea { resize: vertical; min-height: 84px; color: #dce4e8; font: 10px/1.6 "SFMono-Regular", Consolas, monospace; }
.form-actions { justify-content: flex-end; }
.role-badge { color: var(--accent); background: var(--accent-dim); }

.modal { width: min(560px, calc(100vw - 28px)); max-height: min(88vh, 900px); padding: 0; border: 1px solid var(--line-strong); border-radius: 15px; color: var(--text); background: var(--panel); box-shadow: var(--shadow); }
.modal--wide { width: min(760px, calc(100vw - 28px)); }
.modal::backdrop { background: rgba(0,0,0,.67); backdrop-filter: blur(5px); }
.modal-shell { display: grid; gap: 17px; padding: 21px; overflow: auto; max-height: 88vh; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.modal-head h2 { font-size: 19px; }
.modal-copy { margin: -4px 0 0; color: var(--muted); font-size: 10px; }
.modal-actions { justify-content: flex-end; padding-top: 3px; }
.modal-actions--split { justify-content: space-between; }
.command-search { display: flex; grid-template: none; align-items: center; gap: 10px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--muted); background: var(--panel-soft); }
.command-search input { width: 100%; min-height: 43px; padding: 0; border: 0; outline: 0; background: transparent; }
.command-list { display: grid; gap: 4px; }
.command-item { display: grid; grid-template-columns: 31px minmax(0,1fr) auto; gap: 11px; align-items: center; width: 100%; padding: 9px; border: 1px solid transparent; border-radius: 9px; color: var(--text); background: transparent; cursor: pointer; text-align: left; }
.command-item:hover, .command-item.is-active { border-color: var(--line); background: var(--panel-strong); }
.command-item__icon { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 8px; color: var(--accent); background: var(--accent-dim); }
.command-item strong, .command-item small { display: block; }.command-item strong { font-size: 10px; }.command-item small { margin-top: 3px; color: var(--muted); font-size: 8px; }.command-item kbd { justify-self: end; }
.builder-result, .decision-context { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-soft); }
.builder-result h3 { margin-bottom: 8px; }.builder-result p { color: var(--muted-strong); font-size: 10px; }.builder-result pre, .decision-context pre { max-height: 240px; overflow: auto; margin: 10px 0 0; white-space: pre-wrap; color: var(--muted); font: 9px/1.55 ui-monospace, monospace; }
.decision-context dl { margin: 0; }

.toast-region { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: grid; gap: 9px; width: min(370px, calc(100vw - 36px)); }
.toast { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 11px; align-items: start; padding: 13px; border: 1px solid var(--line-strong); border-radius: 11px; background: #191e22; box-shadow: var(--shadow); animation: toast-in .18s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(7px); } }
.toast__icon { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; color: var(--green); background: var(--green-dim); }
.toast--error .toast__icon { color: var(--red); background: var(--red-dim); }
.toast--warning .toast__icon { color: var(--yellow); background: var(--yellow-dim); }
.toast strong, .toast small { display: block; }.toast strong { font-size: 10px; }.toast small { margin-top: 3px; color: var(--muted); font-size: 9px; }.toast button { padding: 0; border: 0; color: var(--muted); background: transparent; cursor: pointer; }

@media (max-width: 1250px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .studio-layout { grid-template-columns: 205px minmax(460px, 1fr); }
  .inspector { display: none; }
  .inventory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  :root { --sidebar-width: 224px; }
  .system-state, .command-trigger { display: none; }
  .overview-grid { grid-template-columns: 1fr 1fr; }
  .panel--span-2 { grid-column: span 2; }
  .graph-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .studio-layout { grid-template-columns: 190px minmax(420px, 1fr); overflow-x: auto; }
  .split-panels, .approval-layout { grid-template-columns: 1fr; }
  .run-layout { grid-template-columns: 230px minmax(500px, 1fr); overflow-x: auto; }
}

@media (max-width: 760px) {
  :root { --topbar-height: 61px; }
  .mobile-nav-toggle { display: inline-grid; }
  .brand small { display: none; }
  .identity-button { min-width: auto; }
  .identity-copy, .identity-button > span:last-child { display: none; }
  .sidebar { transform: translateX(-105%); width: min(280px, 88vw); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.is-open { transform: translateX(0); }
  main { margin-left: 0; padding: calc(var(--topbar-height) + 25px) 16px 35px; }
  .page-header, .page-header--hero { align-items: flex-start; flex-direction: column; min-height: 0; }
  .page-actions { width: 100%; }
  .page-actions .button { flex: 1; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
  .panel--span-2 { grid-column: auto; }
  .graph-card-grid { grid-template-columns: 1fr; }
  .studio-layout { display: block; min-height: auto; overflow: visible; }
  .studio-list { margin-bottom: 12px; max-height: 270px; }
  .studio-workspace { grid-template-rows: auto 620px; }
  .studio-toolbar { align-items: stretch; flex-direction: column; }
  .segmented-control { align-self: flex-start; }
  .toolbar-actions { justify-content: flex-end; }
  .run-layout { display: block; min-height: auto; overflow: visible; }
  .run-list-panel { max-height: 350px; margin-bottom: 12px; }
  .run-detail-panel { min-height: 450px; }
  .run-summary-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .node-run-row { grid-template-columns: 25px minmax(0,1fr) auto; }
  .node-run-row > :nth-child(3) { display: none; }
  .inventory-grid { grid-template-columns: 1fr; }
  .inventory-filterbar { align-items: stretch; flex-direction: column; }
  .usage-filterbar { align-items: stretch; flex-direction: column; }
  .usage-filterbar label { min-width: 0; }
  .usage-filter-actions { width: 100%; margin-left: 0; }
  .usage-filter-actions .button { flex: 1; }
  .search-field--wide { width: 100%; }
  .settings-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-span-2 { grid-column: auto; }
  .topology { justify-content: flex-start; }
  .resource-table .resource-row { grid-template-columns: minmax(0,1fr) auto; }
  .resource-row__meta { display: none; }
}

@media (max-width: 440px) {
  .topbar { padding: 0 11px; }
  h1 { font-size: 29px; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-card { min-height: 104px; padding: 13px; }
  .metric-card strong { font-size: 23px; }
  .button { padding-inline: 11px; }
  .modal-shell { padding: 17px; }
}

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