*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --verde:        #1D9E75;
  --verde-claro:  #E1F5EE;
  --verde-texto:  #085041;
  --verm:         #D85A30;
  --verm-claro:   #FAECE7;
  --verm-texto:   #4A1B0C;
  --roxo:         #7F77DD;
  --roxo-claro:   #EEEDFE;
  --roxo-texto:   #26215C;
  --fundo:        #F8F7F4;
  --superficie:   #FFFFFF;
  --texto:        #1a1a18;
  --texto-sec:    #6b6a66;
  --borda:        rgba(0,0,0,0.10);
  --borda-forte:  rgba(0,0,0,0.18);
  --radius-sm:    8px;
  --radius-md:    12px;
  --radius-lg:    16px;
  --fonte:        'DM Sans', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fundo:       #121210;
    --superficie:  #1e1e1b;
    --texto:       #f0efe8;
    --texto-sec:   #9e9d96;
    --borda:       rgba(255,255,255,0.10);
    --borda-forte: rgba(255,255,255,0.18);
    --verde-claro: #0a3326;
    --verde-texto: #6dcfad;
    --verm-claro:  #3d1a0d;
    --verm-texto:  #f0916a;
    --roxo-claro:  #1e1b3e;
    --roxo-texto:  #b0aaf0;
  }
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--fonte);
  background: var(--fundo);
  color: var(--texto);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

.app { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }

/* ── Top bar ── */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem 0.75rem;
  background: var(--superficie);
  border-bottom: 0.5px solid var(--borda);
  position: sticky; top: 0; z-index: 10;
}
.top-bar-left { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.top-bar-left i { font-size: 20px; color: var(--verde); }
.top-bar-right { display: flex; align-items: center; gap: 8px; }
.mes-badge {
  font-size: 13px; color: var(--texto-sec);
  background: var(--fundo); padding: 4px 10px;
  border-radius: 99px; border: 0.5px solid var(--borda);
}
.sync-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 0.5px solid var(--borda-forte);
  background: var(--superficie); color: var(--texto-sec);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; transition: all 0.15s;
}
.sync-btn:active { background: var(--fundo); }

/* ── Tab bar ── */
.tab-bar {
  display: flex; background: var(--superficie);
  border-bottom: 0.5px solid var(--borda); padding: 0 1rem;
  position: sticky; top: 57px; z-index: 9;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 10px 4px 8px;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--texto-sec); font-family: var(--fonte);
  font-size: 12px; font-weight: 500; cursor: pointer; transition: color 0.15s;
}
.tab i { font-size: 20px; }
.tab.active { color: var(--verde); border-bottom-color: var(--verde); }

/* ── Sections ── */
.section { display: none; padding: 1.25rem; flex: 1; overflow-y: auto; }
.section.active { display: block; }

/* ── Fields ── */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--texto-sec); margin-bottom: 6px; }
.opcional { font-weight: 400; }
.field input[type="text"],
.field input[type="number"],
.field input[type="date"],
.field select {
  width: 100%; font-family: var(--fonte); font-size: 16px;
  color: var(--texto); background: var(--superficie);
  border: 0.5px solid var(--borda-forte); border-radius: var(--radius-md);
  padding: 11px 14px; appearance: none; -webkit-appearance: none; transition: border-color 0.15s;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--verde); }
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}

/* ── Tipo buttons ── */
.tipo-btns, .resp-btns { display: flex; gap: 8px; }
.tipo-btn, .resp-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 10px 4px;
  background: var(--superficie); border: 0.5px solid var(--borda-forte);
  border-radius: var(--radius-md); color: var(--texto-sec);
  font-family: var(--fonte); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s;
}
.tipo-btn i { font-size: 22px; }
.tipo-btn.despesa.active  { background: var(--verm-claro);  color: var(--verm-texto);  border-color: var(--verm);  }
.tipo-btn.receita.active  { background: var(--verde-claro); color: var(--verde-texto); border-color: var(--verde); }
.tipo-btn.poupanca.active { background: var(--roxo-claro);  color: var(--roxo-texto);  border-color: var(--roxo);  }
.resp-btn { flex-direction: row; justify-content: center; padding: 11px 6px; }
.resp-btn.active { background: var(--texto); color: var(--superficie); border-color: var(--texto); }

