/* ==========================================================================
   COMPONENTES
   Tokens e reset em tokens.css; shell e grades em layout.css.
   Nenhum hex literal aqui — tudo vem dos tokens.
   ========================================================================== */

/* --------------------------------------------------------------------------
   BOTÕES
   -------------------------------------------------------------------------- */
.btn {
  padding: 8px 16px;
  border-radius: var(--r-ctl);
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1.4;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-ghost {
  background: var(--surface);
  color: var(--muted);
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--line-soft); color: var(--ink); border-color: var(--line); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(0.92); }
.btn-gold { background: var(--amber); color: #fff; }
.btn-gold:hover { filter: brightness(0.92); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Botão só-ícone das linhas de tabela e listas. */
.btn-icon {
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--faint);
  display: inline-flex;
  align-items: center;
  transition: background 0.15s, color 0.15s;
}
.btn-icon:hover { background: var(--line-soft); color: var(--ink); }
.btn-icon.danger:hover { background: var(--red-soft); color: var(--red); }

.btn-block { width: 100%; }

/* --------------------------------------------------------------------------
   CARDS
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 20px 24px;
  min-width: 0;
}
/* Cards de KPI são mais compactos que os de conteúdo. */
.grid-4 > .card, .grid-3 > .card { padding: 18px 20px; }
/* Libre Caslon Text é mais larga que a serifada antiga no mesmo corpo: a 28px
   um valor como "+R$ 10.800,00" quebrava em duas linhas dentro da coluna de
   KPI. O desenho admite 23–30px; a linha de quatro colunas fica no piso. */
.grid-4 > .card .card-value { font-size: 23px; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card-title {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}
.card-value {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.5px;
  line-height: 1.15;
}
.card-delta {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.delta-up { color: var(--green); }
.delta-down { color: var(--red); }

/* --------------------------------------------------------------------------
   TIPOGRAFIA auxiliar
   -------------------------------------------------------------------------- */
.t-faint { color: var(--faint); }
.t-muted { color: var(--muted); }
.t-red   { color: var(--red); }
.t-green { color: var(--green); }
.mt-lg { margin-top: 24px; }
.row-actions { display: flex; gap: 4px; align-items: center; }
.empty-state {
  padding: 24px 20px;
  text-align: center;
  color: var(--faint);
  font-size: var(--fs-base);
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   GRÁFICOS
   -------------------------------------------------------------------------- */
/* O SVG define a própria altura pela proporção do viewBox — nada aqui fixa
   pixels, e nada em graficos.js precisa medir o layout. */
.chart-wrap { width: 100%; min-width: 0; }
.g-svg { display: block; width: 100%; height: auto; overflow: visible; }

.g-grade { stroke: var(--line-soft); stroke-width: 1; }
.g-eixo { font-size: 11px; fill: var(--faint); font-family: var(--font-sans); }
.g-legenda { font-size: 11px; fill: var(--muted); font-family: var(--font-sans); }

.g-barra-a { fill: var(--accent); }
.g-barra-b { fill: var(--accent-pale); }

.g-linha-serie { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.g-serie-conservador { stroke: var(--accent-pale); }
.g-serie-moderado    { stroke: var(--accent); }
.g-serie-otimista    { stroke: var(--green); stroke-dasharray: 5 4; }

/* Linha da lista de despesas por categoria. */
.g-linha { margin-bottom: 14px; }
.g-linha:last-child { margin-bottom: 0; }
.g-linha-topo { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.g-linha-nome { font-size: var(--fs-base); color: var(--ink); }
.g-linha-valor { font-size: var(--fs-base); color: var(--muted); font-weight: 600; }

/* --------------------------------------------------------------------------
   LISTA DE TRANSAÇÕES
   -------------------------------------------------------------------------- */
.tx-list { display: flex; flex-direction: column; }
.tx-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 8px;
  border-radius: var(--r-ctl);
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.1s;
}
.tx-item:last-child { border-bottom: none; }
.tx-item:hover { background: var(--line-soft); }
.tx-icon {
  width: 34px; height: 34px;
  border-radius: var(--r-ctl);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-lg);
  flex-shrink: 0;
}
.tx-info { flex: 1; min-width: 0; }
.tx-name {
  font-size: var(--fs-base); font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tx-cat { font-size: var(--fs-xs); color: var(--faint); margin-top: 2px; }
.tx-amount { font-size: var(--fs-base); font-weight: 700; flex-shrink: 0; color: var(--ink); }
.tx-amount.pos { color: var(--green); }
.tx-amount.neg { color: var(--red); }
.tx-date { font-size: var(--fs-xs); color: var(--faint); flex-shrink: 0; }
.tx-tail { text-align: right; flex-shrink: 0; }
.tx-tail .tx-date { margin-top: 2px; }

/* --------------------------------------------------------------------------
   BADGES
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
}
.badge-blue   { background: var(--accent-soft); color: var(--accent); }
.badge-green  { background: var(--green-soft);  color: var(--green); }
.badge-red    { background: var(--red-soft);    color: var(--red); }
.badge-orange { background: var(--amber-soft);  color: var(--amber); }
.badge-gold   { background: var(--amber-soft);  color: var(--amber); }
.badge-purple { background: var(--accent-soft); color: var(--accent-mid); }
.badge-cinza  { background: var(--line-soft);   color: var(--muted); }

/* --------------------------------------------------------------------------
   ÁREA DE UPLOAD / TILES TRACEJADOS
   -------------------------------------------------------------------------- */
.upload-zone {
  border: 2px dashed var(--accent-pale);
  border-radius: var(--r-card);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--surface);
  position: relative;
}
.upload-zone:hover, .upload-zone.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.upload-icon { color: var(--accent); margin-bottom: 10px; }
.upload-title { font-size: var(--fs-md); font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.upload-sub { font-size: var(--fs-sm); color: var(--faint); line-height: 1.5; }

/* Dois tiles lado a lado: enviar arquivo e fotografar comprovante. */
.tiles-entrada { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tiles-entrada .upload-zone { padding: 22px 14px; }

.area-colar {
  height: 130px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  line-height: 1.6;
}

/* Passo a passo do "Como funciona". */
.passos { list-style: none; margin: 14px 0 0; }
.passos li { display: flex; gap: 12px; margin-bottom: 16px; font-size: var(--fs-base); color: var(--muted); line-height: 1.55; }
.passos li:last-child { margin-bottom: 0; }
.passos b { color: var(--ink); }
.passo-num {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-sm); font-weight: 700;
}

.nota-cinza {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--line-soft);
  border-radius: var(--r-ctl);
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.55;
}

/* --------------------------------------------------------------------------
   CARD DE CONFIRMAÇÃO DO COMPROVANTE
   -------------------------------------------------------------------------- */
.comp-topo { display: flex; gap: 14px; align-items: flex-start; margin: 14px 0; }
.comp-thumb {
  width: 64px; height: 84px;
  object-fit: cover;
  border-radius: var(--r-ctl);
  border: 1px solid var(--line);
  flex-shrink: 0;
  background: var(--line-soft);
}
.comp-resumo { min-width: 0; }
.comp-estabelecimento {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.comp-valor {
  font-family: var(--font-serif);
  font-size: 26px;
  color: var(--red);
  letter-spacing: -0.5px;
  margin-top: 8px;
}

/* --------------------------------------------------------------------------
   MOCK DA CONVERSA — ilustra o fluxo do bot antes de ele existir
   -------------------------------------------------------------------------- */
.chat-mock {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: var(--line-soft);
  border-radius: var(--r-card);
}
.chat-bolha {
  max-width: 86%;
  padding: 9px 12px;
  font-size: var(--fs-sm);
  line-height: 1.5;
  border-radius: 14px;
}
.chat-eu { align-self: flex-end; background: var(--accent-soft); color: var(--ink); border-bottom-right-radius: 4px; }
.chat-bot { align-self: flex-start; background: var(--surface); color: var(--ink); border-bottom-left-radius: 4px; border: 1px solid var(--line); }
.chat-tabela { width: 100%; margin: 8px 0 4px; border-collapse: collapse; }
.chat-tabela td { padding: 3px 0; font-size: var(--fs-xs); }
.chat-tabela td:first-child { color: var(--faint); }
.chat-tabela td:last-child { text-align: right; font-weight: 600; }
.chat-acoes { display: flex; gap: 6px; margin-top: 8px; }
.chat-pill {
  padding: 4px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
}
.chat-pill-primaria { background: var(--accent); border-color: var(--accent); color: #fff; }

/* --------------------------------------------------------------------------
   CANAIS DE CAPTURA
   -------------------------------------------------------------------------- */
.canal {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.canal:last-of-type { border-bottom: none; }
.canal-tile {
  width: 38px; height: 38px;
  border-radius: var(--r-ctl);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.canal-tile-azul  { background: var(--accent-soft); color: var(--accent); }
.canal-tile-verde { background: var(--green-soft);  color: var(--green); }
.canal-info { flex: 1; min-width: 0; }
.canal-nome { font-size: var(--fs-md); font-weight: 600; color: var(--ink); }
.canal-estado { font-size: var(--fs-sm); color: var(--faint); margin-top: 2px; }
.canal-estado.conectado { color: var(--green); }

/* --------------------------------------------------------------------------
   CHAT DA IA
   -------------------------------------------------------------------------- */
.ai-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  display: flex;
  flex-direction: column;
  height: 520px;
}
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg.user { flex-direction: row-reverse; }
.msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs); font-weight: 700;
}
.msg.ai .msg-avatar   { background: var(--accent); color: #fff; }
.msg.user .msg-avatar { background: var(--line-soft); color: var(--muted); }
.msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--ink);
}
.msg.ai .msg-bubble   { background: #F4F5FA; border-radius: 4px 14px 14px 14px; }
.msg.user .msg-bubble { background: var(--accent-soft); border-radius: 14px 4px 14px 14px; }
.ai-input-row {
  display: flex;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--line);
}
.ai-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  padding: 10px 14px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  outline: none;
  transition: border-color 0.15s;
}
.ai-input:focus { border-color: var(--accent); }
.ai-input::placeholder { color: var(--faint); }
.ai-send {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-ctl);
  padding: 10px 16px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  font-weight: 600;
}
.ai-send:hover { background: var(--accent-hover); }
.ai-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* O hover vinha de onmouseover/onmouseout inline; virou CSS. */
.ai-suggestion {
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  padding: 10px 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  line-height: 1.5;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.ai-suggestion:hover { border-color: var(--accent); color: var(--accent); }

.typing-dots { display: inline-flex; gap: 3px; align-items: center; }
.typing-dots span {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--faint);
  animation: bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%,60%,100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* --------------------------------------------------------------------------
   INVESTIMENTOS
   -------------------------------------------------------------------------- */
.inv-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 16px 18px;
}
.inv-ticker {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--faint);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.inv-name { font-size: var(--fs-base); color: var(--muted); margin-bottom: 6px; }
.inv-price { font-size: 19px; font-weight: 700; color: var(--ink); }
.inv-change { font-size: var(--fs-sm); margin-top: 4px; }
.inv-rec {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  margin-top: 8px;
}
.rec-comprar  { background: var(--green-soft); color: var(--green); }
.rec-aguardar { background: var(--amber-soft); color: var(--amber); }
.rec-vender   { background: var(--red-soft);   color: var(--red); }

.alloc-item { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.alloc-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.alloc-name { font-size: var(--fs-base); color: var(--ink); flex: 1; }
.alloc-pct { font-size: var(--fs-base); font-weight: 700; color: var(--ink); }
.alloc-val { font-size: var(--fs-xs); color: var(--faint); }

/* --------------------------------------------------------------------------
   BARRAS DE PROGRESSO
   -------------------------------------------------------------------------- */
.progress-wrap { margin-bottom: 18px; }
.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}
.progress-label { font-size: var(--fs-base); color: var(--ink); font-weight: 600; }
.progress-vals { font-size: var(--fs-sm); color: var(--faint); }
.progress-bar {
  height: 7px;
  background: var(--line-soft);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--accent);
  transition: width 0.4s ease;
}
/* Estado do orçamento: dentro, perto do limite, estourado. */
.progress-fill.alerta  { background: var(--amber); }
.progress-fill.estouro { background: var(--red); }

/* Gerenciador de categorias (Configurações). */
.cat-linha {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  margin-bottom: 6px;
}
.cat-linha:hover { border-color: var(--accent-pale); }
.cat-linha-info { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: var(--fs-base); }
.cat-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.cat-emoji { font-size: var(--fs-lg); }
.cat-nome { font-weight: 600; color: var(--ink); }

/* Resumo do orçamento. */
.orc-resumo { padding: 4px 0; }
.orc-valor {
  font-family: var(--font-serif);
  font-size: 30px;
  color: var(--ink);
  letter-spacing: -0.5px;
  margin: 6px 0 14px;
}
.mt-sm { margin-top: 8px; }
.orc-linha {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: var(--fs-sm);
  color: var(--faint);
  margin-top: 8px;
}
.orc-pill { margin-top: 14px; }

/* Campo de limite dentro da barra de orçamento. */
.input-limite {
  width: 84px;
  padding: 4px 8px;
  font-size: var(--fs-sm);
  text-align: right;
  border-radius: 6px;
}

.goal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 20px;
  position: relative;
}
.goal-topo { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.goal-nome { font-size: var(--fs-md); font-weight: 700; color: var(--ink); }
.goal-pct { font-size: var(--fs-lg); font-weight: 700; color: var(--accent); }
.goal-pct.concluida { color: var(--green); }
.goal-pct.alerta { color: var(--amber); }
.goal-meta { font-size: var(--fs-sm); color: var(--faint); margin: 4px 0 12px; }
.goal-acumulado { font-size: var(--fs-sm); color: var(--muted); margin-top: 8px; }
.goal-nota { font-size: var(--fs-xs); color: var(--muted); margin-top: 6px; line-height: 1.5; }
.goal-aporte { display: flex; gap: 6px; margin-top: 14px; }
.goal-aporte-input { flex: 1; padding: 7px 10px; font-size: var(--fs-sm); }
.goal-aporte .btn { padding: 7px 12px; font-size: var(--fs-sm); white-space: nowrap; }
.goal-acoes { position: absolute; top: 14px; right: 14px; display: flex; gap: 2px; opacity: 0; transition: opacity 0.15s; }
.goal-card:hover .goal-acoes, .goal-acoes:focus-within { opacity: 1; }

/* --------------------------------------------------------------------------
   ANEL DE SAÚDE
   -------------------------------------------------------------------------- */
.score-wrap { display: flex; flex-direction: column; align-items: center; padding: 8px 0 4px; }
.score-ring { position: relative; width: 128px; height: 128px; }
.score-ring svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.score-num {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-size: 34px;
  color: var(--ink);
  letter-spacing: -1px;
}
.score-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--faint);
  margin-top: 10px;
}

