/* NippyAI Investidor — tema escuro (padrão e único).
   Grafite com leve viés azul; verde = ganho, vermelho = perda/alerta, âmbar = atenção.
   A cor da marca (azul elétrico) é só para interação e para a linha do patrimônio. */
:root {
  color-scheme: dark;
  --fundo: #07090d;
  --fundo-2: #0a0d12;
  --superficie: #0e1218;
  --superficie-2: #131821;
  --superficie-3: #19202b;
  --linha-suave: #161c26;
  --linha: #1f2631;
  --linha-forte: #2c3543;
  --texto: #e8ecf2;
  --texto-2: #a6afbe;
  --texto-3: #6f7a8b;
  --marca: #6f8dff;
  --marca-forte: #8aa2ff;
  --marca-fundo: rgba(111, 141, 255, 0.12);
  --pos: #23d18b;
  --pos-fundo: rgba(35, 209, 139, 0.1);
  --neg: #ff5a6a;
  --neg-fundo: rgba(255, 90, 106, 0.1);
  --atencao: #f5b43c;
  --atencao-fundo: rgba(245, 180, 60, 0.11);
  --critico: #ff2e57;
  --info: #4fb0ff;
  --fonte: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --raio: 14px;
  --raio-p: 9px;
  --sombra: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 12px 32px -18px rgba(0, 0, 0, 0.8);
  --lateral: 248px;
  --topo: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font-family: var(--fonte);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}
/* Brilho de fundo muito sutil, fixo — dá profundidade sem distrair. */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(111, 141, 255, 0.07), transparent 60%),
    radial-gradient(700px 420px at -10% 110%, rgba(35, 209, 139, 0.04), transparent 60%);
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
p { margin: 0; }
a { color: var(--marca-forte); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--marca); outline-offset: 2px; border-radius: 6px; }
.ic { width: 18px; height: 18px; flex: none; }
.texto-2 { color: var(--texto-2); }
.texto-3 { color: var(--texto-3); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.neu { color: var(--texto-2); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Estrutura ---------- */
.app { display: grid; grid-template-columns: var(--lateral) minmax(0, 1fr); min-height: 100vh; }
.lateral {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px;
  background: linear-gradient(180deg, var(--fundo-2), var(--fundo));
  border-right: 1px solid var(--linha);
}
.marca { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; }
.marca-logo { width: 34px; height: 34px; flex: none; }
.marca-nome { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; line-height: 1.1; }
.marca-nome small { display: block; font-weight: 500; font-size: 11px; color: var(--texto-3); letter-spacing: 0.04em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--raio-p);
  color: var(--texto-2); font-weight: 500;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.nav a:hover { background: var(--superficie-2); color: var(--texto); text-decoration: none; }
.nav a.ativo { background: var(--marca-fundo); color: var(--texto); }
.nav a.ativo::before {
  content: ''; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--marca); box-shadow: 0 0 12px var(--marca);
  animation: entraBarra 0.35s var(--ease);
}
.nav a.ativo .ic { color: var(--marca-forte); }
@keyframes entraBarra { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.nav-sep { height: 1px; background: var(--linha); margin: 10px 8px; }
.lateral-pe { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.status-monitor { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--linha); border-radius: var(--raio-p); font-size: 12px; color: var(--texto-2); background: var(--superficie); }
.pulso { width: 8px; height: 8px; border-radius: 50%; background: var(--pos); flex: none; position: relative; }
.pulso::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: pulsar 2.2s ease-out infinite; }
.pulso.parado { background: var(--texto-3); }
.pulso.parado::after { animation: none; }
@keyframes pulsar { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(3.2); opacity: 0; } }

