/**
 * 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;inset: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,.xterm .xterm-message{position:absolute;inset:0;z-index:10;color:transparent;pointer-events:none}.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}*,*:before,*:after{box-sizing:border-box}html,body,#app{margin:0;padding:0;height:100%;width:100%}body{background:#0f172a;color:#e2e8f0;font-family:SF Mono,Fira Code,Cascadia Code,monospace;font-size:14px;overflow:hidden}.layout{display:flex;height:100vh;height:var(--vvh, 100dvh)}.sidebar{width:220px;min-width:180px;background:#1e293b;border-right:1px solid #334155;display:flex;flex-direction:column;overflow-y:auto}.main{flex:1;min-width:0;display:flex;flex-direction:column;overflow:hidden}.sidebar-header{padding:16px;font-size:12px;font-weight:700;color:#94a3b8;letter-spacing:.1em;text-transform:uppercase;border-bottom:1px solid #334155}.server-list{padding:8px 0;flex:1;overflow-y:auto}.server-item{display:flex;align-items:center;gap:7px;width:100%;padding:8px 16px;cursor:pointer;color:#cbd5e1;border-left:3px solid transparent;border-top:none;border-right:none;border-bottom:none;background:none;transition:all .15s;font-size:13px;font-family:inherit;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.server-item:hover{background:#334155;color:#f1f5f9}.server-item.active{background:#1d4ed820;border-left-color:#3b82f6;color:#93c5fd}.server-item.offline{color:#64748b}.server-item-dot{font-size:8px;flex-shrink:0}.tab-bar{display:flex;align-items:stretch;background:#0d1117;border-bottom:1px solid #21262d;overflow-x:auto;flex-shrink:0;scrollbar-width:none;min-height:36px}.tab-bar::-webkit-scrollbar{display:none}.tab-wrap{display:flex;align-items:stretch}.tab{padding:0 16px;cursor:pointer;color:#6e7681;border-top:2px solid transparent;border-bottom:2px solid transparent;white-space:nowrap;font-size:12px;font-weight:500;transition:color .12s,background .12s,border-color .12s;background:transparent;border-left:none;border-right:none;display:flex;align-items:center}.tab:hover{color:#c9d1d9;background:#161b22}.tab.active{color:#e6edf3;background:#161b22;border-top-color:#3b82f6;border-bottom-color:transparent}.tab.brain{color:#9e7ff0}.tab.brain.active{color:#c4b5fd;border-top-color:#8b5cf6}.tab.idle:after{content:"●";margin-left:5px;color:#3fb950;font-size:7px;vertical-align:middle}.tab.busy:after{content:"◌";margin-left:5px;color:#e3b341;font-size:7px;vertical-align:middle;animation:spin 1s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.tab.alert{animation:tab-alert .7s ease-in-out 4}@keyframes tab-alert{0%,to{background:transparent;box-shadow:none}50%{background:#1c3a2a;box-shadow:0 0 10px #3fb95060 inset}}.tab.alert.active{animation:tab-alert-active .7s ease-in-out 4}@keyframes tab-alert-active{0%,to{background:#161b22}50%{background:#1e3a2f;box-shadow:0 0 12px #3fb95070 inset}}.tab-ws-dot{margin-left:6px;font-size:7px;line-height:1;vertical-align:middle;flex-shrink:0}.tab-latency{font-size:9px;font-family:monospace;margin-left:2px;vertical-align:middle}.tab-rename-input{padding:0 10px;height:100%;background:#21262d;border:1px solid #3b82f6;color:#e6edf3;font-family:inherit;font-size:12px;outline:none;width:120px}.tab-add-btn{padding:0 12px;background:none;border:none;color:#4b5563;font-size:16px;cursor:pointer;transition:color .12s;flex-shrink:0;align-self:center;line-height:1}.tab-add-btn:hover{color:#9ca3af}.tab-empty{padding:0 16px;color:#4b5563;font-size:12px;display:flex;align-items:center}.toast-container{position:fixed;bottom:80px;right:16px;z-index:500;display:flex;flex-direction:column;gap:8px;pointer-events:none}.toast{background:#1c2128;border:1px solid #3fb950;border-radius:8px;padding:10px 14px;color:#e6edf3;font-size:13px;display:flex;align-items:center;gap:8px;cursor:pointer;pointer-events:all;box-shadow:0 4px 16px #00000080;animation:toast-in .25s ease;min-width:200px;max-width:280px}.toast:hover{background:#21291f}.toast-icon{color:#3fb950;font-size:15px;flex-shrink:0}.toast-body{flex:1;font-size:13px}.toast-close{background:none;border:none;color:#6e7681;cursor:pointer;font-size:12px;padding:0 0 0 4px;flex-shrink:0;line-height:1}.toast-close:hover{color:#e6edf3}@keyframes toast-in{0%{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}@media (max-width: 640px){.toast-container{bottom:130px;right:8px;left:8px}.toast{max-width:100%}}.tab-context-menu{position:fixed;background:#1c2128;border:1px solid #30363d;border-radius:6px;min-width:150px;box-shadow:0 8px 24px #00000080;z-index:100;overflow:hidden}.menu-divider{height:1px;background:#21262d;margin:2px 0}.terminal-container{flex:1;min-height:0;overflow:hidden;background:#0f0f13}.xterm-viewport{scrollbar-width:thin;scrollbar-color:#334155 transparent}.term-scroll-track{position:absolute;right:2px;top:4px;bottom:4px;width:4px;border-radius:2px;background:#ffffff10;opacity:1;transition:opacity .3s;pointer-events:none;z-index:5}.term-scroll-thumb{position:absolute;width:100%;height:24px;border-radius:2px;background:#64748b;transform:translateY(-50%)}.term-scroll-bottom{position:absolute;right:12px;bottom:12px;width:32px;height:32px;border-radius:50%;background:#1e293bee;border:1px solid #475569;color:#93c5fd;font-size:16px;cursor:pointer;display:flex;align-items:center;justify-content:center;z-index:5;transition:background .15s,transform .15s;box-shadow:0 2px 8px #00000060;line-height:1}.term-scroll-bottom:hover{background:#334155;transform:scale(1.1)}.term-scroll-bottom:active{transform:scale(.95)}.controls-wrapper{background:#1e293b;border-top:1px solid #334155;flex-shrink:0}.shortcuts-row{display:flex;align-items:center;border-bottom:1px solid #1e3250}.shortcuts{display:flex;gap:4px;padding:4px 8px;overflow-x:auto;scrollbar-width:none;flex:1;min-width:0}.shortcuts::-webkit-scrollbar{display:none}.shortcuts-model{padding:4px 8px 4px 0;flex-shrink:0;position:relative}.shortcut-btn{flex-shrink:0;padding:4px 8px;background:#0f172a;border:1px solid #334155;border-radius:4px;color:#94a3b8;font-size:11px;font-family:inherit;cursor:pointer;transition:all .1s;white-space:nowrap}.shortcut-btn:hover:not(:disabled){background:#1e3a5f;border-color:#3b82f6;color:#93c5fd}.shortcut-btn:disabled{opacity:.4;cursor:default}.shortcut-btn-wide{padding-left:14px;padding-right:14px}.controls{padding:6px 8px;display:flex;gap:6px;align-items:center}.controls-input{flex:1;min-width:0;background:#0f172a;border:1px solid #334155;color:#e2e8f0;padding:6px 10px;border-radius:4px;font-family:inherit;font-size:13px;outline:none;overflow-y:auto;min-height:32px;max-height:120px;line-height:1.45;word-break:break-word;white-space:pre-wrap}.controls-input:focus{border-color:#3b82f6}.controls-input-disabled{opacity:.4;pointer-events:none}.controls-input:empty:before{content:attr(data-placeholder);color:#475569;pointer-events:none}.menu-wrap{position:relative}.menu-dropdown{position:absolute;bottom:calc(100% + 4px);right:0;background:#1e293b;border:1px solid #334155;border-radius:6px;min-width:140px;box-shadow:0 4px 16px #00000060;z-index:50;overflow:hidden}.menu-item{display:block;width:100%;padding:9px 14px;background:none;border:none;color:#cbd5e1;font-size:13px;font-family:inherit;text-align:left;cursor:pointer;transition:background .1s}.menu-item:hover{background:#334155}.menu-item-warn{color:#fbbf24;background:#292005!important}.menu-item-warn:hover{background:#3a2e07!important}.menu-item-danger{color:#f87171;background:#1f0808!important}.menu-item-danger:hover{background:#2d0e0e!important}.menu-item-active{color:#a78bfa;background:#1e1338!important}.menu-item-active:hover{background:#2a1b4e!important}.btn{padding:6px 12px;border-radius:4px;border:none;cursor:pointer;font-size:12px;font-family:inherit;font-weight:600;transition:all .15s}.btn-primary{background:#3b82f6;color:#fff}.btn-primary:hover{background:#2563eb}.btn-danger{background:#ef4444;color:#fff}.btn-danger:hover{background:#dc2626}.btn-secondary{background:#334155;color:#cbd5e1}.btn-secondary:hover{background:#475569}.qp-trigger-wrap{position:relative;flex-shrink:0}.qp-trigger{padding:6px 9px;background:#0f172a;border:1px solid #334155;border-radius:4px;color:#fbbf24;font-size:14px;cursor:pointer;line-height:1;transition:all .1s;flex-shrink:0}.qp-trigger:hover{background:#1e3a5f;border-color:#fbbf24}.qp-backdrop{display:none}.qp{position:absolute;bottom:calc(100% + 6px);left:0;width:min(50vw,700px);max-height:65vh;background:#1e293b;border:1px solid #334155;border-radius:8px;box-shadow:0 8px 24px #00000070;z-index:45;display:flex;flex-direction:column;overflow:hidden}.qp-toolbar{display:flex;gap:6px;padding:8px 10px;border-bottom:1px solid #334155;flex-shrink:0}.qp-toolbar-btn{padding:4px 10px;background:#0f172a;border:1px solid #334155;border-radius:4px;color:#94a3b8;font-size:11px;font-family:inherit;cursor:pointer;transition:all .1s}.qp-toolbar-btn:hover{background:#1e3a5f;border-color:#3b82f6;color:#93c5fd}.qp-toolbar-btn-danger{color:#f87171;border-color:#7f1d1d;background:#1f0808;margin-left:auto}.qp-toolbar-btn-danger:hover{background:#2d0e0e;border-color:#ef4444;color:#fca5a5}.qp-add-row{display:flex;align-items:center;gap:6px;padding:8px 10px;border-bottom:1px solid #334155;flex-shrink:0}.qp-add-label{font-size:11px;color:#64748b;flex-shrink:0}.qp-add-input{flex:1;min-width:0;background:#0f172a;border:1px solid #334155;color:#e2e8f0;padding:4px 8px;border-radius:4px;font-size:12px;font-family:inherit;outline:none}.qp-add-input:focus{border-color:#3b82f6}.qp-add-confirm{padding:4px 8px;background:#1d4ed8;border:none;border-radius:4px;color:#fff;font-size:13px;cursor:pointer}.qp-add-confirm:hover{background:#2563eb}.qp-add-cancel{padding:4px 6px;background:none;border:none;color:#64748b;font-size:13px;cursor:pointer}.qp-add-cancel:hover{color:#f87171}.qp-list{flex:1;overflow-y:auto;scrollbar-width:thin;scrollbar-color:#334155 transparent}.qp-section-header{padding:6px 10px 3px;font-size:10px;font-weight:700;color:#475569;letter-spacing:.08em;text-transform:uppercase;position:sticky;top:0;background:#1e293b;z-index:1}.qp-history-empty{padding:6px 10px 8px;font-size:11px;color:#475569;font-style:italic}.qp-history-header{display:flex;align-items:center;justify-content:space-between;padding-right:8px}.qp-scope-toggle{display:flex;gap:2px}.qp-scope-btn{padding:2px 8px;background:none;border:1px solid #334155;border-radius:3px;color:#475569;font-size:10px;font-family:inherit;cursor:pointer;transition:all .1s}.qp-scope-btn.active{background:#1e3a5f;border-color:#3b82f6;color:#93c5fd}.qp-scope-btn:not(.active):hover{border-color:#475569;color:#94a3b8}.qp-pills{display:flex;flex-wrap:wrap;gap:5px;padding:5px 10px 8px}.qp-pill{display:inline-flex;align-items:center;padding:4px 10px;border-radius:999px;font-size:12px;font-family:inherit;cursor:pointer;transition:all .1s;white-space:nowrap;border:1px solid}.qp-pill-default{background:#0f172a;border-color:#334155;color:#94a3b8}.qp-pill-default:hover{background:#1e3a5f;border-color:#3b82f6;color:#93c5fd}.qp-pill-custom{background:#1e293b;border-color:#475569;color:#cbd5e1;display:inline-flex;align-items:center;border-radius:999px;overflow:hidden;padding:0}.qp-pill-text{padding:4px 8px 4px 10px;font-size:12px;cursor:pointer}.qp-pill-text:hover{background:#334155}.qp-pill-del{padding:4px 7px 4px 4px;background:none;border:none;color:#475569;font-size:10px;cursor:pointer;transition:color .1s}.qp-pill-del:hover{color:#f87171}.qp-item{display:flex;align-items:flex-start;gap:6px;padding:5px 10px;cursor:pointer;transition:background .1s}.qp-item:hover{background:#293548}.qp-item-history{opacity:.8}.qp-item-history:hover{opacity:1;background:#293548}.qp-item-text{flex:1;min-width:0;font-size:12px;color:#94a3b8;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-break:break-word;line-height:1.5}.qp-item-del{flex-shrink:0;padding:2px 5px;margin-top:1px;background:none;border:none;color:#3f4f63;font-size:10px;cursor:pointer;border-radius:3px;transition:all .1s}.qp-item-del:hover{color:#f87171}.qp-empty{padding:12px;font-size:12px;color:#475569;text-align:center}.qp-pagination{display:flex;align-items:center;justify-content:center;gap:10px;padding:5px 10px;border-top:1px solid #1e3250;flex-shrink:0}.qp-page-btn{padding:3px 10px;background:#0f172a;border:1px solid #334155;border-radius:4px;color:#64748b;font-size:11px;font-family:inherit;cursor:pointer;transition:all .1s}.qp-page-btn:hover:not(:disabled){border-color:#3b82f6;color:#93c5fd}.qp-page-btn:disabled{opacity:.3;cursor:default}.qp-page-info{font-size:11px;color:#475569}@media (max-width: 640px){.qp-backdrop{display:block;position:fixed;inset:0;background:#00000070;z-index:44}.qp{position:fixed;bottom:0;left:0;right:0;width:100%;max-height:60vh;border-radius:12px 12px 0 0;border-bottom:none}}.login-page{display:flex;align-items:center;justify-content:center;height:100vh;height:100dvh}.login-card{background:#1e293b;border:1px solid #334155;border-radius:8px;padding:32px;width:360px;max-width:calc(100vw - 32px)}.login-card h1{margin:0 0 24px;font-size:20px;color:#f1f5f9}.form-group{margin-bottom:16px}.form-group label{display:block;margin-bottom:6px;font-size:12px;color:#94a3b8}.form-group input{width:100%;background:#0f172a;border:1px solid #334155;color:#e2e8f0;padding:8px 12px;border-radius:4px;font-family:inherit;font-size:14px;outline:none}.form-group input:focus{border-color:#3b82f6}.login-card .btn{width:100%;padding:10px}.badge{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:9999px;font-size:11px;font-weight:600}.badge-online{background:#14532d;color:#4ade80}.badge-offline{background:#1f1f1f;color:#64748b}.badge-error{background:#450a0a;color:#f87171}.agent-badge{display:inline-flex;align-items:center;justify-content:center;padding:1px 4px;border-radius:3px;font-size:9px;font-weight:700;color:#fff;margin-right:5px;letter-spacing:.03em;flex-shrink:0}.mobile-server-bar{display:none}@media (max-width: 640px){.sidebar{display:none}.mobile-server-bar{display:flex;align-items:center;justify-content:space-between;padding:4px 10px;background:#1e293b;border-bottom:1px solid #334155;flex-shrink:0;position:relative;z-index:20}.mobile-server-switcher-wrap{position:relative}.mobile-server-btn{background:none;border:none;color:#94a3b8;font-family:inherit;font-size:12px;cursor:pointer;padding:4px 0}.mobile-server-btn:active{color:#e2e8f0}.mobile-server-menu{position:absolute;top:calc(100% + 4px);left:0;background:#1e293b;border:1px solid #334155;border-radius:6px;min-width:180px;box-shadow:0 8px 24px #00000080;z-index:50;overflow:hidden}.mobile-server-menu-item{display:block;width:100%;padding:10px 14px;background:none;border:none;color:#cbd5e1;font-size:13px;font-family:inherit;text-align:left;cursor:pointer}.mobile-server-menu-item:hover,.mobile-server-menu-item:active{background:#334155}.mobile-server-menu-item.active{color:#93c5fd;background:#1d4ed820}.controls{padding:6px 8px;gap:6px}.controls-input{font-size:16px}.btn{padding:8px 10px;font-size:13px}}