/* --------------------------------------------------------------------------
   ALERTAS
   -------------------------------------------------------------------------- */
.alert {
  padding: 12px 14px;
  border-radius: var(--r-ctl);
  font-size: var(--fs-sm);
  line-height: 1.55;
  margin-bottom: 8px;
  border: 1px solid transparent;
}
.alert:last-child { margin-bottom: 0; }
.alert-warn    { background: var(--amber-soft); color: var(--amber); border-color: var(--amber-border); }
.alert-danger  { background: var(--red-soft);   color: var(--red); }
.alert-success { background: var(--green-soft); color: var(--green); }
.alert-info    { background: var(--accent-soft); color: var(--accent); }

.divider { height: 1px; background: var(--line); margin: 18px 0; }

/* Faixa de lembrete de backup, entre a topbar e o conteúdo. */
.faixa-backup {
  padding: 12px 32px;
  background: var(--amber-soft);
  border-bottom: 1px solid var(--amber-border);
  color: var(--amber);
  font-size: var(--fs-base);
  line-height: 1.5;
}

.notif-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
}

/* --------------------------------------------------------------------------
   TABELAS
   -------------------------------------------------------------------------- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--faint);
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td {
  font-size: var(--fs-base);
  color: var(--ink);
  padding: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.data-table tbody tr:hover { background: var(--line-soft); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .num { text-align: right; font-weight: 600; }

/* Fatura de cartão: pai expansível e filhos recuados. */
.bill-parent { cursor: pointer; }
.bill-child td { background: var(--line-soft); font-size: var(--fs-sm); color: var(--muted); }
.bill-child td:first-child { padding-left: 28px; }

