/**
 * 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: #0e1116;--panel: #161b22;--panel2: #1c2430;--border: #2a3240;--text: #e6edf3;--muted: #8b98a9;--accent: #3b82f6;--accent2: #22d3ee;--ok: #22c55e;--err: #f87171}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font:14px/1.5 ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif}h1,h2{margin:0}span.CODE,h1 span,header strong span{color:var(--accent2)}input,textarea,button{font:inherit;color:var(--text);background:var(--panel2);border:1px solid var(--border);border-radius:8px;padding:8px 10px}button{background:var(--accent);border-color:var(--accent);color:#fff;cursor:pointer;font-weight:600}button:hover{filter:brightness(1.08)}button:disabled{opacity:.5;cursor:default}button.ghost{background:transparent;color:var(--muted);border-color:var(--border);font-weight:500}button.small{padding:4px 8px;font-size:12px}.login{display:grid;place-items:center;height:100vh}.card{background:var(--panel);border:1px solid var(--border);border-radius:16px;padding:32px;width:340px;display:grid;gap:12px}.card h1{font-size:28px;letter-spacing:1px}.card .sub{color:var(--muted);margin:-6px 0 8px}.erro{color:var(--err);font-size:13px}.app{height:100vh;display:flex;flex-direction:column}header{display:flex;align-items:center;gap:12px;padding:10px 16px;border-bottom:1px solid var(--border);background:var(--panel)}header strong{letter-spacing:.5px}header .tenant{color:var(--muted);font-size:13px;padding:2px 8px;border:1px solid var(--border);border-radius:20px}header .spacer{flex:1}.carregando{color:var(--accent2)}.erro-bar{background:#f871711f;color:var(--err);padding:6px 16px;font-size:13px;border-bottom:1px solid var(--border)}.grid{flex:1;display:grid;grid-template-columns:320px 1fr;min-height:0}aside{border-right:1px solid var(--border);overflow-y:auto;padding:12px;display:flex;flex-direction:column;gap:20px}aside section h2{font-size:12px;text-transform:uppercase;letter-spacing:1px;color:var(--muted);margin-bottom:8px}aside section h2 small{color:var(--accent2);text-transform:none;letter-spacing:0}.lista,.arvore{list-style:none;margin:0 0 8px;padding:0;display:grid;gap:2px}.lista li,.arvore li{padding:6px 8px;border-radius:6px;cursor:pointer}.lista li:hover,.arvore li:hover{background:var(--panel2)}.lista li.sel{background:#3b82f62e}.arvore li.ctx{background:#22d3ee29;outline:1px solid var(--accent2)}.badge{font-size:10px;padding:1px 6px;border-radius:20px;background:var(--panel2);color:var(--muted)}.badge.ativo{background:#22c55e2e;color:var(--ok)}.badge.erro{background:#f871712e;color:var(--err)}.badge.provisionando{background:#3b82f62e;color:var(--accent)}.form{display:grid;gap:6px}main{display:flex;flex-direction:column;min-height:0}.vazio{margin:auto;color:var(--muted)}.tabs{display:flex;gap:4px;padding:8px 12px 0;border-bottom:1px solid var(--border)}.tab{background:transparent;color:var(--muted);border:1px solid transparent;border-bottom:none;border-radius:8px 8px 0 0;padding:6px 14px;font-weight:500}.tab.sel{color:var(--text);background:var(--panel);border-color:var(--border)}.xterm-host{flex:1;min-height:0;padding:8px 12px;background:#0e1116;overflow:hidden}.chat{flex:1;overflow-y:auto;padding:20px;display:flex;flex-direction:column;gap:14px}.msg{max-width:78%}.msg.user{align-self:flex-end;text-align:right}.msg .quem{font-size:11px;color:var(--muted);margin-bottom:2px}.msg .txt{background:var(--panel);border:1px solid var(--border);border-radius:12px;padding:10px 12px;white-space:pre-wrap;display:inline-block;text-align:left}.msg.user .txt{background:#3b82f62e;border-color:transparent}.cursor{display:inline-block;width:7px;height:14px;background:var(--accent2);margin-left:2px;vertical-align:text-bottom;animation:blink 1s steps(2) infinite}@keyframes blink{50%{opacity:0}}.chips{display:flex;flex-wrap:wrap;gap:6px;padding:0 16px 8px}.chip{font-size:12px;background:#22d3ee24;color:var(--accent2);border:1px solid var(--accent2);border-radius:20px;padding:2px 10px;cursor:pointer}.entrada{display:flex;gap:8px;padding:12px 16px;border-top:1px solid var(--border);background:var(--panel)}.entrada textarea{flex:1;resize:none;height:46px}.contexto{padding:16px;overflow-y:auto;height:100%}.ctx-head{display:flex;align-items:center;justify-content:space-between}.ctx-head h3{margin:0}.ctx-grid{display:grid;grid-template-columns:1fr;gap:8px;margin:12px 0 20px}.ctx-grid>div{display:flex;flex-direction:column;gap:2px;padding:8px 10px;background:#11161d;border:1px solid #1f2733;border-radius:8px}.ctx-grid span{font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:#7d8794}.tl-title{margin:0 0 8px}.tl-title small{color:#7d8794;font-weight:400}.timeline{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px}.timeline li{display:flex;align-items:center;gap:10px;padding:6px 10px;background:#0e1116;border-left:2px solid #3b82f6;border-radius:4px;font-size:13px}.timeline .seq{color:#7d8794;min-width:42px}.timeline .tipo{color:#e6edf3;font-family:ui-monospace,monospace;flex:1}.timeline .quando{color:#7d8794;font-size:12px}.timeline .vazio-tl{color:#7d8794;border-left-color:#1f2733}.pensando{border-left:2px solid #3b82f6;padding:6px 12px;background:#0e1116;border-radius:6px}.pensando__rotulo{display:inline-flex;align-items:center;gap:4px;font-size:12px;color:#7d8794;text-transform:uppercase;letter-spacing:.06em}.pensando__txt{margin-top:6px;font-size:12.5px;font-style:italic;color:#7d8794;max-height:108px;overflow-y:auto;white-space:pre-wrap;line-height:1.45}.agentes{display:grid;grid-template-columns:240px 1fr;height:100%;overflow:hidden}.agentes-lista{border-right:1px solid #1f2733;padding:12px;overflow-y:auto}.agentes-head{display:flex;flex-direction:column;gap:8px;margin-bottom:10px}.agentes-novo{display:flex;gap:6px}.agentes-novo select{flex:1;background:#11161d;color:#e6edf3;border:1px solid #1f2733;border-radius:7px;padding:5px}.agentes-lista ul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px}.agentes-lista li{display:flex;align-items:center;gap:6px;padding:7px 9px;border-radius:7px;cursor:pointer;font-size:13px}.agentes-lista li:hover{background:#11161d}.agentes-lista li.sel{background:#16202e}.badge-tipo{font-size:10px;text-transform:uppercase;padding:2px 6px;border-radius:5px;background:#1f2733;color:#9fb0c3;letter-spacing:.04em}.badge-tipo.code{background:#14304a;color:#7cc7ff}.badge-tipo.test{background:#143a2a;color:#6ee7a8}.badge-tipo.review{background:#3a2a14;color:#e0b048}.badge-tipo.docs{background:#2a1440;color:#c090f0}.ag-id{font-family:ui-monospace,monospace;color:#7d8794;font-size:12px}.ag-wt{color:#6ee7a8}.agentes-lista .badge{margin-left:auto;font-size:10px}.agentes-turno{display:flex;flex-direction:column;height:100%;overflow:hidden}.turno-log{flex:1;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:8px}.turno-linha{display:flex;flex-direction:column;gap:2px}.turno-linha .rot{font-size:10px;text-transform:uppercase;letter-spacing:.05em;color:#7d8794}.turno-linha.tarefa{align-items:flex-end}.turno-linha.tarefa .txt{background:#16202e;padding:8px 12px;border-radius:10px;max-width:80%}.turno-linha.tool .txt{font-family:ui-monospace,monospace;font-size:12.5px;color:#7cc7ff;background:#0e1116;padding:5px 9px;border-radius:6px;border-left:2px solid #3b82f6}.turno-linha.resposta .txt,.turno-linha._stream .txt{background:#11161d;padding:8px 12px;border-radius:10px;max-width:85%}.turno-linha.pensando .txt{font-style:italic;color:#7d8794;font-size:12.5px;max-height:90px;overflow-y:auto;white-space:pre-wrap}.turno-linha.sistema .txt{color:#7d8794;font-size:12px}.aprovacao{background:#3a2a14;border:1px solid #6b5220;border-radius:8px;padding:10px 12px;display:flex;flex-direction:column;gap:8px}.aprovacao button{margin-right:6px}.aprovacao .aprovar{background:#1f7a4d}.aprovacao .rejeitar{background:#7a2a2a}.turno-entrada{display:flex;gap:8px;padding:12px;border-top:1px solid #1f2733}.turno-entrada textarea{flex:1;background:#11161d;color:#e6edf3;border:1px solid #1f2733;border-radius:8px;padding:9px;resize:none;min-height:40px;font-family:inherit}.memoria{padding:16px;overflow-y:auto;height:100%}.memoria .acoes{display:flex;gap:6px}.memoria .nota{font-size:12px;color:var(--muted);margin:6px 0}.propostas{list-style:none;margin:10px 0 22px;padding:0;display:flex;flex-direction:column;gap:10px}.propostas li{border:1px solid #1f2733;border-radius:9px;padding:11px 13px;background:#0e131a}.p-topo{display:flex;align-items:center;gap:6px;margin-bottom:7px}.p-topo .conf{margin-left:auto;font-size:11px;color:var(--muted)}.propostas .tag{font-size:10px;text-transform:uppercase;letter-spacing:.04em;padding:2px 6px;border-radius:5px;background:#16202e;color:#9fb0c3}.propostas .tag.projeto{background:#388bfd29;color:#79b8ff}.propostas .tag.sessao{background:#a371f729;color:#c39cf7}.p-conteudo{margin:0 0 6px;font-size:14px;line-height:1.45}.p-just{margin:0 0 4px;font-size:12px;color:var(--muted);font-style:italic}.p-ev{margin:0 0 8px;font-size:11px;color:#6e7b8b;font-family:ui-monospace,Menlo,monospace}.busca-mem{display:flex;gap:8px;margin:8px 0 12px}.busca-mem input{flex:1;background:#11161d;color:#e6edf3;border:1px solid #1f2733;border-radius:8px;padding:8px 10px;font-family:inherit}.acervo{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}.acervo li{font-size:13px;line-height:1.45;padding:8px 10px;border-left:2px solid #1f2733;color:#c9d4e0}.acervo .tag{font-size:10px;text-transform:uppercase;padding:2px 6px;border-radius:5px;background:#16202e;color:#9fb0c3;margin-right:6px}
