/* styles.css — princípios do §8: um objetivo por tela, botões grandes, texto simples. */

:root {
  --azul: #4f46e5;      /* primária: topo e ações gerais */
  --cartao: #6366f1;    /* seção Cartão de crédito */
  --conta: #10b981;     /* seção Conta bancária */
  --ambar: #f59e0b;     /* alertas / parcelas */
  --perigo: #ef4444;    /* dúvidas / atenção */
  --fundo: #f4f6fb;
  --texto: #1c2230;
  --suave: #6b7688;     /* texto secundário */
}

* { box-sizing: border-box; }

/* display:flex nas telas anularia o atributo hidden sem isto */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--fundo);
  color: var(--texto);
}

header {
  background: var(--azul);
  color: #fff;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 { margin: 0; font-size: 1.25rem; }
#quem { font-size: 0.9rem; opacity: 0.9; }

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
/* Tela inicial: espaçamento compacto para caber tudo sem rolar */
#tela-inicio { padding: 0.9rem 1rem 1.2rem; gap: 0.5rem; }

.convite { font-size: 1.15rem; text-align: center; }
.saudacao { font-size: 1.25rem; font-weight: 600; align-self: flex-start; margin: 0.2rem 0 0; }

.erro {
  color: #b3261e;
  background: #fdeceb;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  text-align: center;
}

.bloco {
  width: 100%;
  font-size: 1.25rem;
  padding: 1.25rem;
  border: none;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: flex-start;
  color: var(--texto);
}

.bloco:hover:not(:disabled) { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18); }

.bloco-titulo { font-size: 1.25rem; }

/* Botões de ação do menu inicial: ícone colorido (por seção) + rótulo em linha */
.bloco.acao { flex-direction: row; align-items: center; gap: 0.9rem; }
.bloco.acao .ic {
  width: 48px; height: 48px; border-radius: 13px; flex: none;
  display: grid; place-items: center; background: var(--azul);
}
.bloco.acao .ic svg {
  width: 26px; height: 26px; stroke: #fff; stroke-width: 2;
  fill: none; stroke-linecap: round; stroke-linejoin: round;
}
.bloco.acao .ic svg.solid { fill: #fff; stroke: none; }
.bloco.cartao .ic { background: var(--cartao); }
.bloco.conta .ic { background: var(--conta); }
.bloco.geral .ic { background: var(--perigo); }
.bloco.acao .bloco-titulo { flex: 1; font-size: 1.1rem; font-weight: 600; }

/* Botão único que junta TODAS as dúvidas (cartão + extrato) — ação principal, destaque âmbar */
.classificar-tudo { width: 100%; background: var(--ambar); border-color: var(--ambar); margin: 0.1rem 0 0.7rem; }
.classificar-tudo .ic { background: rgba(255,255,255,0.28); }
.classificar-tudo .bloco-titulo { color: #fff; }

.secao-titulo.cartao { color: var(--cartao); }
.secao-titulo.conta { color: var(--conta); }
.secao-titulo.geral { color: var(--suave); }

/* Grid 2×2: cada seção cabe numa tela sem rolar (ícone em cima, texto embaixo) */
.grade-acoes { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; width: 100%; }
.grade-acoes .bloco.acao {
  flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 0.45rem; padding: 0.85rem 0.6rem; min-height: 108px;
}
.grade-acoes .bloco.acao .ic { width: 46px; height: 46px; }
.grade-acoes .bloco.acao .bloco-titulo { flex: none; font-size: 0.92rem; line-height: 1.22; }

/* Ícones nas telas internas (setas de Voltar, fechar) */
.com-ic svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2.2;
  fill: none; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.bloco.com-ic { flex-direction: row; align-items: center; justify-content: center; gap: 0.5rem; }
.modal-fechar.com-ic { display: inline-flex; align-items: center; gap: 0.4rem; }

/* Spinner do envio (no lugar do emoji que mudava) */
.spinner { width: 56px; height: 56px; margin: 0 auto; }
.spinner svg { width: 100%; height: 100%; animation: girar 1.1s linear infinite; }
.spinner circle { fill: none; stroke: var(--azul); stroke-width: 4;
  stroke-linecap: round; stroke-dasharray: 90 150; }
@keyframes girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner svg { animation-duration: 3s; } }

/* Botão "Ampliar" dos gráficos */
.ampliar svg.mini { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2.2;
  fill: none; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; margin-right: 4px; }

.secao-titulo {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--azul);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0.7rem 0 0.35rem;
  padding-bottom: 0.28rem;
  border-bottom: 2px solid #dde3ef;
}
.secao-titulo:first-of-type { margin-top: 0.2rem; }