/* --------------------------------------------------------------------------
   CHIPS DE CATEGORIA
   -------------------------------------------------------------------------- */
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.cat-chip:hover { border-color: var(--accent); color: var(--accent); }
.cat-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   FORMULÁRIOS
   -------------------------------------------------------------------------- */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.form-input, .form-select,
select, input[type="text"], input[type="number"], input[type="date"],
input[type="email"], input[type="password"], textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  padding: 10px 12px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  outline: none;
  transition: border-color 0.15s;
}
.form-input::placeholder, textarea::placeholder { color: var(--faint); }
select:focus, input:focus, textarea:focus, .form-input:focus, .form-select:focus {
  border-color: var(--accent);
}
option { background: var(--surface); color: var(--ink); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

#fileInput { display: none; }

/* --------------------------------------------------------------------------
   MODAIS
   -------------------------------------------------------------------------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(23, 26, 46, 0.45);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}
.modal-overlay.show { display: flex; }
.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-modal);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-card);
  animation: slideUp 0.2s ease;
}
.modal-title {
  font-family: var(--font-serif);
  font-size: 21px;
  color: var(--ink);
  margin-bottom: 16px;
  letter-spacing: -0.2px;
}
.modal-close {
  background: none;
  border: none;
  color: var(--faint);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.modal-close:hover { color: var(--ink); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn 0.25s ease; }

/* --------------------------------------------------------------------------
   FAB — some no mobile, onde a tab bar tem o próprio "+"
   -------------------------------------------------------------------------- */
.fab {
  position: fixed;
  bottom: 28px; right: 28px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-fab);
  z-index: 90;
  transition: background 0.15s;
}
.fab:hover { background: var(--accent-hover); }

