:root{color-scheme:light;--app-bg: #f5f7fa;--surface: #ffffff;--surface-subtle: #eef2f6;--surface-muted: #fbfcfe;--text-primary: #172b4d;--text-secondary: #526174;--text-tertiary: #748296;--border: #d5dee8;--border-strong: #b9c6d5;--accent: #2563eb;--accent-hover: #1d4ed8;--accent-soft: #eaf1ff;--on-accent: #ffffff;--control-radius: 8px;--focus-ring: #2563eb40;--editor-active: #2563eb0d;--editor-selection: #93b4ff88;--success: #13734b;--success-bg: #e8f6ef;--warning: #8a5a12;--warning-bg: #fff5de;--error: #b42318;--error-bg: #fff0ee;color:var(--text-primary);background:var(--app-bg);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;font-synthesis:none;text-rendering:optimizeLegibility}:root[data-theme=dark]{color-scheme:dark;--app-bg: #0f1520;--surface: #17202e;--surface-subtle: #1d2939;--surface-muted: #121b29;--text-primary: #e6edf5;--text-secondary: #aab8ca;--text-tertiary: #8c9aaf;--border: #344256;--border-strong: #4a5b72;--accent: #8ab4ff;--accent-hover: #a4c4ff;--accent-soft: #213453;--on-accent: #0f1520;--focus-ring: #8ab4ff55;--editor-active: #8ab4ff12;--editor-selection: #456a9a99;--success: #7fd5a6;--success-bg: #163c30;--warning: #f3c978;--warning-bg: #44371e;--error: #ffaaa4;--error-bg: #482b2a}*{box-sizing:border-box}[hidden]{display:none!important}html{min-width:320px;min-height:100%}body{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto minmax(0,1fr);min-width:320px;height:100vh;height:100dvh;margin:0;overflow:hidden;background:var(--app-bg)}button,input{font:inherit}button{font-weight:550;transition:color .13s ease,border-color .13s ease,background-color .13s ease}button:disabled{cursor:not-allowed;opacity:.48}input[type=checkbox]{width:16px;height:16px;margin:0;flex:0 0 auto;accent-color:var(--accent);cursor:pointer}input[type=text]::placeholder{color:var(--text-tertiary)}button,summary,a{-webkit-tap-highlight-color:transparent}button,summary{color:inherit}button:focus-visible,a:focus-visible,summary:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;clip-path:inset(50%)}.app-header{position:relative;z-index:5;display:flex;min-height:68px;align-items:center;justify-content:space-between;gap:20px;min-width:0;padding:10px 24px;border-bottom:1px solid var(--border);background:var(--surface)}.brand-lockup,.header-actions,.panel-title,.editor-actions,.document-toolbar{display:flex;align-items:center}.brand-lockup{min-width:0;gap:11px}.brand-lockup>div{min-width:0}.brand-mark{display:grid;width:36px;height:36px;place-items:center;border-radius:10px;color:var(--on-accent);background:var(--accent);font-size:18px;font-weight:750;text-decoration:none}.brand-lockup h1{margin:0;font-size:16px;font-weight:700;line-height:20px;letter-spacing:-.025em}.brand-lockup h1 a{color:inherit;text-decoration:none}.brand-lockup p{margin:2px 0 0;color:var(--text-secondary);font-size:12px;line-height:16px}.header-actions{flex:0 0 auto;gap:8px}.document-toolbar{position:relative;z-index:4;min-height:58px;min-width:0;gap:8px;padding:8px 24px;border-bottom:1px solid var(--border);background:var(--surface)}.toolbar-divider{width:1px;height:26px;margin:0 5px;background:var(--border)}.toolbar-spacer{flex:1}.toolbar-button,.menu-disclosure>summary,#repo-link{display:inline-flex;min-height:36px;align-items:center;justify-content:center;gap:8px;padding:0 11px;border:1px solid transparent;border-radius:var(--control-radius);color:var(--text-secondary);background:transparent;font-size:13px;font-weight:550;line-height:1.2;text-decoration:none;white-space:nowrap;cursor:pointer;transition:color .13s ease,border-color .13s ease,background-color .13s ease}.toolbar-button:hover:not(:disabled),.menu-disclosure>summary:hover,#repo-link:hover{color:var(--text-primary);background:var(--surface-subtle)}.toolbar-button:disabled{cursor:not-allowed;opacity:.48}.toolbar-button svg,.menu-disclosure>summary svg,#repo-link svg{width:17px;height:17px;flex:0 0 auto;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.6}.toolbar-button.primary,.menu-panel button.export-primary,.confirm-actions button.primary{border-color:var(--accent);color:var(--on-accent);background:var(--accent)}.toolbar-button.primary:hover:not(:disabled),.menu-panel button.export-primary:hover:not(:disabled),.confirm-actions button.primary:hover:not(:disabled){border-color:var(--accent-hover);color:var(--on-accent);background:var(--accent-hover)}.toolbar-button.button-secondary{border-color:var(--border);background:var(--surface)}#repo-link{min-height:36px;border-color:var(--border);color:var(--text-secondary)}.menu-disclosure{position:relative;flex:0 0 auto}.menu-disclosure>summary{list-style:none;-webkit-user-select:none;user-select:none}.menu-disclosure>summary::-webkit-details-marker{display:none}.menu-disclosure>summary:after{width:6px;height:6px;margin:-3px 0 0 1px;transform:rotate(45deg);border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;content:""}#saved-menu>summary{flex-wrap:nowrap;line-height:1}#saved-menu>summary>svg,#saved-menu>summary>span{display:inline-flex;flex:0 0 auto;align-items:center;vertical-align:middle;line-height:1}#saved-menu>summary>#saved-current-status{flex:0 1 auto;min-width:0}#saved-menu>summary>#saved-count{display:inline-grid;flex-basis:20px;line-height:1}.menu-disclosure[open]>summary{color:var(--text-primary);background:var(--surface-subtle)}.menu-panel{position:absolute;top:calc(100% + 7px);z-index:20;display:grid;min-width:200px;gap:4px;padding:7px;border:1px solid var(--border);border-radius:10px;background:var(--surface);box-shadow:0 12px 28px #101a2a20}.menu-panel button{display:flex;min-height:36px;align-items:center;padding:0 10px;border:1px solid transparent;border-radius:var(--control-radius);color:var(--text-primary);background:transparent;text-align:left;font-size:13px;cursor:pointer}.menu-panel button:hover:not(:disabled){background:var(--surface-subtle)}.menu-panel button:disabled{cursor:not-allowed;opacity:.45}.help-panel,.export-panel{right:0}.help-panel{min-width:185px}.help-panel label{display:flex;min-height:36px;align-items:center;gap:8px;padding:0 10px;color:var(--text-secondary);font-size:13px;white-space:nowrap}.help-panel input{accent-color:var(--accent)}.export-panel{min-width:210px}.saved-panel{left:0;width:min(390px,calc(100vw - 32px))}.saved-panel-heading{display:grid;gap:3px;padding:8px 10px 11px;border-bottom:1px solid var(--border)}.saved-panel-heading strong{font-size:13px}.saved-panel-heading span{color:var(--text-tertiary);font-size:12px}.save-controls{display:grid;grid-template-columns:minmax(80px,1fr) auto auto;gap:6px;padding:8px 2px}.save-controls input,.confirm-content>input{min-width:0;height:36px;padding:0 10px;border:1px solid var(--border);border-radius:var(--control-radius);color:var(--text-primary);background:var(--surface-muted);font-size:13px}.save-controls input:focus,.confirm-content>input:focus{border-color:var(--accent)}.save-controls button{justify-content:center;padding:0 9px;border:1px solid var(--accent);color:var(--on-accent);background:var(--accent)}.save-controls button:hover:not(:disabled){background:var(--accent-hover)}.save-controls button.button-secondary:hover:not(:disabled){background:var(--surface-subtle)}.save-controls button.button-secondary{border-color:var(--border);color:var(--text-secondary);background:var(--surface)}.saved-diagrams-list{display:grid;max-height:min(320px,45vh);gap:4px;overflow:auto}.saved-item{display:flex;min-width:0;gap:4px}.saved-item button{min-width:0}.saved-item .saved-load{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.saved-item.active .saved-load{color:var(--accent);background:var(--accent-soft)}.saved-item .saved-delete{flex:0 0 auto;color:var(--error)}.saved-item .saved-delete:hover{background:var(--error-bg)}.empty-saved{padding:12px 10px;color:var(--text-tertiary);font-size:13px}.count-badge{display:inline-grid;min-width:20px;height:20px;place-items:center;padding:0 5px;border-radius:999px;color:var(--text-secondary);background:var(--surface-subtle);font-size:11px;font-variant-numeric:tabular-nums}.saved-current-status{max-width:170px;overflow:hidden;color:var(--text-tertiary);font-size:12px;text-overflow:ellipsis;white-space:nowrap}main{display:grid;min-height:0;grid-template-columns:minmax(350px,40%) minmax(0,1fr);overflow:hidden}.editor-pane,.preview-pane{display:grid;min-width:0;min-height:0;grid-template-rows:auto minmax(0,1fr) auto;padding:16px 18px}.editor-pane{border-right:1px solid var(--border);background:var(--surface)}.preview-pane{grid-template-rows:auto minmax(0,1fr);background:var(--app-bg)}.panel-header{display:flex;min-height:48px;align-items:center;justify-content:space-between;gap:12px}.editor-heading,.preview-heading{padding:0 0 12px}.panel-title{display:flex;min-width:0;align-items:center;gap:10px}.panel-icon{display:grid;width:32px;height:32px;flex:0 0 auto;place-items:center;border:1px solid var(--border);border-radius:8px;color:var(--text-secondary);background:var(--surface)}.panel-icon svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.5}.code-icon{font:700 10px ui-monospace,monospace;letter-spacing:-1px}.panel-title>div{display:grid;min-width:0;gap:2px}.panel-title h2{margin:0;font-size:14px;font-weight:650;line-height:18px;letter-spacing:-.01em}.mode-label,.preview-status{color:var(--text-tertiary);font-size:11px;line-height:15px}.preview-status{display:inline-flex;align-items:center;gap:6px}.routing-time{display:block;color:var(--text-tertiary);font-size:11px;line-height:15px}.preview-status[data-busy=true]:before{width:11px;height:11px;flex:0 0 auto;border:2px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:spin .8s linear infinite;content:""}.mode-label.read-only{color:var(--warning)}.editor-actions{flex:1 1 auto;min-width:0;flex-wrap:wrap;justify-content:flex-end;gap:4px}.editor-actions .toolbar-button{min-height:36px;padding:0 9px}.editor-actions .toolbar-button,.auto-refresh-control{font-size:12px;font-weight:550}.editor-actions .toolbar-button svg{width:15px;height:15px}.auto-refresh-control{display:inline-flex;align-items:center;gap:5px;padding:0 5px;color:var(--text-secondary);white-space:nowrap}.auto-refresh-control input{accent-color:var(--accent)}.editor-input{width:100%;min-width:0;min-height:0;overflow:hidden;border:1px solid var(--border);border-radius:8px;background:var(--surface-muted)}.editor-input:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px var(--focus-ring)}.editor-input .cm-editor{width:100%;min-width:0;height:100%}.editor-input .cm-gutters{-webkit-user-select:none;user-select:none}.editor-input .cm-focused{outline:none}.editor-input .cm-cursor{border-left-color:var(--accent);border-left-width:2px}.editor-input .cm-selectionBackground{background:var(--editor-selection)!important}.editor-feedback{display:flex;min-height:34px;align-items:center;justify-content:space-between;gap:10px;padding-top:5px}#status{display:block;min-width:0;overflow:hidden;color:var(--text-tertiary);font-size:12px;line-height:17px;text-overflow:ellipsis}#status[data-kind=success]{color:var(--success)}#status[data-kind=warning]{color:var(--warning)}#status[data-kind=error]{color:var(--error)}#goto-error{flex:0 0 auto;min-height:32px;padding:0 9px;border:1px solid var(--error);border-radius:var(--control-radius);color:var(--error);background:var(--error-bg);font-size:12px;cursor:pointer}#preview{position:relative;min-width:0;min-height:0;overflow:auto;border:1px solid var(--border);border-radius:10px;background-color:var(--surface);background-image:radial-gradient(var(--border) .65px,transparent .65px);background-position:-5px -5px;background-size:20px 20px}#preview>.mxgraph{width:100%;min-height:100%}.preview-loading,.preview-fallback{display:grid;min-height:100%;place-content:center;justify-items:center;gap:12px;padding:24px;color:var(--text-secondary);text-align:center;font-size:13px}.preview-fallback{align-content:center}.preview-fallback strong{color:var(--text-primary);font-size:14px}.preview-fallback-icon{display:grid;width:36px;height:36px;place-items:center;border:1px solid var(--warning);border-radius:50%;color:var(--warning);background:var(--warning-bg);font-weight:700}.preview-status[data-kind=success]{color:var(--success)}.preview-status[data-kind=warning]{color:var(--warning)}.preview-status[data-kind=error]{color:var(--error)}.loading-spinner{width:22px;height:22px;border:2px solid var(--border);border-top-color:var(--accent);border-radius:50%;animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}dialog{width:min(680px,calc(100vw - 32px));max-height:calc(100dvh - 32px);overflow:hidden;padding:0;border:1px solid var(--border);border-radius:12px;color:var(--text-primary);background:var(--surface);box-shadow:0 24px 70px #07111f40}dialog::backdrop{background:#10152280;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px)}.guide-content{max-height:calc(100dvh - 32px);padding:24px;overflow:auto}.guide-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:16px}.guide-heading h2{margin:0;font-size:18px;letter-spacing:-.02em}#skill{width:min(900px,calc(100vw - 32px))}.skill-content pre{max-width:100%;white-space:pre-wrap;overflow-wrap:anywhere}.skill-actions{display:flex;gap:8px}.guide-content h3{margin:20px 0 8px;font-size:13px;font-weight:650}.guide-content p{margin:12px 0;color:var(--text-secondary);font-size:13px;line-height:1.6}.guide-content code{color:var(--text-primary)}.guide-content pre{margin:10px 0;padding:14px;overflow-x:auto;border:1px solid var(--border);border-radius:8px;background:var(--surface-subtle);font:12px/1.6 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.guide-close,.confirm-actions button{display:inline-flex;min-height:36px;align-items:center;justify-content:center;padding:0 12px;border:1px solid var(--border);border-radius:var(--control-radius);color:var(--text-secondary);background:var(--surface);cursor:pointer;font-size:13px}.guide-close:hover,.confirm-actions button:hover{background:var(--surface-subtle)}.confirm-content{max-height:calc(100dvh - 32px);padding:24px;overflow:auto}.confirm-content>input{width:100%;margin:8px 0 0}.confirm-content>label,.confirm-content h3{font-size:13px;font-weight:650}.confirm-content h2{margin:0;font-size:18px;letter-spacing:-.02em}.confirm-content h3{margin:20px 0 8px}#collaboration{width:min(540px,calc(100vw - 32px))}#collaboration-participants{display:grid;gap:6px;max-height:180px;overflow:auto;margin:0 0 20px;padding:0;list-style:none;font-size:13px}#collaboration-participants li{padding:10px 12px;border:1px solid var(--border);border-radius:var(--control-radius);color:var(--text-secondary);background:var(--surface-muted);overflow-wrap:anywhere}#collaboration-participants [data-host=true]{font-weight:650;color:var(--text-primary);background:var(--accent-soft)}.confirm-content p{margin:12px 0 20px;color:var(--text-secondary);font-size:13px;line-height:1.6}.confirm-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;padding-top:16px;border-top:1px solid var(--border)}.confirm-actions #delete-accept{border-color:var(--error);color:var(--surface);background:var(--error)}.confirm-actions #delete-accept:hover{filter:brightness(.92)}.confirm-actions #collaboration-leave{margin-right:auto;color:var(--error)}.confirm-actions #collaboration-leave:hover{background:var(--error-bg)}dialog a{color:var(--accent);text-underline-offset:3px}@media(max-width:760px){.app-header{min-height:60px;gap:10px;padding:9px 14px}.brand-mark{width:32px;height:32px}.brand-lockup p{display:none}.header-actions{gap:4px}.header-actions .menu-disclosure>summary,.theme-button{min-height:38px;padding:0 8px}.header-actions .menu-disclosure>summary span,.theme-button .button-label{display:none}.export-disclosure>summary span{display:none}#collaborate .button-label{display:none}.document-toolbar{min-height:54px;gap:4px;padding:7px 12px}.saved-current-status{max-width:92px}.toolbar-button,.menu-disclosure>summary{min-height:38px;padding:0 8px}main{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(calc(100dvh - 114px),auto) minmax(420px,60vh);overflow-x:hidden;overflow-y:auto}.editor-pane,.preview-pane{padding:12px}.editor-pane{border-right:0;border-bottom:1px solid var(--border)}.editor-heading{align-items:flex-start}.editor-actions{gap:2px}.editor-actions .toolbar-button{min-height:36px;padding:0 7px}.auto-refresh-control{gap:3px;padding-inline:2px}#preview{min-height:400px}}@media(max-width:390px){.brand-lockup{gap:8px}.brand-lockup h1{font-size:15px}.document-toolbar{gap:2px;padding-inline:0}#saved-menu>summary>#saved-current-status{display:none}.toolbar-divider{margin-inline:2px}.toolbar-button{gap:5px;font-size:12px}#collaborate{min-width:36px;padding:0 6px}.editor-heading{gap:5px}.panel-icon{width:28px;height:28px}.editor-actions .toolbar-button{gap:4px;padding-inline:5px}.editor-actions .toolbar-button,.auto-refresh-control{font-size:11px}}@media(max-width:480px){#collaboration .confirm-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}#collaboration-leave{grid-column:1 / -1;justify-self:start}}@media(prefers-reduced-motion:reduce){*,*:before,*:after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}.preview-pane.with-flow-layers{grid-template-rows:auto auto minmax(0,1fr)}.connection-layers{min-width:0;max-height:190px;overflow:auto;margin:8px 0 12px;padding:10px 12px;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--text-primary)}.connection-layers[hidden]{display:none}.connection-layers legend{padding:0 5px;font-size:12px;font-weight:600}.layer-actions,.layer-choices{display:flex;flex-wrap:wrap;align-items:center;gap:8px;min-width:0}.layer-actions{margin-bottom:10px}.layer-choices label{display:flex;align-items:center;gap:7px;min-width:0;min-height:36px;max-width:100%;padding:5px 10px;border:1px solid var(--border);border-radius:var(--control-radius);cursor:pointer;font-size:12px;transition:background-color .13s ease,border-color .13s ease}.layer-choices label:hover{background:var(--surface-subtle)}.layer-choices label:has(input:checked){border-color:var(--accent);background:var(--accent-soft)}.layer-choices label:focus-within{outline:2px solid var(--accent);outline-offset:2px}.layer-choices label>span{overflow-wrap:anywhere}.layer-choices input{flex:0 0 auto;width:16px;height:16px;margin:0;accent-color:var(--accent)}.layer-count{color:var(--text-tertiary);font-variant-numeric:tabular-nums}.layer-note{margin:9px 0 0;color:var(--text-secondary);font-size:11px;line-height:1.5}
