/**
 * 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: #0b0e14;--panel: #11151f;--border: #1f2430;--fg: #c0caf5;--muted: #565f89;--accent: #7aa2f7;--ok: #9ece6a;--warn: #e0af68;--err: #f7768e}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}html,body{overscroll-behavior:none;overflow:hidden}body{background:var(--bg);color:var(--fg);font:14px/1.5 ui-monospace,SF Mono,Cascadia Code,Consolas,monospace;touch-action:manipulation}.sidebar,.sched-list,.task-list,.dashboard,.cmd-feed,.xterm-viewport{overscroll-behavior:contain}.app{display:flex;flex-direction:column;height:100%}.header{display:flex;align-items:center;gap:14px;padding:10px 16px;border-bottom:1px solid var(--border);background:var(--panel)}.header .logo{font-weight:700;color:var(--accent)}.header .sub{color:var(--muted);font-size:12px}.header nav{display:flex;gap:6px;margin-left:18px}.header nav button{background:transparent;border:1px solid var(--border);color:var(--fg);padding:4px 12px;border-radius:6px;cursor:pointer;font:inherit;font-size:13px}.header nav button.active{border-color:var(--accent);color:var(--accent)}.header .counts{margin-left:auto;color:var(--muted);font-size:12px}.body{display:flex;flex:1;min-height:0}.sidebar{width:260px;border-right:1px solid var(--border);background:var(--panel);overflow-y:auto}.main{flex:1;min-width:0;display:flex;flex-direction:column}.empty{margin:auto;max-width:420px;text-align:center;color:var(--muted);padding:40px}.panel-title{padding:10px 14px;font-size:11px;letter-spacing:1px;color:var(--muted);display:flex;align-items:center;justify-content:space-between}.spawn-btn{background:transparent;border:1px solid var(--accent);color:var(--accent);width:22px;height:22px;border-radius:4px;cursor:pointer;font-size:14px;line-height:1;display:flex;align-items:center;justify-content:center}.spawn-btn:hover{background:var(--accent);color:var(--bg)}.spawn-form{padding:8px 14px;border-bottom:1px solid var(--border);display:flex;flex-direction:column;gap:6px}.spawn-form input,.spawn-form select{background:var(--bg);color:var(--fg);border:1px solid var(--border);border-radius:4px;padding:4px 8px;font:inherit;font-size:12px}.spawn-actions{display:flex;gap:6px}.spawn-actions button{flex:1;background:var(--accent);color:var(--bg);border:none;border-radius:4px;padding:4px 0;font:inherit;font-size:12px;font-weight:600;cursor:pointer}.spawn-actions button:disabled{opacity:.5;cursor:default}.spawn-cancel{background:transparent!important;color:var(--muted)!important;border:1px solid var(--border)!important}.spawn-err{color:var(--err);font-size:11px}.hint{padding:8px 14px;color:var(--muted);font-size:12px}.agent-item{display:flex;align-items:center;gap:8px;padding:8px 14px;cursor:pointer;border-left:2px solid transparent}.agent-item:hover{background:#161b26}.agent-item.sel{background:#161b26;border-left-color:var(--accent)}.agent-item .dot{width:9px;height:9px;border-radius:50%;flex:none}.agent-item .alias{font-weight:600}.agent-item .runtime{color:var(--muted);font-size:11px}.agent-item .uptime{color:var(--muted);font-size:10px;opacity:.7}.agent-item .badge{margin-left:auto;font-size:10px;color:var(--accent);border:1px solid var(--accent);border-radius:4px;padding:0 5px}.term-wrap{flex:1;display:flex;flex-direction:column;min-height:0}.term-bar{padding:6px 12px;font-size:12px;color:var(--accent);border-bottom:1px solid var(--border);display:flex;align-items:center;gap:8px}.term-meta{color:var(--muted);font-size:11px}.term-esc{margin-left:auto;color:var(--muted);font-size:10px;border:1px solid var(--border);border-radius:3px;padding:0 5px}.term-bar .writing{color:var(--warn);font-size:11px}.term-bar .term-offline{color:var(--err);font-size:11px;animation:offline-blink 1.2s ease-in-out infinite}@keyframes offline-blink{50%{opacity:.35}}.term-kill{background:transparent;border:1px solid var(--err);color:var(--err);font-size:10px;padding:0 6px;border-radius:3px;cursor:pointer;font:inherit}.term-kill:hover{background:var(--err);color:var(--bg)}.term-host{flex:1;min-height:0;padding:6px}.cmd{border-top:1px solid var(--border);background:var(--panel);display:flex;flex-direction:column}.cmd-feed{max-height:120px;overflow-y:auto;padding:6px 14px;border-bottom:1px solid var(--border)}.cmd-msg{margin-bottom:6px}.cmd-msg:last-child{margin-bottom:0}.cmd-user{font-size:12px;color:var(--fg)}.cmd-reply{font-size:12px;color:var(--muted);margin-top:1px}.cmd-input{display:flex;gap:10px;padding:10px 14px}.cmd-input textarea{flex:1;resize:none;height:44px;background:var(--bg);color:var(--fg);border:1px solid var(--border);border-radius:6px;padding:8px 10px;font:inherit;font-size:13px}.cmd-input button{background:var(--accent);color:#0b0e14;border:none;border-radius:6px;padding:0 18px;font-weight:700;cursor:pointer;font:inherit}.cmd-input button:disabled{opacity:.5;cursor:default}.sched-list{padding:14px;overflow-y:auto}.sched-item{border:1px solid var(--border);border-radius:8px;padding:12px 14px;margin-bottom:10px}.sched-item .row{display:flex;gap:10px;align-items:center}.sched-item .kind{font-size:11px;padding:1px 8px;border-radius:4px;border:1px solid var(--border);color:var(--accent)}.sched-item .name{font-weight:600}.sched-item .spec{color:var(--muted);font-size:12px}.sched-item .tmpl{color:var(--fg);font-size:13px;margin-top:6px}.sched-item .meta{color:var(--muted);font-size:11px;margin-top:4px}.status-enabled{color:var(--ok)}.status-disabled{color:var(--muted)}.task-list{padding:14px;overflow-y:auto;flex:1}.task-item{border:1px solid var(--border);border-radius:8px;padding:12px 14px;margin-bottom:10px}.task-row{display:flex;gap:10px;align-items:center}.task-status{font-size:12px;font-weight:600;flex:none}.task-route{font-size:13px;font-weight:600}.task-time{margin-left:auto;font-size:10px;color:var(--muted);white-space:nowrap}.task-payload{font-size:13px;color:var(--fg);margin-top:6px;white-space:pre-wrap;word-break:break-word}.task-result{font-size:12px;color:var(--muted);margin-top:4px;padding-top:4px;border-top:1px dashed var(--border);white-space:pre-wrap;word-break:break-word}.dashboard{padding:24px;overflow-y:auto;flex:1}.dash-section{margin-bottom:24px}.dash-title{font-size:12px;letter-spacing:.5px;color:var(--muted);margin-bottom:12px}.stat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:12px}.stat-card{background:var(--panel);border:1px solid var(--border);border-radius:8px;padding:16px;text-align:center}.stat-value{font-size:28px;font-weight:700;line-height:1.2}.stat-label{font-size:12px;color:var(--muted);margin-top:4px}.stat-sub{font-size:10px;color:var(--muted);margin-top:2px}.dash-event{display:flex;align-items:center;gap:8px;padding:6px 0;border-bottom:1px solid var(--border);font-size:12px}.dash-status{font-weight:700;flex:none}.dash-route{font-weight:600;flex:none}.dash-payload{color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dash-hint{color:var(--muted);font-size:13px;line-height:1.8}.help-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#0009;display:flex;align-items:center;justify-content:center;z-index:100}.help-modal{background:var(--panel);border:1px solid var(--border);border-radius:12px;padding:24px 28px;max-width:360px;width:90%}.help-title{font-size:12px;letter-spacing:.5px;color:var(--muted);margin-bottom:10px}.help-grid{display:grid;grid-template-columns:auto 1fr;gap:6px 14px;align-items:center}.help-grid kbd{background:var(--bg);border:1px solid var(--border);border-radius:4px;padding:2px 8px;font-size:12px;font-family:inherit;color:var(--accent);text-align:center;min-width:28px}.help-grid span{font-size:13px;color:var(--fg)}.help-ops{display:flex;flex-direction:column;gap:4px;font-size:12px;color:var(--fg)}.help-footer{margin-top:16px;font-size:11px;color:var(--muted);text-align:center}.multi-term{display:grid;gap:1px;background:var(--border);flex:1;min-height:0}.multi-cell{background:var(--bg);display:flex;min-height:0}.ch-boot{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px}.ch-star{font-size:48px}.ch-boot-text{font-size:16px;color:var(--muted);text-align:center;line-height:2}.ch-retry{background:var(--accent);color:var(--bg);border:none;border-radius:8px;padding:8px 24px;font:inherit;cursor:pointer;margin-top:8px}.ch-live{flex:1;display:flex;flex-direction:column;min-height:0}.term-bar-right{margin-left:auto;display:flex;gap:6px;align-items:center}.term-esc-btn{background:transparent;border:1px solid var(--warn);color:var(--warn);font-size:11px;padding:2px 8px;border-radius:4px;cursor:pointer;font-family:inherit}.term-esc-btn:hover{background:var(--warn);color:var(--bg)}.term-input-bar{display:flex;gap:8px;padding:8px 12px;border-top:1px solid var(--border);background:var(--panel)}.term-input{flex:1;resize:none;min-height:40px;max-height:100px;background:var(--bg);color:var(--fg);border:1px solid var(--border);border-radius:10px;padding:8px 12px;font:inherit;font-size:16px;line-height:1.4}.term-input:focus{outline:none;border-color:var(--accent)}.term-input::placeholder{color:var(--muted)}.term-send{width:40px;height:40px;border-radius:50%;border:none;background:var(--accent);color:#0b0e14;font-size:18px;font-weight:700;cursor:pointer;flex-shrink:0}.term-send:disabled{opacity:.3;cursor:default}.ch-bar{border-top:1px solid var(--border);background:var(--panel);padding:12px 16px}.ch-input-wrap{max-width:760px;margin:0 auto;display:flex;gap:10px;align-items:flex-end}.ch-input{flex:1;resize:none;min-height:44px;max-height:120px;background:var(--bg);color:var(--fg);border:1px solid var(--border);border-radius:12px;padding:10px 14px;font:inherit;font-size:14px;line-height:1.5}.ch-input:focus{outline:none;border-color:var(--accent)}.ch-input::placeholder{color:var(--muted)}.ch-send{width:44px;height:44px;border-radius:50%;border:none;background:var(--accent);color:#0b0e14;font-size:20px;font-weight:700;cursor:pointer;flex-shrink:0}.ch-send:disabled{opacity:.3;cursor:default}.ch-send:not(:disabled):hover{filter:brightness(1.15)}@media(max-width:680px){.body{flex-direction:column}.sidebar{width:100%;max-height:168px;border-right:none;border-bottom:1px solid var(--border);overflow-x:auto}.header{flex-wrap:wrap;gap:6px;padding:8px 12px}.header nav{margin-left:0;width:100%;overflow-x:auto}.header nav button{font-size:12px;padding:4px 8px;white-space:nowrap}.header .counts{display:none}.cmd textarea{height:44px}.agentlist{display:flex;flex-wrap:nowrap;overflow-x:auto;gap:0}.panel-title{white-space:nowrap;padding:8px 10px}.agent-item{white-space:nowrap;padding:6px 10px;border-left:none;border-bottom:2px solid transparent}.agent-item.sel{border-left-color:transparent;border-bottom-color:var(--accent)}.spawn-form{flex-direction:row;flex-wrap:wrap}.dashboard{padding:14px}.stat-grid{grid-template-columns:repeat(2,1fr);gap:8px}.stat-value{font-size:22px}.stat-card{padding:10px}.dash-event{font-size:11px}.task-list,.task-item{padding:10px}.task-row{flex-wrap:wrap;gap:6px}.task-id{margin-left:0}.multi-term{grid-template-columns:1fr!important}.term-bar{flex-wrap:wrap;gap:4px;font-size:11px}.term-meta{font-size:10px}.term-esc{display:none}.sched-list,.sched-item{padding:10px}.sched-item .row{flex-wrap:wrap;gap:6px}.term-bar{font-size:12px;padding:6px 10px}.term-host{font-size:11px}}
