/**
 * 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,.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right: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}:root{--bg-primary: #0d1117;--bg-secondary: #161b22;--bg-tertiary: #21262d;--border-color: #30363d;--text-primary: #c9d1d9;--text-secondary: #8b949e;--accent-green: #238636;--accent-green-hover: #2ea043;--accent-blue: #58a6ff;--accent-red: #f85149;--accent-yellow: #d29922}*{margin:0;padding:0;box-sizing:border-box}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;background-color:var(--bg-primary);color:var(--text-primary);min-height:100vh}#root{min-height:100vh}.app{display:flex;flex-direction:column;min-height:100vh}.header{display:flex;align-items:center;justify-content:space-between;padding:12px 24px;background-color:var(--bg-secondary);border-bottom:1px solid var(--border-color)}.header h1{font-size:20px;font-weight:600;display:flex;align-items:center;gap:8px}.header-actions{display:flex;gap:12px}.btn{padding:8px 16px;border-radius:6px;border:1px solid var(--border-color);background-color:var(--bg-tertiary);color:var(--text-primary);font-size:14px;cursor:pointer;transition:all .15s ease;display:flex;align-items:center;gap:6px}.btn:hover{background-color:var(--border-color)}.btn-primary{background-color:var(--accent-green);border-color:var(--accent-green);color:#fff}.btn-primary:hover{background-color:var(--accent-green-hover)}.btn-danger{background-color:transparent;border-color:var(--accent-red);color:var(--accent-red)}.btn-danger:hover{background-color:var(--accent-red);color:#fff}.btn-small{padding:4px 8px;font-size:12px}.main-content{display:flex;flex:1;overflow:hidden}.sidebar{width:280px;background-color:var(--bg-secondary);border-right:1px solid var(--border-color);display:flex;flex-direction:column;overflow:hidden}.sidebar-header{padding:16px;border-bottom:1px solid var(--border-color);display:flex;justify-content:space-between;align-items:center}.sidebar-header h2{font-size:14px;font-weight:600;text-transform:uppercase;color:var(--text-secondary)}.terminal-list{flex:1;overflow-y:auto;padding:8px}.terminal-item{padding:12px;border-radius:6px;cursor:pointer;margin-bottom:4px;border:1px solid transparent;transition:all .15s ease}.terminal-item:hover{background-color:var(--bg-tertiary)}.terminal-item.active{background-color:var(--bg-tertiary);border-color:var(--accent-blue)}.terminal-item-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:4px}.terminal-item-name{font-weight:500;font-size:14px}.terminal-item-status{display:flex;align-items:center;gap:4px;font-size:12px}.status-dot{width:8px;height:8px;border-radius:50%}.status-dot.running{background-color:var(--accent-green)}.status-dot.exited{background-color:var(--accent-red)}.terminal-item-info{font-size:12px;color:var(--text-secondary)}.terminal-area{flex:1;display:flex;flex-direction:column;background-color:var(--bg-primary);overflow:hidden}.terminal-tabs{display:flex;background-color:var(--bg-secondary);border-bottom:1px solid var(--border-color);overflow-x:auto}.terminal-tab{padding:10px 16px;border:none;background:transparent;color:var(--text-secondary);font-size:13px;cursor:pointer;border-bottom:2px solid transparent;display:flex;align-items:center;gap:8px;white-space:nowrap}.terminal-tab:hover{color:var(--text-primary);background-color:var(--bg-tertiary)}.terminal-tab.active{color:var(--text-primary);border-bottom-color:var(--accent-blue)}.terminal-tab .close-btn{padding:2px 4px;border-radius:4px;opacity:.6}.terminal-tab .close-btn:hover{opacity:1;background-color:var(--accent-red);color:#fff}.terminal-actions{display:flex;align-items:center;gap:8px;padding:8px 16px;background-color:var(--bg-secondary);border-bottom:1px solid var(--border-color);flex-wrap:wrap}.terminal-actions .actions-label{font-size:12px;color:var(--text-secondary);margin-right:4px}.terminal-actions .btn{font-size:11px;padding:4px 10px}.terminal-container{flex:1;padding:0;overflow:hidden}.terminal-wrapper{height:100%;width:100%}.empty-state{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;color:var(--text-secondary);gap:16px}.empty-state h3{font-size:18px;color:var(--text-primary)}.empty-state p{font-size:14px}.stats-bar{padding:8px 16px;background-color:var(--bg-secondary);border-top:1px solid var(--border-color);display:flex;gap:24px;font-size:12px;color:var(--text-secondary)}.stat{display:flex;align-items:center;gap:6px}.stat-value{color:var(--text-primary);font-weight:500}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background:var(--bg-primary)}::-webkit-scrollbar-thumb{background:var(--border-color);border-radius:4px}::-webkit-scrollbar-thumb:hover{background:var(--text-secondary)}.modal-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background-color:#000000b3;display:flex;align-items:center;justify-content:center;z-index:1000}.modal{background-color:var(--bg-secondary);border:1px solid var(--border-color);border-radius:12px;padding:24px;width:90%;max-width:500px;max-height:80vh;overflow-y:auto}.modal h3{font-size:18px;margin-bottom:8px}.folder-list{margin:16px 0;display:flex;flex-direction:column;gap:8px}.folder-item{padding:12px 16px;border-radius:8px;border:1px solid var(--border-color);cursor:pointer;transition:all .15s ease}.folder-item:hover{background-color:var(--bg-tertiary);border-color:var(--text-secondary)}.folder-item.selected{background-color:var(--bg-tertiary);border-color:var(--accent-blue)}.folder-name{font-weight:500;font-size:14px;display:flex;align-items:center;gap:8px}.folder-path{font-size:12px;color:var(--text-secondary);margin-top:4px;font-family:Monaco,Menlo,monospace}.badge{background-color:var(--accent-green);color:#fff;font-size:10px;padding:2px 6px;border-radius:4px;font-weight:600}.modal-actions{display:flex;justify-content:flex-end;gap:12px;margin-top:16px}.btn:disabled{opacity:.5;cursor:not-allowed}.sidebar-section{display:flex;flex-direction:column;border-bottom:1px solid var(--border-color)}.sidebar-section:last-child{border-bottom:none;flex:1}.project-list{padding:8px;max-height:200px;overflow-y:auto}.project-item{display:flex;align-items:center;gap:12px;padding:10px 12px;border-radius:6px;cursor:pointer;margin-bottom:4px;transition:all .15s ease}.project-item:hover{background-color:var(--bg-tertiary)}.project-color{width:4px;height:32px;border-radius:2px;flex-shrink:0}.project-info{flex:1;min-width:0}.project-name{font-weight:500;font-size:13px;display:flex;align-items:center;gap:8px}.project-path{font-size:11px;color:var(--text-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.badge-small{background-color:var(--accent-green);color:#fff;font-size:9px;padding:1px 4px;border-radius:3px;font-weight:600}.project-color-dot{width:12px;height:12px;border-radius:50%;flex-shrink:0}.project-item{position:relative}.project-delete{position:absolute;right:8px;top:50%;transform:translateY(-50%);opacity:0;transition:opacity .15s ease;padding:2px 6px!important;font-size:14px!important}.project-item:hover .project-delete{opacity:1}.folder-desc{font-size:12px;color:var(--text-secondary);margin-top:4px}.form-group{margin-bottom:16px}.form-group label{display:block;font-size:13px;font-weight:500;margin-bottom:6px;color:var(--text-secondary)}.input{width:100%;padding:10px 12px;border-radius:6px;border:1px solid var(--border-color);background-color:var(--bg-primary);color:var(--text-primary);font-size:14px;outline:none;transition:border-color .15s ease}.input:focus{border-color:var(--accent-blue)}.input::placeholder{color:var(--text-secondary)}.color-picker{display:flex;gap:8px;flex-wrap:wrap}.color-option{width:32px;height:32px;border-radius:6px;cursor:pointer;border:2px solid transparent;transition:all .15s ease}.color-option:hover{transform:scale(1.1)}.color-option.selected{border-color:#fff;box-shadow:0 0 0 2px var(--bg-primary),0 0 0 4px currentColor}.claude-state-badge{font-size:12px;padding:2px 6px;border-radius:4px;margin-left:4px}.claude-state-badge.state-idle{background-color:#23863633;color:var(--accent-green)}.claude-state-badge.state-working{background-color:#d2992233;color:var(--accent-yellow);animation:pulse 1.5s ease-in-out infinite}.claude-state-badge.state-thinking{background-color:#58a6ff33;color:var(--accent-blue);animation:pulse 2s ease-in-out infinite}.claude-state-badge.state-unknown{background-color:#8b949e33;color:var(--text-secondary)}.claude-state-label{display:inline-block;font-size:10px;padding:2px 6px;border-radius:3px;margin-left:8px;font-weight:500}.claude-state-label.state-idle{background-color:#23863633;color:var(--accent-green)}.claude-state-label.state-working{background-color:#d2992233;color:var(--accent-yellow);animation:pulse 1.5s ease-in-out infinite}.claude-state-label.state-thinking{background-color:#58a6ff33;color:var(--accent-blue);animation:pulse 2s ease-in-out infinite}.claude-state-label.state-unknown{background-color:#8b949e33;color:var(--text-secondary)}@keyframes pulse{0%,to{opacity:1}50%{opacity:.6}}