/* ── Valor ── */
/* ── Valor ── */
.valor-wrap { display: flex; align-items: center; background: var(--superficie); border: 0.5px solid var(--borda-forte); border-radius: var(--radius-md); height: 58px; padding: 0 14px; }
.valor-wrap:focus-within { border-color: var(--verde); }
.valor-prefix { font-size: 13px; font-weight: 500; color: var(--texto-sec); flex-shrink: 0; margin-right: 8px; }
.valor-wrap input { flex: 1; border: none !important; background: none !important; padding: 0 !important; font-size: 24px; font-weight: 600; height: 100%; letter-spacing: -0.5px; color: var(--texto); outline: none; -webkit-appearance: none; }

/* ── Botão lançar ── */
.btn-lancar {
  width: 100%; display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 15px; background: var(--verde); color: #fff;
  border: none; border-radius: var(--radius-lg); font-family: var(--fonte);
  font-size: 16px; font-weight: 600; cursor: pointer; margin-top: 0.5rem;
  transition: opacity 0.15s, transform 0.1s; -webkit-tap-highlight-color: transparent;
}
.btn-lancar:active { opacity: 0.85; transform: scale(0.985); }
.btn-lancar:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-lancar i { font-size: 20px; }

/* ── Spinner ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { display: inline-block; animation: spin 0.7s linear infinite; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 32px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--texto); color: var(--superficie);
  padding: 11px 22px; border-radius: 99px; font-size: 14px; font-weight: 500;
  white-space: nowrap; transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: none; z-index: 999;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.sucesso { background: var(--verde); color: #fff; }
.toast.erro    { background: var(--verm);  color: #fff; }

/* ── Skeleton ── */
@keyframes shimmer { 0%{opacity:0.4} 50%{opacity:0.8} 100%{opacity:0.4} }
.skeleton-item {
  height: 64px; border-radius: var(--radius-md);
  background: var(--superficie); border: 0.5px solid var(--borda);
  animation: shimmer 1.4s ease-in-out infinite;
}

/* ── Cards resumo ── */
.resumo-cards { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-bottom: 1.5rem; }
.stat-card { background: var(--superficie); border: 0.5px solid var(--borda); border-radius: var(--radius-md); padding: 14px; }
.stat-label { font-size: 12px; color: var(--texto-sec); margin-bottom: 6px; display: flex; align-items: center; gap: 4px; }
.stat-label i { font-size: 14px; }
.stat-val { font-size: 19px; font-weight: 600; letter-spacing: -0.5px; color: var(--texto); }
.stat-val.verde    { color: var(--verde); }
.stat-val.vermelho { color: var(--verm);  }
.stat-val.roxo     { color: var(--roxo);  }

.secao-title { font-size: 13px; font-weight: 600; color: var(--texto-sec); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px; }

/* ── Barras ── */
.barra-wrap { margin-bottom: 12px; }
.barra-label { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 5px; color: var(--texto); }
.barra-label span:last-child { color: var(--texto-sec); font-variant-numeric: tabular-nums; }
.barra-bg { height: 7px; border-radius: 99px; background: var(--fundo); overflow: hidden; border: 0.5px solid var(--borda); }
.barra-fill { height: 100%; border-radius: 99px; transition: width 0.5s cubic-bezier(0.4,0,0.2,1); }
.barra-fill.ok     { background: var(--verde); }
.barra-fill.alerta { background: var(--verm);  }

