/* ==========================================================================
   Finanças do Jorge: sistema visual aprovado no protótipo (pasta referencia-visual).
   Verde-esmeralda, tema claro e escuro automático, fonte Manrope.
   ========================================================================== */

/* ---------- Fonte (guardada no projeto, não usa internet) ---------- */
@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

/* ---------- Cores (nomes iguais aos do protótipo) ---------- */
:root {
  --bg: #F3F7F4;
  --surface: #FFFFFF;
  --surface2: #E9F1EC;
  --track: #D6E4DB;
  --text: #0F1F1A;
  --muted: #55665E;
  --line: #DFE8E2;
  --accent: #047857;
  --accent-fill: #059669;
  --accent-soft: #DAF3E7;
  --on-accent: #FFFFFF;
  --warn: #92400E;
  --warn-fill: #F59E0B;
  --warn-soft: #FEF0D3;
  --bad: #B42318;
  --bad-soft: #FDE8E6;
  --shadow: 0 1px 2px rgba(15, 31, 26, .06), 0 8px 20px rgba(15, 31, 26, .05);
  /* extras do sistema (não aparecem no protótipo, mas seguem a mesma paleta) */
  --bg-fora: #E4ECE7;
  --nav-bg: rgba(255, 255, 255, .86);
  --fundo-folha: rgba(8, 20, 14, .42);
  --toast-bg: #0F1F1A;
  --toast-fg: #F3F7F4;
  --toast-acao: #6EE7B7;
  color-scheme: light;

  --fonte: "Manrope", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto,
    "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

:root[data-fonte="aparelho"] {
  --fonte: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto,
    "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

:root[data-tema="escuro"] {
  --bg: #0B1310;
  --surface: #131E19;
  --surface2: #1B2A23;
  --track: #26392F;
  --text: #E9F2ED;
  --muted: #9BB0A5;
  --line: #243830;
  --accent: #34D399;
  --accent-fill: #34D399;
  --accent-soft: #12372A;
  --on-accent: #04241A;
  --warn: #FBBF24;
  --warn-fill: #F59E0B;
  --warn-soft: #33260A;
  --bad: #FF9A90;
  --bad-soft: #3A1916;
  --shadow: none;
  --bg-fora: #070D0B;
  --nav-bg: rgba(19, 30, 25, .86);
  --fundo-folha: rgba(0, 0, 0, .6);
  --toast-bg: #E9F2ED;
  --toast-fg: #0B1310;
  --toast-acao: #047857;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root[data-tema="auto"] {
    --bg: #0B1310;
    --surface: #131E19;
    --surface2: #1B2A23;
    --track: #26392F;
    --text: #E9F2ED;
    --muted: #9BB0A5;
    --line: #243830;
    --accent: #34D399;
    --accent-fill: #34D399;
    --accent-soft: #12372A;
    --on-accent: #04241A;
    --warn: #FBBF24;
    --warn-fill: #F59E0B;
    --warn-soft: #33260A;
    --bad: #FF9A90;
    --bad-soft: #3A1916;
    --shadow: none;
    --bg-fora: #070D0B;
    --nav-bg: rgba(19, 30, 25, .86);
    --fundo-folha: rgba(0, 0, 0, .6);
    --toast-bg: #E9F2ED;
    --toast-fg: #0B1310;
    --toast-acao: #047857;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg-fora);
  color: var(--text);
  font-family: var(--fonte);
  font-size: 16px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

body.travado { overflow: hidden; }

button, input, select, textarea { font-family: inherit; }
button, a { touch-action: manipulation; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }

:focus-visible { outline: 2px solid var(--accent-fill); outline-offset: 2px; }

[hidden] { display: none !important; }

.so-leitor {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.icone { flex: none; }

/* ---------- Estrutura da tela ---------- */
.app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

@media (min-width: 560px) {
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

.conteudo {
  flex: 1 0 auto;
  padding: max(36px, calc(env(safe-area-inset-top) + 16px)) 20px 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.bloco { display: flex; flex-direction: column; gap: 18px; }
.grupo { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Cabeçalho de tela ---------- */
.cabecalho {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.cabecalho-linha { font-size: 14px; font-weight: 600; color: var(--muted); }
.cabecalho h1,
.titulo-grande {
  margin: 2px 0 0 0;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -.02em;
}

/* O "Voltar" é pequeno de olhar, mas a área de toque tem 44 px de altura (margem negativa
   compensa a altura extra para o desenho não mudar). */
.voltar {
  display: inline-flex; align-items: center; gap: 2px;
  min-height: 44px; margin: -10px 0 -10px -8px; padding: 0 12px 0 4px;
  font-size: 14px; font-weight: 700; color: var(--accent); text-decoration: none;
}

.btn-icone {
  width: 44px; height: 44px; flex: none;
  border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; text-decoration: none; padding: 0;
}

/* ---------- Botões ---------- */
.btn {
  min-height: 48px; padding: 0 20px;
  border-radius: 14px; border: 0;
  background: var(--accent); color: var(--on-accent);
  font-size: 15px; font-weight: 800; line-height: 1.25; text-align: center;
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-suave {
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font-weight: 700;
}
.btn-perigo {
  border: 1px solid var(--line); background: var(--surface);
  color: var(--bad); font-weight: 700;
}
/* primeiro toque em "apagar": o botão fica vermelho e pede o segundo toque */
.btn.armado { background: var(--bad); border-color: var(--bad); color: var(--bad-soft); font-weight: 800; }
.btn-peq { min-height: 44px; padding: 0 16px; font-size: 14px; }
.btn-grande { min-height: 54px; font-size: 16px; }
.btn-largo { width: 100%; }
.btn-texto {
  min-height: 44px; padding: 0 8px; border: 0; background: transparent;
  color: var(--accent); font-size: 15px; font-weight: 800; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
.btn-texto.perigo { color: var(--bad); }
.linha-de-botoes { display: flex; gap: 10px; }
.linha-de-botoes > * { flex: 1; }

/* ---------- Cartões ---------- */
.cartao {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex; flex-direction: column; gap: 14px;
}
.cartao-grande { padding: 20px; }
.cartao h2 { font-size: 16px; font-weight: 800; }
.texto-apoio { font-size: 13px; font-weight: 500; line-height: 1.45; color: var(--muted); }
.texto-corpo { font-size: 15px; font-weight: 500; line-height: 1.5; color: var(--muted); }
.texto-corpo b, .texto-apoio b { color: var(--text); font-weight: 800; }

.rotulo {
  font-size: 13px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.rotulo.atrasada { color: var(--bad); }

/* ---------- Linha de vencimento ---------- */
.linha {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 14px 14px 14px 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  transition: opacity .22s ease, transform .22s ease, max-height .26s ease .06s,
    padding .26s ease .06s, margin .26s ease .06s, border-width .26s ease .06s;
  max-height: 200px;
}
.linha.atrasada {
  background: var(--bad-soft);
  border-color: var(--bad);
  box-shadow: none;
}
.linha.saindo {
  opacity: 0; transform: translateX(28px);
  max-height: 0; padding-top: 0; padding-bottom: 0; margin-top: -10px; border-width: 0;
}
.linha-texto { min-width: 0; text-decoration: none; color: inherit; display: block; }
.linha-titulo { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.linha-sub {
  margin-top: 2px; font-size: 13px; font-weight: 600; color: var(--muted);
  display: flex; align-items: center; gap: 5px;
}
.linha.atrasada .linha-sub { color: var(--bad); }
.linha-valor { text-align: right; font-size: 17px; font-weight: 800; white-space: nowrap; }
.linha > form { grid-column: 3; margin: 0; display: flex; }

/* linhas de lista dentro de cartões (Contas do mês, listas de Ajustes) */
.lista {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.lista-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; min-height: 60px;
  border-top: 1px solid var(--line);
  text-decoration: none; color: var(--text);
  background: transparent; width: 100%; text-align: left;
  border-left: 0; border-right: 0; border-bottom: 0; font-size: inherit; cursor: pointer;
}
.lista > :first-child { border-top: 0; }
.lista-item.atrasada { background: var(--bad-soft); }
.caixa-icone {
  width: 44px; height: 44px; flex: none; border-radius: 14px;
  background: var(--surface2); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.lista-corpo { flex: 1; min-width: 0; }
.lista-titulo { font-size: 16px; font-weight: 800; overflow-wrap: anywhere; }
.lista-sub { margin-top: 2px; font-size: 13px; font-weight: 600; color: var(--muted); }
.lista-sub.alinhado { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lista-sub .valor-inline { color: var(--text); font-weight: 800; }
.lista-item.atrasada .lista-sub { color: var(--bad); }
.lista-valor { font-size: 17px; font-weight: 800; white-space: nowrap; }
.lista-seta { color: var(--muted); display: flex; }

/* ---------- Chips ---------- */
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 10px;
  background: var(--surface2); color: var(--muted);
  font-size: 12px; font-weight: 800; line-height: 1.3; white-space: nowrap;
}
.chip.verde { background: var(--accent-soft); color: var(--accent); }
.chip.ambar { background: var(--warn-soft); color: var(--warn); }
.chip.ruim { background: var(--bad-soft); color: var(--bad); }

/* ---------- Alternador (7 / 15 / 30 dias) ---------- */
.segmentado {
  display: flex; padding: 4px; border-radius: 14px; background: var(--surface2);
  gap: 0;
}
.segmentado > button,
.segmentado > label > span {
  flex: 1; min-height: 44px; border: 0; border-radius: 11px;
  background: transparent; color: var(--muted);
  font-size: 14px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 0 6px; width: 100%;
}
.segmentado > label { flex: 1; display: flex; position: relative; }
.segmentado input[type="radio"] {
  position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer;
}
.segmentado > button.ativo,
.segmentado input:checked + span {
  background: var(--surface); color: var(--text); font-weight: 800; box-shadow: var(--shadow);
}
.segmentado input:focus-visible + span { outline: 2px solid var(--accent-fill); outline-offset: 1px; }
.segmentado form { display: contents; }

/* ---------- Barra de progresso ---------- */
.barra { position: relative; height: 12px; border-radius: 12px; background: var(--track); }
.barra.g { height: 16px; border-radius: 16px; }
.barra.p { height: 8px; border-radius: 8px; }
.barra-cheia {
  height: 100%; border-radius: inherit; background: var(--accent-fill);
  transform-origin: left center; animation: encher .6s ease-out both;
}
.barra-risco {
  position: absolute; top: -5px; bottom: -5px; width: 3px; border-radius: 2px;
  background: var(--text); opacity: .75;
}
@keyframes encher { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- Blocos de aviso ---------- */
.bloco-aviso, .bloco-info, .bloco-bom {
  border-radius: 14px; padding: 12px 14px;
  font-size: 14px; font-weight: 700; line-height: 1.4;
}
.bloco-aviso { background: var(--warn-soft); color: var(--warn); }
.bloco-info { background: var(--surface2); color: var(--muted); font-weight: 600; }
.bloco-bom { background: var(--accent-soft); color: var(--accent); }

/* ---------- Tela vazia ---------- */
.vazio {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 12px; padding: 24px 12px;
}
.vazio .caixa-icone { width: 56px; height: 56px; border-radius: 18px; background: var(--accent-soft); }
.vazio p { font-size: 15px; font-weight: 500; line-height: 1.5; color: var(--muted); max-width: 30ch; }
.vazio .vazio-titulo { font-size: 17px; font-weight: 800; color: var(--text); }

/* ---------- Atalhos quadrados da tela Início ---------- */
.atalhos { display: flex; gap: 10px; }
.atalho {
  flex: 1; min-height: 76px; border-radius: 18px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow);
  text-decoration: none; padding: 0;
}
.atalho .icone { color: var(--accent); }

/* ---------- Menu de baixo ---------- */
.menu {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; padding: 8px 10px max(10px, env(safe-area-inset-bottom)) 10px;
  background: var(--surface); border-top: 1px solid var(--line);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .menu {
    background: var(--nav-bg);
    -webkit-backdrop-filter: saturate(1.5) blur(16px);
    backdrop-filter: saturate(1.5) blur(16px);
  }
}
.menu a {
  flex: 1; min-height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; font-size: 12px; font-weight: 700; color: var(--muted);
}
.menu .pilula { padding: 4px 18px; border-radius: 14px; background: transparent; display: flex; transition: background .15s ease; }
.menu a[aria-current="page"] { color: var(--accent); }
.menu a[aria-current="page"] .pilula { background: var(--accent-soft); }

/* ---------- Formulários ---------- */
.formulario { display: flex; flex-direction: column; gap: 16px; }
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo > label, .campo > .rotulo-campo { font-size: 14px; font-weight: 700; color: var(--muted); }
.campo input[type="text"], .campo input[type="password"], .campo input[type="number"],
.campo input[type="date"], .campo input[type="datetime-local"], .campo input[type="email"], .campo input[type="search"],
.campo select, .campo textarea {
  width: 100%; min-height: 48px; padding: 0 14px;
  border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  font-size: 16px; font-weight: 600;
  -webkit-appearance: none; appearance: none;
}
.campo input[type="date"], .campo input[type="datetime-local"] { min-width: 0; display: block; text-align: left; line-height: 46px; }
.campo input::-webkit-date-and-time-value { text-align: left; }
/* iPhone: o campo de data vazio aparece em branco; esta dica só vale para o iPhone. */
@supports (-webkit-touch-callout: none) {
  .campo input[type="date"]:required:invalid::before {
    content: "Toque para escolher a data"; color: var(--muted); font-weight: 500;
  }
}
.campo input::placeholder { color: var(--muted); opacity: .7; font-weight: 500; }
.campo select {
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2355665E' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
:root[data-tema="escuro"] .campo select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%239BB0A5' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root[data-tema="auto"] .campo select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%239BB0A5' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  }
}
.campo input:focus, .campo select:focus, .campo textarea:focus {
  outline: 2px solid var(--accent-fill); outline-offset: 0; border-color: var(--accent-fill);
}
.campo.com-erro input, .campo.com-erro select { border-color: var(--bad); }
.campo-ajuda { font-size: 13px; font-weight: 500; line-height: 1.4; color: var(--muted); }
.campo-erro {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: 13px; font-weight: 700; line-height: 1.35; color: var(--bad);
}
.campo-erro .icone { margin-top: 1px; }
.erro-geral {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--bad-soft); color: var(--bad); border: 1px solid var(--bad);
  border-radius: 14px; padding: 12px 14px; font-size: 14px; font-weight: 700;
}

.campo-reais { position: relative; }
.campo-reais .prefixo {
  position: absolute; left: 14px; top: 0; bottom: 0;
  display: flex; align-items: center; font-size: 16px; font-weight: 700; color: var(--muted);
  pointer-events: none;
}
.campo-reais input { padding-left: 46px !important; }

.dois-campos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.dois-campos > .campo { min-width: 0; }

/* interruptor (liga/desliga) */
.troca {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  min-height: 52px; padding: 6px 0; cursor: pointer;
}
.troca-texto { font-size: 15px; font-weight: 700; }
.troca-texto small { display: block; margin-top: 2px; font-size: 13px; font-weight: 500; color: var(--muted); }
.troca input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.troca-trilho {
  position: relative; flex: none; width: 51px; height: 31px; border-radius: 16px;
  background: var(--track); transition: background .2s ease;
}
.troca-trilho::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .2s ease;
}
.troca input:checked + .troca-trilho { background: var(--accent-fill); }
.troca input:checked + .troca-trilho::after { transform: translateX(20px); }
.troca input:focus-visible + .troca-trilho { outline: 2px solid var(--accent-fill); outline-offset: 2px; }

.grupo-de-campos {
  display: flex; flex-direction: column; gap: 16px;
  padding: 14px; border-radius: 16px; background: var(--surface2);
}

/* ---------- Folha que sobe de baixo ---------- */
.folha-fundo {
  position: fixed; inset: 0; z-index: 50;
  background: var(--fundo-folha); opacity: 0; transition: opacity .2s ease;
}
.folha-fundo.aberta { opacity: 1; }
.folha {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51;
  max-width: 520px; margin: 0 auto; max-height: 92vh; max-height: 92dvh;
  background: var(--surface); color: var(--text);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 36px rgba(0, 0, 0, .2);
  display: flex; flex-direction: column;
  transform: translateY(102%); transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
.folha.aberta { transform: none; }
.folha::before {
  content: ""; flex: none; width: 40px; height: 5px; border-radius: 3px;
  background: var(--track); margin: 8px auto 0;
}
.folha-cabeca {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px 6px 20px;
}
.folha-cabeca h2 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.folha-corpo {
  padding: 8px 20px calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 16px;
}

/* ---------- Aviso rápido (toast) ---------- */
.avisos {
  position: fixed; left: 0; right: 0; bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 0 20px; pointer-events: none;
}
.avisos.sem-menu { bottom: calc(24px + env(safe-area-inset-bottom)); }
.aviso {
  pointer-events: auto; max-width: 480px; width: 100%;
  background: var(--toast-bg); color: var(--toast-fg);
  border-radius: 16px; padding: 8px 14px;
  min-height: 52px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 14px; font-weight: 700; line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  animation: entra-aviso .22s ease-out both;
}
.aviso.saindo { animation: sai-aviso .2s ease-in both; }
.aviso-texto { flex: 1; min-width: 0; padding: 4px 0; }
.aviso-acoes { flex: none; display: flex; gap: 0; margin-right: -8px; }
.aviso-acoes button {
  min-height: 44px; padding: 0 12px; border: 0; background: transparent;
  color: var(--toast-acao); font-size: 14px; font-weight: 800; cursor: pointer; border-radius: 12px;
}
@keyframes entra-aviso { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes sai-aviso { to { opacity: 0; transform: translateY(8px); } }

/* ---------- Números grandes e navegação por mês ---------- */
.rotulo-do-numero { font-size: 14px; font-weight: 700; color: var(--muted); }
.numero-grande { font-size: 40px; line-height: 1.05; font-weight: 800; letter-spacing: -.02em; }
.senha-grande {
  font-size: clamp(22px, 8vw, 36px); line-height: 1.15; font-weight: 800; letter-spacing: .02em;
  white-space: nowrap; text-align: center; font-variant-numeric: tabular-nums;
}
.lista-de-riscos { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.assistente-sair { display: flex; justify-content: center; margin-top: 8px; }
.navegar-mes { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.navegar-mes-titulo { font-size: 18px; font-weight: 800; text-align: center; }
.icone-na-linha { display: flex; }
.lista-link { text-decoration: none; color: inherit; }
.titulo-e-texto { display: flex; flex-direction: column; gap: 8px; }

/* ---------- Assistente de primeira vez e entrada ---------- */
.tela-cheia { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.passos { display: flex; flex-direction: column; gap: 10px; }
.passos-topo { display: flex; align-items: center; justify-content: space-between; min-height: 24px; }
.passos-texto { font-size: 14px; font-weight: 700; color: var(--muted); }
.assistente-acoes { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.marca {
  width: 64px; height: 64px; border-radius: 20px; background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center;
}
.entrar { justify-content: center; min-height: 100dvh; }
.marca.marca-aviso { background: var(--warn-soft); color: var(--warn); }

.sugestoes { display: flex; flex-wrap: wrap; gap: 8px; }
.sugestao {
  min-height: 44px; padding: 0 14px 0 10px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.sugestao .icone { color: var(--accent); }

.linha-editavel {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.linha-editavel-topo { display: flex; align-items: flex-end; gap: 8px; }
.linha-editavel-topo .campo { flex: 1; }

/* ---------- Ajustes ---------- */
.secao { display: flex; flex-direction: column; gap: 10px; }
.secao > .rotulo { padding-left: 4px; }
.info-linha {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 15px; font-weight: 600;
}
.info-linha span:first-child { color: var(--muted); }
.passo-a-passo { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; }
.passo-a-passo li { font-size: 15px; font-weight: 500; line-height: 1.5; color: var(--muted); }
.passo-a-passo li b { color: var(--text); }
.endereco-grande {
  font-size: clamp(15px, 4.7vw, 21px); font-weight: 800; letter-spacing: -.01em; overflow-wrap: anywhere;
  padding: 14px 16px; border-radius: 16px; background: var(--accent-soft); color: var(--accent);
}
.caminho { overflow-wrap: anywhere; }
code, .codigo {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 13px;
  background: var(--surface2); padding: 2px 6px; border-radius: 6px;
}

/* ---------- Semana do Uber (igual ao protótipo semana.html) ---------- */
.caixa-icone.verde { background: var(--accent-soft); }
.caixa-icone.ambar { background: var(--warn-soft); color: var(--warn); }
.caixa-icone.apagado { background: var(--surface2); color: var(--muted); }

.linha-numero { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.numero-gigante { font-size: 44px; line-height: 1; font-weight: 800; letter-spacing: -.02em; overflow-wrap: anywhere; }
.numero-gigante .centavos { font-size: 22px; letter-spacing: 0; color: var(--muted); }
.de-meta {
  font-size: 15px; font-weight: 600; color: var(--muted); text-decoration: underline dotted;
  text-underline-offset: 4px; text-decoration-thickness: 1.5px;
  /* a área de toque tem 44 px de altura, mas o desenho não muda */
  padding: 14px 10px; margin: -14px -10px;
}
.linha-resultado { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.resultado { font-size: 20px; font-weight: 800; color: var(--accent); }
.percentual { font-size: 15px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.nota-do-mes { font-size: 12px; font-weight: 600; }

.cartao-sequencia { gap: 16px; }
.sequencia-topo { display: flex; align-items: center; gap: 12px; }
.sequencia-titulo { font-size: 18px; font-weight: 800; }
.sequencia-sub { font-size: 13px; font-weight: 600; color: var(--muted); }
.bolinhas { display: flex; justify-content: space-between; }
.bolinha {
  width: 34px; height: 34px; flex: none; border-radius: 17px;
  display: flex; align-items: center; justify-content: center;
}
.bolinha.bateu { background: var(--accent); color: var(--on-accent); }
.bolinha.faltou { border: 2px dashed var(--track); }
.bolinha.sem_registro, .bolinha.sem_meta { border: 2px dashed var(--track); opacity: .45; }
.bolinha.atual { border: 2px solid var(--accent-fill); }
.bolinha.atual_bateu { border: 2px solid var(--accent-fill); color: var(--accent); }
.bolinhas-rotulos {
  display: flex; justify-content: space-between; gap: 4px;
  font-size: 12px; font-weight: 600; color: var(--muted);
}

.cartao-comparacao { flex-direction: row; align-items: center; gap: 14px; }
.comparacao-texto { flex: 1; min-width: 0; }
.comparacao-titulo { font-size: 15px; font-weight: 800; }
.comparacao-sub { margin-top: 2px; font-size: 13px; font-weight: 600; color: var(--muted); }
.comparacao-pct { font-size: 16px; font-weight: 800; color: var(--accent); white-space: nowrap; }
.comparacao-pct.desceu { color: var(--warn); }
.valor-junto { white-space: nowrap; }  /* "R$ 2.240" nunca se parte em duas linhas */

.cartao-previsto { gap: 18px; }
.bloco-barra { display: flex; flex-direction: column; gap: 8px; }
.bloco-barra-topo { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.bloco-barra-nome { font-size: 15px; font-weight: 800; }
.bloco-barra-previsto { font-size: 13px; font-weight: 600; color: var(--muted); text-align: right; }
.bloco-barra-base { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 700; }
.bloco-barra-base .pct { color: var(--accent); }
.sugestao-da-media { display: flex; flex-direction: column; gap: 10px; }
.dica-da-semana { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.dica-da-semana .btn-texto { padding-left: 0; min-height: 44px; }

.rotulo-da-semana { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-left: 4px; }
.lista-rodape {
  display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px;
  border-top: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--muted);
}
.lista-rodape b { color: var(--text); font-weight: 800; }

/* campo com unidade no fim (km, %) */
.campo-sufixo { position: relative; }
.campo-sufixo .sufixo {
  position: absolute; right: 14px; top: 0; bottom: 0;
  display: flex; align-items: center; font-size: 16px; font-weight: 700; color: var(--muted);
  pointer-events: none;
}
.campo-sufixo input { padding-right: 46px !important; }

/* cartão pequeno da Semana, na tela Início (igual ao protótipo index.html) */
.cartao-compacto { padding: 16px; gap: 12px; text-decoration: none; color: var(--text); }
.compacto-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.compacto-titulo { font-size: 15px; font-weight: 800; }
.compacto-pct { font-size: 14px; font-weight: 700; color: var(--accent); }
.compacto-texto { font-size: 15px; font-weight: 600; color: var(--muted); }
.compacto-texto b { color: var(--text); font-weight: 800; }
a.compacto-texto { text-decoration: none; }

/* ---------- Avisos no celular (passo a passo) ---------- */
.passos { padding-left: 22px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; font-weight: 500; line-height: 1.5; color: var(--muted); }
.passos b { color: var(--text); font-weight: 800; }
.passo-a-passo > summary { cursor: pointer; font-size: 15px; font-weight: 800; }

/* ---------- Tela Cartões (igual ao protótipo cartoes.html) ---------- */
.lista-de-cartoes { gap: 16px; }
.divisor { height: 1px; background: var(--line); }
.cartao-fatura { display: flex; flex-direction: column; }
.linha-cartao {
  display: flex; align-items: center; gap: 12px; list-style: none;
  cursor: pointer; border-radius: 14px; -webkit-tap-highlight-color: transparent;
}
.linha-cartao::-webkit-details-marker { display: none; }
.linha-cartao::marker { content: ""; }
.linha-cartao:focus-visible { outline: 2px solid var(--accent-fill); outline-offset: 4px; }
.linha-cartao-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.linha-cartao-nome { font-size: 16px; font-weight: 800; overflow-wrap: anywhere; }
.linha-cartao-sub {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px;
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.linha-cartao-sub.atrasada { color: var(--bad); }
.linha-cartao-valor { font-size: 18px; font-weight: 800; white-space: nowrap; }
.linha-cartao-seta { color: var(--muted); display: flex; transition: transform .18s ease; }
.cartao-fatura[open] .linha-cartao-seta { transform: rotate(90deg); }

.painel-fatura {
  margin-top: 16px; padding: 14px; border-radius: 16px; background: var(--surface2);
  display: flex; flex-direction: column; gap: 12px;
}
.compras-da-fatura { display: flex; flex-direction: column; gap: 12px; }
/* O desenho é o do protótipo (linhas de texto a 12 px uma da outra). A área de toque é maior que o texto:
   11 px de folga em cima e embaixo, desfeitos pela margem negativa. Nome que quebra em duas linhas mantém o espaço. */
.compra-linha {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; margin: -11px -8px; padding: 11px 8px; border-radius: 10px;
  color: inherit; text-decoration: none;
}
.compra-data { width: 44px; flex: none; font-size: 13px; font-weight: 700; color: var(--muted); }
.compra-nome { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.compra-nome .chip { margin-left: 6px; vertical-align: 1px; }
.compra-valor { font-size: 15px; font-weight: 800; white-space: nowrap; }
.botao-da-fatura { margin-top: 4px; }
.painel-link { align-self: flex-start; padding-left: 0; min-height: 36px; }
.painel-rodape { border-top: 1px solid var(--line); padding-top: 2px; display: flex; flex-direction: column; }
.painel-proxima {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px;
  font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none;
}
.painel-proxima-texto { display: flex; flex-direction: column; gap: 1px; }
.painel-proxima-texto small { font-size: 12px; font-weight: 600; }
.painel-proxima-valor { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.painel-proxima b { color: var(--text); font-size: 15px; font-weight: 800; }
.painel-rodape .btn-texto { align-self: flex-start; padding-left: 0; min-height: 40px; }
.lista-item .compra-data { align-self: center; }
.lista-sub.atrasada { color: var(--bad); }
.btn-icone.desativado { opacity: .35; pointer-events: none; }
.previa-da-compra {
  font-size: 13px; font-weight: 600; line-height: 1.45; color: var(--muted);
  background: var(--surface2); border-radius: 14px; padding: 12px 14px;
}
.previa-da-compra:empty { display: none; }

/* ---------- Tela Carro elétrico (igual ao protótipo carro.html) ---------- */
.voucher-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.voucher-nome { font-size: 15px; font-weight: 800; }
.voucher-vence { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.voucher-de { font-size: 15px; font-weight: 600; color: var(--muted); }
.voucher-legenda {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.link-do-cartao { align-self: flex-start; padding-left: 0; }
.bloco-com-link { display: flex; flex-direction: column; gap: 2px; }
.bloco-com-link .btn-texto { min-height: 44px; margin-bottom: -10px; }
.link-no-texto { color: var(--accent); font-weight: 800; }
.linha-ipva {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; margin: -8px 0; font-size: 13px; font-weight: 500; line-height: 1.45;
  color: var(--muted); text-decoration: none;
}
/* ---------- Previsão do ano ---------- */
.lista-interna { box-shadow: none; background: var(--surface2); border-color: transparent; }
.lista-interna .lista-item { border-top-color: var(--line); }

/* Previsão: a linha "Atrasadas" abre a lista das contas e faturas de meses passados que faltam pagar, cada uma com o Paguei */
.atrasadas { display: flex; flex-direction: column; gap: 10px; }
.atrasadas-resumo {
  display: flex; align-items: center; gap: 8px; min-height: 44px; list-style: none; cursor: pointer;
  font-size: 15px; font-weight: 700; color: var(--bad); border-radius: 10px; -webkit-tap-highlight-color: transparent;
}
.atrasadas-resumo::-webkit-details-marker { display: none; }
.atrasadas-resumo::marker { content: ""; }
.atrasadas-resumo:focus-visible { outline: 2px solid var(--accent-fill); outline-offset: 2px; }
.atrasadas-nome { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.atrasadas-resumo b { font-weight: 800; white-space: nowrap; }
.atrasadas[open] .detalhe-seta { transform: rotate(90deg); }
.aviso-da-linha { display: flex; align-items: flex-start; gap: 6px; }
.aviso-da-linha .icone-na-linha { flex: none; padding-top: 1px; }
.previsao-valor { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.previsao-valor b { font-size: 17px; font-weight: 800; white-space: nowrap; }
.previsao-valor span { font-size: 12px; font-weight: 700; color: var(--muted); }
.previsao-valor.ruim b, .previsao-valor.ruim span { color: var(--bad); }
.info-linha.forte { font-weight: 800; }
.info-linha.forte span:first-child { color: var(--text); }
.lista-item.sem-seta { cursor: default; }

.ipva-texto { display: flex; flex-direction: column; min-width: 0; }
.ipva-obs { overflow-wrap: anywhere; }

/* "Detalhes do voucher": fechado, é uma linha só; aberto, mostra a conta do preço de cada kWh. */
.detalhe-do-cartao { display: flex; flex-direction: column; gap: 4px; }
.detalhe-do-cartao > summary {
  display: flex; align-items: center; gap: 4px; min-height: 44px; margin-top: -8px; list-style: none; cursor: pointer;
  font-size: 15px; font-weight: 800; color: var(--accent); border-radius: 10px;
}
.detalhe-do-cartao > summary::-webkit-details-marker { display: none; }
.detalhe-do-cartao > summary::marker { content: ""; }
.detalhe-do-cartao > summary:focus-visible { outline: 2px solid var(--accent-fill); outline-offset: 2px; }
.detalhe-seta { display: flex; transition: transform .18s ease; }
.detalhe-do-cartao[open] .detalhe-seta { transform: rotate(90deg); }

.custo-linha { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.custo-nome { font-size: 15px; font-weight: 700; }
.custo-nome.forte { font-weight: 800; }
.custo-sub { font-size: 13px; font-weight: 500; color: var(--muted); }
.custo-valor { font-size: 20px; font-weight: 800; white-space: nowrap; }
.custo-un { font-size: 13px; font-weight: 600; color: var(--muted); }

/* A área de toque da recarga tem 44 px de altura; a margem negativa desfaz o espaço extra, para o desenho ficar como o do protótipo. */
.recarga-linha {
  display: flex; align-items: center; gap: 12px;
  min-height: 44px; margin: -3px -8px; padding: 3px 8px; border-radius: 10px;
  color: inherit; text-decoration: none;
}
.recarga-texto { flex: 1; min-width: 0; }
.recarga-data { font-size: 15px; font-weight: 700; }
.recarga-sub { font-size: 13px; font-weight: 500; color: var(--muted); }
.recarga-valor { min-width: 64px; text-align: right; font-size: 15px; font-weight: 800; white-space: nowrap; }

/* ---------- Ajustes finos para telas estreitas ---------- */
/* Menos de 390 px: o botão Paguei desce para baixo do nome, para o nome não ser espremido. */
@media (max-width: 389px) {
  .linha { grid-template-columns: minmax(0, 1fr) auto; row-gap: 10px; }
  .linha > form { grid-column: 1 / -1; }
  .linha > form .btn { width: 100%; }
}
@media (max-width: 359px) {
  .conteudo { padding-left: 16px; padding-right: 16px; }
  .linha-cartao .caixa-icone { display: none; }
  .cabecalho h1, .titulo-grande { font-size: 27px; }
  .atalho { font-size: 12px; }
  .numero-gigante { font-size: 38px; }
  .numero-gigante .centavos { font-size: 19px; }
}

/* ---------- Etapa 7: o que entrou (fontes do dinheiro) e entradas fixas ---------- */
/* "O que entrou na semana": fechada é uma linha só (o total de todas as fontes); aberta mostra quanto veio de cada fonte. */
.entrou-na-semana { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 4px; }
.entrou-na-semana > summary {
  display: flex; align-items: center; gap: 8px; min-height: 44px; list-style: none; cursor: pointer;
  font-size: 15px; font-weight: 700; border-radius: 10px; -webkit-tap-highlight-color: transparent;
}
.entrou-na-semana > summary::-webkit-details-marker { display: none; }
.entrou-na-semana > summary::marker { content: ""; }
.entrou-na-semana > summary:focus-visible { outline: 2px solid var(--accent-fill); outline-offset: 2px; }
.entrou-rotulo { flex: 1; min-width: 0; color: var(--muted); }
.entrou-na-semana > summary b { font-weight: 800; white-space: nowrap; }
.entrou-na-semana[open] .detalhe-seta { transform: rotate(90deg); }
.entrou-fontes { display: flex; flex-direction: column; gap: 10px; padding-bottom: 4px; }
.entrou-fontes .info-linha > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.info-linha small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.info-linha b { white-space: nowrap; }

/* Total da semana por fonte: uma linha por fonte, com a escolha de somar ou substituir quando já há ganhos anotados */
.linha-da-fonte { display: flex; flex-direction: column; gap: 10px; }
.ja-anotado { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 14px; background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 700; line-height: 1.4; }
.ja-anotado .segmentado { background: var(--surface); }
.ja-anotado .campo-erro { color: var(--bad); }

/* Entradas fixas e fontes */
.linha-de-acao { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.linha-de-acao form { display: contents; }
.lista-item.com-botao { cursor: default; }
.lista-item.com-botao .lista-corpo > a { display: block; color: inherit; text-decoration: none; }

/* ---------- Quem prefere menos movimento ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; transition-delay: 0s !important;
  }
}
