/* =========================================================
   PAGAMENTOS — cabeçalho compacto com período, card "Vai entrar",
   resumo da semana, plano em linhas e bottom sheets.
   Mobile primeiro; usa só os tokens (cores, espaços, raios).
   ========================================================= */

.num { font-variant-numeric: tabular-nums; }
.verde { color: var(--green); }
.terra { color: var(--terra); }

/* ---------- Cabeçalho compacto ---------- */
.ph-compact { gap: var(--s2); }
.ph-top { display: flex; align-items: center; justify-content: space-between; min-height: 36px; }
.ph-top h1 { font-size: var(--t-lg); font-weight: 700; letter-spacing: -.01em; }
.periodo { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: 4px; border-radius: var(--r-full); background: var(--surface); box-shadow: var(--shadow); }
.periodo-btn { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); cursor: pointer; transition: background .15s; }
.periodo-btn:active, .periodo-btn:hover { background: var(--surface-2); }
.periodo-txt { display: grid; justify-items: center; text-align: center; line-height: 1.2; }
.periodo-txt b { font-size: var(--t-md); font-weight: 700; white-space: nowrap; }
.periodo-txt small { font-size: var(--t-xs); color: var(--ink-3); }

/* Cards da página: padding 16, raio 20 */
.rc-card, .resumo-sem, .plano-card { padding: var(--s4); border-radius: var(--r-lg); }
.rs-lbl { display: block; font-size: var(--t-xs); color: var(--ink-2); font-weight: 500; }