/* ── Filtros ── */
.filtros { display: flex; gap: 6px; margin-bottom: 1rem; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.filtros::-webkit-scrollbar { display: none; }
.filtro-btn {
  flex-shrink: 0; padding: 7px 14px; border-radius: 99px;
  border: 0.5px solid var(--borda-forte); background: var(--superficie);
  color: var(--texto-sec); font-family: var(--fonte); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s;
}
.filtro-btn.active { background: var(--texto); color: var(--superficie); border-color: var(--texto); }

/* ── Lista ── */
.lista-lancamentos { display: flex; flex-direction: column; gap: 8px; }
.lanc-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--superficie); border: 0.5px solid var(--borda); border-radius: var(--radius-md);
}
.lanc-icon { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.lanc-icon.despesa  { background: var(--verm-claro);  color: var(--verm);  }
.lanc-icon.receita  { background: var(--verde-claro); color: var(--verde); }
.lanc-icon.poupanca { background: var(--roxo-claro);  color: var(--roxo);  }
.lanc-info { flex: 1; min-width: 0; }
.lanc-desc { font-size: 14px; font-weight: 500; color: var(--texto); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lanc-sub  { font-size: 12px; color: var(--texto-sec); margin-top: 2px; }
.lanc-val  { font-size: 15px; font-weight: 600; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.lanc-val.despesa  { color: var(--verm);  }
.lanc-val.receita  { color: var(--verde); }
.lanc-val.poupanca { color: var(--roxo);  }

.btn-del {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  border: none; background: none; color: var(--texto-sec);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; transition: all 0.15s; opacity: 0.5;
}
.btn-del:hover { opacity: 1; color: var(--verm); }
.btn-del:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--texto-sec); font-size: 14px; }
.empty-state i { font-size: 40px; display: block; margin-bottom: 10px; opacity: 0.35; }

.section { padding-bottom: max(1.25rem, env(safe-area-inset-bottom)); }

/* ── Tela de perfil ── */
.tela-perfil {
  display: none;
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.6);
  align-items: center; justify-content: center;
  padding: 1.5rem;
}
.tela-perfil.active { display: flex; }
.perfil-card {
  background: var(--superficie);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  width: 100%; max-width: 320px;
  text-align: center;
}
.perfil-card i { font-size: 40px; color: var(--verde); display: block; margin-bottom: 1rem; }
.perfil-card h2 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.perfil-card p  { font-size: 14px; color: var(--texto-sec); margin-bottom: 1.5rem; }
.perfil-opcoes  { display: flex; flex-direction: column; gap: 10px; }
.perfil-btn {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 0.5px solid var(--borda-forte);
  background: var(--superficie);
  color: var(--texto);
  font-family: var(--fonte); font-size: 16px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
.perfil-btn:hover { background: var(--verde-claro); border-color: var(--verde); color: var(--verde-texto); }

/* ── Perfil badge no top bar ── */
.perfil-badge {
  font-size: 12px; font-weight: 600;
  color: var(--verde-texto);
  background: var(--verde-claro);
  border: 0.5px solid var(--verde);
  padding: 4px 10px; border-radius: 99px;
  cursor: pointer; font-family: var(--fonte);
  transition: opacity 0.15s;
}
.perfil-badge:hover { opacity: 0.8; }

/* ── Para quem buttons ── */
.paraquem-btns {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.paraquem-btn {
  padding: 8px 14px;
  border-radius: 99px;
  border: 0.5px solid var(--borda-forte);
  background: var(--superficie);
  color: var(--texto-sec);
  font-family: var(--fonte); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
.paraquem-btn.active {
  background: var(--texto); color: var(--superficie); border-color: var(--texto);
}

/* ── Título seção lançar ── */
.secao-titulo-lancar {
  font-size: 15px; font-weight: 600; color: var(--texto);
  margin-bottom: 1rem;
}

/* ── Botão editar ── */
.btn-edit {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  border: none; background: none; color: var(--texto-sec);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; transition: all 0.15s; opacity: 0.5;
}
.btn-edit:hover { opacity: 1; color: var(--verde); }

/* ── Botão cancelar edição ── */
.btn-cancelar-edicao {
  width: 100%; display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 13px; background: none;
  color: var(--texto-sec); border: 0.5px solid var(--borda-forte);
  border-radius: var(--radius-lg); font-family: var(--fonte);
  font-size: 15px; font-weight: 500; cursor: pointer; margin-top: 8px;
  transition: all 0.15s;
}
.btn-cancelar-edicao:hover { border-color: var(--verm); color: var(--verm); }

/* ── Filtro mês histórico ── */
.historico-filtros { margin-bottom: 1rem; }
.field-mes { margin-bottom: 0.75rem; }
.field-mes select { font-size: 14px; padding: 8px 36px 8px 12px; }

/* ── Tela de limites ── */
.tela-limites {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.6);
  align-items: flex-end; justify-content: center; padding: 0;
}
.tela-limites.active { display: flex; }
.limites-card {
  background: var(--superficie); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.5rem 1.25rem; width: 100%; max-width: 480px;
  max-height: 85dvh; overflow-y: auto;
}
.limites-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.5rem;
}
.limites-header h2 { font-size: 17px; font-weight: 600; }
.btn-fechar-limites {
  width: 32px; height: 32px; border-radius: 50%; border: none;
  background: var(--fundo); color: var(--texto-sec);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px;
}
.limites-desc { font-size: 13px; color: var(--texto-sec); margin-bottom: 1.25rem; }
.limite-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0;
  border-bottom: 0.5px solid var(--borda);
}
.limite-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--texto); flex: 1;
}
.limite-label i { font-size: 18px; color: var(--texto-sec); }
.limite-input-wrap { display: flex; align-items: center; gap: 4px; }
.limite-prefix { font-size: 13px; color: var(--texto-sec); }
.limite-input {
  width: 90px; font-family: var(--fonte); font-size: 14px;
  color: var(--texto); background: var(--fundo);
  border: 0.5px solid var(--borda-forte); border-radius: var(--radius-sm);
  padding: 7px 10px; text-align: right;
}
.limite-input:focus { outline: none; border-color: var(--verde); }
.btn-salvar-limites {
  width: 100%; display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 14px; background: var(--verde); color: #fff;
  border: none; border-radius: var(--radius-lg); font-family: var(--fonte);
  font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 1.25rem;
}