.principal { min-width: 0; display: flex; flex-direction: column; }
.topo {
  position: sticky; top: 0; z-index: 20;
  height: var(--topo);
  display: flex; align-items: center; gap: 14px;
  padding: 0 28px;
  background: rgba(7, 9, 13, 0.78);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--linha);
}
.topo h1 { font-size: 18px; }
.topo .sub { color: var(--texto-3); font-size: 12px; }
.topo-acoes { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.conteudo { padding: 24px 28px 48px; max-width: 1480px; width: 100%; }

/* Fita de cotações (rolagem contínua) */
.fita { overflow: hidden; border-bottom: 1px solid var(--linha); background: var(--fundo-2); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.fita-trilho { display: flex; gap: 34px; width: max-content; padding: 7px 0; animation: rolarFita 42s linear infinite; }
.fita:hover .fita-trilho { animation-play-state: paused; }
.fita-item { display: flex; gap: 8px; font-size: 12px; white-space: nowrap; color: var(--texto-2); }
.fita-item b { color: var(--texto); font-weight: 600; }
@keyframes rolarFita { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- Componentes ---------- */
.grade { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-painel { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; }
.secao { margin-top: 16px; }

.cartao {
  position: relative;
  min-width: 0;
  background: linear-gradient(180deg, var(--superficie-2), var(--superficie));
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  padding: 18px 20px;
  box-shadow: var(--sombra);
}
.cartao-topo { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cartao-topo h2, .cartao-topo h3 { font-size: 14px; font-weight: 600; color: var(--texto); }
.cartao-topo .dir { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cartao-link { transition: border-color 0.25s var(--ease), transform 0.25s var(--ease); cursor: pointer; }
.cartao-link:hover { border-color: var(--linha-forte); transform: translateY(-2px); }

.rotulo { font-size: 12px; color: var(--texto-3); font-weight: 500; }
.valor { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin-top: 4px; }
.valor-p { font-size: 16px; font-weight: 600; margin-top: 2px; }
.detalhe { font-size: 12px; color: var(--texto-3); margin-top: 4px; }

/* Destaque do patrimônio */
.heroi { padding: 24px 26px 22px; overflow: hidden; }
.heroi::after {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  background: linear-gradient(120deg, transparent 30%, rgba(111, 141, 255, 0.10) 50%, transparent 70%);
  background-size: 250% 100%; animation: brilho 6s var(--ease) infinite;
}
@keyframes brilho { 0%, 55% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
.heroi-valor { font-size: clamp(32px, 4.2vw, 46px); font-weight: 600; letter-spacing: -0.035em; line-height: 1.05; margin: 6px 0 10px; }
.heroi-linha { display: flex; gap: 22px; flex-wrap: wrap; align-items: baseline; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--superficie-3); color: var(--texto-2); border: 1px solid var(--linha); white-space: nowrap; }
.chip.pos { background: var(--pos-fundo); color: var(--pos); border-color: transparent; }
.chip.neg { background: var(--neg-fundo); color: var(--neg); border-color: transparent; }
.chip.atencao { background: var(--atencao-fundo); color: var(--atencao); border-color: transparent; }
.chip.marca { background: var(--marca-fundo); color: var(--marca-forte); border-color: transparent; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--superficie); border: 1px solid var(--linha); border-radius: var(--raio); overflow: hidden; }
.kpi { padding: 14px 16px; min-width: 0; box-shadow: 1px 0 0 var(--linha), 0 1px 0 var(--linha); }

.abas { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--fundo-2); border: 1px solid var(--linha); flex-wrap: wrap; }
.abas button { border: 0; background: transparent; padding: 5px 11px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--texto-3); cursor: pointer; transition: color 0.2s, background 0.2s; }
.abas button:hover { color: var(--texto); }
.abas button.ativa { background: var(--superficie-3); color: var(--texto); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset; }

.legenda { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--texto-2); }
.legenda i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.legenda i.trac { background: repeating-linear-gradient(90deg, var(--texto-3) 0 4px, transparent 4px 8px); }

.area-grafico { position: relative; height: 300px; }
.area-grafico.media { height: 240px; }
.area-grafico.baixa { height: 200px; }
.area-rosca { position: relative; height: 210px; }
.rosca-centro { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.rosca-centro b { font-size: 18px; }

/* Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border-radius: 10px; border: 1px solid var(--linha-forte); background: var(--superficie-3); color: var(--texto); font-weight: 600; font-size: 13px; cursor: pointer; transition: transform 0.15s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.25s; white-space: nowrap; }
.btn:hover { border-color: #3a4556; background: #1e2633; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-primario { background: var(--marca); border-color: transparent; color: #0a0e1a; }
.btn-primario:hover { background: var(--marca-forte); box-shadow: 0 0 0 4px var(--marca-fundo), 0 8px 24px -8px var(--marca); }
.btn-fantasma { background: transparent; border-color: transparent; color: var(--texto-2); }
.btn-fantasma:hover { background: var(--superficie-2); border-color: var(--linha); color: var(--texto); }
.btn-perigo { background: var(--neg); border-color: transparent; color: #1a0508; }
.btn-perigo:hover { background: #ff7784; }
.btn-p { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn-icone { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--texto-2); cursor: pointer; transition: background 0.2s, color 0.2s, border-color 0.2s; }
.btn-icone:hover { background: var(--superficie-2); border-color: var(--linha); color: var(--texto); }
.girando .ic { animation: girar 0.9s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

/* Tabelas */
.tabela-caixa { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 600; font-size: 11.5px; color: var(--texto-3); padding: 8px 10px; border-bottom: 1px solid var(--linha); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--linha-suave); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th.d, td.d { text-align: right; }
tbody tr { transition: background 0.15s; }
tbody tr.clicavel { cursor: pointer; }
tbody tr.clicavel:hover { background: rgba(255, 255, 255, 0.025); }
tr.cancelada td { color: var(--texto-3); text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, 0.2); }
tr.cancelada td.sem-risco { text-decoration: none; }
.ticker { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ticker-selo { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: 10.5px; letter-spacing: 0.02em; flex: none; color: #fff; }
.ticker b { font-weight: 600; display: block; }
.ticker small { color: var(--texto-3); font-size: 11.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.barra-part { height: 4px; border-radius: 2px; background: var(--linha); overflow: hidden; margin-top: 6px; min-width: 60px; }
.barra-part span { display: block; height: 100%; border-radius: 2px; transform-origin: left; animation: crescer 1s var(--ease) both; }
@keyframes crescer { from { transform: scaleX(0); } }

/* Lista em cartões (celular) */
.lista-pos { display: none; flex-direction: column; gap: 10px; }
.item-pos { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--linha); border-radius: 12px; background: var(--superficie); cursor: pointer; transition: border-color 0.2s, transform 0.2s var(--ease); }
.item-pos:active { transform: scale(0.99); }
.item-pos .dir { text-align: right; }

/* Formulários */
.form { display: grid; gap: 14px; }
.form-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.campo > span { font-size: 12px; font-weight: 600; color: var(--texto-2); }
.campo small { font-size: 11.5px; color: var(--texto-3); }
input, select, textarea {
  font: inherit; color: var(--texto); background: var(--fundo-2); border: 1px solid var(--linha-forte); border-radius: 10px; padding: 10px 12px; min-width: 0; width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--marca); box-shadow: 0 0 0 3px var(--marca-fundo); }
.campo.com-erro input, .campo.com-erro select { border-color: var(--neg); box-shadow: 0 0 0 3px var(--neg-fundo); animation: tremer 0.35s; }
@keyframes tremer { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.marcar { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13px; color: var(--texto-2); }
.marcar input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--marca); flex: none; }
.erro-form { padding: 10px 12px; border-radius: 10px; background: var(--neg-fundo); color: var(--neg); font-size: 13px; }
.dica { padding: 10px 12px; border-radius: 10px; background: var(--superficie-3); color: var(--texto-2); font-size: 12.5px; border: 1px solid var(--linha); }
.dica.atencao { background: var(--atencao-fundo); color: var(--atencao); border-color: transparent; }
.acoes-janela { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; flex-wrap: wrap; }
.segmentado { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 6px; }
.segmentado label { position: relative; }
.segmentado input { position: absolute; opacity: 0; pointer-events: none; }
.segmentado span { display: block; text-align: center; padding: 9px 8px; border-radius: 10px; border: 1px solid var(--linha-forte); color: var(--texto-2); font-weight: 600; font-size: 12.5px; cursor: pointer; transition: all 0.2s var(--ease); }
.segmentado input:checked + span { border-color: var(--marca); background: var(--marca-fundo); color: var(--texto); }
.segmentado input:focus-visible + span { outline: 2px solid var(--marca); outline-offset: 2px; }

/* Janela */
.janela-fundo { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(3, 4, 7, 0.65); backdrop-filter: blur(6px); opacity: 0; transition: opacity 0.22s; }
.janela-fundo.aberta { opacity: 1; }
.janela-fundo.saindo { opacity: 0; }
.janela { width: min(var(--larg), 100%); max-height: calc(100dvh - 40px); overflow: auto; background: var(--superficie-2); border: 1px solid var(--linha-forte); border-radius: 18px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.9); transform: translateY(14px) scale(0.98); transition: transform 0.3s var(--ease); }
.janela-fundo.aberta .janela { transform: none; }
.janela-topo { display: flex; align-items: center; gap: 10px; padding: 18px 20px 6px; position: sticky; top: 0; background: var(--superficie-2); z-index: 1; }
.janela-topo h2 { font-size: 16px; }
.janela-topo .btn-icone { margin-left: auto; }
.janela-corpo { padding: 10px 20px 20px; }

/* Avisos */
#avisos { position: fixed; z-index: 200; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.aviso { display: flex; align-items: center; gap: 10px; padding: 11px 15px; border-radius: 12px; background: var(--superficie-3); border: 1px solid var(--linha-forte); box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.8); font-weight: 500; max-width: 380px; animation: entraAviso 0.4s var(--ease); }
.aviso-ok .ic { color: var(--pos); }
.aviso-erro { border-color: rgba(255, 90, 106, 0.4); }
.aviso-erro .ic { color: var(--neg); }
.aviso.saindo { animation: saiAviso 0.35s var(--ease) forwards; }
@keyframes entraAviso { from { opacity: 0; transform: translateY(12px) scale(0.96); } }
@keyframes saiAviso { to { opacity: 0; transform: translateX(30px); } }

/* Entrada das telas: o conteúdo sobe em cascata, uma vez por troca de tela. */
.entrar > * { animation: subir 0.55s var(--ease) both; }
.entrar > *:nth-child(2) { animation-delay: 0.05s; }
.entrar > *:nth-child(3) { animation-delay: 0.1s; }
.entrar > *:nth-child(4) { animation-delay: 0.15s; }
.entrar > *:nth-child(5) { animation-delay: 0.2s; }
.entrar > *:nth-child(n+6) { animation-delay: 0.25s; }
@keyframes subir { from { opacity: 0; transform: translateY(14px); } }

/* Esqueleto de carregamento */
.esqueleto { border-radius: 8px; background: linear-gradient(90deg, var(--superficie-2) 0%, var(--superficie-3) 40%, var(--superficie-2) 80%); background-size: 300% 100%; animation: brilhoEsq 1.4s ease-in-out infinite; }
@keyframes brilhoEsq { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.faisca { color: var(--texto-3); }
.faisca.pos { color: var(--pos); }
.faisca.neg { color: var(--neg); }
.faisca polyline { stroke-dasharray: 1; stroke-dashoffset: 1; animation: desenhar 1.1s var(--ease) 0.2s forwards; }
@keyframes desenhar { to { stroke-dashoffset: 0; } }

.vazio { text-align: center; padding: 34px 18px; color: var(--texto-2); display: grid; justify-items: center; gap: 8px; }
.vazio h3 { color: var(--texto); font-size: 15px; }
.vazio p { max-width: 46ch; font-size: 13px; }
.vazio .btn { margin-top: 8px; }
.vazio-ic { width: 40px; height: 40px; color: var(--marca); opacity: 0.8; animation: girarLento 9s linear infinite; }
@keyframes girarLento { to { transform: rotate(360deg); } }

.faixa-alerta { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: var(--raio); border: 1px solid rgba(255, 46, 87, 0.35); background: linear-gradient(90deg, rgba(255, 46, 87, 0.12), rgba(255, 46, 87, 0.03)); margin-bottom: 16px; }
.faixa-ok { display: flex; gap: 12px; align-items: center; padding: 11px 16px; border-radius: var(--raio); border: 1px solid var(--linha); background: var(--superficie); margin-bottom: 16px; color: var(--texto-2); font-size: 13px; }
.faixa-ok .ic { color: var(--pos); }

.lista-simples { display: flex; flex-direction: column; }
.lista-simples > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--linha-suave); }
.lista-simples > div:last-child { border-bottom: 0; }

