/* Finanças — estilos. Sem fontes externas nem estilos inline (CSP). */
:root {
  --bg: #f4f6f8;
  --superficie: #ffffff;
  --texto: #1b2430;
  --texto-suave: #5f6b7a;
  --borda: #dde3ea;
  --primaria: #0f766e;
  --primaria-hover: #0b5d57;
  --sobre-primaria: #ffffff;
  --erro-fundo: #fdecec;
  --erro-texto: #a12626;
  --sombra: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --raio: 12px;
  --menu-h: 64px;
  --lateral-w: 232px;
  --fonte: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --superficie: #182028;
    --texto: #e7ecf2;
    --texto-suave: #9aa7b6;
    --borda: #2a3541;
    --primaria: #2dd4bf;
    --primaria-hover: #5eead4;
    --sobre-primaria: #06201d;
    --erro-fundo: #3a1c1c;
    --erro-texto: #ffb4b4;
    --sombra: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--texto);
  font: 16px/1.5 var(--fonte);
}

h1, h2 { margin: 0; line-height: 1.25; }

/* ---------- Carregando ---------- */
.carregando {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  color: var(--texto-suave);
}

/* ---------- Marca ---------- */
.marca { display: flex; align-items: center; gap: .6rem; font-weight: 700; }
.marca-icone {
  display: grid; place-items: center;
  width: 2rem; height: 2rem;
  border-radius: 9px;
  background: var(--primaria);
  color: var(--sobre-primaria);
  font-weight: 800;
}
.marca-grande { justify-content: center; font-size: 1.5rem; }
.marca-grande .marca-icone { width: 2.6rem; height: 2.6rem; font-size: 1.3rem; border-radius: 12px; }

/* ---------- Botões e campos ---------- */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: .6rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primario { background: var(--primaria); color: var(--sobre-primaria); }
.btn-primario:hover:not(:disabled) { background: var(--primaria-hover); }
.btn-contorno { background: transparent; color: var(--texto); border-color: var(--borda); }
.btn-contorno:hover { background: var(--bg); }
.btn-bloco { width: 100%; }

label { display: block; margin: 1rem 0 .35rem; font-weight: 600; font-size: .92rem; }
input {
  width: 100%;
  min-height: 46px;
  padding: .6rem .8rem;
  font: inherit;               /* 16px evita zoom automático no iPhone */
  color: var(--texto);
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: 10px;
}

:focus-visible { outline: 3px solid var(--primaria); outline-offset: 2px; }
input:focus-visible { outline-offset: 0; }

.erro {
  margin: 1rem 0 0;
  padding: .7rem .9rem;
  border-radius: 10px;
  background: var(--erro-fundo);
  color: var(--erro-texto);
  font-size: .92rem;
}

/* ---------- Login ---------- */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: 16px;
  padding: 2rem 1.5rem 1.75rem;
  box-shadow: var(--sombra);
}
.login-sub { margin: .5rem 0 .5rem; text-align: center; color: var(--texto-suave); }
.login-card .btn { margin-top: 1.5rem; }

/* ---------- Layout do app ---------- */
.app { min-height: 100dvh; }

.lateral {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--lateral-w);
  background: var(--superficie);
  border-right: 1px solid var(--borda);
  padding: 1.25rem .9rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.menu { display: flex; flex-direction: column; gap: .25rem; }
.menu a {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem .8rem;
  border-radius: 10px;
  color: var(--texto-suave);
  text-decoration: none;
  font-weight: 600;
}
.menu a svg {
  width: 22px; height: 22px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.menu a:hover { background: var(--bg); color: var(--texto); }
.menu a[aria-current="page"] { background: var(--bg); color: var(--primaria); }

.coluna { margin-left: var(--lateral-w); min-height: 100dvh; }

.topo {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--superficie);
  border-bottom: 1px solid var(--borda);
}
.topo h1 { font-size: 1.25rem; }
.topo-usuario { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.usuario-email {
  color: var(--texto-suave); font-size: .9rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.pagina { padding: 1.5rem; max-width: 1100px; outline: none; }

/* ---------- Conteúdo ---------- */
.cartoes {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.cartao {
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--sombra);
}
.cartao h2 { font-size: .85rem; font-weight: 600; color: var(--texto-suave); text-transform: uppercase; letter-spacing: .04em; }
.valor { margin: .5rem 0 0; font-size: 1.75rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.valor-apagado { color: var(--texto-suave); }
.nota { margin: .25rem 0 0; font-size: .85rem; color: var(--texto-suave); min-height: 1.3em; }

.vazio {
  margin: 1.25rem 0 0;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--texto-suave);
  border: 1px dashed var(--borda);
  border-radius: var(--raio);
}
.cartoes + .vazio { margin-top: 1.5rem; }

.dados { display: grid; grid-template-columns: max-content 1fr; gap: .6rem 1.5rem; margin: 1rem 0 0; }
.dados dt { color: var(--texto-suave); }
.dados dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* ---------- Celular: menu embaixo ---------- */
@media (max-width: 760px) {
  .lateral {
    inset: auto 0 0 0;
    width: auto;
    height: calc(var(--menu-h) + env(safe-area-inset-bottom));
    padding: 0 .5rem env(safe-area-inset-bottom);
    border-right: 0;
    border-top: 1px solid var(--borda);
    z-index: 10;
  }
  .lateral .marca { display: none; }
  .menu { flex-direction: row; justify-content: space-around; flex: 1; gap: 0; }
  .menu a {
    flex: 1; flex-direction: column; justify-content: center;
    gap: .15rem; padding: .4rem .25rem;
    font-size: .72rem; border-radius: 8px;
  }
  .menu a[aria-current="page"] { background: transparent; }

  .coluna { margin-left: 0; padding-bottom: calc(var(--menu-h) + env(safe-area-inset-bottom)); }
  .topo { padding: .75rem 1rem; position: sticky; top: 0; z-index: 5; }
  .usuario-email { display: none; }
  .pagina { padding: 1rem; }
  .dados { grid-template-columns: 1fr; gap: .1rem; }
  .dados dd { margin-bottom: .7rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .menu a { transition: background-color .15s, color .15s; }
}