/* ── Topo do resumo ── */
.resumo-topo {
  display: flex; align-items: center; gap: 10px; margin-bottom: 1rem;
}
.resumo-topo .field-mes { flex: 1; margin-bottom: 0; }
.btn-limites {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-md);
  border: 0.5px solid var(--borda-forte); background: var(--superficie);
  color: var(--texto-sec); font-family: var(--fonte);
  font-size: 13px; font-weight: 500; cursor: pointer;
  white-space: nowrap; transition: all 0.15s; flex-shrink: 0;
}
.btn-limites:hover { border-color: var(--verde); color: var(--verde); }
.btn-limites i { font-size: 16px; }

/* ── Barras com limite ── */
.barra-valores { display: flex; align-items: center; gap: 6px; }
.limite-ref { color: var(--texto-sec); font-size: 12px; }
.limite-pct {
  font-size: 11px; font-weight: 600; padding: 2px 6px;
  border-radius: 99px;
}
.limite-pct.ok     { background: var(--verde-claro); color: var(--verde-texto); }
.limite-pct.aviso  { background: var(--amar-claro, #FFF3CD); color: #7A5C00; }
.limite-pct.alerta { background: var(--verm-claro);  color: var(--verm-texto);  }
.barra-fill.aviso  { background: #F0A500; }

/* ── Modal de confirmação ── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.5);
  align-items: flex-end; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-card {
  background: var(--superficie); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.5rem 1.25rem; width: 100%; max-width: 480px;
}
.modal-titulo { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.modal-desc   { font-size: 14px; color: var(--texto-sec); margin-bottom: 1.25rem; }
.modal-acoes  { display: flex; gap: 10px; }
.modal-btn {
  flex: 1; padding: 13px; border-radius: var(--radius-md);
  font-family: var(--fonte); font-size: 15px; font-weight: 500;
  cursor: pointer; border: 0.5px solid var(--borda-forte);
  background: var(--superficie); color: var(--texto); transition: all 0.15s;
}
.modal-btn.confirmar {
  background: var(--verm); color: #fff; border-color: var(--verm);
}

/* ── Badge recente ── */
.lanc-val-wrap {
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0;
}
.badge-recente {
  font-size: 10px; font-weight: 600;
  color: var(--verde); background: var(--verde-claro);
  border: 0.5px solid var(--verde);
  padding: 1px 6px; border-radius: 99px;
  letter-spacing: 0.03em; white-space: nowrap;
}

/* ── Botão duplicar ── */
.btn-copy {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  border: none; background: none; color: var(--texto-sec);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; transition: all 0.15s; opacity: 0.5;
}
.btn-copy:hover { opacity: 1; color: var(--roxo); }

/* ── Ícone colorido por categoria ── */
.cat-icon-small {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.barra-cat-label {
  display: flex; align-items: center; gap: 7px;
}

/* ── Badge recente (lado direito) ── */
.lanc-val-wrap {
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0;
}
.badge-recente {
  font-size: 10px; font-weight: 600;
  color: var(--verde); background: var(--verde-claro);
  border: 0.5px solid var(--verde);
  padding: 1px 6px; border-radius: 99px;
  letter-spacing: 0.03em; white-space: nowrap;
}

/* ── Botão duplicar ── */
.btn-copy {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  border: none; background: none; color: var(--texto-sec);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; transition: all 0.15s; opacity: 0.5;
}
.btn-copy:hover { opacity: 1; color: var(--roxo); }

/* ── Paginação ── */
.paginacao {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 1rem 0; flex-wrap: wrap;
}
.pag-info { font-size: 12px; color: var(--texto-sec); }
.pag-controles { display: flex; align-items: center; gap: 8px; }
.pag-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 0.5px solid var(--borda-forte); background: var(--superficie);
  color: var(--texto); display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; transition: all 0.15s;
}
.pag-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.pag-label { font-size: 13px; color: var(--texto); font-weight: 500; }
.pag-select {
  font-family: var(--fonte); font-size: 13px; padding: 6px 10px;
  border: 0.5px solid var(--borda-forte); border-radius: var(--radius-md);
  background: var(--superficie); color: var(--texto); cursor: pointer;
}

/* ── Tela de categorias ── */
.tela-categorias {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.6);
  align-items: flex-end; justify-content: center;
}
.tela-categorias.active { display: flex; }
.categorias-card {
  background: var(--superficie); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.5rem 1.25rem; width: 100%; max-width: 480px;
  max-height: 88dvh; overflow-y: auto;
}
.cat-tipo-btns {
  display: flex; gap: 6px; margin-bottom: 1.25rem;
}
.cat-tipo-btn {
  flex: 1; padding: 8px; border-radius: var(--radius-md);
  border: 0.5px solid var(--borda-forte); background: var(--superficie);
  color: var(--texto-sec); font-family: var(--fonte); font-size: 13px;
  font-weight: 500; cursor: pointer; transition: all 0.15s;
}
.cat-tipo-btn.active { background: var(--texto); color: var(--superficie); border-color: var(--texto); }

.cat-grupo { margin-bottom: 1rem; }
.cat-grupo-header {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; border-bottom: 0.5px solid var(--borda);
  margin-bottom: 6px;
}
.cat-nome { flex: 1; font-size: 14px; font-weight: 600; color: var(--texto); }
.btn-remover-cat {
  border: none; background: none; color: var(--texto-sec);
  cursor: pointer; font-size: 15px; opacity: 0.5; padding: 4px;
  transition: all 0.15s;
}
.btn-remover-cat:hover { opacity: 1; color: var(--verm); }

.subcats-lista { padding-left: 34px; display: flex; flex-direction: column; gap: 4px; }
.subcat-item {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: var(--texto-sec); padding: 4px 0;
}
.btn-remover-subcat {
  border: none; background: none; color: var(--texto-sec);
  cursor: pointer; font-size: 13px; opacity: 0.4; padding: 2px 6px;
  transition: all 0.15s;
}
.btn-remover-subcat:hover { opacity: 1; color: var(--verm); }
.btn-add-subcat {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--verde); border: none; background: none;
  cursor: pointer; padding: 4px 0; font-family: var(--fonte); margin-top: 2px;
}
.btn-add-cat {
  width: 100%; display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 12px; border-radius: var(--radius-md);
  border: 0.5px dashed var(--borda-forte); background: none;
  color: var(--texto-sec); font-family: var(--fonte); font-size: 14px;
  cursor: pointer; margin-top: 8px; transition: all 0.15s;
}
.btn-add-cat:hover { border-color: var(--verde); color: var(--verde); }

/* ── Barra aviso (amarelo) ── */
.barra-fill.aviso { background: #F0A500; }

/* ── Limite-pct badge ── */
.limite-pct {
  font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 99px;
}
.limite-pct.ok     { background: var(--verde-claro); color: var(--verde-texto); }
.limite-pct.aviso  { background: #FFF3CD; color: #7A5C00; }
.limite-pct.alerta { background: var(--verm-claro); color: var(--verm-texto); }
.limite-ref { color: var(--texto-sec); font-size: 12px; }
.barra-valores { display: flex; align-items: center; gap: 6px; }

/* ── Tela limites ── */
.tela-limites {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.6);
  align-items: flex-end; justify-content: center;
}
.tela-limites.active { display: flex; }
.limites-card {
  background: var(--superficie); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.5rem 1.25rem; width: 100%; max-width: 480px;
  max-height: 85dvh; overflow-y: auto;
}
.limites-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.limites-header h2 { font-size: 17px; font-weight: 600; }
.btn-fechar-limites {
  width: 32px; height: 32px; border-radius: 50%; border: none;
  background: var(--fundo); color: var(--texto-sec);
  display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 16px;
}
.limites-desc { font-size: 13px; color: var(--texto-sec); margin-bottom: 1.25rem; }
.limite-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0; border-bottom: 0.5px solid var(--borda);
}
.limite-label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--texto); flex: 1; }
.limite-input-wrap { display: flex; align-items: center; gap: 4px; }
.limite-prefix { font-size: 13px; color: var(--texto-sec); }
.limite-input {
  width: 90px; font-family: var(--fonte); font-size: 14px;
  color: var(--texto); background: var(--fundo);
  border: 0.5px solid var(--borda-forte); border-radius: var(--radius-sm);
  padding: 7px 10px; text-align: right;
}
.limite-input:focus { outline: none; border-color: var(--verde); }
.btn-salvar-limites {
  width: 100%; display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 14px; background: var(--verde); color: #fff;
  border: none; border-radius: var(--radius-lg); font-family: var(--fonte);
  font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 1.25rem;
}

