/**
 * Copyright (c) 2014 The xterm.js authors. All rights reserved.
 * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
 * https://github.com/chjj/term.js
 * @license MIT
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * Originally forked from (with the author's permission):
 *   Fabrice Bellard's javascript vt100 for jslinux:
 *   http://bellard.org/jslinux/
 *   Copyright (c) 2011 Fabrice Bellard
 *   The original design remains. The terminal itself
 *   has been extended to include xterm CSI codes, among
 *   other features.
 */.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{-webkit-user-select:text;user-select:text;white-space:pre}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1!important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}:root{--bg: #0a0d12;--surface: #10151d;--surface-raised: #151b24;--surface-soft: #1a222e;--terminal: #070b12;--border: #263140;--border-strong: #39485d;--text: #edf2f8;--muted: #95a2b4;--faint: #647084;--accent: #2f8cff;--accent-strong: #62a8ff;--danger: #ff6b6b;--warning: #f5b84b;--ok: #40d498;--shadow: 0 18px 50px rgba(0, 0, 0, .34);color-scheme:dark}*{box-sizing:border-box}html,body,#root{margin:0;height:100%;background:var(--bg);color:var(--text);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;-webkit-text-size-adjust:100%}button,input,textarea,select{font:inherit}button{min-height:36px;border:1px solid var(--border);border-radius:9px;background:var(--surface-soft);padding:8px 13px;color:var(--text);cursor:pointer;transition:border-color .14s ease,background .14s ease,color .14s ease,transform .12s ease}button:hover:not(:disabled){border-color:var(--border-strong);background:#202a38}button:active:not(:disabled){transform:translateY(1px)}button.primary{border-color:var(--accent);background:var(--accent);color:#fff;font-weight:700}button.primary:hover:not(:disabled){border-color:var(--accent-strong);background:var(--accent-strong)}button.ghost{background:transparent;color:var(--muted)}button.ghost.danger{color:var(--danger)}button.icon{display:inline-grid;flex:0 0 34px;width:34px;height:34px;min-height:34px;place-items:center;border-radius:9px;padding:0;font-size:18px;line-height:1}button.icon.danger{color:var(--danger)}button.block{width:100%}button:disabled{cursor:not-allowed;opacity:.45}input,textarea,select{width:100%;min-height:42px;border:1px solid var(--border);border-radius:9px;background:#0c1119;padding:10px 12px;color:var(--text);outline:none}textarea{resize:none}input:focus,textarea:focus,select:focus{border-color:var(--accent);box-shadow:0 0 0 3px #2f8cff2e}h1,h2,p{margin:0}.muted{color:var(--muted);font-size:13px}.eyebrow{margin-bottom:4px;color:var(--faint);font-size:10px;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.field-label{color:var(--muted);font-size:12px;font-weight:700;text-align:left}.app{display:flex;min-width:320px;height:100dvh;flex-direction:column;padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom)}.topbar{position:sticky;top:0;z-index:10;display:flex;min-height:60px;align-items:center;justify-content:space-between;gap:12px;border-bottom:1px solid var(--border);background:#0a0d12f5;padding:10px 14px;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}.topbar-lead{display:flex;min-width:0;align-items:center;gap:10px}.nav-back{display:inline-grid;flex:0 0 38px;width:38px;height:38px;min-height:38px;place-items:center;border-radius:10px;padding:0;font-size:26px;line-height:1}.topbar-heading{display:flex;min-width:0;flex-direction:column}.topbar-title{overflow:hidden;font-size:16px;font-weight:800;text-overflow:ellipsis;white-space:nowrap}.brand-block{display:flex;min-width:0;flex-direction:column}.brand{font-size:16px;font-weight:800}.topbar-sub{max-width:52vw;overflow:hidden;color:var(--muted);font-size:12px;text-overflow:ellipsis;white-space:nowrap}.topbar-actions{display:flex;flex:0 0 auto;align-items:center;gap:8px}.status,.approval-pill{display:inline-flex;min-height:24px;align-items:center;border:1px solid var(--border);border-radius:999px;padding:3px 9px;font-size:10px;font-weight:800;text-transform:uppercase}.status.open{border-color:#40d4986b;color:var(--ok)}.status.connecting{color:var(--muted)}.status.closed{border-color:#ff6b6b73;color:var(--danger)}.approval-pill{border-color:#f5b84b70;color:var(--warning)}.error{margin:10px 14px 0;border:1px solid rgba(255,107,107,.42);border-radius:9px;background:#ff6b6b1f;padding:10px 12px;color:var(--danger);font-size:13px}.screen{flex:1;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch}.screen-inner{display:flex;width:min(100%,760px);flex-direction:column;gap:12px;margin:0 auto;padding:14px}.empty{display:flex;min-height:120px;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:24px;color:var(--muted);text-align:center}.empty strong{color:var(--text);font-size:18px}.grow{flex:1}.machine-switcher{display:flex;gap:10px;overflow-x:auto;padding-bottom:2px}.machine-chip{display:flex;flex:0 0 auto;min-width:160px;max-width:240px;flex-direction:column;align-items:flex-start;gap:4px;border-radius:11px;background:var(--surface);padding:11px 13px}.machine-chip.active{border-color:var(--accent);background:#121b28;box-shadow:inset 0 0 0 1px #2f8cff33}.machine-head{display:flex;width:100%;min-width:0;align-items:center;gap:8px}.dot{width:8px;height:8px;flex:0 0 8px;border-radius:50%}.dot.online{background:var(--ok);box-shadow:0 0 0 4px #40d4981a}.dot.offline{background:var(--faint)}.machine-name{overflow:hidden;font-weight:800;text-overflow:ellipsis;white-space:nowrap}.machine-caps{width:100%;overflow:hidden;color:var(--muted);font-size:12px;text-overflow:ellipsis;white-space:nowrap}.folder-row{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:60px;border-radius:11px;background:var(--surface);padding:12px 14px;text-align:left}.folder-body{display:flex;min-width:0;flex-direction:column;gap:2px}.folder-name{overflow:hidden;font-size:15px;font-weight:800;text-overflow:ellipsis;white-space:nowrap}.folder-meta{overflow:hidden;color:var(--muted);font-size:12px;text-overflow:ellipsis;white-space:nowrap}.chev{flex:0 0 auto;color:var(--faint);font-size:22px;line-height:1}.panel{overflow:hidden;border:1px solid var(--border);border-radius:11px;background:var(--surface)}.panel-header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;border-bottom:1px solid var(--border);padding:12px 14px}.panel-header h2{font-size:15px;line-height:1.2}.panel-actions{display:flex;flex:0 0 auto;gap:8px}.panel-path{display:block;max-width:260px;margin-top:4px;overflow:hidden;color:var(--muted);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;text-overflow:ellipsis;white-space:nowrap}.new-project{display:grid;grid-template-columns:minmax(0,1fr) auto auto auto;align-items:center;gap:10px;border-bottom:1px solid var(--border);background:#0d131c;padding:12px 14px}.new-project label{display:inline-flex;align-items:center;gap:6px;color:var(--muted);font-size:12px;white-space:nowrap}.new-project input[type=checkbox]{width:16px;min-height:16px;accent-color:var(--accent)}.project-list{display:flex;flex-direction:column;margin:0;padding:6px;list-style:none}.project-list li{display:flex;min-width:0;align-items:center;gap:8px;border-radius:9px}.project-list li.active{background:#111b29;box-shadow:inset 0 0 0 1px #2f8cff66}.row-main{display:flex;min-width:0;min-height:52px;flex:1 1 auto;flex-direction:column;align-items:flex-start;justify-content:center;gap:2px;border:0;background:transparent;padding:9px 11px;text-align:left}.row-main:hover:not(:disabled){background:#151d28}.row-title{max-width:100%;overflow:hidden;font-weight:800;text-overflow:ellipsis;white-space:nowrap}.row-meta{max-width:100%;overflow:hidden;color:var(--muted);font-size:12px;text-overflow:ellipsis;white-space:nowrap}.badge{display:inline-flex;flex:0 0 auto;min-height:22px;align-items:center;margin-right:8px;border:1px solid var(--border);border-radius:999px;background:#0d131c;padding:2px 8px;color:var(--muted);font-size:11px;font-weight:800}.action-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:10px}.action-row .primary{min-height:46px;font-size:15px}.segment{display:flex;gap:4px;border:1px solid var(--border);border-radius:11px;background:var(--surface);padding:4px}.segment button{flex:1;min-height:38px;border:0;border-radius:8px;background:transparent;color:var(--muted);font-weight:700}.segment button.active{background:var(--accent);color:#fff}.segment button:hover:not(:disabled):not(.active){background:var(--surface-soft)}.entry-list{display:flex;flex-direction:column;gap:8px;margin:0;padding:0;list-style:none}.entry-list li{display:flex;min-width:0;align-items:stretch;gap:8px}.entry{display:flex;flex:1 1 auto;min-width:0;align-items:center;gap:11px;border:1px solid var(--border);border-radius:11px;background:var(--surface);padding:11px 13px;text-align:left}.entry:hover:not(:disabled){border-color:var(--border-strong);background:var(--surface-raised)}.entry-list li.active .entry{border-color:var(--accent);box-shadow:inset 0 0 0 1px #2f8cff52}.entry-badge{display:inline-flex;flex:0 0 auto;align-items:center;min-height:22px;border:1px solid var(--border);border-radius:999px;padding:2px 9px;font-size:10px;font-weight:800;text-transform:uppercase}.entry-badge.live{border-color:#40d49880;background:#40d4981f;color:var(--ok)}.entry-badge.saved{color:var(--muted)}.entry-body{display:flex;min-width:0;flex-direction:column;gap:3px}.entry-title{overflow:hidden;font-size:15px;font-weight:800;text-overflow:ellipsis;white-space:nowrap}.entry-meta{overflow:hidden;color:var(--muted);font-size:12px;text-overflow:ellipsis;white-space:nowrap}.inline-empty{display:block;border:1px dashed var(--border);border-radius:11px;padding:22px 14px;color:var(--muted);font-size:13px;text-align:center}.git-status{padding:14px}.git-branch{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.dirty,.clean{font-size:13px}.dirty{color:var(--warning)}.clean{color:var(--ok)}.risk-dangerous{border-color:#ff6b6b80;color:var(--danger)}.risk-caution{border-color:#f5b84b85;color:var(--warning)}.diff{max-height:52dvh;overflow:auto;margin:0 14px 14px;border:1px solid var(--border);border-radius:9px;background:var(--terminal);padding:10px;color:#dce6f3;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;white-space:pre}.terminal-screen{display:flex;flex-direction:column;overflow:hidden;background:var(--terminal);overscroll-behavior:contain}.terminal-wrap{display:flex;flex:1;min-height:0;flex-direction:column;gap:8px;padding:8px}.terminal{position:relative;flex:1;width:100%;min-height:0;overflow:hidden;contain:layout paint style}.terminal .xterm{height:100%}.terminal .xterm-viewport{overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;touch-action:pan-y}.terminal-touch-scroll{position:absolute;top:0;right:0;bottom:0;left:0;z-index:6;overflow-y:scroll;background:transparent;overscroll-behavior:contain;scrollbar-width:none;-webkit-overflow-scrolling:touch;touch-action:pan-y}.terminal-touch-scroll::-webkit-scrollbar{width:0;height:0}.terminal-touch-scroll-spacer{width:1px;min-height:100%;pointer-events:none}.mobile-terminal-input{display:none;grid-template-columns:minmax(0,1fr) auto auto;gap:8px;border-top:1px solid var(--border);background:var(--terminal);padding-top:8px}.mobile-terminal-input textarea{grid-column:1 / -1;min-height:92px;max-height:min(180px,32dvh);padding:11px 12px;line-height:1.42;overflow-y:auto;-webkit-overflow-scrolling:touch}.mobile-terminal-input button{min-width:58px;min-height:42px}.attachment-file-input{display:none}.attachment-list,.attachment-error{grid-column:1 / -1}.attachment-list{display:flex;flex-wrap:wrap;gap:6px}.attachment-chip{display:inline-flex;max-width:100%;min-height:30px;align-items:center;gap:6px;border:1px solid var(--border);border-radius:999px;background:#0d131c;padding:3px 5px 3px 10px;color:var(--muted);font-size:12px}.attachment-chip span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.attachment-chip button{display:inline-grid;width:24px;min-width:24px;height:24px;min-height:24px;place-items:center;border-radius:50%;padding:0}.attachment-error{color:var(--danger);font-size:12px}.empty-terminal{flex:1}.conversation-wrap{position:relative;display:flex;flex:1;min-height:0;flex-direction:column;gap:8px;padding:8px;background:var(--terminal)}.conversation-scroll{display:flex;flex:1;min-height:0;flex-direction:column;gap:10px;overflow-y:auto;overscroll-behavior:contain;padding:4px 2px 8px;-webkit-overflow-scrolling:touch}.conversation-wrap .mobile-terminal-input{display:grid}.message{width:fit-content;max-width:min(92%,780px);border:1px solid var(--border);border-radius:8px;background:#0d131c;padding:9px 11px;color:#e7edf7;line-height:1.48}.message.user{align-self:flex-end;border-color:#7dd3fc52;background:#102131}.message.assistant{align-self:flex-start}.message.system{align-self:center;max-width:min(96%,820px);border-style:dashed;color:var(--muted)}.message-meta{display:flex;align-items:center;gap:8px;margin-bottom:4px;color:var(--muted);font-size:11px}.message-meta time{color:#718096}.message-text{overflow-wrap:anywhere;white-space:pre-wrap}.conversation-status,.conversation-error{align-self:center;color:var(--muted);font-size:13px}.conversation-error{max-width:100%;color:var(--danger);overflow-wrap:anywhere}.conversation-jump{position:absolute;right:16px;bottom:132px;z-index:8;border-color:#7dd3fc5c;background:#102131f0;box-shadow:var(--shadow)}.gate-wrap{display:grid;min-height:100dvh;place-items:center;background:var(--bg);padding:22px}.gate{display:flex;width:min(100%,380px);flex-direction:column;gap:14px;border:1px solid var(--border);border-radius:12px;background:var(--surface);padding:22px;box-shadow:var(--shadow)}.gate h1{font-size:28px}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:20;display:flex;align-items:center;justify-content:center;background:#000000ad;padding:20px;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}.modal{display:flex;width:min(100%,460px);flex-direction:column;gap:12px;border:1px solid var(--border-strong);border-radius:12px;background:var(--surface-raised);padding:18px;box-shadow:var(--shadow)}.modal h2{font-size:18px}.modal .action{border:1px solid var(--border);border-radius:9px;background:#0d131c;padding:10px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px;line-height:1.5;word-break:break-word}.settings-modal{gap:10px}.approval-context{display:flex;flex-direction:column;gap:7px;margin:0}.approval-context div{display:grid;grid-template-columns:92px minmax(0,1fr);gap:8px}.approval-context dt{color:var(--muted)}.approval-context dd{margin:0;word-break:break-word}.modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:4px}@media(max-width:560px){.new-project{grid-template-columns:1fr 1fr}.new-project input:first-child{grid-column:1 / -1}.terminal-wrap{padding-bottom:max(8px,env(safe-area-inset-bottom))}.mobile-terminal-input{display:grid;position:static}}@media(hover:none)and (pointer:coarse){.mobile-terminal-input{display:grid;position:static}}
