:root {
  --fundo: #0f1419; --fundo2: #161d25; --cartao: #1b232d; --borda: #2a3541; --texto: #e6edf3; --mudo: #8b98a5;
  --acento: #5b8def; --ok: #2fb38a; --alerta: #e0a526; --erro: #e5534b;
  --trabalhando: #2fb38a; --disponivel: #7d8fa3; --aguardando: #e0a526; --revisao: #a371f7;
  --bloqueado: #e5534b; --concluido: #39c5cf; --reuniao: #8a5cf6; --sem_sinal: #4b5663;
  font-family: "Segoe UI", system-ui, sans-serif; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--fundo); color: var(--texto); font-size: 14px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: var(--cartao); border: 1px solid var(--borda); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
button:hover { border-color: var(--acento); }
button.prim { background: var(--acento); border-color: var(--acento); color: #fff; }
input, select, textarea { background: var(--fundo); border: 1px solid var(--borda); border-radius: 6px; padding: 7px 9px; }
textarea { width: 100%; resize: vertical; }
a { color: #79a6ff; }
.mudo { color: var(--mudo); }
small { color: var(--mudo); font-weight: 400; }

.topo { display: flex; align-items: center; gap: 20px; padding: 10px 18px; background: var(--fundo2); border-bottom: 1px solid var(--borda); flex-wrap: wrap; }
.marca { font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.logo { color: var(--acento); }
.kpis { display: flex; gap: 10px; flex: 1; flex-wrap: wrap; }
.kpi { background: var(--cartao); border: 1px solid var(--borda); border-radius: 8px; padding: 4px 10px; line-height: 1.2; }
.kpi b { font-size: 16px; display: block; }
.kpi span { font-size: 11px; color: var(--mudo); }
.abas { display: flex; gap: 2px; padding: 0 12px; background: var(--fundo2); border-bottom: 1px solid var(--borda); overflow-x: auto; }
.abas button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 10px 14px; color: var(--mudo); white-space: nowrap; }
.abas button.ativa { color: var(--texto); border-bottom-color: var(--acento); }
main { padding: 14px 18px; }
.aba { display: none; }
.aba.ativa { display: block; }

.sede-barra { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.seg { display: inline-flex; }
.seg button { border-radius: 0; margin-left: -1px; }
.seg button:first-child { border-radius: 6px 0 0 6px; }
.seg button:last-child { border-radius: 0 6px 6px 0; }
.seg button.on { background: var(--acento); border-color: var(--acento); color: #fff; }
.legenda { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--mudo); }
.ponto { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.sede-corpo { display: grid; grid-template-columns: 1fr 360px; gap: 14px; height: calc(100vh - 190px); min-height: 480px; }
.palco { position: relative; background: radial-gradient(ellipse at 50% 30%, #1d2a38, #0c1116); border: 1px solid var(--borda); border-radius: 10px; overflow: hidden; }
.palco3d { position: absolute; inset: 0; }
.palco2d { position: absolute; inset: 0; overflow: auto; padding: 14px; }
.carregando { position: absolute; inset: 0; display: grid; place-items: center; color: var(--mudo); pointer-events: none; }
.painel { background: var(--cartao); border: 1px solid var(--borda); border-radius: 10px; padding: 14px; overflow: auto; }
.painel h2 { margin: 0 0 4px; font-size: 18px; }
.painel h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--mudo); margin: 16px 0 6px; }
.painel ul { margin: 0; padding-left: 18px; }
.painel li { margin: 3px 0; }

.rotulo-sala { font-size: 11px; font-weight: 600; color: #fff; background: rgba(15, 20, 25, .72); padding: 2px 7px; border-radius: 10px; border-left: 3px solid; pointer-events: none; white-space: nowrap; }
.rotulo-agente { font-size: 11px; color: #fff; background: rgba(15, 20, 25, .85); padding: 1px 6px; border-radius: 8px; pointer-events: none; white-space: nowrap; }
.rotulo-agente .ponto { width: 7px; height: 7px; }

.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 8px; border-radius: 10px; background: rgba(255,255,255,.06); }
.andar2d { margin-bottom: 16px; }
.andar2d h4 { margin: 0 0 6px; color: var(--mudo); font-weight: 600; }
.salas2d { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.sala2d { background: var(--cartao); border: 1px solid var(--borda); border-top: 3px solid; border-radius: 8px; padding: 8px; cursor: pointer; }
.sala2d:hover { border-color: var(--acento); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; background: var(--fundo); border-radius: 10px; padding: 2px 8px; margin: 3px 3px 0 0; cursor: pointer; }

.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.cartao { background: var(--cartao); border: 1px solid var(--borda); border-radius: 10px; padding: 14px; }
.cartao h3 { margin: 0 0 6px; font-size: 15px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--borda); vertical-align: top; }
th { color: var(--mudo); font-weight: 600; font-size: 12px; }
.colunas { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.coluna { background: var(--fundo2); border: 1px solid var(--borda); border-radius: 10px; padding: 10px; min-height: 120px; }
.coluna h4 { margin: 0 0 8px; font-size: 13px; color: var(--mudo); }
.item { background: var(--cartao); border: 1px solid var(--borda); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; cursor: pointer; }
.item:hover { border-color: var(--acento); }
.msg { border-left: 3px solid var(--borda); padding: 6px 10px; margin: 8px 0; background: var(--cartao); border-radius: 0 8px 8px 0; white-space: pre-wrap; }
.msg.GPT { border-left-color: var(--reuniao); }
.msg.Claude { border-left-color: var(--acento); }
.msg.fundador { border-left-color: var(--alerta); }
.msg.sistema { border-left-color: var(--erro); }
.msg .cab { font-size: 12px; color: var(--mudo); margin-bottom: 3px; white-space: normal; }

.lab { display: grid; grid-template-columns: 380px 1fr; gap: 14px; }
.lab-form textarea { min-height: 110px; }
.lab-form .linha { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.filtros { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.ideia { background: var(--cartao); border: 1px solid var(--borda); border-radius: 8px; padding: 10px; margin-bottom: 8px; cursor: pointer; }
.ideia:hover { border-color: var(--acento); }
.nota { font-weight: 700; font-size: 18px; }
.mapa { width: 100%; height: 420px; background: var(--fundo2); border: 1px solid var(--borda); border-radius: 10px; }
.original { white-space: pre-wrap; background: var(--fundo); border: 1px dashed var(--borda); padding: 10px; border-radius: 8px; }
.tag { display: inline-block; font-size: 11px; background: var(--fundo); border: 1px solid var(--borda); border-radius: 10px; padding: 1px 7px; margin: 2px 2px 0 0; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 50; }
.modal[hidden] { display: none; }
.modal-caixa { position: relative; background: var(--fundo2); border: 1px solid var(--borda); border-radius: 12px; padding: 18px; width: min(760px, 94vw); max-height: 88vh; overflow: auto; }
.fechar { position: absolute; top: 8px; right: 8px; border: 0; font-size: 20px; background: none; }
.aviso { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--cartao); border: 1px solid var(--acento); padding: 10px 16px; border-radius: 8px; z-index: 60; max-width: 90vw; }
.aviso[hidden] { display: none; }

/* v2: comando, painéis, login, celular */
.topo-dir { display: flex; gap: 8px; align-items: center; margin-left: auto; font-size: 12px; }
.comando-rapido { display: flex; gap: 8px; padding: 8px 18px; background: var(--fundo2); border-bottom: 1px solid var(--borda); }
.comando-rapido input { flex: 1; min-width: 0; }
.comando-rapido select { max-width: 210px; }
.numeros { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.numero { background: var(--cartao); border: 1px solid var(--borda); border-radius: 10px; padding: 10px 12px; cursor: default; }
.numero[data-ir] { cursor: pointer; }
.numero[data-ir]:hover { border-color: var(--acento); }
.numero b { display: block; font-size: 24px; line-height: 1.1; }
.numero span { font-size: 12px; color: var(--mudo); }
.numero.alerta b { color: var(--alerta); }
.numero.erro b { color: var(--erro); }
.duas { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
h3.secao { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--mudo); margin: 18px 0 8px; }
.form-grade { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grade label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--mudo); }
.form-grade label.largo { grid-column: 1 / -1; }
.form-grade input, .form-grade select, .form-grade textarea { color: var(--texto); font-size: 14px; }
.acoes { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.acoes button { padding: 4px 10px; font-size: 13px; }
button.perigo { border-color: var(--erro); color: #ffb4ae; }
button.ok { border-color: var(--ok); color: #8be0c4; }
.pill { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 10px; background: rgba(255,255,255,.08); }
.pill.publicado, .pill.concluido, .pill.ativo, .pill.concluida { background: rgba(57,197,207,.18); color: #8fe3ea; }
.pill.pronto, .pill.agendado, .pill.proposta, .pill.em\ andamento, .pill.em\ revisão, .pill.na\ fila\ do\ Claude { background: rgba(224,165,38,.18); color: #f1c96b; }
.pill.bloqueado, .pill.bloqueada, .pill.falhou, .pill.rejeitado, .pill.rejeitada { background: rgba(229,83,75,.2); color: #ffb4ae; }
.faixa { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.avatar { font-size: 26px; line-height: 1; }
.equipe { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.equipe .cartao ul { margin: 4px 0; padding-left: 18px; font-size: 13px; }
.cobertura td:last-child { font-size: 12px; }
.spark { width: 100%; height: 60px; display: block; }
.calendario { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendario .dia { background: var(--fundo2); border: 1px solid var(--borda); border-radius: 6px; padding: 4px; min-height: 64px; font-size: 11px; }
.calendario .dia.hoje { border-color: var(--acento); }
.calendario .dia b { display: block; color: var(--mudo); }
.calendario .ev { display: block; border-radius: 4px; padding: 1px 4px; margin-top: 2px; background: rgba(91,141,239,.2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendario .ev.viceclips { background: rgba(240,138,93,.22); }
.md { line-height: 1.5; }
.md h1 { font-size: 20px; } .md h2 { font-size: 17px; } .md h3 { font-size: 15px; }
.md pre, .md code { background: var(--fundo); border-radius: 4px; padding: 1px 4px; white-space: pre-wrap; }
.lista-docs .item { margin-bottom: 4px; padding: 6px 10px; }
.qr { background: #fff; padding: 10px; border-radius: 8px; display: inline-block; }
.qr img { display: block; }
.trilha { font-size: 12px; color: var(--mudo); border-left: 2px solid var(--borda); padding-left: 8px; margin: 6px 0; }
.resposta { white-space: pre-wrap; background: var(--fundo); border: 1px solid var(--borda); border-radius: 8px; padding: 10px; margin-top: 6px; max-height: 420px; overflow: auto; }

/* visitante: só visualização (o servidor também recusa qualquer alteração) */
body.leitura .so-adm, body.leitura .abas [data-adm], body.leitura .acoes, body.leitura #pNovo, body.leitura #pForm, body.leitura #pFiltro { display: none !important; }
.selo-visitante { background: rgba(224,165,38,.18); color: #f1c96b; border-radius: 10px; padding: 2px 8px; }
.senha-gerada { font: 600 18px/1.3 Consolas, monospace; background: var(--fundo); border: 1px dashed var(--acento); border-radius: 8px; padding: 8px 12px; display: inline-block; user-select: all; }

.tela-login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.caixa-login { width: min(380px, 100%); }
.caixa-login .marca { margin-bottom: 8px; }

@media (max-width: 900px) {
  .sede-corpo { grid-template-columns: 1fr; height: auto; }
  .palco { height: 60vh; }
  .lab, .duas, .tres { grid-template-columns: 1fr; }
  .form-grade { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  input, select, textarea { font-size: 16px; } /* evita zoom automático no iPhone */
  .topo { gap: 8px; padding: 8px 12px; }
  .marca small { display: none; }
  .kpis { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; }
  .kpi { flex: 0 0 auto; }
  .comando-rapido { flex-wrap: wrap; padding: 8px 12px; }
  .comando-rapido input { flex: 1 1 100%; order: 1; }
  .comando-rapido select { max-width: none; flex: 1 1 0; min-width: 0; order: 2; }
  .comando-rapido button { order: 3; }
  main { padding: 10px 10px 40px; }
  .abas { padding: 0 4px; }
  .abas button { padding: 10px 10px; }
  .numeros { grid-template-columns: repeat(2, 1fr); }
  .modal-caixa { width: 100vw; max-height: 100vh; height: 100vh; border-radius: 0; padding: 14px 12px; }
  table { font-size: 13px; }
  .tabela-rolavel { overflow-x: auto; }
  .calendario .dia { min-height: 48px; }
}

/* finanças: barras de progresso até a monetização */
.meta-linha { margin: 8px 0; }
.meta-cab { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.meta-barra { height: 8px; background: rgba(255,255,255,.08); border-radius: 6px; overflow: hidden; margin: 4px 0 2px; }
.meta-barra i { display: block; height: 100%; background: linear-gradient(90deg, #2fb38a, #5b8def); border-radius: 6px; }
.meta-linha small { color: var(--mudo, #9aa3b2); font-size: 11px; }
.pill.reprovado, .pill.precisa\ do\ fundador { background: rgba(229,83,83,.18); color: #f08a8a; }
.dist { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.dist-item { background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.08); border-radius: 10px; padding: 8px; }
.dist-item textarea { width: 100%; margin-top: 6px; font-size: 12px; box-sizing: border-box; }
a.botao { display: inline-block; padding: 4px 10px; border-radius: 8px; background: rgba(91,141,239,.18); color: #9fbfff; text-decoration: none; font-size: 13px; margin-left: 6px; }
