:root {
  --ink: #15272e;
  --muted: #718187;
  --faint: #a1afb1;
  --canvas: #eef3f2;
  --surface: #fff;
  --line: #dbe6e3;
  --teal: #0b756b;
  --teal-deep: #07554f;
  --teal-soft: #e4f3ef;
  --navy: #10262e;
  --orange: #ec7442;
  --radius: 12px;
  font-family: "Noto Sans SC", "DM Sans", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, a { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid #8bd1c5; outline-offset: 2px; }
.portal-shell { min-height: 100dvh; display: flex; }
.portal-sidebar { width: 236px; flex: 0 0 236px; min-height: 100dvh; padding: 27px 16px 22px; background: var(--navy); color: #eaf7f4; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 11px 39px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: #b5e4d9; color: #0e4540; font-size: 16px; font-weight: 800; }
.brand-copy strong, .brand-copy small { display: block; }
.brand-copy strong { font-size: 15px; line-height: 1.2; }
.brand-copy small { margin-top: 3px; color: #87aaa7; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.main-nav { display: grid; gap: 7px; }
.nav-link { min-height: 47px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: #9bb5b4; text-align: left; transition: background 180ms ease, color 180ms ease; }
.nav-link:hover, .nav-link.is-active { background: rgba(181,228,217,.13); color: #f2fbf9; }
.nav-link.is-active { box-shadow: inset 3px 0 #b5e4d9; }
.nav-index { width: 23px; color: #668d8c; font-size: 10px; letter-spacing: .08em; }
.nav-link.is-active .nav-index { color: #b5e4d9; }
.sidebar-note { display: flex; align-items: center; gap: 8px; margin: auto 12px 0; color: #759593; font-size: 11px; letter-spacing: .05em; }
.online-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: #58c5aa; box-shadow: 0 0 0 4px rgba(88,197,170,.14); }
.portal-main { min-width: 0; flex: 1; }
.portal-topbar { height: 72px; padding: 0 42px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.78); display: flex; align-items: center; justify-content: space-between; }
.location { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.location-muted, .location-sep { color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.port-label { color: var(--faint); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; letter-spacing: .08em; }
.avatar { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 700; }
.portal-view { max-width: 1450px; margin: 0 auto; padding: 42px 42px 58px; }
.portal-view.is-hidden { display: none; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 29px; }
.view-head h1 { margin: 8px 0 9px; font-size: clamp(28px,3.2vw,42px); letter-spacing: -.04em; line-height: 1.08; }
.eyebrow, .panel-kicker { color: var(--teal); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.view-desc { margin: 0; color: var(--muted); font-size: 14px; }
.primary-btn, .secondary-btn { min-height: 44px; padding: 0 16px; border-radius: 9px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 9px; white-space: nowrap; }
.primary-btn { border: 1px solid var(--orange); background: var(--orange); color: #fff; font-weight: 750; box-shadow: 0 6px 16px rgba(236,116,66,.18); }
.primary-btn span { font-size: 20px; font-weight: 400; line-height: 0; }
.secondary-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 650; }
.secondary-btn:hover { border-color: #a9cec6; background: #f8fbfa; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 2px 10px rgba(21,39,46,.03); overflow: hidden; }
.doc-layout { display: grid; grid-template-columns: 330px minmax(0,1fr); gap: 18px; }
.doc-list-panel, .doc-editor { min-height: 580px; }
.panel-head { min-height: 73px; padding: 18px 21px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.panel-head h2 { margin: 6px 0 0; font-size: 18px; letter-spacing: -.02em; }
.panel-kicker { margin: 0; }
.count-badge { display: grid; place-items: center; width: 33px; height: 25px; border-radius: 6px; background: var(--teal-soft); color: var(--teal-deep); font-size: 11px; font-weight: 750; }
.doc-list { padding: 10px; }
.doc-item { width: 100%; min-height: 82px; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 12px 11px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--ink); text-align: left; }
.doc-item:hover, .doc-item.is-selected { border-color: #cce3de; background: #f6fbfa; }
.doc-item.is-selected { box-shadow: inset 3px 0 var(--teal); }
.doc-type { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; background: var(--teal); color: #fff; font-size: 11px; font-weight: 800; }
.muted-type { background: #eef2f1; color: #809392; }
.doc-info { min-width: 0; }
.doc-info strong, .doc-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-info strong { font-size: 13px; }
.doc-info small { margin-top: 6px; color: var(--muted); font-size: 11px; }
.doc-state { color: var(--faint); font-size: 10px; white-space: nowrap; }
.doc-state.is-draft { color: var(--teal); font-weight: 750; }
.editor-head { min-height: 73px; }
.editor-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 38px; height: 38px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); letter-spacing: 3px; }
.editor-canvas { max-width: 760px; min-height: 495px; margin: 0 auto; padding: 31px 46px; position: relative; }
.editor-meta { display: flex; align-items: center; gap: 9px; color: var(--faint); font-size: 11px; }
.skeleton-title, .skeleton-subtitle, .skeleton-line, .skeleton-rule, .skeleton-block { border-radius: 7px; background: #e9efee; }
.skeleton-title { width: 62%; height: 29px; margin-top: 27px; background: #d7e5e1; }
.skeleton-subtitle { width: 37%; height: 12px; margin-top: 14px; }
.skeleton-rule { height: 1px; margin: 29px 0; background: #e1eae7; }
.skeleton-line { width: 78%; height: 11px; margin-top: 14px; }
.skeleton-line.wide { width: 93%; }
.skeleton-line.medium { width: 54%; }
.skeleton-block { height: 145px; margin: 32px 0 25px; background: #f1f5f4; }
.empty-hint { position: absolute; right: 46px; bottom: 30px; display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 11px; }
.empty-mark { width: 22px; height: 22px; display: grid; place-items: center; border: 1px dashed #b6c7c3; border-radius: 6px; color: var(--teal); font-size: 16px; }
.doc-content { max-height: 470px; overflow: auto; padding: 29px 39px 34px; line-height: 1.75; color: #3f4c51; font-size: 13px; font-family: "Noto Sans SC", "DM Sans", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
.doc-content h1, .doc-content h2, .doc-content h3 { color: var(--ink); letter-spacing: -.025em; line-height: 1.25; }
.doc-content h1 { margin: 0 0 18px; font-size: 27px; }
.doc-content h2 { margin: 28px 0 9px; padding-top: 8px; border-top: 1px solid #edf0ee; font-size: 18px; }
.doc-content h3 { margin: 19px 0 7px; font-size: 15px; }
.doc-content p { margin: 9px 0; }
.doc-content .doc-lead { color: #526166; font-size: 14px; line-height: 1.85; }
.doc-content .doc-meta-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; color: var(--faint); font-size: 11px; }
.doc-content ul { margin: 9px 0 14px; padding-left: 21px; }
.doc-content li { margin: 4px 0; }
.doc-content ol { margin: 9px 0 14px; padding-left: 23px; }
.doc-content ol li { margin: 7px 0; padding-left: 3px; }
.doc-content blockquote { margin: 16px 0; padding: 11px 15px; border-left: 3px solid var(--orange); border-radius: 0 7px 7px 0; background: #fff7f2; color: #6f5a51; }
.doc-content code { padding: 2px 5px; border-radius: 4px; background: #eef2f1; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.doc-content pre { overflow: auto; margin: 16px 0; padding: 14px 16px; border-radius: 8px; background: #142a3c; color: #e5f1ef; font: 12px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }
.doc-content table { width: 100%; margin: 14px 0; border-collapse: collapse; font-size: 12px; }
.doc-content th, .doc-content td { padding: 9px 10px; border: 1px solid #e0e8e5; text-align: left; vertical-align: top; }
.doc-content th { background: #f1f6f4; color: var(--teal-deep); font-weight: 750; }
.doc-content strong { color: var(--ink); }
.doc-content a { color: var(--teal); text-decoration: underline; }
.state-diagram { margin: 14px 0 18px; padding: 15px 14px 13px; border: 1px solid #dce8e4; border-radius: 10px; background: #f8fbfa; }
.state-diagram-label { margin-bottom: 12px; color: var(--teal-deep); font-size: 11px; font-weight: 750; }
.state-flow { display: flex; align-items: stretch; gap: 2px; overflow-x: auto; padding: 2px 1px 8px; }
.state-node { flex: 1 0 66px; min-height: 82px; display: flex; flex-direction: column; justify-content: center; padding: 8px 4px 7px; border: 1px solid #d7e5e1; border-radius: 8px; background: #fff; box-shadow: 0 3px 10px rgba(21,39,46,.04); }
.state-node strong { margin-top: 4px; color: var(--ink); font-size: 11px; white-space: nowrap; }
.state-node small { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.35; }
.state-index { color: var(--faint); font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; }
.state-node-user { border-color: #f0cdbd; background: #fff8f4; }
.state-node-user .state-index { color: #bf5d38; }
.state-node-agent { border-color: #bfe0d8; background: #f3fbf8; }
.state-node-agent .state-index { color: var(--teal); }
.state-node-done { border-color: #b8d9cf; background: #eaf7f2; }
.state-node-done .state-index { color: var(--teal-deep); }
.state-arrow { flex: 0 0 12px; align-self: center; color: var(--orange); font-size: 14px; font-weight: 700; text-align: center; }
.state-branches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 4px; }
.state-branch { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 10px; border-radius: 8px; font-size: 11px; }
.state-branch strong, .state-branch small { display: block; }
.state-branch strong { color: var(--ink); }
.state-branch small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.branch-line { color: var(--orange); font-size: 18px; }
.state-branch-alert { border: 1px solid #f0d4c7; background: #fff8f4; }
.state-branch-stop { border: 1px solid #d9e2e4; background: #f3f6f7; }
.state-branch-stop .branch-line { color: #7d9195; }
.loading-doc { color: var(--muted); font-size: 13px; }
.error-doc { color: #b54c47; }
.compact-head { margin-bottom: 24px; }
.workbench-frame-wrap { height: calc(100dvh - 190px); min-height: 610px; }
.frame-bar { height: 43px; padding: 0 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.frame-status { display: flex; align-items: center; gap: 8px; color: var(--teal-deep); font-weight: 700; }
.frame-url { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--faint); font-size: 10px; }
iframe { width: 100%; height: calc(100% - 43px); display: block; border: 0; background: #f6f8f7; }
.toast { position: fixed; right: 25px; bottom: 24px; padding: 12px 15px; border: 1px solid #b9ded5; border-radius: 9px; background: #effaf7; color: var(--teal-deep); box-shadow: 0 12px 30px rgba(21,39,46,.12); font-size: 12px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity 180ms ease, transform 180ms ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
@media (max-width: 900px) { .portal-sidebar { width: 200px; flex-basis: 200px; } .portal-topbar, .portal-view { padding-left: 26px; padding-right: 26px; } .doc-layout { grid-template-columns: 1fr; } .doc-list-panel { min-height: 0; } .doc-editor { min-height: 500px; } .workbench-frame-wrap { height: 680px; } }
@media (max-width: 650px) { .portal-shell { display: block; } .portal-sidebar { width: 100%; min-height: 0; height: auto; padding: 13px 15px 12px; flex-direction: row; align-items: center; gap: 14px; } .brand { padding: 0; } .brand-copy small { display: none; } .main-nav { display: flex; gap: 4px; margin-left: auto; } .nav-link { min-height: 40px; padding: 0 10px; } .nav-link.is-active { box-shadow: inset 0 -3px 0 #b5e4d9; } .nav-index, .sidebar-note { display: none; } .portal-topbar { height: 57px; padding: 0 15px; } .port-label { display: none; } .portal-view { padding: 28px 15px 40px; } .view-head { align-items: flex-start; flex-direction: column; margin-bottom: 23px; } .view-head h1 { font-size: 31px; } .view-head .primary-btn, .view-head .link-btn { align-self: stretch; } .doc-editor { min-height: 460px; } .doc-content { max-height: 580px; padding: 24px 20px 30px; } .frame-bar { padding: 0 11px; } .frame-url { max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .workbench-frame-wrap { height: calc(100dvh - 205px); min-height: 520px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; } }

/* Visual pass: align the portal with the warmer, more decisive workbench palette. */
:root { --canvas: #f4f3f0; --line: #e4e1db; --teal: #1b7b70; --teal-deep: #0d5b55; --teal-soft: #e5f3ef; --orange: #f1733e; --navy: #142a3c; }
body { background: var(--canvas); }
.portal-sidebar { width: 248px; flex-basis: 248px; background: var(--navy); }
.brand { padding: 2px 11px 45px; }
.brand-mark { background: var(--orange); color: #fff; box-shadow: 0 7px 18px rgba(241,115,62,.25); }
.brand-copy strong { letter-spacing: -.01em; }
.nav-link.is-active { background: #29445d; box-shadow: inset 3px 0 var(--orange); }
.nav-link.is-active .nav-index { color: #ffb093; }
.portal-topbar { background: #fff; }
.port-label { color: #9a948c; }
.portal-view { padding-top: 47px; }
.view-head { margin-bottom: 24px; }
.view-head h1 { font-size: clamp(30px,3vw,39px); letter-spacing: -.045em; }
.eyebrow { color: var(--orange); }
.view-desc { color: #7d8586; }
.primary-btn { border-color: var(--orange); background: var(--orange); box-shadow: 0 7px 18px rgba(241,115,62,.2); }
.panel { border-color: #e5e1da; box-shadow: 0 8px 24px rgba(29,42,47,.045); }
.workspace-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) 1.35fr; gap: 12px; margin-bottom: 18px; }
.workspace-stat { min-height: 76px; display: flex; align-items: center; gap: 11px; padding: 13px 15px; border: 1px solid #e5e1da; border-radius: 10px; background: rgba(255,255,255,.75); }
.workspace-stat > span:last-child { min-width: 0; }
.workspace-stat strong, .workspace-stat small { display: block; }
.workspace-stat strong { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 23px; line-height: 1; letter-spacing: -.04em; }
.workspace-stat small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.stat-mark { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; font-size: 11px; font-weight: 800; }
.stat-mark-teal { background: var(--teal-soft); color: var(--teal-deep); }
.stat-mark-orange { background: #fff0e7; color: #bd572d; }
.stat-mark-ink { background: #e9edf0; color: var(--ink); }
.workspace-stat-note { justify-content: flex-start; color: #788383; font-size: 11px; }
.doc-layout { grid-template-columns: 315px minmax(0,1fr); gap: 16px; }
.doc-list-panel, .doc-editor { min-height: 555px; }
.panel-head { padding-left: 20px; padding-right: 20px; }
.doc-list { padding: 9px; }
.doc-item { min-height: 79px; }
.doc-item.is-selected { background: #fff8f4; border-color: #f3d0c1; box-shadow: inset 3px 0 var(--orange); }
.doc-type { background: var(--orange); }
.editor-canvas { max-width: 820px; min-height: 478px; }
.editor-meta .doc-state { padding: 5px 8px; border-radius: 5px; background: #fff0e7; }
.skeleton-title { width: 56%; height: 32px; background: #d9e1df; }
.skeleton-subtitle { width: 30%; }
.skeleton-block { height: 155px; background: #f4f1ed; border: 1px solid #ece8e2; }
.empty-hint { color: #9a9690; }
.empty-mark { color: var(--orange); border-color: #d9b6a4; }
.workbench-frame-wrap { box-shadow: 0 8px 24px rgba(29,42,47,.045); }
.frame-bar { background: #fffaf7; }
@media (max-width: 900px) { .portal-sidebar { width: 210px; flex-basis: 210px; } .workspace-stats { grid-template-columns: repeat(2, minmax(0,1fr)); } .workspace-stat-note { grid-column: 1/-1; } }
@media (max-width: 650px) { .portal-sidebar { width: 100%; } .workspace-stats { grid-template-columns: repeat(2, minmax(0,1fr)); } .workspace-stat-note { grid-column: 1/-1; } .workspace-stat { padding: 12px; } .workspace-stat strong { font-size: 20px; } }
@media (max-width: 650px) { .state-branches { grid-template-columns: 1fr; } .state-node { flex-basis: 126px; } }