/* ---------- Vai entrar ---------- */
.rc-card { display: grid; gap: var(--s2); }
.rc-topo { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s2); }
.rc-total { display: block; font-size: 30px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.piso-pill { flex: none; padding: 4px 10px; border-radius: var(--r-full); font-size: var(--t-xs); font-weight: 600; white-space: nowrap; }
.piso-pill.ok { background: var(--green-soft); color: var(--green); }
.piso-pill.warn { background: var(--terra-soft); color: var(--terra); }
.rc-card .track.thin { margin: 2px 0 var(--s1); }

.rc-lista { list-style: none; margin: 0; padding: 0; }
.rc-linha { display: grid; grid-template-columns: 32px 1fr auto auto; align-items: center; column-gap: var(--s2); padding: 10px 0; border-top: 1px solid var(--line); }
.rc-lista > .rc-linha:first-child { border-top: 0; }
.rc-ic { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); }
.rc-txt { display: grid; min-width: 0; line-height: 1.25; }
.rc-nome { font-weight: 600; font-size: var(--t-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-sub { font-size: var(--t-xs); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-dir { display: grid; justify-items: end; line-height: 1.2; }
.rc-dir b { font-size: var(--t-sm); white-space: nowrap; }
.rc-st { font-size: 11px; color: var(--ink-3); }
.rc-st.ok { color: var(--green); }
.rc-st.warn { color: var(--amber); font-weight: 600; }
.rc-menu { width: 36px; height: 40px; margin-right: -8px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--ink-3); cursor: pointer; }
.rc-menu:active, .rc-menu:hover { background: var(--surface-2); color: var(--ink); }
/* Linha com "Confirmar": o botão vai para uma segunda linha alinhada ao texto */
.rc-linha .pill { grid-column: 2 / 4; grid-row: 2; justify-self: start; margin-top: 6px; }
.pill { padding: 6px 14px; border: 0; border-radius: var(--r-full); font-weight: 600; font-size: var(--t-xs); cursor: pointer; }
.pill.ok { background: var(--green); color: #fff; }

.rc-acoes { display: flex; justify-content: space-between; align-items: center; padding-top: var(--s2); border-top: 1px solid var(--line); }
.txt-acao { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 4px; border: 0; background: none; color: var(--green); font-weight: 600; font-size: var(--t-sm); text-decoration: none; cursor: pointer; }
.txt-acao:last-child { color: var(--ink-2); }

/* ---------- Resumo da semana ---------- */
.resumo-sem { display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; gap: var(--s3); }
.rs-disp b { display: block; font-size: 26px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; white-space: nowrap; }
.rs-mini { display: grid; gap: 6px; padding-left: var(--s3); border-left: 1px solid var(--line); }
.rs-mini b { font-size: var(--t-sm); white-space: nowrap; }

/* ---------- Plano de pagamento ---------- */
.plano-card { display: grid; gap: var(--s1); }
.plano-card .card-head { margin: 0; }
.plano-card .card-head h2 { font-size: var(--t-md); }
.plano-card .card-head .total { font-size: var(--t-xs); color: var(--ink-3); }
.pl-lista { list-style: none; margin: 0; padding: 0; }
.pl-linha { display: grid; grid-template-columns: 22px 1fr auto 28px; align-items: center; column-gap: var(--s2); padding: 10px 0; border-top: 1px solid var(--line); transition: opacity .2s; }
.pl-lista > .pl-linha:first-child { border-top: 0; }
.pl-n { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--ink-2); font-size: 11px; font-weight: 700; }
.pl-txt { display: grid; min-width: 0; line-height: 1.25; }
/* Nome: até 2 linhas antes de cortar (nomes longos como "Capital One Silver — mínimo") */
.pl-nome { font-weight: 600; font-size: var(--t-sm); overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: anywhere; }
.pl-sub { font-size: var(--t-xs); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-dir { display: grid; justify-items: end; row-gap: 3px; line-height: 1.2; }
.pl-dir b { font-size: var(--t-sm); white-space: nowrap; }
/* Controle compacto: caixinha + estado, juntos (5px), alinhados à direita sob o valor */
.pl-ctrl { position: relative; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-size: 11px; color: var(--ink-3); white-space: nowrap; -webkit-tap-highlight-color: transparent; }
.pl-ctrl::before { content: ""; position: absolute; inset: -11px -4px; } /* área de toque ≈ 40px de altura */
.pl-ctrl .check { position: relative; z-index: 1; width: 18px; height: 18px; border-width: 1.5px; }
.pl-st { font-size: 11px; color: var(--ink-3); }
.pl-st.ok { color: var(--green); font-weight: 700; }
.pl-st.terra { color: var(--terra); font-weight: 600; }
.pl-st.lilac { color: var(--lilac); }
.pl-ctrl:has(.check:focus-visible) { outline: 3px solid var(--lilac); outline-offset: 3px; border-radius: 8px; }
.pl-ctrl .check:focus-visible { outline: 0; }
/* Paga: o "✓ Paga" já diz o estado; nome legível em tom secundário, sem riscado */
.pl-linha.done .pl-nome { color: var(--ink-2); }
.pl-linha.done .pl-dir b { color: var(--ink-2); }
/* Agendada: contorno lilás tracejado (ainda não saiu; marcar = confirmar) */
.pl-linha .check[data-confirmar] { border-style: dashed; border-color: var(--lilac); }
.pl-ctrl:hover .check[data-confirmar] { border-style: solid; }
.pl-linha.done .pl-n { background: var(--green-soft); color: var(--green); }

/* ---------- Bottom sheet (ações e formulários) ---------- */
.sheet h2 { font-size: var(--t-md); margin: 0; }
.sheet-acoes { display: grid; gap: 4px; }
.sheet-acoes > button, .sheet-acoes > a { all: unset; box-sizing: border-box; display: flex; align-items: center; min-height: 48px; padding: 0 var(--s4); border-radius: var(--r-md); background: var(--surface-2); font-weight: 600; color: var(--ink); cursor: pointer; }
.sheet-acoes > .danger { color: var(--terra); }
.sheet-acoes > .neutro { justify-content: center; background: transparent; color: var(--ink-2); }
.sheet-form { display: grid; gap: var(--s3); }
@media (prefers-reduced-motion: no-preference) {
  .sheet-backdrop { animation: fade .18s ease-out; }
  @keyframes fade { from { opacity: 0; } }
}

/* Telas bem estreitas (iPhone SE / mini) */
@media (max-width: 360px) {
  .rc-total { font-size: 26px; }
  .rs-disp b { font-size: 22px; }
  .rc-ic { display: none; }
  .rc-linha { grid-template-columns: 1fr auto auto; }
  .rc-linha .pill { grid-column: 1 / 3; }
}
/* Desktop: mais respiro, mesma estrutura */
@media (min-width: 720px) {
  .rc-total { font-size: 34px; }
  .rs-disp b { font-size: 30px; }
}

/* Resumo numa linha só: Disponível em destaque + entradas e saídas */
.resumo-sem { grid-template-columns: 1.3fr 1fr 1fr; gap: var(--s2); padding: var(--s3) var(--s4); }
.rs-disp b { font-size: 22px; }
.rs-mini { gap: 2px; padding-left: var(--s2); }
.rs-mini b { font-size: var(--t-xs); font-weight: 700; }
.rc-linha { padding: 8px 0; }
.rc-card { gap: 6px; }
.ph-top .alert-btn { width: 36px; height: 36px; }
@media (max-width: 360px) { .rs-disp b { font-size: 19px; } }
