/* IntegriMind Ao Vivo — sistema visual
   Cores oficiais, fonte única Inter e ícones Google (Material Symbols). */

:root {
  --azul-profundo: #071B3D;
  --verde: #009688;
  --azul: #2563EB;
  --grafite: #1F2937;
  --cinza: #E5E7EB;

  /* Tons derivados das cores oficiais (estados de interação e fundos suaves) */
  --verde-hover: color-mix(in srgb, var(--verde) 86%, var(--azul-profundo));
  --verde-suave: color-mix(in srgb, var(--verde) 10%, white);
  --azul-suave: color-mix(in srgb, var(--azul) 9%, white);
  --fundo: color-mix(in srgb, var(--cinza) 42%, white);
  --superficie: #FFFFFF;
  --texto: var(--grafite);
  --texto-2: color-mix(in srgb, var(--grafite) 66%, white);
  --texto-3: color-mix(in srgb, var(--grafite) 48%, white);
  --divisor: var(--cinza);
  --perigo: #B42318;

  --raio-s: 10px;
  --raio: 14px;
  --raio-l: 20px;
  --sombra-1: 0 1px 2px rgba(7, 27, 61, .06), 0 1px 1px rgba(7, 27, 61, .04);
  --sombra-2: 0 8px 24px rgba(7, 27, 61, .08), 0 2px 6px rgba(7, 27, 61, .05);
  --sombra-3: 0 24px 64px rgba(7, 27, 61, .18);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --gutter: clamp(16px, 4vw, 40px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  color: var(--texto);
  background: var(--fundo);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}
h1, h2, h3, h4 { margin: 0; color: var(--azul-profundo); letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-weight: 700; font-size: clamp(28px, 4vw, 36px); }
h2 { font-weight: 600; font-size: 22px; }
h3 { font-weight: 600; font-size: 17px; }
p { margin: 0; }
a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ms {
  font-family: 'Material Symbols Rounded';
  font-weight: normal; font-style: normal; font-size: 22px; line-height: 1;
  letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap;
  direction: ltr; -webkit-font-smoothing: antialiased; font-feature-settings: 'liga';
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none; flex: none;
}
.ms.fill { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

.subtitulo { font-weight: 500; color: var(--texto-2); }
.legenda { font-size: 13px; font-weight: 300; color: var(--texto-2); }
.metrica { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap;
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .1s var(--ease), box-shadow .2s;
  background: var(--superficie); color: var(--azul-profundo); border-color: var(--divisor);
  text-decoration: none !important;
}
.btn:hover { background: color-mix(in srgb, var(--cinza) 35%, white); }
.btn:active { transform: scale(.98); }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--azul) 35%, transparent); outline-offset: 2px;
}
.btn .ms { font-size: 20px; }
.btn-primario { background: var(--verde); color: #fff; border-color: var(--verde); }
.btn-primario:hover { background: var(--verde-hover); border-color: var(--verde-hover); }
.btn-escuro { background: var(--azul-profundo); color: #fff; border-color: var(--azul-profundo); }
.btn-escuro:hover { background: color-mix(in srgb, var(--azul-profundo) 88%, white); }
.btn-perigo { color: var(--perigo); }
.btn-perigo.cheio { background: var(--perigo); color: #fff; border-color: var(--perigo); }
.btn-texto { background: transparent; border-color: transparent; color: var(--azul); padding: 0 10px; }
.btn-texto:hover { background: var(--azul-suave); }
.btn-grande { min-height: 52px; font-size: 17px; border-radius: 14px; padding: 0 24px; }
.btn-bloco { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  border: 0; background: transparent; color: var(--texto-2); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: color-mix(in srgb, var(--cinza) 60%, white); color: var(--azul-profundo); }
.icon-btn.perigo:hover { color: var(--perigo); background: color-mix(in srgb, var(--perigo) 8%, white); }

/* ---------- Formulários ---------- */
.campo { display: grid; gap: 6px; }
.campo > label, .rotulo { font-size: 13px; font-weight: 500; color: var(--texto-2); }
.input, textarea.input, select.input {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--divisor); background: var(--superficie); color: var(--texto);
  transition: border-color .15s, box-shadow .15s; font-size: 16px;
}
textarea.input { resize: vertical; min-height: 88px; line-height: 1.45; }
.input:focus { border-color: var(--azul); box-shadow: 0 0 0 4px color-mix(in srgb, var(--azul) 15%, transparent); outline: none; }
.input::placeholder { color: var(--texto-3); }
.ajuda { font-size: 13px; color: var(--texto-2); font-weight: 300; }
.erro-form { color: var(--perigo); font-size: 14px; min-height: 20px; }

/* Interruptor estilo iOS */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; cursor: pointer; }
.switch input { appearance: none; width: 51px; height: 31px; border-radius: 99px; background: var(--cinza); position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.18); transition: transform .25s var(--ease); }
.switch input:checked { background: var(--verde); }
.switch input:checked::after { transform: translateX(20px); }