/* ── Topo resumo ── */
.resumo-topo {
  display: flex; align-items: center; gap: 8px; margin-bottom: 1rem; flex-wrap: wrap;
}
.resumo-topo .field-mes { flex: 1; margin-bottom: 0; min-width: 120px; }
.btn-limites {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px;
  border-radius: var(--radius-md); border: 0.5px solid var(--borda-forte);
  background: var(--superficie); color: var(--texto-sec);
  font-family: var(--fonte); font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: all 0.15s;
}
.btn-limites:hover { border-color: var(--verde); color: var(--verde); }

/* ── Modal ── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.5); align-items: flex-end; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-card {
  background: var(--superficie); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.5rem 1.25rem; width: 100%; max-width: 480px;
}
.modal-titulo { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.modal-desc   { font-size: 14px; color: var(--texto-sec); margin-bottom: 1.25rem; }
.modal-acoes  { display: flex; gap: 10px; }
.modal-btn {
  flex: 1; padding: 13px; border-radius: var(--radius-md);
  font-family: var(--fonte); font-size: 15px; font-weight: 500;
  cursor: pointer; border: 0.5px solid var(--borda-forte);
  background: var(--superficie); color: var(--texto); transition: all 0.15s;
}
.modal-btn.confirmar { background: var(--verm); color: #fff; border-color: var(--verm); }

/* ── Skeleton ── */
@keyframes shimmer { 0%{opacity:0.4} 50%{opacity:0.8} 100%{opacity:0.4} }
.skeleton-item {
  height: 64px; border-radius: var(--radius-md);
  background: var(--superficie); border: 0.5px solid var(--borda);
  animation: shimmer 1.4s ease-in-out infinite; margin-bottom: 8px;
}

