/**
 * 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-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{font-family:monospace;-webkit-user-select:text;user-select:text;white-space:pre}.xterm .xterm-accessibility-tree>div{transform-origin:left;width:fit-content}.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}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px!important}.xterm .xterm-scrollable-element>.visible{opacity:1;background:#0000;transition:opacity .1s linear;z-index:11}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity .8s linear}.xterm .xterm-scrollable-element>.shadow{position:absolute;display:none}.xterm .xterm-scrollable-element>.shadow.top{display:block;top:0;left:3px;height:3px;width:100%;box-shadow:var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.left{display:block;top:3px;left:0;height:100%;width:3px;box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.top-left-corner{display:block;top:0;left:0;height:3px;width:3px}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}*{margin:0;padding:0;box-sizing:border-box}:root{--bg: #0d1117;--bg-secondary: #161b22;--bg-tertiary: #21262d;--border: #30363d;--text: #e6edf3;--text-muted: #8b949e;--accent: #58a6ff;--accent-hover: #79c0ff;--success: #3fb950;--danger: #f85149;--warning: #d29922}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif;background:var(--bg);color:var(--text);line-height:1.5;padding:16px;height:100vh;overflow:hidden}html{height:100%;overflow:hidden}#root{border:1px solid var(--border);border-radius:12px;overflow:hidden;height:calc(100vh - 32px);display:flex;flex-direction:column}a{color:var(--accent);text-decoration:none}a:hover{color:var(--accent-hover)}button{cursor:pointer;border:1px solid var(--border);background:var(--bg-tertiary);color:var(--text);padding:8px 16px;border-radius:6px;font-size:14px;transition:background .15s}button:hover{background:var(--border)}button:disabled{opacity:.5;cursor:not-allowed}.btn-primary{background:var(--accent);color:#000;border-color:var(--accent)}.btn-primary:hover{background:var(--accent-hover)}.btn-danger{background:transparent;color:var(--danger);border-color:var(--danger)}.btn-danger:hover{background:var(--danger);color:#fff}input,textarea{background:var(--bg);border:1px solid var(--border);color:var(--text);padding:8px 12px;border-radius:6px;font-size:14px;width:100%}input:focus,textarea:focus{outline:none;border-color:var(--accent)}.container{max-width:1200px;margin:0 auto;padding:0 24px}.header{display:flex;align-items:center;justify-content:space-between;padding:16px 24px;border-bottom:1px solid var(--border);background:var(--bg-secondary)}.header h1{font-size:20px;font-weight:600}.login-page{display:flex;align-items:center;justify-content:center;min-height:calc(100vh - 32px)}.login-form{background:var(--bg-secondary);border:1px solid var(--border);border-radius:12px;padding:40px;width:380px}.login-form h1{margin-bottom:24px;text-align:center}.form-group{margin-bottom:16px}.form-group label{display:block;margin-bottom:6px;font-size:14px;color:var(--text-muted)}.error-msg{color:var(--danger);font-size:14px;margin-bottom:12px}.dashboard{padding:24px 0;overflow-y:auto;flex:1}.dashboard-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:24px}.project-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:16px}.project-card{background:var(--bg-secondary);border:1px solid var(--border);border-radius:8px;padding:20px;transition:border-color .15s}.project-card:hover{border-color:var(--accent)}.project-card h3{margin-bottom:8px}.project-card .slug{color:var(--text-muted);font-size:13px;font-family:monospace}.project-card .status{display:inline-block;padding:2px 8px;border-radius:12px;font-size:12px;margin-top:8px}.status-running{background:#3fb95033;color:var(--success)}.status-stopped{background:#8b949e33;color:var(--text-muted)}.status-error{background:#f8514933;color:var(--danger)}.project-card .actions{display:flex;gap:8px;margin-top:16px}.project-page{flex:1;display:flex;flex-direction:column;overflow:hidden}.tab-bar{display:flex;gap:0;border-bottom:1px solid var(--border);background:var(--bg-secondary);padding:0 16px}.tab-bar button{border:none;border-bottom:2px solid transparent;border-radius:0;background:transparent;padding:12px 20px;color:var(--text-muted);font-size:14px}.tab-bar button:hover{color:var(--text);background:transparent}.tab-bar button.active{color:var(--accent);border-bottom-color:var(--accent)}.tab-content{flex:1;overflow:hidden;display:flex;flex-direction:column}.tab-panel{flex:1;min-height:0}.console-container{display:flex;flex-direction:column;height:100%}.console-messages{flex:1;overflow-y:auto;padding:16px}.console-message{margin-bottom:16px;padding:12px 16px;border-radius:8px;font-size:14px;line-height:1.6}.console-message.user{background:var(--bg-tertiary);border:1px solid var(--border)}.console-message.assistant{background:var(--bg-secondary);border:1px solid var(--border)}.console-message.system{color:var(--text-muted);font-size:13px;font-style:italic}.console-message .role{font-size:12px;font-weight:600;text-transform:uppercase;color:var(--text-muted);margin-bottom:6px}.console-message.user .role{color:var(--accent)}.console-message.assistant .role{color:var(--success)}.console-message.thinking{background:#d2992214;border:1px solid rgba(210,153,34,.25);font-size:13px;color:var(--text-muted);max-height:300px;overflow-y:auto}.console-message.thinking .role{color:var(--warning)}.console-message pre{background:var(--bg);border:1px solid var(--border);border-radius:6px;padding:12px;overflow-x:auto;margin:8px 0;font-size:13px}.console-message code{font-family:SF Mono,Fira Code,monospace;font-size:13px}.console-input{display:flex;gap:8px;padding:16px;border-top:1px solid var(--border);background:var(--bg-secondary)}.console-input textarea{resize:none;min-height:44px;max-height:200px;font-family:inherit}.thinking-indicator{display:flex;align-items:center;gap:8px;padding:8px 16px;color:var(--text-muted);font-size:13px}.thinking-dot{width:6px;height:6px;background:var(--accent);border-radius:50%;animation:pulse 1.4s infinite}@keyframes pulse{0%,80%,to{opacity:.3}40%{opacity:1}}.files-container{height:100%;display:flex;flex-direction:column}.files-toolbar{display:flex;align-items:center;gap:8px;padding:12px 16px;border-bottom:1px solid var(--border);background:var(--bg-secondary)}.breadcrumb{display:flex;gap:4px;font-size:14px}.breadcrumb span{color:var(--text-muted)}.file-list{flex:1;overflow-y:auto;padding:8px 0}.file-row{display:flex;align-items:center;padding:8px 16px;border-bottom:1px solid var(--border);cursor:pointer;transition:background .1s}.file-row:hover{background:var(--bg-secondary)}.file-row .icon{margin-right:12px;font-size:16px}.file-row .name{flex:1;font-size:14px}.file-row .size{color:var(--text-muted);font-size:13px;margin-right:12px}.upload-progress{padding:8px 16px;background:var(--bg-secondary);border-bottom:1px solid var(--border)}.upload-progress-info{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;font-size:13px}.upload-progress-name{color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:80%}.upload-progress-percent{color:var(--accent);font-weight:600;font-variant-numeric:tabular-nums}.upload-progress-track{height:4px;background:var(--bg-tertiary);border-radius:2px;overflow:hidden}.upload-progress-fill{height:100%;background:var(--accent);border-radius:2px;transition:width .15s ease}.files-container{position:relative}.files-drag-active{outline:2px dashed var(--accent);outline-offset:-2px}.files-drop-overlay{position:absolute;top:0;right:0;bottom:0;left:0;background:#58a6ff14;display:flex;align-items:center;justify-content:center;z-index:10;pointer-events:none}.files-drop-message{background:var(--bg-secondary);border:2px dashed var(--accent);border-radius:12px;padding:32px 48px;color:var(--accent);font-size:16px;font-weight:500}.files-empty{padding:40px 20px;text-align:center;color:var(--text-muted);font-size:14px}.files-mkdir-row{display:flex;align-items:center;gap:8px;padding:8px 16px;border-bottom:1px solid var(--border);background:var(--bg-tertiary)}.files-mkdir-input{flex:1;padding:4px 8px;font-size:14px}.files-context-menu{position:fixed;background:var(--bg-secondary);border:1px solid var(--border);border-radius:8px;box-shadow:0 8px 24px #0006;z-index:300;min-width:160px;overflow:hidden;padding:4px 0}.context-menu-item{display:block;width:100%;padding:8px 16px;border:none;border-radius:0;background:transparent;color:var(--text);font-size:13px;text-align:left;cursor:pointer;transition:background .1s}.context-menu-item:hover{background:var(--bg-tertiary)}.context-menu-danger{color:var(--danger)}.context-menu-danger:hover{background:#f851491a}.preview-container{height:100%;display:flex;flex-direction:column}.preview-toolbar{display:flex;align-items:center;gap:12px;padding:8px 16px;border-bottom:1px solid var(--border);background:var(--bg-secondary)}.preview-toolbar .url{flex:1;font-family:monospace;font-size:13px;color:var(--text-muted);background:var(--bg);padding:6px 12px;border-radius:6px;border:1px solid var(--border)}.preview-iframe{flex:1;border:none;width:100%;background:#fff}.modal-overlay{position:fixed;top:0;right:0;bottom:0;left:0;background:#0009;display:flex;align-items:center;justify-content:center;z-index:100}.modal{background:var(--bg-secondary);border:1px solid var(--border);border-radius:12px;padding:32px;width:420px}.modal h2{margin-bottom:20px}.modal .form-group{margin-bottom:16px}.modal .actions{display:flex;gap:8px;justify-content:flex-end;margin-top:24px}select{background:var(--bg);border:1px solid var(--border);color:var(--text);padding:8px 12px;border-radius:6px;font-size:14px;width:100%}select:focus{outline:none;border-color:var(--accent)}.user-menu{position:relative}.user-avatar{width:36px;height:36px;border-radius:50%;border:2px solid var(--border);background:var(--accent);color:#000;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:700;padding:0;cursor:pointer;overflow:hidden;transition:border-color .15s}.user-avatar:hover{border-color:var(--accent);background:var(--accent)}.user-avatar img{width:100%;height:100%;object-fit:cover}.user-dropdown{position:absolute;top:calc(100% + 8px);right:0;background:var(--bg-secondary);border:1px solid var(--border);border-radius:12px;width:260px;z-index:200;box-shadow:0 8px 24px #0006;overflow:hidden}.user-dropdown-header{display:flex;gap:12px;padding:16px;align-items:center}.user-dropdown-avatar{width:40px;height:40px;border-radius:50%;background:var(--accent);color:#000;display:flex;align-items:center;justify-content:center;font-size:14px;font-weight:700;flex-shrink:0;overflow:hidden}.user-dropdown-avatar img{width:100%;height:100%;object-fit:cover}.user-dropdown-info{min-width:0}.user-dropdown-name{font-weight:600;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.user-dropdown-username{font-size:13px;color:var(--text-muted)}.user-dropdown-role{font-size:12px;color:var(--accent);margin-top:2px}.user-dropdown-divider{height:1px;background:var(--border)}.user-dropdown-divider-light{height:1px;background:var(--border);margin:2px 16px;opacity:.5}.user-dropdown-item{display:block;width:100%;padding:10px 16px;border:none;border-radius:0;background:transparent;color:var(--text);font-size:14px;text-align:left;cursor:pointer;transition:background .1s}.user-dropdown-item:hover{background:var(--bg-tertiary)}.user-dropdown-item-danger{color:var(--danger)}.user-dropdown-item-danger:hover{background:#f851491a}.admin-page{padding:24px 0}.admin-section{margin-bottom:40px}.admin-section-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.admin-table{width:100%;border-collapse:collapse;background:var(--bg-secondary);border:1px solid var(--border);border-radius:8px;overflow:hidden}.admin-table th,.admin-table td{padding:12px 16px;text-align:left;border-bottom:1px solid var(--border);font-size:14px}.admin-table th{background:var(--bg-tertiary);color:var(--text-muted);font-weight:600;font-size:13px;text-transform:uppercase;letter-spacing:.5px}.admin-table tr:last-child td{border-bottom:none}.admin-table code{font-size:13px;color:var(--text-muted)}.role-badge{display:inline-block;padding:2px 10px;border-radius:12px;font-size:12px;font-weight:500}.role-admin{background:#58a6ff26;color:var(--accent)}.role-developer{background:#3fb95026;color:var(--success)}.role-tester{background:#d2992226;color:var(--warning)}.access-user-list{max-height:300px;overflow-y:auto;margin:12px 0}.access-user-row{display:flex;align-items:center;gap:12px;padding:8px 12px;border-radius:6px;cursor:pointer;font-size:14px;transition:background .1s}.access-user-row:hover{background:var(--bg-tertiary)}.access-user-row input[type=checkbox]{width:auto;accent-color:var(--accent)}.profile-page{padding:24px 0;display:flex;justify-content:center}.profile-card{background:var(--bg-secondary);border:1px solid var(--border);border-radius:12px;padding:32px;width:480px}.profile-avatar-section{display:flex;align-items:center;gap:20px;margin-bottom:24px}.profile-avatar-large{width:72px;height:72px;border-radius:50%;background:var(--accent);color:#000;display:flex;align-items:center;justify-content:center;font-size:24px;font-weight:700;flex-shrink:0;overflow:hidden}.profile-avatar-large img{width:100%;height:100%;object-fit:cover}.profile-avatar-actions{display:flex;flex-direction:column;gap:8px}.profile-info-row{display:flex;align-items:center;justify-content:space-between;padding:10px 0;border-bottom:1px solid var(--border);font-size:14px}.profile-label{color:var(--text-muted)}.profile-divider{height:1px;background:var(--border);margin:24px 0}.success-msg{color:var(--success);font-size:14px;margin-bottom:12px}
