:root {
  --cf-cor: #0f766e;
  --cf-cor-escura: #0b4f4a;
  --cf-fundo: #f3f6f6;
  --cf-receita: #198754;
  --cf-despesa: #dc3545;
  --bs-primary: #0f766e;
  --bs-primary-rgb: 15, 118, 110;
}
body {
  background: var(--cf-fundo);
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
.btn-primary { --bs-btn-bg: var(--cf-cor); --bs-btn-border-color: var(--cf-cor); --bs-btn-hover-bg: var(--cf-cor-escura); --bs-btn-hover-border-color: var(--cf-cor-escura); --bs-btn-active-bg: var(--cf-cor-escura); }
.cf-topo {
  position: sticky; top: 0; z-index: 1020;
  display: flex; justify-content: space-between; align-items: center;
  background: var(--cf-cor); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
}
.cf-btn-sync { color: #fff; border: 1px solid rgba(255,255,255,.4); font-size: .8rem; }
.cf-btn-sync.girando i { display: inline-block; animation: cfGira 1s linear infinite; }
@keyframes cfGira { to { transform: rotate(360deg); } }
.cf-aviso { background: #fff3cd; color: #664d03; font-size: .85rem; padding: 8px 14px; }
.cf-mes {
  display: flex; justify-content: center; align-items: center; gap: 8px;
  background: #fff; border-bottom: 1px solid #e3e8e8; padding: 2px 0;
}
.cf-mes strong { min-width: 150px; text-align: center; text-transform: capitalize; }
.cf-mes .btn-link { color: var(--cf-cor); font-size: 1.2rem; }
.cf-conteudo { max-width: 860px; padding-top: 12px; }
.cf-card { background: #fff; border-radius: 14px; padding: 14px; margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.cf-card h6 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: #6c757d; margin-bottom: 10px; }
.cf-resumo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cf-resumo div { background: #fff; border-radius: 12px; padding: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.cf-resumo small { color: #6c757d; display: block; font-size: .72rem; }
.cf-resumo strong { font-size: 1rem; white-space: nowrap; }
.cf-pos { color: var(--cf-receita); }
.cf-neg { color: var(--cf-despesa); }
.cf-barra { height: 8px; background: #e9ecef; border-radius: 4px; overflow: hidden; }
.cf-barra > span { display: block; height: 100%; background: var(--cf-cor); }
.cf-cat-linha { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; margin-bottom: 9px; font-size: .9rem; }
.cf-cat-linha .cf-barra { grid-column: 1 / 3; }
.cf-ponto { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.cf-dia { font-size: .75rem; color: #6c757d; text-transform: uppercase; margin: 12px 4px 4px; }
.cf-item {
  display: flex; align-items: center; gap: 10px;
  background: #fff; padding: 10px 12px; border-bottom: 1px solid #f0f2f2; cursor: pointer;
}
.cf-lista { border-radius: 12px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.cf-item:last-child { border-bottom: 0; }
.cf-item .cf-ic { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; flex: none; font-size: .95rem; }
.cf-item .cf-txt { flex: 1; min-width: 0; }
.cf-item .cf-txt div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cf-item .cf-txt small { color: #6c757d; }
.cf-item .cf-val { font-weight: 600; white-space: nowrap; }
.cf-item.pendente-sync .cf-txt small::after { content: " · aguardando envio"; color: #b58105; }
.cf-item .form-check-input { width: 1.4em; height: 1.4em; margin: 0; flex: none; }
.cf-item.pago .cf-txt div { text-decoration: line-through; color: #6c757d; }
.cf-grupo { font-size: .78rem; font-weight: 600; color: #495057; margin: 12px 4px 4px; display: flex; justify-content: space-between; }
.cf-fab {
  position: fixed; right: 18px; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 1030;
  width: 56px; height: 56px; border-radius: 50%; font-size: 1.6rem;
  background: var(--cf-cor); color: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.25);
}
.cf-fab:hover, .cf-fab:active { background: var(--cf-cor-escura); color: #fff; }
.cf-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: #fff; border-top: 1px solid #e3e8e8; padding-bottom: env(safe-area-inset-bottom);
}
.cf-nav button { border: 0; background: none; padding: 8px 2px 7px; color: #6c757d; font-size: .68rem; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cf-nav button i { font-size: 1.25rem; }
.cf-nav button.ativo { color: var(--cf-cor); font-weight: 600; }
.cf-vazio { text-align: center; color: #6c757d; padding: 30px 10px; }
.cf-vazio i { font-size: 2rem; display: block; margin-bottom: 6px; }
.cf-tabela { font-size: .85rem; }
.cf-tabela td, .cf-tabela th { white-space: nowrap; }
.cf-insight { display: flex; gap: 10px; margin-bottom: 10px; font-size: .9rem; }
.cf-insight i { color: var(--cf-cor); font-size: 1.1rem; }
.cf-colunas { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 10px; }
.cf-colunas .col-b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: .62rem; color: #6c757d; }
.cf-colunas .col-b span { width: 100%; max-width: 26px; background: var(--cf-cor); border-radius: 4px 4px 0 0; min-height: 2px; }
.cf-colunas .col-b.atual span { background: #f59f00; }
.cf-previa { max-height: 50vh; overflow: auto; font-size: .82rem; }
.cf-previa select { font-size: .8rem; padding: 2px 24px 2px 6px; }
@media (min-width: 768px) {
  .cf-resumo strong { font-size: 1.3rem; }
  .cf-nav { max-width: 860px; margin: 0 auto; border-radius: 14px 14px 0 0; }
}

/* Telas cheias: login e acesso não liberado */
.cf-tela-cheia { display: none; position: fixed; inset: 0; z-index: 3000; background: var(--cf-fundo); overflow: auto; padding: 24px 16px; }
.cf-tela-cheia .cf-caixa { max-width: 380px; margin: 8vh auto 0; background: #fff; border-radius: 18px; padding: 28px 22px; text-align: center; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.cf-cadeado { font-size: 2.6rem; color: var(--cf-cor); }
body.modo-login #cfTelaLogin, body.modo-bloqueio #cfTelaBloqueio { display: block; }
body.modo-login > :not(#cfTelaLogin):not(.toast-container):not(script),
body.modo-bloqueio > :not(#cfTelaBloqueio):not(.toast-container):not(script),
body.cf-carregando > :not(.toast-container):not(script) { visibility: hidden; }
body.modo-login .modal, body.modo-bloqueio .modal { display: none !important; }