/* --------------------------------------------------------------------------
   TELA DE ENTRADA
   -------------------------------------------------------------------------- */
.auth-gate {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-gate.show { display: flex; }
.auth-card {
  background: var(--surface);
  border-radius: 18px;
  width: 100%;
  max-width: 860px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

/* Painel escuro da esquerda — o único lugar do app claro que usa --ink como
   fundo, junto do card de saldo do celular. */
.auth-lado {
  background: var(--ink);
  color: #fff;
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
}
.auth-logo { font-family: var(--font-serif); font-size: 22px; color: #fff; }
.auth-lado .logo-casa { color: var(--accent-light); }
.auth-headline {
  font-family: var(--font-serif);
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: -0.5px;
  margin-top: 36px;
}
.auth-copy {
  font-size: var(--fs-md);
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 16px;
}
.auth-rodape { margin-top: auto; padding-top: 32px; }
.auth-sub {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  font-weight: 600;
}
.auth-credito { font-size: 10.5px; color: rgba(255, 255, 255, 0.4); margin-top: 6px; }

.auth-form { padding: 40px 36px; }
.auth-titulo {
  font-family: var(--font-serif);
  font-size: 26px;
  color: var(--ink);
  margin-bottom: 22px;
}

@media (max-width: 760px) {
  .auth-card { grid-template-columns: minmax(0, 1fr); max-width: 420px; }
  /* No celular o painel de marca vira uma faixa curta: a headline ocuparia
     meia tela antes de a pessoa chegar no campo de email. */
  .auth-lado { padding: 24px; }
  .auth-headline, .auth-copy, .auth-rodape { display: none; }
  .auth-form { padding: 24px; }
}

/* --------------------------------------------------------------------------
   SINCRONIZAÇÃO
   -------------------------------------------------------------------------- */
#syncStatus {
  font-size: var(--fs-xs);
  color: var(--faint);
  padding: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   BARRA DE ROLAGEM
   -------------------------------------------------------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: var(--r-pill); border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--accent-pale); }

/* --------------------------------------------------------------------------
   PLANEJAMENTO MÉDICA (módulo fiscal) — renderizado por fiscal.js
   -------------------------------------------------------------------------- */
.pm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.pm-bloco { display: flex; flex-direction: column; }
.pm-valor-destaque {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 400;
  color: var(--ink);
  margin: 6px 0 4px;
  letter-spacing: -0.5px;
}
.pm-badge {
  font-size: var(--fs-xs);
  font-weight: 600;
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--faint);
}
.pm-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: var(--fs-base);
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
  margin-top: 4px;
}
.pm-stat { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pm-stat span { color: var(--muted); }
.pm-stat b { color: var(--ink); font-weight: 700; white-space: nowrap; }
.pm-pgbl-bar {
  width: 100%;
  height: 7px;
  background: var(--line-soft);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.pm-pgbl-fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-pill);
  transition: width 0.4s ease;
}
.pm-atalhos-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.pm-atalho {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-base);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.pm-atalho:hover { border-color: var(--accent); color: var(--accent); }