/* ── Titulo seção lançar ── */
.secao-titulo-lancar { font-size: 15px; font-weight: 600; color: var(--texto); margin-bottom: 1rem; }

/* ── Botão editar ── */
.btn-edit {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  border: none; background: none; color: var(--texto-sec);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; transition: all 0.15s; opacity: 0.5;
}
.btn-edit:hover { opacity: 1; color: var(--verde); }

/* ── Botão cancelar edição ── */
.btn-cancelar-edicao {
  width: 100%; display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 13px; background: none;
  color: var(--texto-sec); border: 0.5px solid var(--borda-forte);
  border-radius: var(--radius-lg); font-family: var(--fonte);
  font-size: 15px; font-weight: 500; cursor: pointer; margin-top: 8px; transition: all 0.15s;
}
.btn-cancelar-edicao:hover { border-color: var(--verm); color: var(--verm); }

/* ── Filtro mês histórico ── */
.historico-filtros { margin-bottom: 1rem; }
.field-mes { margin-bottom: 0.75rem; }
.field-mes select { font-size: 14px; padding: 8px 36px 8px 12px; }

/* ── Tela perfil ── */
.tela-perfil {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.6); align-items: center; justify-content: center; padding: 1.5rem;
}
.tela-perfil.active { display: flex; }
.perfil-card {
  background: var(--superficie); border-radius: var(--radius-lg);
  padding: 2rem 1.5rem; width: 100%; max-width: 320px; text-align: center;
}
.perfil-card i { font-size: 40px; color: var(--verde); display: block; margin-bottom: 1rem; }
.perfil-card h2 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.perfil-card p  { font-size: 14px; color: var(--texto-sec); margin-bottom: 1.5rem; }
.perfil-opcoes  { display: flex; flex-direction: column; gap: 10px; }
.perfil-btn {
  padding: 14px; border-radius: var(--radius-md);
  border: 0.5px solid var(--borda-forte); background: var(--superficie);
  color: var(--texto); font-family: var(--fonte); font-size: 16px; font-weight: 500; cursor: pointer; transition: all 0.15s;
}
.perfil-btn:hover { background: var(--verde-claro); border-color: var(--verde); color: var(--verde-texto); }
.perfil-badge {
  font-size: 12px; font-weight: 600; color: var(--verde-texto);
  background: var(--verde-claro); border: 0.5px solid var(--verde);
  padding: 4px 10px; border-radius: 99px; cursor: pointer; font-family: var(--fonte); transition: opacity 0.15s;
}
.perfil-badge:hover { opacity: 0.8; }

