/**
 * 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}*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}:root,[data-theme=dark]{--bg: #0d0d0d;--bg2: #141414;--bg3: #1c1c1c;--border: #272727;--text: #e2e2e2;--text2: #666;--accent: #00d4aa;--accent2: #4d94ff;--danger: #ff4444;--warn: #ffaa00;--success: #00cc66;--term-bg: #0d0d0d;--sidebar-w: 200px;--font: "SF Mono","Fira Code","Consolas",monospace}[data-theme=light]{--bg: #f5f5f5;--bg2: #ffffff;--bg3: #ebebeb;--border: #d0d0d0;--text: #1a1a1a;--text2: #888;--accent: #009977;--accent2: #2266cc;--danger: #cc2222;--warn: #cc7700;--success: #007744;--term-bg: #111}html,body,#root{height:100%;min-height:100%;background:var(--bg);color:var(--text);font-family:var(--font);font-size:13px;overflow:hidden;-webkit-font-smoothing:antialiased}button{cursor:pointer;font-family:var(--font);border:none;outline:none;background:none}input,textarea,select{font-family:var(--font);background:var(--bg3);color:var(--text);border:1px solid var(--border);border-radius:4px;padding:8px 10px;outline:none;font-size:13px;width:100%}input:focus,textarea:focus,select:focus{border-color:var(--accent)}::-webkit-scrollbar{width:4px;height:4px}::-webkit-scrollbar-track{background:var(--bg2)}::-webkit-scrollbar-thumb{background:var(--border);border-radius:2px}.xterm-viewport::-webkit-scrollbar-thumb{background:var(--border)}.app-layout{display:flex;height:100%;overflow:hidden}.sidebar{width:var(--sidebar-w);min-width:var(--sidebar-w);background:var(--bg2);border-right:1px solid var(--border);display:flex;flex-direction:column;height:100%;overflow:hidden;transition:transform .2s ease;z-index:100}.app-main{flex:1;display:flex;flex-direction:column;overflow:hidden;min-width:0;min-height:0}.page-content{flex:1;overflow:hidden;display:flex;flex-direction:column;min-height:0;position:relative}.sidebar-header{padding:14px 12px;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:8px}.sidebar-logo{font-size:18px}.sidebar-title{font-weight:700;font-size:14px;color:var(--accent)}.sidebar-nav{flex:1;overflow-y:auto;padding:8px 0}.nav-item{display:flex;align-items:center;gap:8px;width:100%;padding:8px 12px;color:var(--text2);font-size:12px;text-align:left;border-left:2px solid transparent;transition:background .1s,color .1s}.nav-item:hover{background:var(--bg3);color:var(--text)}.nav-item.active{background:var(--bg3);color:var(--accent);border-left-color:var(--accent)}.nav-item-dim{opacity:.5}.nav-icon{font-size:14px;min-width:18px}.nav-label{flex:1}.nav-section-label{padding:10px 12px 4px;font-size:10px;color:var(--text2);letter-spacing:1px}.nav-divider{height:1px;background:var(--border);margin:6px 0}.session-dot,.status-dot,.service-dot{width:7px;height:7px;border-radius:50%;flex-shrink:0}.dot-alive{background:var(--success)}.dot-dead{background:var(--border)}.sidebar-footer{padding:10px 12px;border-top:1px solid var(--border);display:flex;flex-direction:column;gap:6px}.sidebar-user{font-size:11px;color:var(--text2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mobile-topbar{display:none;background:var(--bg2);border-bottom:1px solid var(--border);padding:8px 12px;align-items:center;gap:10px}.hamburger{font-size:18px;color:var(--text2);padding:2px 6px}.mobile-title{color:var(--accent);font-weight:700;font-size:14px}.sidebar-overlay{display:none;position:fixed;top:0;right:0;bottom:0;left:0;background:#0009;z-index:99}@media (max-width: 640px){.sidebar{position:fixed;left:0;top:0;height:100%;bottom:auto;transform:translate(-100%)}.sidebar.sidebar-open{transform:translate(0)}.sidebar-overlay{display:block}.mobile-topbar{display:flex}}.btn-primary{background:var(--accent);color:#000;font-weight:700;padding:8px 16px;border-radius:4px;font-size:13px}.btn-primary:disabled{opacity:.5;cursor:default}.btn-ghost{color:var(--text2);font-size:11px;padding:4px 8px;border:1px solid var(--border);border-radius:3px}.btn-ghost:hover{color:var(--text);border-color:var(--text2)}.btn-danger-ghost{color:var(--danger);font-size:11px;padding:4px 8px;border:1px solid var(--border);border-radius:3px}.dim{color:var(--text2)}.badge{font-size:10px;padding:2px 6px;border-radius:3px;font-weight:700;border:1px solid}.badge-claude{color:#a78bfa;border-color:#a78bfa}.badge-codex{color:#60a5fa;border-color:#60a5fa}.badge-hermes{color:#f59e0b;border-color:#f59e0b}.badge-memezaurus{color:#34d399;border-color:#34d399}.badge-admin{color:var(--danger);border-color:var(--danger)}.badge-viewer{color:var(--text2);border-color:var(--border)}.dashboard{padding:16px;height:100%;overflow:auto}.page-title{font-size:16px;font-weight:700;margin-bottom:16px;color:var(--text)}.dash-section{margin-bottom:20px}.dash-section-header{display:flex;justify-content:space-between;align-items:center;font-size:10px;letter-spacing:1px;color:var(--text2);margin-bottom:8px}.session-grid{display:flex;flex-direction:column;gap:6px}.session-card{background:var(--bg2);border:1px solid var(--border);border-radius:6px;padding:10px 12px;text-align:left;cursor:pointer;transition:border-color .15s}.session-card:hover{border-color:var(--accent2)}.session-attached{border-color:var(--accent)!important}.session-card-name{display:flex;align-items:center;gap:6px;font-size:13px;margin-bottom:2px}.session-card-meta{font-size:11px;color:var(--text2)}.stat-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:8px}.stat-card{background:var(--bg2);border:1px solid var(--border);border-radius:6px;padding:10px 12px}.stat-label{font-size:10px;color:var(--text2);letter-spacing:.5px;margin-bottom:4px}.stat-value{font-size:13px;color:var(--text)}.service-list{display:flex;flex-direction:column;gap:4px}.service-row{background:var(--bg2);border:1px solid var(--border);border-radius:4px;padding:8px 12px;display:flex;align-items:center;gap:8px;font-size:12px}.service-name{flex:1}.service-detail{font-size:11px}.service-badge{font-size:10px;padding:1px 5px;border-radius:2px;border:1px solid var(--border)}.service-badge.systemd{color:#60a5fa;border-color:#60a5fa}.service-badge.docker{color:#34d399;border-color:#34d399}.terminal-page{display:flex;flex-direction:column;height:100%;min-height:0;overflow:hidden;position:relative}.terminal-toolbar{background:var(--bg2);border-bottom:1px solid var(--border);padding:4px 10px;display:flex;align-items:center;gap:6px;flex-shrink:0}.terminal-container{flex:1;min-height:0;overflow:hidden;background:var(--term-bg);touch-action:none;overscroll-behavior:contain;position:relative}.terminal-container .xterm{height:100%;touch-action:none}.terminal-container .xterm-viewport{touch-action:none!important;overscroll-behavior:contain}.keybar{background:var(--bg2);border-top:1px solid var(--border);padding:5px 8px;display:flex;gap:4px;flex-wrap:wrap;flex-shrink:0}.key-btn{background:var(--bg3);color:var(--text);border:1px solid var(--border);border-radius:4px;padding:5px 9px;font-size:12px;min-width:34px;text-align:center;user-select:none;-webkit-user-select:none}.key-btn:active{background:var(--border)}.key-active{background:var(--accent)!important;color:#000!important;border-color:var(--accent)!important}.key-warn{color:var(--warn)!important}.login-wrap{display:flex;align-items:center;justify-content:center;height:100%;background:var(--bg)}.login-card{width:100%;max-width:300px;padding:32px 24px;background:var(--bg2);border:1px solid var(--border);border-radius:8px}.login-logo{text-align:center;font-size:36px;margin-bottom:8px}.login-title{text-align:center;color:var(--accent);font-weight:700;font-size:18px}.login-sub{text-align:center;color:var(--text2);font-size:12px;margin-top:4px}.login-error{color:var(--danger);font-size:12px;margin-bottom:8px}.rename-btn{transition:opacity .15s}div:hover>div>.rename-btn{opacity:1!important}.admin-page{padding:16px;height:100%;overflow:auto}.tab-bar{display:flex;gap:4px;margin-bottom:16px;border-bottom:1px solid var(--border);padding-bottom:8px}.tab-btn{padding:6px 14px;font-size:12px;color:var(--text2);border-radius:4px}.tab-btn.active{background:var(--bg3);color:var(--accent);border-bottom:2px solid var(--accent)}.card{background:var(--bg2);border:1px solid var(--border);border-radius:6px;padding:14px;margin-bottom:12px}.card-title{font-size:11px;letter-spacing:1px;color:var(--text2);margin-bottom:12px}.user-row{display:flex;align-items:center;gap:10px;padding:8px 0;border-bottom:1px solid var(--border);flex-wrap:wrap}.user-row:last-child{border-bottom:none}.user-name{font-size:13px;margin-right:6px}.audit-row{display:flex;gap:10px;padding:4px 0;border-bottom:1px solid var(--border);flex-wrap:wrap;align-items:center}.alert{padding:8px 12px;border-radius:4px;font-size:12px;margin-bottom:12px}.alert-error{background:#ff44441a;color:var(--danger);border:1px solid var(--danger)}.alert-success{background:#00cc661a;color:var(--success);border:1px solid var(--success)}.scroll-indicator{position:absolute;bottom:48px;right:12px;background:var(--bg3);color:var(--accent);border:1px solid var(--accent);border-radius:20px;padding:4px 14px;font-size:12px;font-weight:700;z-index:10;opacity:.9;box-shadow:0 2px 8px #0006}.scroll-indicator:active{opacity:.6}.touch-scroll-proxy{position:absolute;top:0;right:0;bottom:0;left:0;overflow-y:scroll;overflow-x:hidden;-webkit-overflow-scrolling:touch;opacity:.01;z-index:5;pointer-events:auto}