.etapa { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--linha-suave); }
.etapa:last-child { border-bottom: 0; }
.etapa-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; background: var(--superficie-3); color: var(--texto-2); border: 1px solid var(--linha-forte); }
.etapa.feita .etapa-n { background: var(--pos-fundo); color: var(--pos); border-color: transparent; }
.etapa h4 { font-size: 13.5px; }
.etapa p { color: var(--texto-2); font-size: 13px; margin-top: 2px; }

.doc { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--linha-suave); }
.doc:last-child { border-bottom: 0; }
.doc-tipo { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--superficie-3); color: var(--texto-2); white-space: nowrap; }
.doc-tipo.relevante { background: var(--atencao-fundo); color: var(--atencao); }
.doc b { font-weight: 600; display: block; }
.doc small { color: var(--texto-3); }

/* Login */
.tela-login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: min(400px, 100%); text-align: center; }
.login .marca-logo { width: 64px; height: 64px; margin: 0 auto 18px; display: block; filter: drop-shadow(0 0 24px rgba(111, 141, 255, 0.45)); animation: flutuar 5s ease-in-out infinite; }
@keyframes flutuar { 50% { transform: translateY(-6px); } }
.login h1 { font-size: 24px; }
.login p { color: var(--texto-2); margin: 6px 0 22px; }
.login .cartao { text-align: left; }