.progresso {
  width: 100%;
  height: 18px;
  background: #dde3ef;
  border-radius: 9px;
  overflow: hidden;
}
.progresso-barra {
  width: 0%;
  height: 100%;
  background: var(--azul);
  border-radius: 9px;
  transition: width 0.5s ease;
}
.detalhe { font-size: 0.9rem; color: #667; text-align: center; }

/* Tela de processamento — tranquiliza usuários idosos/impacientes */
.processando {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  text-align: center;
  width: 100%;
}
.emoji-pulsa { font-size: 3.5rem; animation: pulsa 1.2s ease-in-out infinite; }
@keyframes pulsa {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}
.processando-titulo { font-size: 1.5rem; font-weight: 700; margin: 0; color: var(--azul); }
.processando-tempo { font-size: 1.6rem; font-weight: 700; color: var(--azul); margin: 0; font-variant-numeric: tabular-nums; }
.processando-sub { font-size: 1.1rem; color: #445; line-height: 1.55; margin: 0; }
.convite-pequeno { font-size: 1.05rem; text-align: center; margin: 0.5rem 0; }

.despesa {
  width: 100%;
  background: #fff;
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  text-align: center;
}
.despesa-desc { font-size: 1.3rem; font-weight: 600; margin: 0 0 0.5rem; }
.despesa-info { font-size: 0.95rem; color: #556; margin: 0; }

.grade {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
.cat {
  padding: 0.9rem 0.5rem;
  font-size: 0.95rem;
  border: none;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  color: var(--texto);
}
.cat:hover:not(:disabled) { background: #eef2fb; }
.cat:disabled { opacity: 0.5; }
.cat.escolhida {
  background: #1e7e34;
  color: #fff;
  opacity: 1;
  font-weight: 700;
  transform: scale(1.04);
}
.cat.escolhida::after { content: ' ✓'; }

/* Campeões por categoria (Top 10) */
.camp-card {
  width: 100%;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  margin-bottom: 0.9rem;
  overflow: hidden;
}
.camp-cab {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1rem;
  background: var(--azul);
  color: #fff;
}
.camp-cat { font-weight: 700; font-size: 1.05rem; }
.camp-total { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.camp-itens { list-style: none; counter-reset: pos; margin: 0; padding: 0.4rem 0.6rem 0.6rem; }
.camp-itens li {
  counter-increment: pos;
  display: grid;
  grid-template-columns: 1.6rem 1fr auto auto;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.3rem;
  border-bottom: 1px solid #eef1f6;
}
.camp-itens li:last-child { border-bottom: none; }
.camp-itens li::before {
  content: counter(pos);
  font-weight: 700;
  color: var(--azul);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.camp-nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.camp-vezes { color: #778; font-size: 0.9rem; white-space: nowrap; }
.camp-valor { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.bloco.secundario { background: #eef2fb; font-size: 1rem; text-align: center; align-items: center; }

/* BI */
.gastos-topo {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.gastos-mes-label { font-size: 1.1rem; font-weight: 600; }
#gastos-mes { font-size: 1.1rem; padding: 0.4rem 0.6rem; border-radius: 8px; border: 1px solid #ccd3e0; }
.gastos-topo .bloco.secundario { width: auto; padding: 0.6rem 1rem; }
.grafico-card {
  position: relative;
  width: 100%;
  background: #fff;
  border-radius: 14px;
  padding: 1rem 1.1rem 1.3rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}
.ampliar {
  position: absolute;
  top: 0.8rem;
  right: 0.9rem;
  background: #eef2fb;
  color: var(--azul);
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
  z-index: 1;
}
.ampliar:hover { background: #dde6f7; }

/* modal de gráfico ampliado */
.modal {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.2rem 1.5rem;
  box-sizing: border-box;
}
.modal-topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
}
.modal-titulo { font-size: 1.3rem; font-weight: 700; color: var(--azul); }
.modal-fechar {
  background: var(--azul);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  white-space: nowrap;
}
.modal-wrap { position: relative; flex: 1; min-height: 0; }
.grafico-card h3 { font-size: 1.1rem; margin: 0.2rem 0 0.6rem; color: var(--azul); }
.grafico-wrap { position: relative; height: 280px; }
.grafico-wrap.baixo { height: 200px; }
.grafico-nota { font-size: 0.85rem; color: #667; margin: 0 0 0.6rem; }
.viz-select { font-size: 1rem; padding: 0.4rem 0.6rem; border-radius: 8px; border: 1px solid #ccd3e0; margin-bottom: 0.6rem; width: 100%; }

.tiles { width: 100%; display: flex; gap: 0.8rem; }
.tile {
  flex: 1;
  background: #fff;
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.tile-rotulo { font-size: 0.9rem; color: #556; }
.tile-valor { font-size: 1.6rem; font-weight: 700; color: var(--azul); }
.tile-valor.laranja { color: #c2560f; }
.bloco:disabled { opacity: 0.55; cursor: default; }
.bloco small { font-size: 0.85rem; color: #667; }