/* --------------------------------------------------------------------------
   TOGGLE (Configurações → Módulos)
   -------------------------------------------------------------------------- */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--line);
  border-radius: var(--r-pill);
  transition: background 0.2s;
}
.toggle-switch .slider:before {
  content: "";
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-switch input:checked + .slider { background: var(--accent); }
.toggle-switch input:checked + .slider:before { transform: translateX(18px); }

/* --------------------------------------------------------------------------
   SIDEBAR DO MOBILE — provisório, some quando a tab bar entrar
   -------------------------------------------------------------------------- */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 14px; left: 14px;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 20px;
  padding: 6px 10px;
  border-radius: var(--r-ctl);
  cursor: pointer;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(23, 26, 46, 0.45);
  z-index: 99;
}
.sidebar-overlay.show { display: block; }

@media (max-width: 768px) {
  .hamburger-btn { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar { padding: 0 16px 0 56px; }
  .content { padding: 16px; }
  .grid-4, .grid-3, .grid-2, .grid-21, .grid-12 { grid-template-columns: minmax(0, 1fr); }
  .fab { bottom: 20px; right: 20px; width: 48px; height: 48px; font-size: 24px; }
}

/* Bloco de pareamento do Telegram, dentro de Canais de captura. */
.pareamento {
  margin-top: 12px;
  padding: 16px;
  border: 1px solid var(--accent-pale);
  border-radius: var(--r-ctl);
  background: var(--accent-soft);
  text-align: center;
}
.pareamento-codigo {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--accent);
}
.pareamento-prazo { font-size: var(--fs-sm); color: var(--muted); margin: 6px 0 14px; }
.pareamento-alt { font-size: var(--fs-sm); color: var(--muted); margin-top: 10px; line-height: 1.5; }
.pareamento a.btn { display: block; text-decoration: none; }
.pareamento a.btn:hover { text-decoration: none; color: #fff; }
