:root {
  --bg: #03050c;
  --panel: rgba(6, 10, 22, 0.86);
  --card: rgba(34, 229, 255, 0.035);
  --border: rgba(34, 229, 255, 0.16);
  --text: #e6faff;
  --muted: #8aa4c0;
  --accent: #22e5ff;
  --accent2: #ff2bd6;
  --display: Orbitron, Rajdhani, system-ui, sans-serif;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 12px;
  --panel-w: 410px;
  font-family: Rajdhani, Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; font-size: 15px; font-weight: 500; }
button, input, select, textarea { font: inherit; color: inherit; }
code { background: rgba(255,255,255,.08); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
h2, h3, h4 { margin: 0 0 8px; }
h2, h3, h4 { font-family: var(--display); letter-spacing: .04em; }
h3 { font-size: 12.5px; text-transform: uppercase; color: var(--accent); text-shadow: 0 0 10px rgba(34,229,255,.45); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.right { margin-left: auto; }
.err { color: #fca5a5; }
.pre { white-space: pre-wrap; margin: 0; }

/* ---------- cena ---------- */
#scene { position: fixed; inset: 0; right: var(--panel-w); transition: right .25s; }
body.panel-hidden #scene { right: 0; }
#scene canvas { display: block; }
.label-layer { position: absolute; inset: 0; pointer-events: none; }
.fatal { padding: 80px 30px; color: #fca5a5; }
#hint { position: fixed; left: 16px; bottom: 14px; font-size: 12px; color: var(--muted); background: rgba(0,0,0,.35); padding: 6px 10px; border-radius: 8px; pointer-events: none; }

.agent-label { display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: auto; cursor: pointer; transform: translateY(-6px); user-select: none; }
.agent-label .tag { display: flex; align-items: center; gap: 4px; background: rgba(3, 6, 16, .8); border: 1px solid var(--c); box-shadow: 0 0 10px -2px var(--c); border-radius: 4px; font-family: var(--display); letter-spacing: .05em; font-size: 10.5px !important; padding: 2px 8px 2px 4px; font-size: 12px; font-weight: 600; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.agent-label .icon:empty { display: none; }
.agent-label.thinking .icon { animation: pulse 1s infinite alternate; }
.agent-label.selected .tag { background: var(--c); color: #0b0f17; }
.agent-label .bubble { display: none; max-width: 190px; background: rgba(4, 12, 28, .9); color: #d9fbff; border: 1px solid rgba(34,229,255,.6); padding: 5px 9px; border-radius: 12px; font-size: 11.5px; line-height: 1.3; position: relative; box-shadow: 0 0 14px rgba(34,229,255,.25); text-align: center; animation: pop .25s ease-out; }
.agent-label .bubble::after { content: ''; position: absolute; left: 50%; bottom: -6px; border: 6px solid transparent; border-top-color: rgba(34,229,255,.7); border-bottom: 0; transform: translateX(-50%); }
.agent-label.has-bubble .bubble { display: block; }
@keyframes pulse { from { opacity: .4; } to { opacity: 1; } }
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- topo ---------- */
#topbar { position: fixed; top: 10px; left: 12px; right: calc(var(--panel-w) + 12px); display: flex; align-items: center; gap: 10px; pointer-events: none; transition: right .25s; z-index: 5; }
body.panel-hidden #topbar { right: 12px; }
#topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--accent); box-shadow: 0 0 18px rgba(34,229,255,.25), inset 0 0 12px rgba(34,229,255,.08); padding: 7px 16px; border-radius: 4px; font-family: var(--display); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 13px; backdrop-filter: blur(8px); white-space: nowrap; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex: 1; }
.pill { background: var(--panel); border: 1px solid var(--border); padding: 5px 10px; border-radius: 4px; font-size: 12.5px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; backdrop-filter: blur(8px); }
.pill:empty { display: none; }
.pill.ok { border-color: rgba(34,197,94,.5); }
.pill.warn { border-color: rgba(245,158,11,.6); color: #fcd34d; }
.pill.bad { border-color: rgba(239,68,68,.7); color: #fca5a5; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 3px rgba(239,68,68,.2); }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.icon-btn { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; width: 36px; height: 36px; cursor: pointer; display: inline-grid; place-items: center; }
.icon-btn.small { width: 24px; height: 24px; border-radius: 6px; font-size: 11px; background: transparent; }
.icon-btn:hover { border-color: var(--accent); }

/* ---------- painel ---------- */
#panel { position: fixed; top: 0; right: 0; bottom: 0; width: var(--panel-w); background: linear-gradient(180deg, rgba(6,10,22,.92), rgba(10,6,24,.9)); border-left: 1px solid var(--accent); box-shadow: -10px 0 40px rgba(34,229,255,.08); backdrop-filter: blur(14px); display: flex; flex-direction: column; transition: transform .25s; z-index: 6; }
body.panel-hidden #panel { transform: translateX(100%); }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 10px; border-bottom: 1px solid var(--border); }
.tabs button { background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 7px 4px; cursor: pointer; color: var(--muted); font-size: 13px; position: relative; }
.tabs button:hover { color: var(--text); background: var(--card); }
.tabs button { font-family: var(--display); font-size: 11px !important; letter-spacing: .05em; text-transform: uppercase; }
.tabs button.active { color: #fff; background: rgba(34,229,255,.12); border-color: var(--accent); box-shadow: 0 0 14px rgba(34,229,255,.3), inset 0 0 10px rgba(34,229,255,.12); }
.badge { background: var(--accent); color: #0b0f17; border-radius: 999px; font-size: 10px; padding: 0 6px; font-weight: 700; margin-left: 2px; }
.tab-body { display: none; overflow-y: auto; padding: 12px; flex: 1; }
.tab-body.active { display: block; }
.tab-body::-webkit-scrollbar, .drawer-body::-webkit-scrollbar { width: 8px; }
.tab-body::-webkit-scrollbar-thumb, .drawer-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: inset 0 1px 0 rgba(255,255,255,.03); padding: 12px; margin-bottom: 10px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > input, .row > select { flex: 1; min-width: 0; }
.row.between { justify-content: space-between; }
.row.gap { margin-top: 8px; flex-wrap: wrap; }
input, select, textarea { background: rgba(0,0,0,.25); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; outline: none; width: 100%; }
.row input, .row select { width: auto; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.btn { background: rgba(255,255,255,.07); border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-block; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: linear-gradient(90deg, #0891b2, #7c3aed); border-color: var(--accent); color: #fff; font-family: var(--display); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; box-shadow: 0 0 16px rgba(34,229,255,.3); }
.btn.primary:hover { box-shadow: 0 0 24px rgba(255,43,214,.45); }
.btn.danger { background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.5); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.notice { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.35); border-radius: 10px; padding: 10px; margin-bottom: 10px; font-size: 13px; }
.form-card summary { cursor: pointer; font-weight: 600; }
.form-card[open] summary { margin-bottom: 10px; }
.filters { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.filters select { flex: 1; }
.chip { background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 12px; }
.chip.active { border-color: var(--accent); background: rgba(96,165,250,.15); }

/* agentes */
.agent-grid { display: flex; flex-direction: column; gap: 8px; }
.agent-card { display: flex; gap: 10px; padding: 10px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--c); box-shadow: -4px 0 14px -6px var(--c); cursor: pointer; transition: background .15s; }
.agent-card:hover, .agent-card.selected { background: rgba(255,255,255,.08); }
.avatar-dot { width: 38px; height: 38px; flex: none; border-radius: 10px; box-shadow: 0 0 12px -2px var(--c, transparent); display: grid; place-items: center; font-size: 19px; background: rgba(255,255,255,.08); border: 2px solid var(--c, var(--border)); }
.avatar-dot.big { width: 48px; height: 48px; font-size: 24px; }
.agent-card .info { min-width: 0; flex: 1; }
.agent-card .name { font-family: var(--display); font-size: 13px; letter-spacing: .05em; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.agent-card .role { color: var(--muted); font-size: 12px; }
.agent-card .activity { font-size: 12px; margin-top: 3px; }
.task-mini { font-size: 12px; margin-top: 3px; color: #bfdbfe; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quote { font-size: 12px; font-style: italic; color: #cbd5e1; margin-top: 4px; }
.spinner { width: 12px; height: 12px; border: 2px solid rgba(96,165,250,.3); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* tarefas */
.task-card { padding: 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); margin-bottom: 6px; cursor: pointer; }
.task-card:hover { border-color: rgba(96,165,250,.5); }
.task-top { display: flex; gap: 6px; align-items: center; font-size: 12px; }
.tid { color: var(--muted); font-family: ui-monospace, monospace; }
.task-title { font-weight: 600; margin: 4px 0 2px; }
.st { font-size: 11px; padding: 1px 7px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.st-todo { background: rgba(255,209,102,.18); color: #fde68a; }
.st-doing { background: rgba(123,223,242,.18); color: #a5f3fc; }
.st-review { background: rgba(205,180,219,.2); color: #e9d5ff; }
.st-blocked { background: rgba(239,68,68,.2); color: #fca5a5; }
.st-done { background: rgba(34,197,94,.18); color: #bbf7d0; }

/* feed */
.feed-item { padding: 8px 10px; border-left: 2px solid var(--border); margin-bottom: 6px; background: var(--card); border-radius: 0 8px 8px 0; font-size: 13px; }
.feed-item .meta, .msg-list .meta { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.feed-item.alerta { border-left-color: var(--bad); background: rgba(239,68,68,.08); }
.feed-item.documento { border-left-color: #a78bfa; }
.feed-item.tarefa, .feed-item.nova_tarefa { border-left-color: var(--accent); }
.feed-item.reuniao { border-left-color: #f472b6; }
.feed-item.to-ceo { border-left-color: var(--ok); background: rgba(34,197,94,.07); }

/* docs */
.doc-card { padding: 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); margin-bottom: 6px; cursor: pointer; }
.doc-card:hover { border-color: #a78bfa; }
.doc-title { font-weight: 600; }
.md { line-height: 1.55; overflow-wrap: anywhere; }
.md pre { background: rgba(0,0,0,.35); padding: 10px; border-radius: 8px; overflow-x: auto; }
.md li { margin-left: 18px; }

/* vps */
.host { font-size: 12px; margin-bottom: 10px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-width: 0; }
.tile .label { font-size: 12px; color: var(--muted); }
.tile .value { font-size: 20px; font-weight: 700; margin: 2px 0; }
.tile .sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.warn .value { color: #fcd34d; }
.tile.bad .value { color: #fca5a5; }
.tile canvas { width: 100%; height: 40px; margin-top: 6px; display: block; }
canvas.tall { width: 100%; height: 120px; display: block; }
.bar { height: 10px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; margin: 6px 0; }
.bar.big { height: 18px; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, #3b82f6, #60a5fa); border-radius: 999px; transition: width .5s; }
.bar.warn span { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.bar.bad span { background: linear-gradient(90deg, #dc2626, #ef4444); }
.legend { float: right; font-weight: 400; font-size: 11px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin: 0 3px 0 8px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 13px; margin: 8px 0; }
.kv span { color: var(--muted); }
table.usage { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
table.usage th, table.usage td { text-align: right; padding: 4px 6px; border-bottom: 1px solid var(--border); }
table.usage th:first-child, table.usage td:first-child { text-align: left; }

/* drawer */
#drawer { position: fixed; top: 60px; bottom: 14px; left: 14px; width: 420px; max-width: calc(100vw - 28px); background: var(--panel); border: 1px solid var(--border); border-radius: 16px; backdrop-filter: blur(14px); display: flex; flex-direction: column; transform: translateX(-120%); transition: transform .25s; z-index: 7; box-shadow: 0 20px 50px rgba(0,0,0,.4); }
#drawer.open { transform: none; }
#drawer.wide { width: 640px; }
.drawer-head { display: flex; gap: 12px; align-items: center; padding: 14px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 15px; margin: 0; }
#drawer { border-color: var(--accent) !important; box-shadow: 0 0 40px rgba(34,229,255,.15) !important; }
.drawer-head > div:nth-child(2) { flex: 1; min-width: 0; }
.drawer-body { overflow-y: auto; padding: 12px; flex: 1; }
.loading { padding: 30px; text-align: center; color: var(--muted); }
.stats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.stats b { color: var(--text); }
.mem-list, .msg-list, .ev-list, .task-list-mini { list-style: none; padding: 0; margin: 8px 0 0; font-size: 13px; }
.mem-list li { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--border); }
.mem-list .imp { flex: none; width: 22px; height: 22px; border-radius: 6px; background: rgba(96,165,250,.18); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.mem-list .txt { flex: 1; }
.tag-ceo { background: rgba(250,204,21,.2); color: #fde68a; font-size: 10px; padding: 0 5px; border-radius: 4px; }
.msg-list li, .ev-list li { padding: 6px 0; border-bottom: 1px solid var(--border); white-space: pre-wrap; }
.task-list-mini li { padding: 5px 0; cursor: pointer; }
.task-list-mini li:hover { color: var(--accent); }

/* toasts */
#toasts { position: fixed; bottom: 16px; right: calc(var(--panel-w) + 16px); display: flex; flex-direction: column; gap: 8px; z-index: 20; max-width: 360px; }
body.panel-hidden #toasts { right: 16px; }
.toast { background: rgba(17,22,34,.96); border: 1px solid var(--border); border-left: 4px solid var(--accent); padding: 10px 12px; border-radius: 10px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.4); animation: pop .2s; cursor: pointer; transition: opacity .4s; }
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--bad); }
.toast.msg { border-left-color: #facc15; }
.toast.out { opacity: 0; }

/* login */
.login-page { display: grid; place-items: center; background: radial-gradient(circle at 30% 20%, rgba(124,58,237,.35), transparent 50%), radial-gradient(circle at 70% 80%, rgba(34,229,255,.25), transparent 50%), #03050c; overflow: auto; }
.login-page::before { content: ''; position: fixed; inset: 0; background-image: linear-gradient(rgba(34,229,255,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(34,229,255,.07) 1px, transparent 1px); background-size: 40px 40px; pointer-events: none; }
.login-card { width: min(360px, 92vw); background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: 28px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login-card { position: relative; border-color: var(--accent); box-shadow: 0 0 40px rgba(34,229,255,.2); }
.login-card h1 { margin: 0; font-size: 22px; font-family: var(--display); letter-spacing: .1em; text-transform: uppercase; text-shadow: 0 0 14px rgba(34,229,255,.6); }
.logo.big { font-size: 44px; }

/* responsivo */
@media (max-width: 900px) {
  :root { --panel-w: 0px; }
  #scene { right: 0; bottom: 48vh; }
  body.panel-hidden #scene { bottom: 0; }
  #panel { top: auto; height: 48vh; width: 100%; border-left: 0; border-top: 1px solid var(--border); }
  body.panel-hidden #panel { transform: translateY(100%); }
  #topbar { right: 12px; }
  .hide-sm, #hint { display: none; }
  .tabs { grid-template-columns: repeat(6, 1fr); }
  .tabs button { font-size: 0; padding: 8px 0; }
  .tabs button::first-letter { font-size: 18px; }
  #drawer, #drawer.wide { top: 56px; left: 8px; right: 8px; width: auto; bottom: calc(48vh + 8px); }
  #toasts { right: 12px; left: 12px; bottom: calc(48vh + 12px); max-width: none; }
}

/* ---------- extras futuristas ---------- */
.scanline { position: fixed; inset: 0; pointer-events: none; z-index: 4; background: repeating-linear-gradient(0deg, rgba(255,255,255,.015) 0 1px, transparent 1px 3px); mix-blend-mode: overlay; }
.tile .value { font-family: var(--display); letter-spacing: .03em; }
.tile { box-shadow: inset 0 0 20px rgba(34,229,255,.04); }
.toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle input { width: auto; accent-color: var(--accent); }
.gmail-list li { padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.gmail-list .from { color: var(--accent); }
.engine { padding: 8px 0; border-bottom: 1px solid var(--border); }

/* ---------------------------------------------------------------- projetos */
.focus-pill { cursor: pointer; border-color: var(--accent2); box-shadow: 0 0 12px rgba(255,43,214,.3); }
.proj-card { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.proj-card:hover { border-color: var(--accent); }
.proj-card.focused { border-color: var(--accent2); box-shadow: 0 0 16px rgba(255,43,214,.25); }
.proj-card p { margin: 6px 0; }
.proj-card a { color: var(--accent); word-break: break-all; }
.proj-top { display: flex; align-items: center; gap: 6px; }
.focus-card { border-color: var(--accent2); }
.health { font-size: 12px; white-space: nowrap; }
.health.ok { color: var(--ok); }
.health.bad { color: var(--bad); font-weight: 700; }
.health.none { color: var(--muted); }
.proj-tag { font-size: 11.5px; color: var(--accent2); margin-top: 2px; }
.lock { font-size: 12px; }

/* ---------------------------------------------------------------- voz */
.voice-pill { cursor: pointer; }
#voice-btn { position: fixed; left: 16px; bottom: 48px; width: 58px; height: 58px; border-radius: 50%; font-size: 24px; cursor: pointer; z-index: 8;
  border: 1px solid var(--accent); background: radial-gradient(circle at 30% 30%, rgba(34,229,255,.35), rgba(124,58,237,.55)); color: #fff;
  box-shadow: 0 0 22px rgba(34,229,255,.45); transition: transform .15s, box-shadow .15s; }
#voice-btn:hover { transform: scale(1.06); }
#voice-btn.on { background: radial-gradient(circle at 30% 30%, rgba(255,43,214,.6), rgba(239,68,68,.6)); box-shadow: 0 0 30px rgba(255,43,214,.7); animation: voicePulse 1.1s infinite; }
body:has(#drawer.open) #voice-btn { left: auto; right: calc(var(--panel-w) + 16px); bottom: 16px; }
@keyframes voicePulse { 50% { transform: scale(1.1); } }
#voice-overlay { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(3,5,12,.55); backdrop-filter: blur(4px); z-index: 30; }
#voice-overlay[hidden] { display: none; }
.voice-box { width: min(520px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--accent2); border-radius: 18px; padding: 22px; text-align: center;
  box-shadow: 0 0 40px rgba(255,43,214,.3); display: flex; flex-direction: column; gap: 12px; align-items: center; }
#voice-text { font-size: 20px; min-height: 2.6em; }
.voice-wave { display: flex; gap: 5px; height: 30px; align-items: center; }
.voice-wave span { width: 6px; height: 10px; border-radius: 3px; background: var(--accent2); animation: wave 1s infinite ease-in-out; }
.voice-wave span:nth-child(2) { animation-delay: .1s; } .voice-wave span:nth-child(3) { animation-delay: .2s; }
.voice-wave span:nth-child(4) { animation-delay: .3s; } .voice-wave span:nth-child(5) { animation-delay: .4s; }
@keyframes wave { 50% { height: 28px; } }
.mic-field { position: relative; }
.mic-field textarea { padding-right: 42px; }
.mic-field .mic-btn { position: absolute; right: 6px; top: 6px; }
.mic-btn { background: rgba(255,255,255,.06); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; padding: 4px 8px; font-size: 15px; }
.mic-btn:hover { border-color: var(--accent); }
.mic-btn.on { border-color: var(--accent2); box-shadow: 0 0 12px rgba(255,43,214,.5); animation: voicePulse 1.1s infinite; }
@media (prefers-reduced-motion: reduce) { #voice-btn.on, .mic-btn.on, .voice-wave span { animation: none; } }
@media (max-width: 760px) { #voice-btn { bottom: calc(48vh + 12px); } }
