/* Wendy: tema do design system (DesignSystem/DesignDesktop.png e DesignCelular.png).
   Escuro, azul-marinho com degrade azul -> roxo. Mesmos tokens do painel do agente
   (conferidos por test/theme-parity.test.js). Sem estilo inline: a politica de conteudo proibe. */

:root {
  color-scheme: dark;
  --bg: #050a1f;
  --sidebar: #060b20;
  --sidebar-2: #0b0d2c;
  --surface: #0c1430;
  --surface-2: #0a1226;
  --code: #050a16;
  --line: #17224a;
  --line-strong: #22306c;
  --text: #eaf0ff;
  --text-2: #9aa6cf;
  --muted: #7b8390;
  --blue: #35a1fd;
  --indigo: #4b50fe;
  --purple: #a049fc;
  --grad: linear-gradient(90deg, #35a1fd 0%, #4b50fe 55%, #a049fc 100%);
  --grad-send: linear-gradient(135deg, #4086fe, #9448fa);
  --sel: #111f61;
  --sel-line: #2a46c8;
  --user: #14246f;
  --user-line: #2a3fa8;
  --avatar: #5a50fd;
  --ok: #22c55e;
  --ok-bg: #083031;
  --ok-line: #0a2f35;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 14px;
  --gutter: 16px;
  --font: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  color: var(--text);
  font: 15px/1.5 var(--font);
  background:
    radial-gradient(900px 520px at 88% -8%, rgba(104, 72, 255, 0.24), transparent 62%),
    radial-gradient(760px 520px at -8% 108%, rgba(30, 120, 255, 0.2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
img { max-width: 100%; }

.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.boot { margin: 40vh var(--gutter) 0; text-align: center; color: var(--text-2); }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ── botoes ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border: 1px solid var(--line-strong);
  border-radius: 12px; background: var(--surface); cursor: pointer; font-weight: 600; color: var(--text);
}
.btn:hover { border-color: var(--sel-line); }
.btn.primary, .btn-grad {
  background: var(--grad); border-color: transparent; color: #fff;
  box-shadow: 0 6px 22px rgba(80, 90, 255, 0.35);
}
.btn.danger { border-color: rgba(248, 113, 113, 0.55); color: var(--bad); background: transparent; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn-grad {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  min-height: 50px; border: 0; border-radius: 12px; font-weight: 600; font-size: 16px; cursor: pointer;
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { background: rgba(120, 140, 255, 0.12); color: var(--text); }
.so-mobile { display: none; }


/* ── utilitarios ── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sem-rolagem { overflow: hidden; }
.copia-oculta { position: fixed; left: -9999px; opacity: 0; pointer-events: none; }
.muted { color: var(--text-2); font-size: 14px; }
.botao-link { text-decoration: none; display: inline-flex; width: auto; padding: 0 22px; }
.link { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--blue); text-decoration: underline; cursor: pointer; font-size: 13px; margin-left: auto; }
.ok-texto { display: flex; align-items: center; gap: 8px; color: #4ade80; }
code, .code { font-family: var(--mono); background: #0b1232; padding: 1px 7px; border-radius: 6px; font-size: 0.92em; color: #8fd3ff; }

/* ── entrada: login e troca de senha ── */
.tela-entrada { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px 16px; }
.entrada-cartao {
  width: min(420px, 100%); text-align: center; padding: 26px 24px 22px; border: 1px solid var(--line-strong); border-radius: 22px;
  background: rgba(10, 16, 44, 0.78); backdrop-filter: blur(6px); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.entrada-cartao .logo-grande { display: block; margin: 0 auto 6px; width: min(260px, 72%); height: auto; mix-blend-mode: screen; }
.entrada-cartao form, .entrada-cartao .campo { text-align: left; }
.entrada-titulo { margin: 4px 0 14px; font-size: 22px; font-weight: 600; }
.entrada-rodape { margin-top: 14px; }
.entrada-cartao .btn-grad { margin-top: 14px; }
.erro-bloco { margin: 10px 0 0; padding: 10px 12px; border: 1px solid rgba(248, 113, 113, 0.55); border-radius: 12px; background: rgba(248, 113, 113, 0.1); color: #fecaca; font-size: 14px; text-align: left; }

/* ── formularios ── */
.campo { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; position: relative; }
.campo label { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-2); }
.campo input, .campo select {
  height: 46px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: #050d1c; font: inherit; width: 100%;
}
.campo input[readonly] { color: var(--text-2); background: #070f22; }
.campo.com-botao input { padding-right: 46px; }
.ver-senha { position: absolute; right: 4px; bottom: 3px; width: 40px; height: 40px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; border-radius: 10px; }
.formulario { display: flex; flex-direction: column; }

/* ── casca do site: menu lateral + conteudo ── */
.app-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.nav-lateral {
  display: flex; flex-direction: column; min-height: 0; padding: 14px 12px 12px; z-index: 40;
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%); border-right: 1px solid var(--line);
}
.nav-marca { display: flex; justify-content: center; margin: 4px 0 12px; }
.nav-marca img { width: 170px; height: auto; mix-blend-mode: screen; }
.nav-lista { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid transparent; border-radius: 12px;
  color: var(--text-2); text-decoration: none; font-weight: 500;
}
.nav-item:hover { background: rgba(120, 140, 255, 0.1); color: var(--text); }
.nav-item.ativo { background: var(--sel); border-color: var(--sel-line); color: var(--text); }
.nav-rodape { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.nav-usuario { display: flex; align-items: center; gap: 10px; padding: 6px 4px 10px; }
.nav-usuario-txt { display: flex; flex-direction: column; min-width: 0; }
.nav-usuario-txt strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.nav-usuario-txt small { color: var(--text-2); }
.nav-acoes { display: flex; flex-wrap: wrap; gap: 4px; }
.nav-mini {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 0; border-radius: 10px; background: transparent;
  color: var(--text-2); font-size: 13px; cursor: pointer; text-decoration: none;
}
.nav-mini:hover { background: rgba(120, 140, 255, 0.12); color: var(--text); }
.nav-fundo { display: none; }
.conteudo-app { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: rgba(3, 7, 19, 0.5); }
.topo-mobile { display: none; }
.tela-raiz { flex: 1; min-height: 0; overflow-y: auto; }
.tela-pagina { padding: 22px 26px 40px; }
.tela-chat { overflow: hidden; display: flex; }
.avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 42px; height: 42px; border-radius: 50%; background: var(--avatar); font-weight: 600; font-size: 14px; color: #fff; }

/* ── pagina de CRUD ── */
.pagina { max-width: 1040px; margin: 0 auto; }
.pagina-cab {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 16px; border: 1px solid var(--line-strong); border-radius: 18px;
  background: linear-gradient(90deg, rgba(53, 161, 253, 0.16), rgba(160, 73, 252, 0.16));
}
.pagina-mascote { width: 44px; height: 44px; flex: none; mix-blend-mode: screen; }
.pagina-titulos { min-width: 0; }
.pagina-titulos h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: 0.08em; }
.pagina-titulos p { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.pagina-acoes { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.pagina-area { min-height: 120px; }

.chips { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.chip {
  flex: 1 0 128px; display: flex; flex-direction: column; padding: 12px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
}
.chip-valor { font-size: 28px; font-weight: 700; line-height: 1.15; }
.chip-rotulo { font-size: 12px; font-weight: 600; color: var(--text-2); }
.chip-detalhe { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.chip.ok { background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.4); } .chip.ok .chip-valor { color: #4ade80; }
.chip.azul { background: rgba(53, 161, 253, 0.08); border-color: rgba(53, 161, 253, 0.4); } .chip.azul .chip-valor { color: var(--blue); }
.chip.roxo { background: rgba(160, 73, 252, 0.09); border-color: rgba(160, 73, 252, 0.4); } .chip.roxo .chip-valor { color: #c58bff; }
.chip.ruim { background: rgba(248, 113, 113, 0.08); border-color: rgba(248, 113, 113, 0.45); } .chip.ruim .chip-valor { color: var(--bad); }
.chip.alerta { background: rgba(251, 191, 36, 0.08); border-color: rgba(251, 191, 36, 0.4); } .chip.alerta .chip-valor { color: var(--warn); }

.barra-busca { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.busca-campo {
  flex: 1 1 220px; display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 12px;
  background: rgba(12, 20, 48, 0.7); color: var(--text-2);
}
.busca-campo input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; }
.busca-campo input::placeholder { color: var(--text-2); }
.filtro { height: 46px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(12, 20, 48, 0.7); font: inherit; min-width: 150px; }

.cartao-item {
  display: flex; align-items: center; gap: 14px; padding: 14px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
}
.cartao-item.desabilitado { opacity: 0.62; }
.cartao-corpo { flex: 1; min-width: 0; }
.cartao-titulo { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cartao-linha { display: flex; align-items: flex-start; gap: 7px; margin: 5px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.cartao-linha svg { flex: none; margin-top: 2px; color: var(--text-2); }
.cartao-acoes { display: flex; gap: 2px; flex: none; }
.acao-icone { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 12px; background: transparent; color: var(--text-2); cursor: pointer; }
.acao-icone:hover { background: rgba(120, 140, 255, 0.14); color: var(--text); }
.acao-icone.perigo:hover { background: rgba(248, 113, 113, 0.14); color: var(--bad); }
.pilula { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid transparent; }
.pilula.ok { background: rgba(34, 197, 94, 0.13); color: #4ade80; border-color: rgba(34, 197, 94, 0.3); }
.pilula.alerta { background: rgba(251, 191, 36, 0.12); color: var(--warn); border-color: rgba(251, 191, 36, 0.3); }
.pilula.ruim { background: rgba(248, 113, 113, 0.12); color: var(--bad); border-color: rgba(248, 113, 113, 0.3); }
.pilula.azul { background: rgba(53, 161, 253, 0.13); color: var(--blue); border-color: rgba(53, 161, 253, 0.3); }
.pilula.neutro { background: rgba(154, 166, 207, 0.1); color: var(--text-2); border-color: var(--line-strong); }
.faixa-erro { display: flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: 12px; border: 1px solid rgba(248, 113, 113, 0.5); border-radius: 12px; background: rgba(248, 113, 113, 0.1); color: #fecaca; font-size: 14px; }
.esqueleto { opacity: 0.7; animation: pulsa 1.2s ease-in-out infinite; }
.esq-bola { width: 44px; height: 44px; border-radius: 50%; background: var(--line); flex: none; }
.esq-linhas { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.esq-linha { height: 10px; width: 50%; border-radius: 6px; background: var(--line); }
.esq-linha.larga { width: 70%; }
@keyframes pulsa { 50% { opacity: 0.35; } }
.vazio-pagina { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 16px; color: var(--text-2); gap: 4px; }
.vazio-pagina img { mix-blend-mode: screen; margin-bottom: 8px; }
.vazio-pagina p { margin: 0; color: var(--text); font-weight: 600; }
.contador { text-align: center; color: var(--text-2); font-size: 12px; margin: 10px 0 0; }
.item-ico.grande { width: 46px; height: 46px; }

.cartao-secao { padding: 18px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.cartao-secao h2 { margin: 0 0 8px; font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.cartao-secao h3 { margin: 14px 0 6px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.cartao-secao.dica { display: flex; gap: 10px; align-items: flex-start; }
.cartao-secao.dica p { margin: 0; }
.secao-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.secao-cab .filtro { min-width: 170px; }
.passo { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--grad); color: #fff; font-size: 13px; }
.texto-longo p { margin: 0 0 6px; }
.dados { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 6px 14px; margin: 8px 0 0; }
.dados dt { color: var(--text-2); }
.dados dd { margin: 0; overflow-wrap: anywhere; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.row .btn, .row .btn-grad { flex: 0 1 auto; }
.btn-grad { width: auto; padding: 0 22px; }
.entrada-cartao .btn-grad, .modal-rodape .btn-grad { width: 100%; }

.comando { display: flex; gap: 8px; align-items: stretch; margin: 8px 0; }
.comando code { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; background: var(--code); overflow-wrap: anywhere; font-size: 12.5px; line-height: 1.5; }
.abas-so { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.aba-so { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: transparent; color: var(--text-2); cursor: pointer; }
.aba-so.ativa { background: var(--sel); border-color: var(--sel-line); color: var(--text); }
.cartoes-so { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 14px 0 18px; }
.cartao-so {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 30px 14px; border: 1px solid var(--line-strong); border-radius: 20px;
  background: var(--surface); color: var(--text); cursor: pointer;
}
.cartao-so:hover { border-color: var(--blue); box-shadow: 0 0 24px rgba(53, 161, 253, 0.18); }
.so-icone { color: var(--blue); }
.cartao-so strong { font-size: 18px; }
.requisitos ul { margin: 6px 0; padding-left: 20px; }
.hash { display: block; padding: 8px 10px; word-break: break-all; font-size: 12px; background: var(--code); border-radius: 8px; }
.passos { padding-left: 20px; margin: 8px 0; }
.passos li { margin-bottom: 4px; }
.credencial { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.credencial code { font-size: 15px; padding: 6px 10px; }
.lista-simples .linha-projeto { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.log-linha .log-dados { margin: 8px 0 0; padding: 10px; border-radius: 10px; background: var(--code); font: 12px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; color: #67d4ff; max-height: 300px; overflow: auto; }
.log-usuario { color: #c58bff; }
.seguranca-bloco { margin-top: 12px; }

/* graficos */
.grafico { width: 100%; height: auto; display: block; }
.grafico .grade { stroke: var(--line); stroke-width: 1; }
.grafico .eixo { fill: var(--text-2); font-size: 10px; }
.grafico .linha { stroke-width: 2; stroke-linejoin: round; }
.grafico .area { fill: rgba(53, 161, 253, 0.1); }
.grafico .barra { fill: var(--indigo); }
.uso { margin: 10px 0; }
.uso-cab { display: flex; justify-content: space-between; margin-bottom: 4px; }
.uso-trilho { height: 10px; border-radius: 999px; background: #0a1230; overflow: hidden; }
.uso-preenchido { height: 100%; border-radius: 999px; background: var(--grad); }
.uso-preenchido.alerta { background: var(--warn); }
.uso-preenchido.ruim { background: var(--bad); }

/* ── modal ("modal_window_skill") ── */
.modal-fundo {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; padding: 12px;
  background: rgba(2, 4, 14, 0.72); backdrop-filter: blur(4px);
}
.modal-cartao {
  position: relative; display: flex; flex-direction: column; width: 100%; max-height: 92dvh; border: 1px solid var(--line-strong); border-radius: 22px; background: #0a1030;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}
.modal-cartao.estreita { max-width: 380px; }
.modal-cartao.media { max-width: 500px; }
.modal-cartao.larga { max-width: 680px; }
.modal-x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.modal-x:hover { background: rgba(120, 140, 255, 0.14); color: var(--text); }
.modal-cab { padding: 20px 52px 4px 22px; }
.modal-cab h2 { margin: 0; font-size: 18px; font-weight: 700; }
.modal-cab p { margin: 2px 0 0; }
.modal-erro { margin: 8px 22px 0; padding: 9px 12px; border-radius: 10px; background: rgba(248, 113, 113, 0.12); color: #fecaca; font-size: 13px; }
.modal-corpo { overflow-y: auto; padding: 10px 22px 14px; }
.modal-rodape { display: flex; gap: 10px; padding: 12px 22px 20px; flex-wrap: wrap; }
.modal-rodape .btn { flex: 1 1 140px; }
.modal-corpo .lista { max-height: 50dvh; }
@media (min-width: 640px) { .modal-fundo { align-items: center; } }

.busca {
  display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; padding: 0 14px; height: 44px;
  border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(12, 20, 48, 0.7); color: var(--text-2);
}
.busca input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; }
.busca input::placeholder { color: var(--text-2); }
.lista { flex: 1; overflow-y: auto; min-height: 0; padding: 2px 0; }
.grupo { margin: 16px 6px 6px; font-size: 14px; color: var(--text-2); }
.item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; margin: 2px 0;
  border: 1px solid transparent; border-radius: 12px; background: transparent; cursor: pointer; text-align: left;
}
.item:hover { background: rgba(120, 140, 255, 0.08); }
.item.sel { background: var(--sel); border-color: var(--sel-line); }
.item-ico {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px;
  border-radius: 11px; background: rgba(37, 99, 235, 0.22); color: #8fb4ff;
}
.item.sel .item-ico { background: #2150d8; color: #fff; }
.item-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item-txt strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-txt small { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item time { color: var(--text-2); font-size: 13px; flex: none; align-self: flex-start; margin-top: 4px; }
.vazio-lista { color: var(--text-2); padding: 16px 8px; }

/* ── chat: lista de conversas + conversa ── */
.chat-shell { display: grid; grid-template-columns: 320px minmax(0, 1fr); width: 100%; height: 100%; min-height: 0; }
.chat-shell .sidebar { display: flex; flex-direction: column; min-height: 0; padding: 14px 16px 10px; background: rgba(6, 11, 32, 0.6); border-right: 1px solid var(--line); }
.lista-cab { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.lista-cab h2 { margin: 0; font-size: 18px; font-weight: 600; }

/* ── painel da conversa ── */
.chat-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: rgba(3, 7, 19, 0.55); }
.chat-top {
  display: flex; align-items: center; gap: 12px; padding: 10px 18px; min-height: 64px;
  border-bottom: 1px solid var(--line); background: rgba(4, 16, 39, 0.7);
}
.chat-titulo { min-width: 0; display: flex; flex-direction: column; }
.chat-titulo h2 { margin: 0; font-size: 18px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-titulo small { color: var(--text-2); }
.spacer { flex: 1; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: #0b1230; font-size: 14px; color: var(--text); white-space: nowrap;
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.off { background: var(--bad); }
.dot.wait { background: var(--warn); }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px;
  border-radius: 50%; background: var(--avatar); font-weight: 600; font-size: 14px; color: #fff;
}
.avatar-ia { width: 36px; height: 36px; border-radius: 50%; flex: none; object-fit: cover; mix-blend-mode: screen; }
.avatar-ia.grande { width: 42px; height: 42px; }
.menu-wrap { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: 48px; z-index: 15; min-width: 240px; padding: 6px;
  border: 1px solid var(--line-strong); border-radius: 12px; background: #0b1232; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
}
.menu-pop button { width: 100%; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; }
.menu-pop button:hover { background: rgba(120, 140, 255, 0.14); }

.banner {
  margin: 10px 18px 0; padding: 10px 14px; border: 1px solid rgba(251, 191, 36, 0.6); border-radius: 12px;
  background: rgba(251, 191, 36, 0.08); font-size: 14px;
}
.banner.bad { border-color: rgba(248, 113, 113, 0.6); background: rgba(248, 113, 113, 0.08); }
.banner .btn { margin-left: 8px; min-height: 34px; padding: 0 12px; }

.messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; -webkit-overflow-scrolling: touch; }
.empty { margin: auto; text-align: center; color: var(--text-2); padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.empty img { mix-blend-mode: screen; margin-bottom: 6px; }
.empty p { margin: 0; color: var(--text); }
.msg { display: flex; gap: 10px; max-width: 100%; }
.msg.user { justify-content: flex-end; }
.msg.assistant { align-items: flex-start; }
.msg-col { min-width: 0; max-width: min(860px, 100%); }
.msg-nome { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.msg-nome time, .bubble .hora { color: var(--text-2); font-size: 12px; }
.bubble { padding: 12px 15px; border-radius: 16px; overflow-wrap: anywhere; word-break: break-word; }
.bubble .texto { white-space: pre-wrap; }
.bubble.user {
  max-width: min(640px, 86%); background: var(--user); border: 1px solid var(--user-line);
  border-bottom-right-radius: 6px; display: flex; flex-direction: column; gap: 4px;
}
.bubble.user .hora { align-self: flex-end; }
.bubble.assistant { background: var(--surface); border: 1px solid var(--line); border-top-left-radius: 6px; }
.bubble.error { border-color: rgba(248, 113, 113, 0.6); }
.bubble .meta { display: block; margin-top: 6px; font-size: 12px; color: var(--text-2); }
.thinking { color: var(--text-2); font-style: italic; }
.divider {
  align-self: center; font-size: 12px; color: var(--text-2); padding: 2px 12px;
  border: 1px dashed var(--line-strong); border-radius: 999px;
}

/* cartao de "ferramentas usadas" (como o cartao "Comandos executados" do design) */
.card-tools { margin: 0 0 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); overflow: hidden; }
.card-tools-cab { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.ico-ok { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; background: var(--ok); color: #04210f; align-items: center; justify-content: center; flex: none; }
.card-tools-titulo { flex: 1; font-size: 14px; }
.estado { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--ok-line); }
.estado.ok { background: var(--ok-bg); color: #4ade80; }
.estado.rodando { background: rgba(53, 161, 253, 0.12); color: var(--blue); border-color: rgba(53, 161, 253, 0.4); }
.estado.parado { background: rgba(251, 191, 36, 0.1); color: var(--warn); border-color: rgba(251, 191, 36, 0.4); }
.linhas { list-style: none; counter-reset: l; margin: 0; padding: 10px 12px; background: var(--code); font: 13px/1.7 var(--mono); }
.linhas li { counter-increment: l; display: flex; gap: 12px; }
.linhas li::before { content: counter(l); color: var(--muted); min-width: 1.4em; text-align: right; }
.linhas .cod { color: #67d4ff; overflow-wrap: anywhere; }
.linhas li.negada .cod { color: var(--bad); }
.linhas em { color: var(--bad); font-style: normal; }

/* ── composicao ── */
.composer { display: flex; align-items: flex-end; gap: 10px; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); }
.composer-caixa {
  flex: 1; display: flex; align-items: flex-end; gap: 6px; padding: 4px 6px 4px 14px; min-width: 0;
  border: 1px solid var(--line-strong); border-radius: 16px; background: #050d1c;
}
.composer-caixa:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(53, 161, 253, 0.16); }
.composer textarea {
  flex: 1; min-height: 44px; max-height: 160px; resize: none; padding: 10px 0; border: 0; outline: 0;
  background: transparent; line-height: 1.35; min-width: 0;
}
.composer textarea::placeholder { color: var(--text-2); }
.mic.on { background: var(--bad); color: #fff; }
.enviar {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: none; min-width: 52px; height: 52px;
  padding: 0 18px; border: 0; border-radius: 14px; background: var(--grad-send); color: #fff; font-weight: 600; cursor: pointer;
  box-shadow: 0 6px 20px rgba(100, 80, 255, 0.35);
}
.enviar[disabled] { opacity: 0.5; cursor: default; }
.enviar.parar { background: #3a1020; border: 1px solid rgba(248, 113, 113, 0.6); color: var(--bad); box-shadow: none; }
.so-desktop { display: inline; }


/* ── janela de aviso e aviso rapido ── */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: 90vw; padding: 10px 16px; border-radius: 12px; background: #e9eeff; color: #0a1030;
  font-size: 14px; z-index: 30; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}


/* ── celular ── */
@media (max-width: 899px) {
  .so-mobile { display: block; }
  .so-desktop { display: none; }
  .app-shell { display: block; }
  .nav-lateral { position: fixed; left: 0; top: 0; bottom: 0; width: min(290px, 84vw); transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, 0.6); }
  .nav-lateral.aberto { transform: none; }
  .nav-fundo { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(2, 4, 14, 0.6); }
  .nav-fundo[hidden] { display: none; }
  .conteudo-app { height: 100vh; height: 100dvh; }
  .topo-mobile { display: flex; align-items: center; gap: 8px; padding: 6px 10px calc(6px) 6px; padding-top: calc(6px + env(safe-area-inset-top)); border-bottom: 1px solid var(--line); background: rgba(4, 16, 39, 0.85); }
  .topo-mobile img { mix-blend-mode: screen; }
  .tela-pagina { padding: 14px 12px 40px; }
  .pagina-cab { flex-wrap: wrap; padding: 12px; }
  .pagina-acoes { margin-left: 0; width: 100%; justify-content: flex-start; }
  .cartao-item { flex-wrap: wrap; }
  .cartao-acoes { width: 100%; justify-content: flex-end; }
  .dados { grid-template-columns: 1fr; gap: 0; }
  .dados dt { margin-top: 8px; font-size: 12px; }
  .cartoes-so { grid-template-columns: 1fr; }
  .comando { flex-direction: column; }
  .chips { flex-wrap: nowrap; }

  /* chat: lista OU conversa (a conversa cobre a tela inteira) */
  .chat-shell { display: block; }
  .chat-shell .sidebar { height: 100%; border-right: 0; }
  .item { padding: 12px; border-radius: 0; border: 0; border-bottom: 1px solid var(--line); margin: 0; }
  .item.sel { background: var(--sel); border-radius: 12px; border: 1px solid var(--sel-line); }
  .item-ico { width: 46px; height: 46px; }
  .chat-shell[data-view='home'] .chat-pane { display: none; }
  .chat-shell[data-view='chat'] .sidebar { display: none; }
  .chat-shell[data-view='chat'] .chat-pane { position: fixed; inset: 0 auto auto 0; width: 100%; height: 100%; height: var(--vvh, 100%); z-index: 30; padding-top: env(safe-area-inset-top); background: var(--bg); }
  .lista .grupo { display: none; }
  .chat-titulo { flex: 1; min-width: 0; }
  .chat-titulo small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .chat-top { padding: 8px 10px; gap: 8px; }
  .chat-top .spacer { display: none; }
  .pill { padding: 8px; }
  .pill #status-texto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .bubble.user { max-width: 88%; background: linear-gradient(135deg, #1a2aa8, #2a2fcf); border-color: #3a46e0; }
  .messages { padding: 14px 12px; }
  .composer { padding-left: 12px; padding-right: 12px; }
  /* iOS amplia a pagina inteira ao focar um campo com fonte menor que 16px: a tela ficaria maior que o celular */
  input, textarea, select, .busca input, .composer textarea { font-size: 16px; }
}
@media (min-width: 900px) { .so-mobile { display: none !important; } }

@media (prefers-reduced-motion: no-preference) {
  .msg { animation: surge 0.14s ease-out; }
  @keyframes surge { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}

/* ── plano, autorizacao e Telegram ── */
.card-plano { margin: 12px 0 0; padding: 14px; border: 1px solid var(--sel-line); border-radius: 12px; background: var(--sel); }
.card-plano-cab { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.plano-resumo { margin: 4px 0 8px; font-weight: 600; overflow-wrap: anywhere; }
.plano-arquivos { margin: 4px 0 10px; padding-left: 20px; }
.plano-arquivos li { overflow-wrap: anywhere; }
.linha-codigo { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0 4px; }
.linha-codigo input { flex: 1 1 140px; min-width: 120px; height: 46px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--code); font: 700 22px/1 var(--mono); letter-spacing: 6px; text-align: center; }
.erro-aprovacao { color: var(--bad); margin: 6px 0 0; }
.erro-aprovacao[hidden] { display: none; }
.bubble.deploy { min-width: min(100%, 320px); }
.deploy-cab { padding: 0 0 8px; }
/* gauge de pizza do deploy: --p (0..100) vem do JS pela CSSOM */
.gauge-deploy { display: flex; align-items: center; gap: 14px; margin: 4px 0 6px; }
.gauge-roda { position: relative; width: 76px; height: 76px; flex: none; }
.gauge-disco { --p: 0; --cor: var(--blue); position: absolute; inset: 0; border-radius: 50%; border: 1px solid var(--line-strong);
  background: conic-gradient(var(--cor) calc(var(--p) * 1%), rgba(154, 166, 207, 0.12) 0); transition: background 0.2s linear; }
.gauge-centro { position: absolute; inset: 21px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); box-shadow: 0 0 0 2px rgba(5, 10, 31, 0.6); }
.gauge-num { font: 700 13px/1 var(--mono); color: var(--text); }
.gauge-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.gauge-tempo { font-size: 14px; }
.gauge-legenda { color: var(--text-2); font-size: 12px; }
.gauge-deploy[data-estado="done"] .gauge-disco { --cor: var(--ok); }
.gauge-deploy[data-estado="error"] .gauge-disco, .gauge-deploy[data-estado="lost"] .gauge-disco { --cor: var(--bad); }
.gauge-deploy[data-estado="aborted"] .gauge-disco { --cor: var(--warn); }
.gauge-deploy[data-estado="sem-previsao"] .gauge-disco { --p: 25; animation: gauge-girar 1.2s linear infinite; }
@keyframes gauge-girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .gauge-deploy[data-estado="sem-previsao"] .gauge-disco { animation: none; } }
.saida-deploy { margin: 8px 0 0; padding: 10px 12px; max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--code); font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; }
.ok-aprovacao { display: flex; align-items: center; gap: 6px; color: #4ade80; margin: 6px 0 0; }
.codigo-grande { font: 700 34px/1.2 var(--mono); letter-spacing: 6px; text-align: center; padding: 14px 8px; border: 2px dashed var(--blue); border-radius: var(--radius); background: var(--surface-2); user-select: all; }
ol.passos { margin: 8px 0; padding-left: 22px; display: grid; gap: 12px; }
ol.passos li { overflow-wrap: anywhere; }
ol.passos-bot li p { margin: 2px 0 0; }
@media (max-width: 899px) { .codigo-grande { font-size: 26px; letter-spacing: 4px; } }
.plano-arquivos .cod { color: #67d4ff; }

/* ── imagem do projeto (cadastrada no painel do agente) ── */
.item-ico.com-img { background: transparent; padding: 0; overflow: hidden; }
.item.sel .item-ico.com-img { background: transparent; box-shadow: 0 0 0 2px #2150d8; }
.proj-img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.avatar-ia.proj-img { width: 40px; height: 40px; border-radius: 12px; mix-blend-mode: normal; border: 1px solid var(--line-strong); }