/* Barra inferior (celular) */
.barra-inferior { display: none; }

/* ---------- Telas médias ---------- */
@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-painel { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Celular e tablet em pé ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .lateral { display: none; }
  .topo { padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); height: 58px; top: 0; }
  .topo h1 { font-size: 17px; }
  .topo .sub { display: none; }
  .conteudo { padding: 16px max(16px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .g-2, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .form-2 { grid-template-columns: minmax(0, 1fr); }
  .cartao { padding: 16px; }
  .tabela-caixa { margin: 0 -16px; padding: 0 16px; }
  .area-grafico { height: 240px; }
  .so-pc { display: none !important; }
  .lista-pos { display: flex; }
  .barra-inferior {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    background: rgba(10, 13, 18, 0.9); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--linha);
  }
  .barra-inferior a, .barra-inferior button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border: 0; background: none; color: var(--texto-3); font-size: 10.5px; font-weight: 600; border-radius: 10px; cursor: pointer; transition: color 0.2s; }
  .barra-inferior a:hover { text-decoration: none; }
  .barra-inferior .ic { width: 22px; height: 22px; transition: transform 0.3s var(--ease); }
  .barra-inferior .ativo { color: var(--texto); }
  .barra-inferior .ativo .ic { color: var(--marca-forte); transform: translateY(-2px); }
  .janela-fundo { place-items: end center; padding: 0; }
  .janela { width: 100%; border-radius: 20px 20px 0 0; max-height: 92dvh; transform: translateY(40px); padding-bottom: env(safe-area-inset-bottom); }
  #avisos { left: 16px; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); align-items: stretch; }
  .aviso { max-width: none; }
}
@media (max-width: 560px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .valor { font-size: 19px; }
  .heroi { padding: 20px 18px; }
  .so-largo { display: none !important; }
}
.so-cel { display: none; }
@media (max-width: 900px) { .so-cel { display: initial; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .fita-trilho { animation: none; }
}

@media (max-width: 560px) {
  .dist { grid-template-columns: minmax(0, 1fr) !important; }
  .area-rosca { height: 190px; }
}

/* ---------- Busca de ativos ---------- */
.topo-titulo { min-width: 0; }
.busca { position: relative; display: flex; align-items: center; gap: 8px; flex: 1; max-width: 460px; margin-left: auto; padding: 0 12px; height: 38px; border-radius: 11px; background: var(--fundo-2); border: 1px solid var(--linha-forte); transition: border-color 0.2s, box-shadow 0.2s; }
.busca:focus-within { border-color: var(--marca); box-shadow: 0 0 0 3px var(--marca-fundo); }
.busca .ic { color: var(--texto-3); }
.busca input { border: 0; background: transparent; padding: 0; height: 100%; box-shadow: none !important; }
.busca-lista { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40; background: var(--superficie-2); border: 1px solid var(--linha-forte); border-radius: 12px; box-shadow: 0 20px 50px -15px rgba(0, 0, 0, 0.9); padding: 6px; max-height: 60vh; overflow: auto; animation: entraAviso 0.2s var(--ease); }
.busca-item { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; }
.busca-item:hover, .busca-item.sel { background: var(--superficie-3); }
.busca-item span { color: var(--texto-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.busca-item small { color: var(--texto-3); font-size: 11px; }
.busca-vazio { padding: 12px; color: var(--texto-3); font-size: 13px; }
.busca-janela { max-width: none; margin: 0; }
.topo .topo-acoes { margin-left: 12px; }
.sino { position: relative; }
.sino.ativo { color: var(--texto); background: var(--superficie-2); }
.sino-n { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--neg); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; animation: entraAviso 0.3s var(--ease); }

/* ---------- Ao vivo ---------- */
.status-vivo { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--texto-2); white-space: nowrap; }
.status-vivo.vivo .pulso { background: var(--pos); }
.status-vivo.fechado .pulso { background: var(--texto-3); }
.status-vivo.fechado .pulso::after, .status-vivo.parado .pulso::after { animation: none; }
.status-vivo.parado .pulso { background: var(--texto-3); }
.status-vivo.atencao .pulso { background: var(--atencao); }
.pisca-alta { animation: piscaAlta 1.2s var(--ease); }
.pisca-baixa { animation: piscaBaixa 1.2s var(--ease); }
@keyframes piscaAlta { 0% { background: rgba(35, 209, 139, 0.35); color: var(--pos); } 100% { background: transparent; } }
@keyframes piscaBaixa { 0% { background: rgba(255, 90, 106, 0.35); color: var(--neg); } 100% { background: transparent; } }
[data-live-preco], [data-live-total] { border-radius: 5px; transition: color 0.6s; }
.fita-item { text-decoration: none !important; }

/* Cartões do Market Live */
.mercado-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.cartao-cot { cursor: pointer; display: flex; flex-direction: column; gap: 10px; }
.cartao-cot .linha1 { display: flex; align-items: center; gap: 10px; }
.cartao-cot .preco { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; padding: 0 4px; margin: 0 -4px; }
.cartao-cot .mini { height: 46px; }
.cartao-cot dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; margin: 0; font-size: 12px; }
.cartao-cot dt { color: var(--texto-3); }
.cartao-cot dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.selo-dado { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; letter-spacing: 0.02em; }
.selo-dado.atrasado { background: var(--atencao-fundo); color: var(--atencao); }
.selo-dado.real { background: var(--pos-fundo); color: var(--pos); }
.selo-dado.fechado { background: var(--superficie-3); color: var(--texto-3); }
.selo-dado.indisponivel { background: var(--neg-fundo); color: var(--neg); }
.grafico-lw { position: relative; height: 380px; }
.grafico-lw.baixo { height: 300px; }

