/* 工作台视觉：深色工具栏、浅色编辑面板和低饱和流程节点 */
#diagnostics { width: min(760px, calc(100vw - 32px)); max-height: min(760px, calc(100dvh - 48px)); padding: 0; overflow: hidden; border-radius: 10px; background: #fff; }
#diagnostics[open] { display: flex; flex-direction: column; }
#diagnostics h2 { margin: 0; padding: 20px 24px 8px; font-size: 18px; }
#diagnosticsSummary { margin: 0; padding: 0 24px 18px; color: #748195; line-height: 1.6; }
#diagnostics #issuesContent { max-height: none; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 24px 16px; border-top: 1px solid #e5eaf0; }
.diagnostic-file { padding: 16px 0; border-bottom: 1px solid #e5eaf0; }
.diagnostic-file:last-child { border: 0; }
.diagnostic-file h3 { margin: 0 0 9px; font: 600 13px/1.6 "Segoe UI", "Microsoft YaHei", sans-serif; overflow-wrap: anywhere; color: #283446; }
#issuesContent .diagnostic-reason { display: flex; flex-direction: column; gap: 4px; color: #526075; margin: 7px 0; line-height: 1.65; }
.diagnostic-reason small { font-size: 11px; color: #8b6a3c; }
.diagnostic-file summary { cursor: pointer; font-size: 12px; color: #57749c; padding: 6px 0; }
.diagnostic-file pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #f5f7fa; border: 1px solid #e7ebf0; border-radius: 5px; padding: 10px; color: #657185; font: 11px/1.65 Consolas, monospace; }
#diagnostics .dialogfoot { padding: 12px 24px; border-top: 1px solid #e5eaf0; align-items: center; flex-shrink: 0; }
#diagnostics .dialogfoot span { margin-right: auto; color: #8893a3; font-size: 11px; }
:root { font-family: "Segoe UI", "Microsoft YaHei", sans-serif; color: #283446; background: #edf0f4; font-size: 14px; --accent: #346fcb; --border: #e0e5ec; --muted: #748195; }
header { height: 58px; padding: 0 24px; background: #202b3b; border: 0; color: #f0f4fa; }
.brand { gap: 11px; font-size: 20px; letter-spacing: -.5px; font-weight: 650; }
.brand svg { width: 27px; height: 27px; color: #92b7ee; }
.sub { margin-left: 19px; padding-left: 22px; border-left: 1px solid #455061; color: #aeb9ca; font-size: 13px; font-weight: 400; letter-spacing: 0; }
.local { padding: 0; border: 0; background: none; color: #b5c0cf; font-size: 12px; }
.local:before { content: ''; display: inline-block; width: 6px; height: 6px; background: #81c4ac; border-radius: 50%; margin: 0 8px 2px 0; }
main { height: calc(100dvh - 58px); padding: 0 16px; gap: 0; }
button, input, select { border: 1px solid #d5dce6; border-radius: 6px; padding: 8px 12px; transition: background .12s, border-color .12s; }
button { font-size: 13px; font-weight: 500; }
button:hover { background: #edf3fc; border-color: #b8cbe6; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid #5e8fda; outline-offset: 2px; }
input:focus { outline: 2px solid #94b4e4; }
.primary { background: #346fcb; border-color: #346fcb; color: #fff; box-shadow: 0 2px 3px #346fcb18; }
.primary:hover { background: #295eaf; border-color: #295eaf; }
.project { background: transparent; border: 0; border-radius: 0; padding: 16px 0; gap: 10px; }
.project label { color: #58667a; font-size: 13px; font-weight: 500; padding-right: 4px; }
.project-choice { height: 38px; padding: 5px 12px; border: 1px solid #d5dce6; border-radius: 6px; background: #fff; display: flex; align-items: center; gap: 12px; overflow: hidden; }
.project-choice strong { min-width: 0; max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #33445c; font-size: 13px; font-weight: 600; }
.project-choice span { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #8793a5; font-size: 11px; }
.project select, .project button { height: 38px; white-space: nowrap; }
#example { color: #547199; background: transparent; border-color: transparent; }
#example:hover { background: #e2e9f3; }
#files, #browse { color: #415b7d; }
#start { padding: 0 20px; }
.workspace { border: 1px solid #d9e0e9; border-radius: 8px; min-height: 0; grid-template-columns: 260px minmax(260px,var(--code-width,39%)) 5px minmax(0,1fr); box-shadow: 0 2px 6px #23344f05; }
.sidebar { background: #f6f8fb; border-color: var(--border); }
.sidehead { padding: 18px 16px 12px; border: 0; }
.sidehead strong { font-size: 13px; font-weight: 600; }
.sidehead input { margin-top: 16px; padding: 8px 10px; background: #fff; border-color: #dfe5ee; font-size: 12px; }
.count { background: #e8edf5; color: #63718a; border-radius: 4px; font-size: 11px; padding: 2px 7px; }
.treeactions { padding: 0 8px 8px; border-bottom: 1px solid var(--border); }
.treeactions button { color: #79869a; font-size: 11px; }
.items { padding: 10px 6px; }
.tree summary { padding: 7px 8px; border-radius: 4px; font-size: 13px; }
.tree summary:hover { background: #eaf0f7; }
.tree summary:before { color: #8391a5; }
.tree .children { margin-left: 13px; border-color: #dce4ee; }
.tree .treeicon { color: #9b885f; }
.tree.file .treeicon { color: #6587b6; font-size: 10px; }
.tree .item { padding: 8px; border-radius: 0 4px 4px 0; align-items: center; }
.tree .item b { font-size: 12px; }
.tree .item.active { background: #e1ebfa; border-left-color: #5586ce; color: #244d86; }
.tree .functionicon { color: #8c75ac; }
.tree .filecount { color: #7f8ba0; }
.codeheader { height: 82px; padding: 16px 18px; border-color: var(--border); background: #fff; position: relative; }
.codeheader:before { content: ''; position: absolute; left: 18px; bottom: -1px; height: 2px; width: 34px; background: #6795d8; }
.codeheader b { font-size: 13px; font-weight: 500; line-height: 1.7; }
.codeheader span { color: #8893a4; white-space: nowrap; font-size: 11px; }
.splitter { background: #edf1f6; border-left: 1px solid #e5eaf1; border-right: 1px solid #e5eaf1; }
.splitter:hover, .splitter:focus { background: #a6bfdf; outline: none; }
.canvaspanel>.toolbar { min-height: 82px; padding: 14px 18px; gap: 10px; background: #fff; border-color: var(--border); }
.toolbar .title { flex-basis: auto; }
.toolbar .title b { font-size: 13px; font-weight: 600; line-height: 1.6; }
.toolbar .title small { color: #8590a1; line-height: 1.6; margin-top: 3px; }
.tools { gap: 4px; }
.tools button, .tools select { height: 30px; padding: 4px 9px; font-size: 11px; border-color: #e0e6ee; background: #fff; }
.tools button:hover { background: #edf3fc; }
#download { margin-left: 5px; color: #346fcb; background: #f3f7fd; border-color: #dbe6f5; }
.stage { background: #fcfdff; }
#graph { background: transparent; margin: 28px auto; }
#graph svg>g>polygon { fill: #fcfdff; }
#graph g.node polygon, #graph g.node path, #graph g.node ellipse { fill: #edf3fb; stroke: #7186a3; stroke-width: 1.15; }
#graph g.node[id$="decision"] polygon { fill: #fff4d8; stroke: #b5a071; }
#graph g.node[id$="entry"] ellipse { fill: #e5f3ec; stroke: #779d8b; }
#graph g.node[id$="exit"] ellipse { fill: #f2edf6; stroke: #a394b2; }
#graph g.node[id$="transfer"] polygon { fill: #e7effb; stroke: #7997bf; }
#graph g.node text, #graph g.edge text { fill: #394b63; }
#graph g.edge path { stroke: #94a3b7; }
#graph g.edge polygon { fill: #94a3b7; stroke: #94a3b7; }
#graph g.node:focus { outline: none; }
#graph g.node:focus polygon, #graph g.node:focus path, #graph g.node:focus ellipse { stroke: #346fcb; stroke-width: 2; }
.placeholder h2 { color: #536278; font-size: 17px; font-weight: 500; margin-bottom: 14px; }
.placeholder p { font-size: 13px; color: #7a879a; max-width: 520px; line-height: 2; overflow-wrap: anywhere; }
.codeempty, .emptylist { color: #8693a6; font-size: 13px; }
footer { padding: 7px 2px; border: 0; color: #7a8698; min-height: 34px; font-size: 11px; }
footer button { padding: 2px 8px; font-size: 11px; }
progress { accent-color: #5b87c8; }
.errorbox { border: 1px solid #ebd6b2; background: #fff8e9; color: #876533; border-radius: 6px; }
dialog { border: 1px solid #dce3ed; border-radius: 10px; padding: 24px; box-shadow: 0 20px 70px #182b4933; }
dialog::backdrop { background: #182b4966; backdrop-filter: none; }
dialog h2 { font-size: 18px; font-weight: 600; }
#folders { border-radius: 5px; border-color: var(--border); }
#folders button { padding: 13px 16px; }
.codepanel .cm-editor { font-size: 14px; }
.codepanel .cm-gutters { color: #9aa7b9; background: #fafbfd; border-color: #eef1f6; }
.codepanel .cm-activeLineGutter { background: #edf3fc; }
.codepanel .flow-source-highlight { background: #edf3fc !important; box-shadow: inset 3px 0 #759bd2; }
@media(max-width:1400px) { .canvaspanel>.toolbar { flex-wrap: wrap; } .toolbar .title { flex-basis: 100%; } .tools { margin-left: auto; } }
@media(max-width:1100px) { .workspace { grid-template-columns: 210px minmax(240px,38%) 5px minmax(0,1fr); } main { padding: 0 10px; } .project { flex-wrap: wrap; } .project-choice { flex-basis: calc(100% - 90px); } }
@media(max-width:800px) { main { height: auto; } .workspace { grid-template-columns: 1fr; } .local { display: none; } .project-choice { flex-basis: 100%; order: 2; } .project-choice strong { max-width: 50%; } .codepanel { height: 350px; } }
@media(prefers-reduced-motion:reduce) { button, input, select { transition: none; } }

/* 文件是可选择项，目录才承担展开操作 */
.items { padding: 10px 10px 16px; }
.tree summary { gap: 8px; padding: 8px 6px; color: #61718a; font-size: 12px; font-weight: 500; }
.tree summary:before { content: ''; width: 5px; height: 5px; border-right: 1.3px solid #8b99ad; border-top: 1.3px solid #8b99ad; transform: rotate(45deg); margin: 0 3px 0 2px; }
.tree[open]>summary:before { transform: rotate(135deg); }
.folder-icon { width: 18px; height: 18px; color: #8194af; flex-shrink: 0; }
.tree .children { margin: 1px 0 5px 11px; padding-left: 8px; border-color: #e0e7f0; }
.file-row { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 40px; text-align: left; margin: 3px 0; padding: 7px 9px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #4c5d75; position: relative; }
.file-row:hover { background: #edf2f9; border-color: #e1e8f2; }
.file-row.active { background: #e6eefb; border-color: #c8daf4; color: #224f88; box-shadow: 0 1px 2px #28486b05; }
.file-row.active:before { content: ''; position: absolute; left: -1px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: #4c81ca; }
.file-row:focus-visible { outline: 2px solid #80a6d8; outline-offset: 1px; }
.file-label { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; line-height: 1.6; font-weight: 400; }
.file-row.active .file-label { font-weight: 600; }
.file-badge { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 24px; height: 25px; border-radius: 5px; font: 600 10px Consolas, monospace; letter-spacing: -.3px; background: #e9edf4; color: #6e7f99; }
.file-badge[data-language="js"] { background: #f7edcc; color: #967016; }
.file-badge[data-language="ts"] { background: #e2edfb; color: #366daa; }
.file-badge[data-language="java"] { background: #f8e9df; color: #ab7048; }
.file-badge[data-language="py"] { background: #e4efe9; color: #4a8067; }
.file-badge[data-language="go"] { background: #dff0f4; color: #458394; }
.file-badge[data-language="cs"] { background: #ece7f5; color: #8167a4; }
.file-count { flex-shrink: 0; min-width: 20px; padding: 2px 4px; text-align: center; font: 11px Consolas, monospace; color: #8b98aa; border-radius: 4px; }
.file-row.active .file-count { color: #4e77ac; background: #d9e6f9; }
/* 触发器与搜索浮层共享函数名、行号和选择状态 */
#functionSelect { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 300px; min-height: 32px; padding: 4px 8px; text-align: left; background: #f6f8fc; border: 1px solid #e5eaf2; border-radius: 7px; }
#functionSelect:hover { background: #eff4fb; border-color: #c8d9f0; }
#functionSelect[aria-expanded="true"] { background: #f0f5fc; border-color: #8caddc; box-shadow: 0 0 0 3px #e7effb; }
.function-symbol { width: 21px; height: 21px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: #507bb7; background: #e7eef9; font: italic 16px Georgia, serif; flex-shrink: 0; }
.function-caption { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.function-overline { display: none; font-size: 10px; font-weight: 400; color: #8290a5; letter-spacing: .4px; }
#functionName { font-size: 13px; font-weight: 600; color: #304c74; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.5; }
.line-tag { font: 11px Consolas, monospace; font-variant-numeric: tabular-nums; color: #7e8ba0; background: #eef1f6; border: 1px solid #e3e8f0; padding: 3px 5px; border-radius: 4px; white-space: nowrap; flex-shrink: 0; }
.picker-chevron { width: 16px; height: 16px; color: #8b9bb1; flex-shrink: 0; }
#functionSelect[aria-expanded="true"] .picker-chevron { transform: rotate(180deg); }
.canvaspanel>.toolbar { min-height: 82px; }
.codeheader { height: 82px; }
.toolbar .title small { padding-left: 2px; margin-top: 6px; }
#functionPanel { position: fixed; inset: auto; margin: 0; padding: 0; border: 1px solid #dbe3ee; border-radius: 10px; background: #fff; color: #34455e; box-shadow: 0 12px 40px #20375526, 0 2px 5px #2037550d; display: flex; flex-direction: column; overflow: hidden; }
#functionPanel:not(:popover-open) { display: none; }
#functionPanel::backdrop { background: transparent; }
.function-panel-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px 8px; font-size: 12px; font-weight: 600; flex-shrink: 0; }
#functionCount { color: #8e9cb0; font: 11px Consolas, monospace; }
.function-search { display: flex; align-items: center; gap: 8px; margin: 0 12px 10px; padding: 0 10px; border: 1px solid #dce4ef; background: #fafbfd; border-radius: 6px; flex-shrink: 0; }
.function-search:focus-within { border-color: #8dadd7; box-shadow: 0 0 0 2px #eef3fb; }
.function-search svg { width: 16px; height: 16px; color: #95a2b6; flex-shrink: 0; }
#functionSearch { width: 100%; min-width: 0; height: 30px; padding: 0; border: 0; background: transparent; outline: none; font-size: 12px; }
#functionSearch::placeholder { color: #9aa5b5; }
#functionOptions { padding: 0 6px 6px; overflow: auto; min-height: 0; max-height: 302px; overscroll-behavior: contain; }
.function-option { display: flex; align-items: center; gap: 10px; padding: 6px 8px; min-height: 32px; margin: 2px 0; border: 1px solid transparent; border-radius: 6px; cursor: pointer; }
.function-option.keyboard-active { background: #f0f4fa; border-color: #e4eaf3; }
.function-option[aria-selected="true"] { background: #edf3fc; color: #2d5d9a; }
.function-option[aria-selected="true"].keyboard-active { border-color: #cdddf3; background: #e8f0fc; }
.option-symbol { font: italic 16px Georgia, serif; width: 20px; text-align: center; color: #8a9bb2; flex-shrink: 0; }
.function-option[aria-selected="true"] .option-symbol { color: #5984bd; }
.option-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 13px; line-height: 1.5; }
.option-check { color: #4b7fc3; width: 14px; flex-shrink: 0; font-size: 13px; }
.function-panel-foot { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid #edf0f5; background: #fafbfd; font-size: 10px; color: #98a4b6; flex-shrink: 0; }
.function-panel-foot kbd { font: 10px Consolas, monospace; padding: 2px 3px; color: #8997aa; }
#functionNoMatch { text-align: center; padding: 24px 12px 30px; color: #718199; font-size: 13px; }
#functionNoMatch span { display: block; color: #9ca8b9; font-size: 11px; margin-top: 8px; }

#functionPanel.compact .function-panel-head,
#functionPanel.compact .function-search,
#functionPanel.compact .function-panel-foot { display: none; }
#functionPanel.compact #functionOptions { padding: 4px; }
#functionOptions:focus { outline: none; }

.sidehead { position: relative; }
.sidehead .count { margin-right: 34px; }
.explorer-toggle { position: absolute; right: 10px; top: 12px; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid transparent; border-radius: 5px; background: transparent; color: #708098; }
.explorer-toggle svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.explorer-toggle:hover { background: #e8eef7; border-color: #d8e2f0; color: #315c95; }
.explorer-toggle:focus-visible { outline: 2px solid #6096df; outline-offset: 1px; }
.workspace.explorer-collapsed { grid-template-columns: 44px minmax(240px,var(--code-width,39%)) 5px minmax(0,1fr); }
.explorer-collapsed .sidebar { background: #f4f7fb; }
.explorer-collapsed .sidehead { padding: 12px 6px; border: 0; }
.explorer-collapsed .explorer-toggle { position: static; width: 32px; height: 32px; color: #42638e; background: #fff; border-color: #dce4ef; box-shadow: 0 1px 2px #23344f08; }
.explorer-collapsed .explorer-toggle:hover { background: #e8eef7; border-color: #b9cce5; }
.explorer-collapsed .toggle-arrow { transform: rotate(180deg); transform-origin: 12.5px 10px; }
.explorer-collapsed .sidehead > :not(.explorer-toggle),
.explorer-collapsed .treeactions, .explorer-collapsed .items { display: none; }
@media(max-width:800px) { .workspace.explorer-collapsed { grid-template-columns: 1fr; } .explorer-collapsed .sidebar { min-height: 40px; border-bottom: 1px solid var(--border); } }
