:root {
  --bg: #0b1020;
  --superficie: #131a2e;
  --superficie-2: #0f1526;
  --borda: #253154;
  --texto: #e8eefc;
  --suave: #93a2c4;
  --destaque: #38bdf8;
  --destaque-escuro: #0ea5e9;
  --verde: #22c55e;
  --verde-suave: #10311f;
  --amarelo: #facc15;
  --amarelo-suave: #3a2f0b;
  --vermelho: #f87171;
  --vermelho-suave: #3b1518;
  --roxo: #c4b5fd;
  --sombra: 0 2px 10px rgb(0 0 0 / 35%);
  --raio: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--texto); font-size: 15px; line-height: 1.45;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--destaque); }
[hidden] { display: none !important; }
.suave { color: var(--suave); }
.pequeno { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------------------------------------------- layout */
.topo {
  position: sticky; top: 0; z-index: 20; background: var(--superficie);
  border-bottom: 1px solid var(--borda); padding: 0 16px;
}
.topo-linha { display: flex; align-items: center; gap: 14px; height: 56px; max-width: 1400px; margin: 0 auto; }
.marca { font-weight: 800; letter-spacing: .2px; white-space: nowrap; }
.marca span { color: var(--destaque); }
.nav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 8px 12px; border-radius: 8px; color: var(--suave); text-decoration: none; font-weight: 600;
  white-space: nowrap; font-size: 14px;
}
.nav a[aria-current="page"] { background: #0c2f45; color: var(--destaque); }
main { max-width: 1400px; margin: 0 auto; padding: 16px; }
h1 { font-size: 21px; margin: 0 0 14px; }
h2 { font-size: 16px; margin: 0; }
.cabecalho { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }

/* ---------------------------------------------------- componentes */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px;
  border: 1px solid var(--borda); background: var(--superficie); color: var(--texto); cursor: pointer;
  padding: 8px 14px; border-radius: 9px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--suave); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primario { background: var(--destaque-escuro); border-color: var(--destaque-escuro); color: #04151f; }
.btn.perigo { color: var(--vermelho); }
.btn.pequeno { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn.icone { min-width: 38px; padding: 6px; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--destaque); outline-offset: 2px; }

.cartao { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--suave); }
input[type=text], input[type=password], input[type=search], input[type=number], select, textarea {
  width: 100%; background: var(--superficie-2); border: 1px solid var(--borda); border-radius: 9px;
  padding: 9px 11px; min-height: 40px;
}
textarea { resize: vertical; min-height: 120px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.5; }
.campo { display: flex; flex-direction: column; gap: 2px; }
.grade { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }

.selo { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.t-quente { background: var(--vermelho-suave); color: var(--vermelho); }
.t-morno { background: var(--amarelo-suave); color: var(--amarelo); }
.t-frio { background: #152a4a; color: #93c5fd; }
.s-reuniao_agendada { background: var(--verde-suave); color: var(--verde); }
.s-com_gustavo { background: #2a2150; color: var(--roxo); }
.s-sem_fit, .s-perdido { background: #1e2740; color: var(--suave); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--borda); background: var(--superficie); color: var(--suave); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { background: #0c2f45; color: var(--destaque); border-color: transparent; }

/* ---------------------------------------------------- login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(380px, 100%); padding: 26px; display: grid; gap: 14px; }
.alerta { padding: 10px 12px; border-radius: 9px; font-size: 14px; }
.alerta.erro { background: var(--vermelho-suave); color: var(--vermelho); }
.alerta.aviso { background: var(--amarelo-suave); color: var(--amarelo); }
.alerta.ok { background: var(--verde-suave); color: var(--verde); }

/* ---------------------------------------------------- simulador */
.sim { display: grid; grid-template-columns: 260px minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
@media (max-width: 1100px) { .sim { grid-template-columns: minmax(0, 1fr); } .sim .lateral-dir { order: 3; } }

.lista-conversas { max-height: 72vh; overflow-y: auto; }
.lista-conversas button {
  width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--borda);
  padding: 10px 12px; cursor: pointer; display: grid; gap: 2px;
}
.lista-conversas button:hover { background: var(--superficie-2); }
.lista-conversas button[aria-current="true"] { background: #0c2f45; }

.zap { display: flex; flex-direction: column; height: 72vh; border-radius: var(--raio); overflow: hidden; }
.zap-topo { background: #1f2c34; padding: 10px 14px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #0d1418; }
.zap-topo .avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--destaque-escuro); display: grid; place-items: center; font-weight: 800; color: #04151f; }
.zap-topo b { display: block; font-size: 15px; }
.zap-topo small { color: #8696a0; }
.zap-corpo {
  flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 6px;
  background: #0b141a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Cg fill='%23121d24'%3E%3Ccircle cx='10' cy='10' r='1.5'/%3E%3Ccircle cx='40' cy='30' r='1.5'/%3E%3Ccircle cx='20' cy='50' r='1.5'/%3E%3C/g%3E%3C/svg%3E");
}
.balao {
  max-width: 76%; padding: 7px 10px 18px; border-radius: 8px; position: relative; font-size: 14.5px;
  white-space: pre-wrap; word-wrap: break-word; box-shadow: 0 1px 1px rgb(0 0 0 / 30%);
}
.balao.cliente { background: #005c4b; align-self: flex-end; border-radius: 8px 0 8px 8px; }
.balao.ia { background: #202c33; align-self: flex-start; border-radius: 0 8px 8px 8px; }
.balao.gustavo { background: #3b2f1d; align-self: flex-start; border-radius: 0 8px 8px 8px; }
.balao .hora { position: absolute; right: 8px; bottom: 3px; font-size: 11px; color: #8696a0; }
.balao audio { width: 240px; max-width: 100%; margin-bottom: 4px; }
.balao img { max-width: 240px; border-radius: 6px; margin-bottom: 4px; }
.balao .transcricao { font-size: 12px; color: #8696a0; font-style: italic; }
.digitando { align-self: flex-start; background: #202c33; border-radius: 0 8px 8px 8px; padding: 10px 14px; display: flex; gap: 4px; }
.digitando i { width: 7px; height: 7px; border-radius: 50%; background: #8696a0; animation: pulo 1.2s infinite; }
.digitando i:nth-child(2) { animation-delay: .2s; }
.digitando i:nth-child(3) { animation-delay: .4s; }
@keyframes pulo { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }
.zap-rodape { background: #1f2c34; padding: 8px; display: flex; gap: 8px; align-items: center; }
.zap-rodape input[type=text] { background: #2a3942; border: 0; border-radius: 20px; min-height: 42px; }
.zap-rodape .btn { background: #2a3942; border-color: transparent; border-radius: 50%; min-width: 42px; height: 42px; padding: 0; }
.zap-rodape .btn.gravando { background: var(--vermelho); color: #fff; animation: pisca 1s infinite; }
@keyframes pisca { 50% { opacity: .55; } }

.painel-estado { display: grid; gap: 10px; }
.painel-estado .cartao { padding: 12px 14px; }
.linha-info { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 3px 0; border-bottom: 1px dashed var(--borda); }
.linha-info:last-child { border-bottom: 0; }
.linha-info span:first-child { color: var(--suave); }
.linha-info span:last-child { text-align: right; font-weight: 600; }

/* ---------------------------------------------------- listas e detalhes */
.tabela { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabela th, .tabela td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--borda); vertical-align: top; }
.tabela th { font-size: 12px; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; }
.tabela tr:hover td { background: var(--superficie-2); }
.rolagem { overflow-x: auto; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { padding: 12px 14px; }
.kpi b { display: block; font-size: 23px; }
.kpi span { font-size: 12px; color: var(--suave); font-weight: 600; }
.briefing { white-space: pre-wrap; font-size: 14px; line-height: 1.6; background: var(--superficie-2); border-radius: 9px; padding: 12px 14px; }
.duas-colunas { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
@media (max-width: 1000px) { .duas-colunas { grid-template-columns: minmax(0, 1fr); } }
.vazio { padding: 32px; text-align: center; color: var(--suave); }

/* ---------------------------------------------------- follow-up e prompt */
.preview-zap { background: #0b141a; padding: 14px; border-radius: 10px; }
.preview-zap .balao { max-width: 100%; }
.editor-prompt { width: 100%; min-height: 62vh; }
.barra-sticky { position: sticky; bottom: 0; background: var(--superficie); border-top: 1px solid var(--borda); padding: 10px 0; display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.barra-sticky .estado { margin-right: auto; color: var(--suave); font-size: 13px; }

/* ---------------------------------------------------- modal e avisos */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100% - 24px)); background: var(--superficie); color: var(--texto); }
dialog::backdrop { background: rgb(2 6 16 / 65%); }
dialog form, dialog .corpo { padding: 20px; display: grid; gap: 12px; }
dialog .rodape { display: flex; gap: 8px; justify-content: flex-end; }
#avisos { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; width: min(420px, calc(100% - 24px)); }
.aviso { background: var(--texto); color: var(--bg); padding: 10px 14px; border-radius: 10px; font-size: 14px; box-shadow: var(--sombra); }
.aviso.erro { background: var(--vermelho); color: #fff; }
.carregando { padding: 30px; text-align: center; color: var(--suave); }
