/* ============ Título do mês: toca e abre a roda ============ */
.mes-titulo-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; max-width: 100%;
  padding: 0.1rem 0.5rem; margin: 0; border: 0; border-radius: 6px; background: none; color: inherit;
  font: inherit; letter-spacing: inherit; line-height: inherit; cursor: pointer; transition: color 0.15s, background 0.15s;
}
.mes-titulo-btn > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mes-titulo-btn .mes-titulo-ic { flex: none; width: 0.9rem; height: 0.9rem; color: var(--ouro, var(--acento)); opacity: 0.75; transition: transform 0.2s; }
@media (hover: hover) { .mes-titulo-btn:hover { color: var(--ouro-claro, var(--tx)); background: var(--ouro-fundo, rgba(127, 127, 127, 0.08)); } }
@media (hover: hover) { .mes-titulo-btn:hover .mes-titulo-ic { opacity: 1; transform: translateY(1px); } }
.mes-titulo-btn:focus-visible { outline: 2px solid var(--ouro, var(--acento)); outline-offset: 2px; }

/* ============ Roda de meses ============ */
.modal-roda .modal-corpo { padding-top: 0.25rem; overflow: visible; }
.roda-moldura { position: relative; height: calc(var(--alt) * var(--vis)); margin: 0 -0.25rem; }
.roda {
  position: relative; height: 100%; overflow-y: auto; overscroll-behavior: contain; scroll-snap-type: y mandatory;
  scrollbar-width: none; outline: none; perspective: 520px; perspective-origin: 50% 50%; touch-action: pan-y;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 34%, #000 66%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 34%, #000 66%, transparent 100%);
}
.roda::-webkit-scrollbar { display: none; }
.roda-lista { list-style: none; margin: 0; padding: calc(var(--alt) * (var(--vis) - 1) / 2) 0; transform-style: preserve-3d; }
.roda-item {
  position: relative; height: var(--alt); display: flex; align-items: center; justify-content: center; gap: 0.45rem;
  scroll-snap-align: center; scroll-snap-stop: normal; cursor: pointer; user-select: none; -webkit-user-select: none;
  font-family: var(--serif, inherit); font-size: 1.3rem; font-weight: 500; color: var(--tx2); letter-spacing: 0.01em;
  transform-origin: 50% 50%; will-change: transform, opacity; backface-visibility: hidden;
}
.roda-a { font-size: 0.86em; color: var(--tx3); font-variant-numeric: lining-nums tabular-nums; }
.roda-sel { color: var(--ouro-claro, var(--tx)); font-weight: 600; }
.roda-sel .roda-a { color: var(--ouro, var(--tx2)); }
.roda-ponto { position: absolute; right: 1.1rem; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--ouro, var(--acento)); box-shadow: 0 0 0 3px var(--ouro-fundo, transparent); }
/* virada de ano: um filete discreto acima de janeiro */
.roda-jan::before { content: ''; position: absolute; left: 32%; right: 32%; top: 0; height: 1px; background: var(--borda2); }

/* faixa do meio: fundo dourado suave e filetes dourados em cima e embaixo */
.roda-faixa {
  position: absolute; left: 0; right: 0; top: 50%; height: var(--alt); margin-top: calc(var(--alt) / -2); pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--ouro-fundo, rgba(127, 127, 127, 0.08)) 18%, var(--ouro-fundo, rgba(127, 127, 127, 0.08)) 82%, transparent);
}
.roda-faixa::before, .roda-faixa::after {
  content: ''; position: absolute; left: 0; right: 0; height: 1px; background: var(--filete, var(--borda3));
}
.roda-faixa::before { top: 0; }
.roda-faixa::after { bottom: 0; }
.roda-faixa::before, .roda-faixa::after { opacity: 0.75; transition: opacity 0.2s; }
.roda-moldura:has(.roda:focus-visible) .roda-faixa::before, .roda-moldura:has(.roda:focus-visible) .roda-faixa::after { opacity: 1; }
.roda-hoje-btn .ic { width: 1rem; height: 1rem; }

/* ============ Resumo: Saldo atual × Saldo previsto ============ */
.kpi-heroi-duplo { flex-direction: row; gap: 0; padding: 0; }
.heroi-lado { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; padding: var(--e5) var(--e5) var(--e4); }
.heroi-dir { align-items: flex-end; text-align: right; position: relative; }
.heroi-dir::before {
  content: ''; position: absolute; left: 0; top: 18%; bottom: 18%; width: 1px;
  background: linear-gradient(180deg, transparent, var(--ouro-borda, var(--borda2)), transparent);
}
.heroi-lado .kpi-valor { max-width: 100%; }
.heroi-lado .kpi-valor.txt-ruim { color: var(--ruim); }
@media (min-width: 901px) {
  .kpis-mes:has(> .kpi-heroi-duplo) { grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr)); }
  .kpis-mes > .kpi-heroi-duplo { order: -1; }
  .roda-item { font-size: 1.4rem; }
}
@media (max-width: 900px) {
  .casca .kpis-mes > .kpi-heroi-duplo { padding: 0; }
  .casca .kpi-heroi-duplo .heroi-lado { padding: 0.15rem 0.95rem 0.9rem; gap: 0.1rem; }
  .casca .kpi-heroi-duplo .kpi-sub { font-size: 0.72rem; color: var(--tx3); }
  .casca .kpi-heroi-duplo .heroi-dir::before { top: 0.35rem; bottom: 0.8rem; }
  /* celular: a roda abre como folha inferior, um pouco mais alta e com respiro para o polegar */
  .modal-roda { width: 100%; }
  .modal-roda .roda-moldura { --vis: 5; margin: 0; }
  .modal-roda .roda-item { font-size: 1.35rem; }
  .modal-roda .modal-rodape { flex-wrap: nowrap; }
  .modal-roda .rodape-extra { margin-right: 0; }
  .modal-roda .modal-rodape .btn { flex: 1 1 0; padding: 0 0.6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .roda { scroll-behavior: auto; }
  .roda-item { will-change: auto; }
  .mes-titulo-btn, .mes-titulo-btn .mes-titulo-ic { transition: none; }
}
/* desktop estreito: o cartão dos saldos ocupa a linha de cima e os quatro números vêm embaixo */
@media (min-width: 901px) and (max-width: 1299px) {
  .kpis-mes:has(> .kpi-heroi-duplo) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpis-mes > .kpi-heroi-duplo { grid-column: 1 / -1; }
}
/* celular: o título cabe inteiro mesmo com fonte grande (setinha menor e sem respiro lateral) */
@media (max-width: 900px) {
  .casca .mes-titulo-btn { padding: 0.1rem 0.15rem; gap: 0.25rem; letter-spacing: 0; }
  .casca .mes-titulo-btn .mes-titulo-ic { width: 0.7rem; height: 0.7rem; }
}
