:root {
  --ink: #dce8f3;
  --muted: #8092a5;
  --faint: #506376;
  --bg: #07111d;
  --panel: #0c1a29;
  --panel-2: #102337;
  --line: #1d354b;
  --line-soft: #172b3d;
  --teal: #5ee0cf;
  --teal-dim: #2da99f;
  --orange: #ffb76b;
  --rose: #f28a9b;
  --purple: #af9dff;
  --shadow: 0 16px 40px rgba(0, 0, 0, .24);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: Manrope, system-ui, sans-serif; }
body { min-width: 1080px; }
button, select { font: inherit; }
button { color: inherit; }
.app-shell { display: flex; min-height: 100vh; background: radial-gradient(circle at 80% -10%, #15334d 0, transparent 34rem), var(--bg); }
.sidebar { width: 240px; flex: 0 0 240px; padding: 26px 16px 18px; border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; background: rgba(5, 14, 24, .45); }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 12px 38px; font-size: 15px; font-weight: 800; letter-spacing: -.02em; }
.brand-mark { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; color: #07111d; background: var(--teal); font-size: 18px; }
.eyebrow { margin: 0; font: 500 10px/1.2 'DM Mono', monospace; letter-spacing: .13em; color: var(--faint); }
.eyebrow.accent { color: var(--teal); }
.workflow-picker { margin: 12px 0 30px; padding: 12px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); font-size: 12px; font-weight: 700; }
.status-dot, .live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px rgba(94, 224, 207, .1); }
.version-badge { margin-left: auto; padding: 3px 6px; border-radius: 4px; color: var(--teal); background: rgba(94, 224, 207, .1); font: 500 10px 'DM Mono', monospace; }
.version-badge.large { padding: 7px 9px; font-size: 12px; }
.side-nav { display: grid; gap: 5px; }
.nav-item { padding: 10px 11px; display: flex; gap: 10px; align-items: center; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); text-align: left; font-size: 12px; cursor: pointer; }
.nav-item:hover, .nav-item.active { border-color: var(--line); background: var(--panel); color: var(--ink); }
.nav-item.active { box-shadow: inset 2px 0 var(--teal); }
.nav-icon { width: 15px; color: var(--teal); font-size: 16px; text-align: center; }
.sidebar-note { margin-top: auto; padding: 13px; display: flex; gap: 9px; border: 1px solid #243746; border-radius: 8px; background: linear-gradient(135deg, rgba(94, 224, 207, .08), rgba(10, 26, 40, .7)); color: var(--muted); font-size: 10px; line-height: 1.6; }
.sidebar-note strong { color: var(--ink); font-size: 10px; }
.note-icon { color: var(--teal); font-size: 17px; }
.sidebar-footer { padding: 17px 10px 0; display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 10px; }
.sidebar-footer .mono { margin-left: auto; }
.mono { font: 10px 'DM Mono', monospace; letter-spacing: .01em; }
.main-content { min-width: 0; flex: 1; padding: 0 38px; }
.topbar { height: 72px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line-soft); }
.breadcrumb { display: flex; align-items: center; gap: 11px; color: var(--faint); font-size: 11px; }
.breadcrumb strong { color: var(--ink); font-weight: 600; }
.crumb-slash { color: var(--line); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.upload-button, .ghost-button { padding: 8px 11px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); font-size: 11px; cursor: pointer; }
.upload-button:hover, .ghost-button:hover { border-color: var(--teal-dim); background: var(--panel-2); }
.upload-button span { margin-right: 5px; color: var(--teal); font-size: 15px; }
.ghost-button { color: var(--muted); }
.page-heading { padding: 36px 0 28px; display: flex; justify-content: space-between; align-items: end; gap: 30px; }
h1, h2, p { margin-top: 0; }
h1 { margin: 8px 0 8px; font-size: clamp(26px, 3vw, 34px); letter-spacing: -.045em; line-height: 1.1; }
h1 span { color: var(--muted); font-size: .48em; font-weight: 500; letter-spacing: .01em; vertical-align: middle; }
.lede { margin: 0; color: var(--muted); font-size: 12px; }
.metric-strip { display: flex; gap: 28px; padding-bottom: 2px; }
.metric { min-width: 72px; display: grid; gap: 4px; border-left: 1px solid var(--line); padding-left: 13px; }
.metric-value { font-size: 21px; font-weight: 700; letter-spacing: -.04em; }
.metric-label { color: var(--muted); font: 9px 'DM Mono', monospace; text-transform: uppercase; letter-spacing: .06em; }
.metric.warning .metric-value { color: var(--orange); }
.view-tabs { display: flex; border-bottom: 1px solid var(--line); gap: 3px; }
.view-tab { padding: 13px 17px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--faint); cursor: pointer; font: 10px 'DM Mono', monospace; text-align: left; }
.view-tab span { margin-left: 7px; color: var(--muted); font: 600 11px Manrope, sans-serif; }
.view-tab:hover { color: var(--ink); }
.view-tab.active { border-color: var(--teal); color: var(--teal); }
.view-tab.active span { color: var(--ink); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 278px; gap: 17px; padding: 17px 0 26px; }
.canvas-column { min-width: 0; }
.toolbar { min-height: 45px; display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 0 0 12px; }
.toolbar-title { display: flex; align-items: baseline; gap: 10px; color: var(--muted); font-size: 11px; }
.toolbar-kicker { color: var(--teal); font: 500 10px 'DM Mono', monospace; letter-spacing: .08em; }
.toolbar-controls { display: flex; gap: 10px; align-items: center; }
.toggle-control { display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: 10px; cursor: pointer; user-select: none; }
.toggle-control input { position: absolute; opacity: 0; }
.toggle { width: 27px; height: 15px; padding: 2px; border-radius: 10px; background: var(--line); transition: .2s; }
.toggle:after { content: ''; display: block; width: 11px; height: 11px; border-radius: 50%; background: var(--muted); transition: .2s; }
.toggle-control input:checked + .toggle { background: var(--teal-dim); }
.toggle-control input:checked + .toggle:after { transform: translateX(12px); background: #fff; }
.filter-control { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 5px; outline: none; background: var(--panel); color: var(--ink); font-size: 10px; }
.view-panel[hidden] { display: none; }
.subworkflow-card, .authored-canvas, .compiled-wrap { min-height: 386px; border: 1px solid var(--line); border-radius: 9px; background: linear-gradient(145deg, rgba(16, 35, 55, .86), rgba(8, 20, 32, .86)); box-shadow: var(--shadow); }
.subworkflow-card { padding: 25px 25px 18px; }
.subworkflow-head { display: flex; justify-content: space-between; align-items: start; }
.pill { display: inline-block; padding: 4px 6px; border-radius: 4px; font: 500 9px 'DM Mono', monospace; letter-spacing: .08em; }
.pill.teal { background: rgba(94, 224, 207, .12); color: var(--teal); }
.subworkflow-head h2 { margin: 12px 0 5px; font-size: 20px; letter-spacing: -.04em; }
.subworkflow-head h2 small { color: var(--teal); font: 500 13px 'DM Mono', monospace; }
.subworkflow-head p { margin: 0; color: var(--muted); font-size: 11px; }
.tier-track { min-height: 190px; display: flex; align-items: center; padding: 14px 0 0; }
.tier-item { position: relative; flex: 1; min-width: 84px; }
.tier-item:not(:last-child):after { content: '→'; position: absolute; top: 46px; right: -6px; z-index: 1; color: var(--teal-dim); font-size: 18px; }
.tier-node { position: relative; z-index: 2; margin: auto; width: 78px; min-height: 95px; padding: 10px 8px; border: 1px solid #2a5362; border-radius: 7px; background: #0d2635; text-align: left; }
.tier-number { display: block; color: var(--teal); font: 500 9px 'DM Mono', monospace; }
.tier-node strong { display: block; margin: 8px 0 13px; font-size: 16px; }
.node-policy { color: var(--muted); font: 9px 'DM Mono', monospace; }
.annotation { display: grid; gap: 4px; margin-top: 9px; color: var(--muted); font: 9px 'DM Mono', monospace; }
.annotation b { font-weight: 400; color: var(--orange); }
.annotation .retain-label b { color: var(--rose); }
.subworkflow-foot { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 15px; color: var(--muted); font-size: 10px; }
.legend-swatch { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--orange); }
.legend-swatch.retain { background: var(--rose); }
.subworkflow-foot .mono { margin-left: auto; color: var(--faint); }
.callout, .graph-footnote { margin-top: 12px; padding: 12px 14px; display: flex; gap: 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: rgba(12, 26, 41, .65); font-size: 10px; line-height: 1.55; }
.callout strong { display: block; color: var(--ink); font-size: 10px; }
.callout-icon { color: var(--teal); font-size: 16px; }
.authored-canvas { position: relative; padding: 24px; overflow: hidden; }
.authored-stage { display: grid; grid-template-columns: 130px minmax(310px, 1fr) 150px; gap: 18px; align-items: center; min-height: 336px; }
.author-start, .author-terminal, .author-join { display: grid; gap: 5px; align-content: center; min-height: 73px; padding: 12px; border: 1px solid #2a5362; border-radius: 7px; background: #0d2635; }
.author-start strong, .author-terminal strong, .author-join strong { font-size: 11px; }
.author-start small, .author-terminal small, .author-join small { color: var(--muted); font: 9px 'DM Mono', monospace; }
.author-start { border-color: #786140; background: #282617; }
.author-start .node-type { color: var(--orange); }
.author-terminal { border-color: #3e756e; background: #102d34; }
.author-join { border-color: #4c4674; background: #211e3a; }
.node-type { color: var(--teal); font: 9px 'DM Mono', monospace; letter-spacing: .04em; }
.policy-stack { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.policy-card { padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: rgba(11, 29, 45, .9); }
.policy-card strong { display: block; overflow: hidden; color: var(--ink); font: 600 10px 'DM Mono', monospace; text-overflow: ellipsis; white-space: nowrap; }
.policy-card span { color: var(--faint); font-size: 9px; }
.policy-card:before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--teal); }
.compiled-wrap { padding: 16px 15px 11px; min-height: 490px; }
.compiled-legend { display: flex; gap: 18px; align-items: center; padding: 0 4px 13px; color: var(--muted); font-size: 10px; }
.compiled-legend .mono { margin-left: auto; color: var(--faint); }
.line-swatch { display: inline-block; width: 23px; height: 2px; margin-right: 5px; vertical-align: middle; background: var(--teal-dim); }
.line-swatch.generated-line { background: var(--rose); border-top: 1px dashed var(--rose); }
.compiled-scroll { overflow-x: auto; overflow-y: hidden; padding: 0 0 3px; }
.compiled-board { position: relative; min-width: 1080px; padding: 20px 0 47px; }
.board-header, .lane-row { display: grid; grid-template-columns: 155px repeat(7, 93px) 145px; gap: 6px; padding: 0 10px; }
.board-header { margin-bottom: 7px; color: var(--faint); font: 9px 'DM Mono', monospace; letter-spacing: .06em; }
.board-header span:not(:first-child) { text-align: center; }
.lane-row { position: relative; min-height: 54px; align-items: center; }
.lane-row:nth-child(odd) { background: rgba(19, 43, 62, .22); }
.lane-label { padding-left: 8px; overflow: hidden; color: var(--muted); font: 10px 'DM Mono', monospace; text-overflow: ellipsis; white-space: nowrap; }
.lane-label b { display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--teal); }
.graph-node { position: relative; z-index: 5; width: 72px; min-height: 35px; justify-self: center; padding: 6px 7px; border: 1px solid #275164; border-radius: 5px; background: #102c3b; color: var(--ink); text-align: left; cursor: pointer; }
.graph-node:hover, .graph-node.selected { border-color: var(--teal); background: #164152; box-shadow: 0 0 0 2px rgba(94, 224, 207, .12); }
.graph-node strong { display: block; font: 600 10px 'DM Mono', monospace; }
.graph-node small { display: block; margin-top: 3px; color: var(--muted); font: 8px 'DM Mono', monospace; }
.graph-node.retained { border-bottom: 2px solid var(--rose); }
.graph-node.reused { border-top: 2px solid var(--orange); }
.side-node { position: absolute; z-index: 6; display: grid; gap: 4px; min-width: 120px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); text-align: left; cursor: pointer; box-shadow: 0 5px 13px rgba(0,0,0,.17); }
.side-node:hover, .side-node.selected { border-color: var(--teal); }
.side-node strong { font: 600 10px 'DM Mono', monospace; }
.side-node small { color: var(--muted); font: 8px 'DM Mono', monospace; }
.source-node { left: 7px; top: 8px; border-color: #665a40; background: #282719; }
.source-node .node-type { color: var(--orange); }
.rejected-node { left: 37px; bottom: 7px; border-color: #6d4651; background: #2d1d2a; }
.rejected-node .node-type { color: var(--rose); }
.join-node { right: 65px; top: 325px; border-color: #4e4774; background: #211e3c; }
.join-node .node-type { color: var(--purple); }
.approved-node { right: 6px; bottom: 7px; border-color: #39756d; background: #102d34; }
.approved-node .node-type { color: var(--teal); }
.edge-layer { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.edge-visible { fill: none; stroke: var(--teal-dim); stroke-width: 1.5; opacity: .7; pointer-events: none; }
.edge-visible.generated { stroke: var(--rose); stroke-dasharray: 4 4; opacity: .78; }
.edge-hit { fill: none; stroke: transparent; stroke-width: 12; pointer-events: stroke; cursor: pointer; }
.edge-visible.selected { stroke: #fff; stroke-width: 2.7; opacity: 1; }
.edge-arrow { fill: var(--teal-dim); }
.edge-arrow.generated { fill: var(--rose); }
.edge-arrow.selected { fill: #fff; }
.graph-footnote { margin-top: 10px; }
.info-dot { width: 15px; height: 15px; display: grid; flex: 0 0 15px; place-items: center; border: 1px solid var(--faint); border-radius: 50%; color: var(--muted); font: 10px Georgia, serif; }
.inspector { min-height: 490px; border: 1px solid var(--line); border-radius: 9px; background: rgba(12, 26, 41, .7); box-shadow: var(--shadow); }
.inspector-heading { padding: 18px 17px 15px; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); }
.inspector-heading h2 { margin: 8px 0 0; font-size: 15px; letter-spacing: -.025em; }
.icon-button { width: 22px; height: 22px; padding: 0; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--faint); cursor: pointer; font-size: 19px; line-height: 1; }
.icon-button:hover { border-color: var(--line); color: var(--ink); }
.inspector-body { min-height: 260px; padding: 18px 17px; }
.empty-state { display: flex; flex-direction: column; justify-content: center; align-items: center; color: var(--muted); text-align: center; }
.empty-state strong { margin-top: 12px; color: var(--ink); font-size: 11px; }
.empty-state p { max-width: 190px; margin: 7px 0 0; font-size: 10px; line-height: 1.6; }
.empty-glyph { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--teal); font-size: 23px; }
.detail-type { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.detail-type .pill { color: var(--rose); background: rgba(242, 138, 155, .11); }
.generated-label { color: var(--rose); font: 9px 'DM Mono', monospace; }
.detail-grid { display: grid; gap: 13px; }
.detail-row { display: grid; gap: 4px; }
.detail-row label { color: var(--faint); font: 9px 'DM Mono', monospace; text-transform: uppercase; letter-spacing: .06em; }
.detail-row div { color: var(--ink); font-size: 11px; word-break: break-word; }
.detail-row code { display: inline-block; padding: 4px 5px; border-radius: 3px; background: rgba(94, 224, 207, .08); color: var(--teal); font: 10px 'DM Mono', monospace; }
.detail-reason { padding: 9px; border-left: 2px solid var(--rose); background: rgba(242, 138, 155, .06); color: var(--muted) !important; line-height: 1.5; }
.diagnostics { border-top: 1px solid var(--line); padding: 15px 17px 17px; }
.diagnostics-heading { display: flex; justify-content: space-between; color: var(--faint); font: 9px 'DM Mono', monospace; letter-spacing: .07em; }
.diagnostic-count { padding: 2px 5px; border-radius: 3px; color: var(--orange); background: rgba(255, 183, 107, .12); }
.diagnostic-item { display: flex; gap: 8px; margin-top: 12px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.diagnostic-item:before { content: ''; width: 5px; height: 5px; flex: 0 0 5px; margin-top: 4px; border-radius: 50%; background: var(--orange); }
.diagnostic-item.info:before { background: var(--teal); }
.diagnostic-item strong { color: var(--ink); font-weight: 600; }
.page-footer { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line-soft); padding: 14px 0 20px; color: var(--faint); font-size: 10px; }
.footer-separator { color: var(--line); }.footer-spacer { flex: 1; }
@media (max-width: 1300px) { .main-content { padding: 0 24px; } .workspace { grid-template-columns: minmax(0, 1fr) 250px; } .metric-strip { gap: 15px; } }
@media (max-width: 900px) {
  body { min-width: 0; }
  .app-shell { display: block; }
  .sidebar { width: 100%; height: auto; padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .brand { padding: 0 0 14px; }
  .sidebar .eyebrow, .workflow-picker, .sidebar-note, .sidebar-footer { display: none; }
  .side-nav { display: flex; overflow-x: auto; }
  .nav-item { flex: 0 0 auto; white-space: nowrap; }
  .main-content { padding: 0 16px; }
  .topbar { height: 60px; }
  .breadcrumb span:first-child, .breadcrumb .crumb-slash { display: none; }
  .page-heading { display: block; padding: 26px 0 20px; }
  .metric-strip { margin-top: 22px; }
  .view-tabs { overflow-x: auto; }
  .view-tab { flex: 0 0 auto; padding: 12px 10px; }
  .workspace { display: block; }
  .inspector { margin-top: 14px; min-height: 0; }
  .inspector-body { min-height: 180px; }
  .toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-controls { width: 100%; justify-content: space-between; }
  .subworkflow-card { padding: 18px 14px; overflow-x: auto; }
  .tier-track { min-width: 700px; }
  .authored-canvas { overflow-x: auto; }
  .authored-stage { min-width: 730px; }
}