/* ── Para quem ── */
.paraquem-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.paraquem-btn {
  padding: 8px 14px; border-radius: 99px;
  border: 0.5px solid var(--borda-forte); background: var(--superficie);
  color: var(--texto-sec); font-family: var(--fonte); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s;
}
.paraquem-btn.active { background: var(--texto); color: var(--superficie); border-color: var(--texto); }

/* ── Spinner ── */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { display: inline-block; animation: spin 0.7s linear infinite; }

/* ── Login ── */
.tela-login {
  display: flex; position: fixed; inset: 0; z-index: 200;
  background: var(--fundo); align-items: center; justify-content: center; padding: 1.5rem;
}
.login-card {
  background: var(--superficie); border-radius: var(--radius-lg);
  padding: 2.5rem 2rem; width: 100%; max-width: 360px; text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
.login-logo { width: 64px; height: 64px; border-radius: 50%; background: var(--verde-claro); display: flex; align-items: center; justify-content: center; margin: 0 auto 1.25rem; }
.login-logo i { font-size: 32px; color: var(--verde); }
.login-titulo { font-size: 24px; font-weight: 600; margin-bottom: 6px; }
.login-sub    { font-size: 14px; color: var(--texto-sec); margin-bottom: 2rem; }
.btn-google {
  width: 100%; display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 14px; border-radius: var(--radius-md);
  border: 0.5px solid var(--borda-forte); background: var(--superficie);
  color: var(--texto); font-family: var(--fonte); font-size: 15px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
.btn-google:hover { background: var(--fundo); }
.login-rodape { font-size: 12px; color: var(--texto-sec); margin-top: 1.25rem; }

/* ── Família ── */
.tela-familia {
  display: none; position: fixed; inset: 0; z-index: 150;
  background: var(--fundo); align-items: center; justify-content: center; padding: 1.5rem;
}
.familia-card {
  background: var(--superficie); border-radius: var(--radius-lg);
  padding: 2rem 1.5rem; width: 100%; max-width: 360px; text-align: center;
}
.familia-card i { font-size: 40px; color: var(--verde); display: block; margin-bottom: 1rem; }
.familia-card h2 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.familia-card p  { font-size: 14px; color: var(--texto-sec); margin-bottom: 1.5rem; }
.familia-opcoes  { display: flex; flex-direction: column; gap: 10px; }
.familia-btn {
  padding: 14px; border-radius: var(--radius-md);
  border: 0.5px solid var(--borda-forte); background: var(--superficie);
  color: var(--texto); font-family: var(--fonte); font-size: 15px; font-weight: 500;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all 0.15s;
}
.familia-btn.principal { background: var(--verde); color: #fff; border-color: var(--verde); }

/* ── Configurações ── */
.tela-config {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.6); align-items: flex-end; justify-content: center;
}
.tela-config.active { display: flex; }
.config-card {
  background: var(--superficie); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.5rem 1.25rem; width: 100%; max-width: 480px;
  max-height: 90dvh; overflow-y: auto;
}
.config-secao { margin-bottom: 1.5rem; }
.config-secao-titulo {
  font-size: 11px; font-weight: 600; color: var(--texto-sec);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px;
}
.config-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 0.5px solid var(--borda); gap: 12px;
}
.config-label { font-size: 14px; color: var(--texto-sec); }
.config-valor { font-size: 14px; font-weight: 500; color: var(--texto); }
.config-membro-badge {
  display: inline-block; font-size: 12px; font-weight: 500;
  background: var(--verde-claro); color: var(--verde-texto);
  border: 0.5px solid var(--verde); padding: 3px 10px; border-radius: 99px; margin: 2px;
}
.btn-copiar-codigo {
  display: flex; align-items: center; gap: 6px; padding: 7px 12px;
  border-radius: var(--radius-sm); border: 0.5px solid var(--borda-forte);
  background: var(--superficie); color: var(--texto-sec);
  font-family: var(--fonte); font-size: 13px; cursor: pointer; transition: all 0.15s;
}
.btn-copiar-codigo:hover { border-color: var(--verde); color: var(--verde); }
.btn-sair {
  width: 100%; display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 13px; border-radius: var(--radius-md);
  border: 0.5px solid var(--borda-forte); background: none;
  color: var(--verm); font-family: var(--fonte); font-size: 15px; font-weight: 500; cursor: pointer;
}

/* ── Bolinha de cor nas barras ── */
.bolinha-cat {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; display: inline-block;
}
.barra-cat-label { display: flex; align-items: center; gap: 7px; }

/* ── Logo na tela de login ── */
.login-logo-wrap {
  margin: 0 auto 1.25rem;
  width: 180px; height: 180px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
}
.login-logo-img {
  width: 180px; height: 180px;
  object-fit: contain;
  display: block;
}

/* ── Logo no header ── */
.header-logo {
  width: 28px; height: 28px;
  object-fit: contain;
  border-radius: 6px;
  background: #000;
  display: block;
}