/* Controle segmentado */
.segmentado { display: inline-flex; padding: 3px; gap: 2px; background: color-mix(in srgb, var(--cinza) 70%, white); border-radius: 12px; }
.segmentado button { border: 0; background: transparent; min-height: 36px; padding: 0 16px; border-radius: 9px; font-weight: 500; font-size: 14px; color: var(--texto-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background .2s, color .2s, box-shadow .2s; }
.segmentado button[aria-selected="true"] { background: #fff; color: var(--azul-profundo); box-shadow: var(--sombra-1); font-weight: 600; }
.segmentado button .ms { font-size: 18px; }

/* ---------- Superfícies ---------- */
.cartao { background: var(--superficie); border-radius: var(--raio-l); box-shadow: var(--sombra-1); border: 1px solid color-mix(in srgb, var(--cinza) 70%, transparent); }
.selo { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: color-mix(in srgb, var(--cinza) 60%, white); color: var(--texto-2); }
.selo.verde { background: var(--verde-suave); color: color-mix(in srgb, var(--verde) 70%, var(--azul-profundo)); }
.selo.azul { background: var(--azul-suave); color: var(--azul); }
.selo.ao-vivo { background: var(--verde); color: #fff; }
.selo.ao-vivo::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulso 1.6s infinite; }
@keyframes pulso { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- Barra superior translúcida ---------- */
.topo {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  height: 64px; padding: 0 var(--gutter);
  background: color-mix(in srgb, white 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid color-mix(in srgb, var(--cinza) 80%, transparent);
}
.topo .logo { height: 26px; width: auto; display: block; } /* largura automática mantém a proporção do logotipo */
.topo .espaco { flex: 1; }
.logo-branco { filter: brightness(0) invert(1); }

/* ---------- Esferas com fade (elemento humano da marca) ---------- */
.esferas { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.esferas i { position: absolute; border-radius: 50%; display: block; filter: blur(.5px); }
.esferas i:nth-child(1) { width: 46vmax; height: 46vmax; right: -14vmax; top: -18vmax; background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--verde) 55%, transparent), transparent 68%); }
.esferas i:nth-child(2) { width: 34vmax; height: 34vmax; left: -12vmax; bottom: -14vmax; background: radial-gradient(circle at 60% 40%, color-mix(in srgb, var(--azul) 40%, transparent), transparent 68%); }
.esferas i:nth-child(3) { width: 12vmax; height: 12vmax; left: 18%; top: 12%; background: radial-gradient(circle at 40% 40%, color-mix(in srgb, var(--verde) 35%, transparent), transparent 70%); }
.esferas.suaves i { opacity: .45; }

/* ---------- Modal (folha) ---------- */
.veu { position: fixed; inset: 0; z-index: 100; background: rgba(7, 27, 61, .32); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: aparecer .2s var(--ease); }
.folha { width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: #fff; border-radius: 22px; box-shadow: var(--sombra-3); padding: 28px; display: grid; gap: 20px; animation: subir .28s var(--ease); }
.folha header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.folha footer { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
@keyframes aparecer { from { opacity: 0; } }
@keyframes subir { from { transform: translateY(16px) scale(.98); opacity: 0; } }
@media (max-width: 560px) {
  .veu { place-items: end center; padding: 0; }
  .folha { border-radius: 22px 22px 0 0; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); }
  .folha footer .btn { flex: 1; }
}

/* ---------- Aviso (toast) ---------- */
.avisos { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); }
.aviso { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--azul-profundo); color: #fff; box-shadow: var(--sombra-3); font-size: 15px; font-weight: 500; animation: subir .25s var(--ease); }
.aviso.erro .ms { color: #FCA5A5; }
.aviso.ok .ms { color: color-mix(in srgb, var(--verde) 60%, white); }

/* ---------- Menu suspenso ---------- */
.menu { position: absolute; z-index: 50; min-width: 220px; background: #fff; border-radius: 14px; box-shadow: var(--sombra-3); padding: 6px; border: 1px solid var(--divisor); animation: aparecer .15s; }
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 10px 12px; border-radius: 9px; cursor: pointer; text-align: left; font-size: 15px; color: var(--texto); }
.menu button:hover { background: var(--fundo); }
.menu button.perigo { color: var(--perigo); }
.menu hr { border: 0; border-top: 1px solid var(--divisor); margin: 6px 4px; }

.vazio { text-align: center; padding: 56px 24px; display: grid; gap: 12px; justify-items: center; color: var(--texto-2); }
.vazio .ms { font-size: 44px; color: var(--verde); }

.carregando { display: grid; place-items: center; min-height: 40vh; color: var(--texto-2); }
.girando { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--cinza); border-top-color: var(--verde); animation: girar 0.8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

/* =========================================================
   Gráficos e visualizações (compartilhados)
   ========================================================= */
.graf { --g-texto: var(--grafite); --g-texto-2: var(--texto-2); --g-trilho: color-mix(in srgb, var(--cinza) 55%, white); --g-barra: var(--azul); --g-certo: var(--verde); --g-titulo: var(--azul-profundo); color: var(--g-texto); width: 100%; }
.tema-escuro .graf, .graf.escuro { --g-texto: #fff; --g-texto-2: rgba(255,255,255,.72); --g-trilho: rgba(255,255,255,.09); --g-barra: var(--azul); --g-titulo: #fff; }

/* Barras horizontais */
.barras { display: grid; gap: var(--gap-barras, 18px); }
.barra-linha { display: grid; gap: 8px; }
.barra-topo { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.barra-rotulo { font-weight: 500; font-size: var(--fs-rotulo, 16px); display: flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.barra-valor { font-weight: 600; font-variant-numeric: tabular-nums; font-size: var(--fs-valor, 16px); white-space: nowrap; }
.barra-valor small { font-weight: 300; color: var(--g-texto-2); margin-left: 6px; font-size: .8em; }
.barra-trilho { height: var(--altura-barra, 14px); border-radius: 99px; background: var(--g-trilho); overflow: hidden; }
.barra-preench { height: 100%; width: 0; border-radius: 99px; background: var(--g-barra); transition: width .7s var(--ease), background .3s; }
.barra-linha.certa .barra-preench { background: var(--g-certo); }
.barra-linha.certa .barra-rotulo .ms { color: var(--g-certo); }
.barra-linha.esmaecida { opacity: .55; }
.barra-linha.minha .barra-rotulo::after { content: 'Seu voto'; font-size: 11px; font-weight: 600; letter-spacing: .02em; padding: 2px 8px; border-radius: 99px; background: color-mix(in srgb, var(--g-barra) 14%, transparent); color: var(--g-barra); }
.tema-escuro .barra-linha.minha .barra-rotulo::after { color: #fff; background: rgba(255,255,255,.14); }

/* Colunas (termômetro) */
.escala { display: grid; gap: 24px; }
.escala-media { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.escala-numero { font-size: var(--fs-media, 56px); font-weight: 700; color: var(--g-titulo); letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.escala-numero small { display: block; font-size: 13px; font-weight: 300; letter-spacing: 0; color: var(--g-texto-2); margin-top: 6px; }
.termometro { flex: 1; min-width: 220px; display: grid; gap: 8px; }
.termometro-trilho { position: relative; height: 16px; border-radius: 99px; background: linear-gradient(90deg, var(--azul), var(--verde)); }
.termometro-marca { position: absolute; top: 50%; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 4px solid var(--azul-profundo); transform: translate(-50%, -50%); left: 0; transition: left .7s var(--ease); box-shadow: var(--sombra-2); }
.tema-escuro .termometro-marca { border-color: #fff; background: var(--azul-profundo); }
.termometro-rotulos { display: flex; justify-content: space-between; font-size: 13px; color: var(--g-texto-2); gap: 12px; }
.colunas { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: clamp(4px, 1vw, 12px); align-items: end; height: var(--altura-colunas, 200px); }
.coluna { display: grid; grid-template-rows: auto 1fr auto; height: 100%; gap: 6px; text-align: center; }
.coluna-valor { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--g-texto-2); }
.coluna-trilho { display: flex; align-items: flex-end; }
.coluna-barra { width: 100%; height: 0; min-height: 3px; border-radius: 8px 8px 3px 3px; background: var(--g-barra); transition: height .7s var(--ease); }
.coluna.minha .coluna-barra { background: var(--verde); }
.coluna-rotulo { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Nuvem de palavras */
.nuvem { position: relative; width: 100%; height: var(--altura-nuvem, 360px); }
.nuvem span { position: absolute; left: 0; top: 0; white-space: nowrap; line-height: 1; letter-spacing: -0.02em; transition: transform .8s var(--ease), font-size .8s var(--ease), opacity .5s; will-change: transform; }
.nuvem span.nova { opacity: 0; }

/* Respostas em texto */
.textos { columns: var(--colunas-texto, 3) 260px; column-gap: 16px; }
.texto-item { break-inside: avoid; margin: 0 0 16px; padding: 16px 18px; border-radius: 16px; background: #fff; box-shadow: var(--sombra-1); border: 1px solid color-mix(in srgb, var(--cinza) 70%, transparent); animation: subir .4s var(--ease); color: var(--grafite); }
.texto-item p { font-size: var(--fs-texto, 16px); overflow-wrap: anywhere; }
.texto-item .legenda { margin-top: 8px; display: block; }
.tema-escuro .texto-item { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.08); box-shadow: none; color: #fff; }
.tema-escuro .texto-item .legenda { color: rgba(255,255,255,.65); }

/* Placar */
.placar { display: grid; gap: 10px; }
.placar-linha { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px; padding: 12px 18px; border-radius: 16px; background: #fff; box-shadow: var(--sombra-1); animation: subir .4s var(--ease) both; color: var(--grafite); }
.placar-pos { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: color-mix(in srgb, var(--cinza) 60%, white); color: var(--azul-profundo); }
.placar-linha:nth-child(1) .placar-pos { background: var(--verde); color: #fff; }
.placar-linha:nth-child(2) .placar-pos, .placar-linha:nth-child(3) .placar-pos { background: var(--azul); color: #fff; }
.placar-nome { font-weight: 600; overflow-wrap: anywhere; }
.placar-pts { font-weight: 600; font-variant-numeric: tabular-nums; }
.placar-pts small { font-weight: 300; color: var(--texto-2); margin-left: 4px; }
.tema-escuro .placar-linha { background: rgba(255,255,255,.07); box-shadow: none; color: #fff; }
.tema-escuro .placar-pts small { color: rgba(255,255,255,.65); }

.graf-vazio { display: grid; place-items: center; gap: 10px; padding: 32px; text-align: center; color: var(--g-texto-2); }
.graf-vazio .ms { font-size: 40px; color: var(--verde); }