/* Central de alertas */
.alerta-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--linha-suave); align-items: start; }
.alerta-item:last-child { border-bottom: 0; }
.alerta-item.nao-lida b { color: var(--texto); }
.alerta-item.nao-lida::before { content: ''; }
.nivel { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.nivel-1 { background: var(--superficie-3); color: var(--texto-3); }
.nivel-2 { background: rgba(79, 176, 255, 0.12); color: var(--info); }
.nivel-3 { background: var(--atencao-fundo); color: var(--atencao); }
.nivel-4 { background: rgba(255, 138, 60, 0.14); color: #ff8a3c; }
.nivel-5 { background: rgba(255, 46, 87, 0.16); color: var(--critico); }
.ponto-novo { width: 8px; height: 8px; border-radius: 50%; background: var(--marca); display: inline-block; margin-right: 6px; }
.interruptor { position: relative; width: 40px; height: 22px; flex: none; }
.interruptor input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.interruptor span { position: absolute; inset: 0; border-radius: 11px; background: var(--linha-forte); transition: background 0.2s; pointer-events: none; }
.interruptor span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.25s var(--ease); }
.interruptor input:checked + span { background: var(--marca); }
.interruptor input:checked + span::after { transform: translateX(18px); }
.interruptor input:focus-visible + span { outline: 2px solid var(--marca); outline-offset: 2px; }
.linha-pref { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--linha-suave); }
.linha-pref:last-child { border-bottom: 0; }

@media (max-width: 900px) {
  .busca.so-pc { display: none !important; }
  .topo .topo-acoes { margin-left: auto; }
  .grafico-lw { height: 300px; }
  .cartao-cot .preco { font-size: 21px; }
}
.topo-acoes .status-vivo.so-cel { display: none; }
@media (max-width: 900px) { .topo-acoes .status-vivo.so-cel { display: inline-flex; } .topo-acoes .status-vivo.so-cel span:last-child { max-width: 120px; overflow: hidden; text-overflow: ellipsis; } }
.cartao-cot .mini svg { width: 100%; height: 46px; }
