*,
*::before,
*::after{box-sizing:border-box}
:root,:root[data-theme="dark"]{
  --bg:#0b0d10;--surface:#111418;--surface2:#0f1318;
  --border:#1f2937;--border2:#334155;--text:#e5e7eb;--muted:#94a3b8;
  --link:#93c5fd;--link-hover:#dbeafe;
  --diff-file:#93c5fd;--diff-hunk:#60a5fa;
  --diff-add:#22c55e;--diff-add-bg:rgba(34,197,94,.08);
  --diff-del:#f87171;--diff-del-bg:rgba(248,113,113,.08);
  color-scheme:dark;
}
:root[data-theme="light"]{
  --bg:#f8fafc;--surface:#ffffff;--surface2:#f8fafc;
  --border:#dbe4ee;--border2:#cbd5e1;--text:#0f172a;--muted:#64748b;
  --link:#2563eb;--link-hover:#1d4ed8;
  --diff-file:#1d4ed8;--diff-hunk:#2563eb;
  --diff-add:#15803d;--diff-add-bg:rgba(34,197,94,.12);
  --diff-del:#b91c1c;--diff-del-bg:rgba(239,68,68,.12);
  color-scheme:light;
}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--text);font:14px/1.5 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace}
.page{min-height:100%;display:flex;flex-direction:column}
.page-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:14px 18px;border-bottom:1px solid var(--border);background:var(--surface)}
.page-title-wrap{min-width:0}
.page-head-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.page-title{margin:0;font-size:16px;line-height:1.3;font-weight:600}
.page-meta{margin-top:4px;color:var(--muted);font-size:12px;word-break:break-word}
.task-link{color:var(--link);text-decoration:none;white-space:nowrap}
.task-link:hover{text-decoration:underline}
.page-status{padding:10px 18px;border-bottom:1px solid var(--border);color:var(--muted);background:var(--surface2);display:flex;align-items:center;justify-content:space-between;gap:12px}
.page-status-text{min-width:0}
.page-status-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}
.page-status.error .page-status-text{color:var(--diff-del)}
.page-action{border:1px solid var(--border2);background:var(--surface);color:var(--text);border-radius:8px;padding:6px 10px;font:inherit;cursor:pointer;white-space:nowrap}
.page-action:hover{border-color:var(--link);color:var(--link-hover)}
.page-action:disabled{cursor:default;opacity:.5}
.diff-view{margin:0;padding:18px;flex:1;overflow:auto;white-space:pre-wrap;word-break:break-word}
.diff-line{display:block}
.diff-editor-line{color:inherit;cursor:pointer;text-decoration:none;user-select:text;-webkit-user-drag:none}
.diff-editor-line:hover{box-shadow:inset 2px 0 var(--link)}
.log-view{white-space:pre-wrap;word-break:break-word;padding-bottom:76px}
.log-line{display:block}
.log-line-command{color:var(--link-hover)}
.log-line-empty{color:var(--muted)}
.log-match{background:rgba(250,204,21,.28);color:inherit;border-radius:3px;padding:0 2px}
.log-filter-bar{position:fixed;left:0;right:0;bottom:0;padding:10px 18px calc(10px + env(safe-area-inset-bottom,0px));border-top:1px solid var(--border);background:color-mix(in srgb,var(--surface) 94%,transparent);backdrop-filter:blur(10px)}
.log-filter-input{display:block;width:100%;border:1px solid var(--border2);background:var(--surface2);color:var(--text);border-radius:8px;padding:8px 10px;font:inherit;outline:none}
.log-filter-input:focus{border-color:var(--link)}
.log-filter-input::placeholder{color:var(--muted)}
.log-page{height:100%;min-height:0;overflow:hidden}
.log-page .page-head,.log-page .page-status,.log-page .log-filter-bar{flex:0 0 auto}
.log-page .log-view{min-height:0;padding-bottom:18px}
.log-page .log-filter-bar{position:static}
.terminal-page{height:100vh;min-height:0;overflow:hidden}
.terminal-page .page-head{flex-shrink:0}
.terminal-page .page-status{flex-shrink:0}
.terminal-topbar{align-items:center;padding:8px 12px;gap:12px}
.terminal-topbar .page-title-wrap{display:flex;align-items:center;gap:10px;min-width:0;flex:1}
.terminal-topbar .page-title{font-size:14px;line-height:1.2;white-space:nowrap}
.terminal-topbar .page-meta{margin:0;min-width:0;max-width:42vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.terminal-topbar .page-head-actions{flex-shrink:0;gap:8px}
.terminal-status-line{min-width:120px;max-width:28vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted);font-size:12px}
.terminal-topbar.error .terminal-status-line{color:var(--diff-del)}
.terminal-size{border:1px solid var(--border2);border-radius:6px;padding:2px 6px;color:var(--muted);font-size:11px;white-space:nowrap}
.terminal-shell{flex:1;min-height:0;overflow:hidden;display:flex;flex-direction:column;background:#05070b;color:#d6deeb}
.terminal-screen{flex:1;min-height:0;overflow:auto;padding:14px 16px;white-space:pre;word-break:normal;outline:none;tab-size:4;font:12px/1.45 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace}
.terminal-screen:focus{box-shadow:inset 0 0 0 1px rgba(45,212,191,.48)}
.terminal-screen.empty{color:var(--muted)}
.terminal-footer{padding:8px 12px;border-top:1px solid rgba(148,163,184,.18);color:#94a3b8;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.terminal-input-cursor{display:inline-block;width:7px;height:1.1em;margin-left:1px;vertical-align:-2px;background:#d6deeb;animation:terminal-cursor 1s steps(1,end) infinite}
.terminal-cursor-cell{background:#d6deeb!important;color:#05070b!important}
.terminal-ansi-dim{opacity:.68}
.terminal-ansi-bold{font-weight:700}
.terminal-ansi-reverse{background:#d6deeb!important;color:#05070b!important}
.terminal-fg-black{color:#64748b}.terminal-fg-red{color:#f87171}.terminal-fg-green{color:#34d399}.terminal-fg-yellow{color:#fbbf24}.terminal-fg-blue{color:#60a5fa}.terminal-fg-magenta{color:#c084fc}.terminal-fg-cyan{color:#22d3ee}.terminal-fg-white{color:#e5e7eb}
.terminal-bg-black{background:#020617}.terminal-bg-red{background:#7f1d1d}.terminal-bg-green{background:#064e3b}.terminal-bg-yellow{background:#713f12}.terminal-bg-blue{background:#1e3a8a}.terminal-bg-magenta{background:#581c87}.terminal-bg-cyan{background:#155e75}.terminal-bg-white{background:#e5e7eb}.terminal-bg-white:not([class*="terminal-fg-"]){color:#020617}
.terminal-bg-bright-black{background:#475569}.terminal-bg-bright-red{background:#dc2626}.terminal-bg-bright-green{background:#059669}.terminal-bg-bright-yellow{background:#ca8a04}.terminal-bg-bright-blue{background:#2563eb}.terminal-bg-bright-magenta{background:#9333ea}.terminal-bg-bright-cyan{background:#0891b2}.terminal-bg-bright-white{background:#f8fafc}.terminal-bg-bright-white:not([class*="terminal-fg-"]){color:#020617}
@keyframes terminal-cursor{0%,50%{opacity:1}51%,100%{opacity:0}}
.editor-page{height:100%;min-height:100%}
.editor-page .page-status{flex-shrink:0}
.editor-shell{flex:1;min-height:0;display:grid;grid-template-columns:var(--editor-sidebar-width,300px) 5px minmax(0,1fr);background:var(--surface2)}
.editor-sidebar{min-width:0;min-height:0;display:flex;flex-direction:column;background:var(--surface)}
.editor-resizer{position:relative;min-height:0;background:var(--surface);cursor:col-resize;touch-action:none;outline:0}
.editor-resizer::after{content:"";position:absolute;inset:0 2px;background:var(--border);transition:background .12s ease}
.editor-resizer:hover::after,.editor-resizer:focus-visible::after,body.editor-resizing .editor-resizer::after{background:var(--link)}
body.editor-resizing{cursor:col-resize;user-select:none}
.editor-search-row{padding:10px;border-bottom:1px solid var(--border)}
.editor-search{display:block;width:100%;border:1px solid var(--border2);background:var(--surface2);color:var(--text);border-radius:8px;padding:8px 10px;font:inherit;outline:none}
.editor-search:focus{border-color:var(--link)}
.editor-file-list{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;padding:6px}
.editor-file-count{flex:0 0 auto;padding:4px 7px 6px;color:var(--muted);font-size:11px;border-bottom:1px solid var(--border);margin-bottom:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.editor-tree{display:flex;flex-direction:column;gap:1px;min-width:0}
.editor-tree-node,.editor-tree-group{display:flex;flex-direction:column;gap:1px;min-width:0}
.editor-tree-group[hidden]{display:none}
.editor-folder,.editor-file{appearance:none;width:100%;min-width:0;flex:0 0 auto;border:1px solid transparent;background:transparent;color:var(--muted);border-radius:6px;padding:5px 7px 5px calc(7px + var(--tree-depth,0) * 14px);text-align:left;font:12px/1.25 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace;white-space:nowrap;cursor:pointer;display:flex;align-items:center;gap:4px}
.editor-folder{color:var(--text)}
.editor-folder:hover,.editor-folder:focus-visible,.editor-file:hover,.editor-file:focus-visible,.editor-file.selected{background:var(--surface2);border-color:var(--border2);color:var(--text);outline:0}
.editor-folder-chevron{flex:0 0 10px;width:10px;color:var(--muted);text-align:center}
.editor-tree-label{min-width:0;overflow:hidden;text-overflow:ellipsis}
.editor-empty{padding:10px 7px;color:var(--muted);font-size:12px}
.editor-main{min-width:0;min-height:0;display:flex;flex-direction:column}
.editor-markdown-preview{flex:1;min-height:0;overflow:auto;padding:24px;background:var(--surface2);font-family:system-ui,sans-serif;--mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace;--surface3:var(--surface)}
.editor-markdown-preview .codex-md{max-width:960px;margin:0 auto}
.editor-markdown-preview a{color:var(--link)}
.editor-markdown-preview a:hover{color:var(--link-hover)}
.editor-main [hidden]{display:none}
#markdown-preview-btn,#plain-text-btn{flex-shrink:0}
.editor-file-head .page-action[aria-pressed="true"]{border-color:var(--link);color:var(--link);background:var(--surface2)}
.editor-tabs{height:34px;display:flex;align-items:stretch;overflow-x:auto;overflow-y:hidden;border-bottom:1px solid var(--border);background:var(--surface);flex-shrink:0;scrollbar-width:thin}
.editor-tabs:empty{display:none}
.editor-tab{appearance:none;min-width:110px;max-width:220px;display:flex;align-items:center;gap:7px;padding:0 7px 0 10px;border:0;border-right:1px solid var(--border);border-bottom:2px solid transparent;background:var(--surface);color:var(--muted);font:12px/1.2 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace;cursor:pointer}
.editor-tab:hover{background:var(--surface2);color:var(--text)}
.editor-tab.active{border-bottom-color:var(--link);background:var(--surface2);color:var(--text)}
.editor-tab-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.editor-tab-dirty{width:8px;flex:0 0 8px;color:var(--link);text-align:center}
.editor-tab-close{appearance:none;width:19px;height:19px;display:grid;place-items:center;flex:0 0 19px;padding:0;border:0;border-radius:4px;background:transparent;color:var(--muted);font:15px/1 sans-serif;cursor:pointer}
.editor-tab-close:hover,.editor-tab-close:focus-visible{background:var(--surface3);color:var(--text);outline:0}
.editor-file-head{height:36px;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:0 12px;border-bottom:1px solid var(--border);background:var(--surface);flex-shrink:0}
.editor-path{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--text)}
.editor-cursor{color:var(--muted);white-space:nowrap;font-size:12px}
.editor-viewport{position:relative;flex:1;min-height:0;overflow:auto;background:var(--surface2);font:12px/18px ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace}
.editor-spacer{width:1px}
.editor-lines{position:absolute;left:0;top:0;min-width:100%}
.editor-line{position:relative;display:grid;grid-template-columns:54px minmax(0,1fr);width:100%}
.editor-line.active .editor-line-number{color:var(--text)}
.editor-line.selected:not(.char-selected) .editor-line-number,.editor-line.selected:not(.char-selected) .editor-line-input{background:rgba(96,165,250,.18)}
.editor-line.char-selected .editor-line-input::selection{background:rgba(96,165,250,.4);color:var(--text)}
.editor-line.dirty .editor-line-number{color:var(--link)}
.editor-line-number{appearance:none;border:0;border-right:1px solid var(--border);border-radius:0;background:var(--surface);color:var(--muted);text-align:right;padding:0 9px 0 4px;user-select:none;font:inherit;cursor:pointer}
.editor-line-input{width:100%;min-width:0;height:18px;border:0;outline:0;border-radius:0;padding:0 8px;background:transparent;color:var(--text);font:12px/18px ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace;white-space:pre;tab-size:4}
.editor-line-input:focus{background:rgba(147,197,253,.1)}
.editor-line-input[readonly]{cursor:default;caret-color:transparent}
.editor-vim-cursor{position:absolute;top:2px;width:7.2px;height:14px;background:var(--text);opacity:.82;pointer-events:none;mix-blend-mode:difference}
.editor-line-input:disabled{color:var(--muted)}
.editor-footer{height:30px;flex-shrink:0;padding:6px 12px;border-top:1px solid var(--border);background:var(--surface);color:var(--muted);font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.diff-file{color:var(--diff-file);font-weight:600}
.diff-meta,.diff-filehdr{color:var(--muted)}
.diff-hunk{color:var(--diff-hunk)}
.diff-add{color:var(--diff-add);background:var(--diff-add-bg)}
.diff-del{color:var(--diff-del);background:var(--diff-del-bg)}
@media (max-width: 700px){
  .page-head{padding:12px 14px;flex-direction:column;align-items:flex-start}
  .page-head-actions{width:100%;justify-content:space-between}
  .page-status{padding-left:14px;padding-right:14px;align-items:flex-start;flex-direction:column}
  .page-status-actions{width:100%;justify-content:flex-start}
  .terminal-topbar{align-items:flex-start;gap:8px}
  .terminal-topbar .page-title-wrap{width:100%;flex-wrap:wrap}
  .terminal-topbar .page-meta{max-width:100%;width:100%}
  .terminal-status-line{max-width:100%;width:100%}
  .editor-shell{grid-template-columns:1fr}
  .editor-sidebar{height:220px;border-right:0;border-bottom:1px solid var(--border)}
  .editor-resizer{display:none}
  .diff-view{padding-left:14px;padding-right:14px}
  .log-filter-bar{padding-left:14px;padding-right:14px}
}
