/* SpaceCase v1.0.0 - estilos (celular primeiro) */

@font-face { font-family: "Bricolage"; src: url("../fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex"; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --papel: #edf2f5;
  --folha: #ffffff;
  --tinta: #0e2740;
  --mudo: #56697d;
  --traco: #cbd8e2;
  --traco-forte: #9fb4c4;
  --petroleo: #0a5c7d;
  --petroleo-fundo: #dcebf2;
  --sobre-petroleo: #ffffff;
  --cota: #d9822b;
  --bom: #0f7b55;
  --bom-fundo: #ddf3e9;
  --ruim: #b93a2b;
  --ruim-fundo: #f9e2de;
  --aviso-fundo: #fff1d6;
  --aviso-texto: #6b4708;
  --sombra-folha: 0 1px 0 rgba(14, 39, 64, 0.04);
  --fonte-titulo: "Bricolage", "Segoe UI", system-ui, sans-serif;
  --fonte-texto: "Plex", "Segoe UI", system-ui, -apple-system, sans-serif;
  --nav-h: 62px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --papel: #0b1622;
    --folha: #122130;
    --tinta: #e6eef4;
    --mudo: #93a7b8;
    --traco: #24384a;
    --traco-forte: #35506a;
    --petroleo: #4fb3d9;
    --petroleo-fundo: #12303f;
    --sobre-petroleo: #06202c;
    --cota: #f0a24a;
    --bom: #43ce98;
    --bom-fundo: #0f3326;
    --ruim: #f28a7b;
    --ruim-fundo: #3d1c18;
    --aviso-fundo: #3a2e12;
    --aviso-texto: #f3d38f;
    --sombra-folha: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  font-family: var(--fonte-texto);
  font-size: 16px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}
body.sheet-aberto { overflow: hidden; }
h1, h2, h3 { font-family: var(--fonte-titulo); margin: 0; letter-spacing: -0.01em; line-height: 1.15; }
h1 { font-size: 28px; font-weight: 650; }
h2 { font-size: 20px; font-weight: 620; }
h3 { font-size: 16px; font-weight: 620; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--petroleo); }
:focus-visible { outline: 2px solid var(--petroleo); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.mudo { color: var(--mudo); }
.peq { font-size: 13px; }
.oculto-visual { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Splash ---------- */
.splash { min-height: 100dvh; display: grid; place-content: center; gap: 8px; text-align: center; }
.splash-marca { font-family: var(--fonte-titulo); font-weight: 650; font-size: 30px; }
.splash-msg { color: var(--mudo); }

/* ---------- Telas cheias (instalacao, login...) ---------- */
.auth {
  min-height: 100dvh;
  max-width: 460px;
  margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top, 0px)) 22px calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.auth-marca { display: flex; align-items: center; gap: 10px; font-family: var(--fonte-titulo); font-weight: 650; font-size: 22px; }
.auth-marca svg { width: 40px; height: 40px; flex: none; }
.auth h1 { margin-top: 6px; }
.auth .sub { color: var(--mudo); margin-top: -8px; }
.auth form { display: flex; flex-direction: column; gap: 14px; }
.auth .rodape-versao { margin-top: auto; padding-top: 16px; }
.caixa-info { background: var(--petroleo-fundo); border-left: 3px solid var(--petroleo); border-radius: 8px; padding: 12px 14px; font-size: 14.5px; }
.caixa-info b { font-weight: 600; }
.caixa-aviso { background: var(--aviso-fundo); color: var(--aviso-texto); border-radius: 8px; padding: 12px 14px; font-size: 14.5px; }

.rodape-versao { text-align: center; color: var(--mudo); font-size: 12.5px; padding: 22px 0 6px; }

/* ---------- Campos ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; min-width: 0; scroll-margin-top: 76px; scroll-margin-bottom: calc(var(--nav-h) + 120px); }
.campo > .rotulo { font-size: 14px; font-weight: 500; }
.campo > .dica { font-size: 12.5px; color: var(--mudo); line-height: 1.4; }
.entrada {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 12px;
  background: var(--folha);
  border: 1px solid var(--traco-forte);
  border-radius: 8px;
}
.entrada:focus-within { border-color: var(--petroleo); box-shadow: 0 0 0 2px var(--petroleo-fundo), 0 0 0 3px var(--petroleo); }
.entrada.invalida { border-color: var(--ruim); }
.entrada.travada { background: var(--petroleo-fundo); border-style: dashed; }
.entrada input, .entrada select, .entrada textarea {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 17px;
  padding: 10px 0;
  width: 100%;
}
.entrada textarea { resize: vertical; min-height: 84px; line-height: 1.4; }
.entrada .pre, .entrada .suf { color: var(--mudo); font-size: 14px; white-space: nowrap; }
.entrada input.num { text-align: right; }
.entrada .btn-olho { border: 0; background: none; color: var(--petroleo); font-size: 14px; padding: 8px 2px; cursor: pointer; }
.linha-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.erro { background: var(--ruim-fundo); color: var(--ruim); border-radius: 8px; padding: 10px 12px; font-size: 14.5px; line-height: 1.4; }

/* ---------- Botoes ---------- */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  min-height: 48px;
  padding: 0 18px;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: background-color 0.12s;
}
.btn.primario { background: var(--petroleo); color: var(--sobre-petroleo); }
.btn.primario:active { filter: brightness(0.92); }
.btn.secundario { background: transparent; border-color: var(--traco-forte); color: var(--tinta); }
.btn.perigo { background: transparent; border-color: var(--ruim); color: var(--ruim); }
.btn.cheio { width: 100%; }
.btn.peq { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.link { background: none; border: 0; color: var(--petroleo); font-weight: 500; padding: 8px 0; cursor: pointer; text-align: left; font-size: 15px; }
.icone-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; color: var(--tinta); border-radius: 10px; cursor: pointer; }
.icone-btn svg { width: 22px; height: 22px; }

/* ---------- Estrutura do app ---------- */
.topo {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--papel);
  border-bottom: 1px solid var(--traco);
  padding: env(safe-area-inset-top, 0px) 8px 0;
}
.topo-in { max-width: 720px; margin: 0 auto; min-height: 56px; display: flex; align-items: center; gap: 4px; }
.topo-titulo { flex: 1; min-width: 0; padding: 0 8px; }
.topo-titulo h1 { font-size: 20px; line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.topo-titulo .sub { font-size: 12.5px; color: var(--mudo); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conteudo { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + 96px + env(safe-area-inset-bottom, 0px)); }
.pilha { display: flex; flex-direction: column; gap: 16px; }

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: var(--folha);
  border-top: 1px solid var(--traco);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav-in { max-width: 720px; margin: 0 auto; height: var(--nav-h); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.nav a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--mudo);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
}
.nav a svg { width: 24px; height: 24px; }
.nav a[aria-current="page"] { color: var(--petroleo); }
.nav a[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 0;
  width: 28px;
  height: 3px;
  background: var(--cota);
  border-radius: 0 0 3px 3px;
}

.fab {
  position: fixed;
  right: max(16px, calc(50% - 344px));
  bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom, 0px));
  z-index: 25;
  box-shadow: 0 6px 18px rgba(10, 40, 64, 0.28);
  border-radius: 999px;
  padding: 0 20px;
}

.barra-salvar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  z-index: 25;
  background: var(--papel);
  border-top: 1px solid var(--traco);
  padding: 10px 16px;
}
.barra-salvar-in { max-width: 720px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.barra-salvar .estado { flex: 1; font-size: 13px; color: var(--mudo); min-width: 0; }
.barra-salvar .estado.sujo { color: var(--cota); font-weight: 600; }

/* ---------- Folhas (blocos) ---------- */
.folha { background: var(--folha); border: 1px solid var(--traco); border-radius: 10px; box-shadow: var(--sombra-folha); }
.folha-pad { padding: 16px; }
.folha-titulo { padding: 14px 16px 0; }
.folha-titulo p { color: var(--mudo); font-size: 13px; margin-top: 2px; }
.secao-campos { display: flex; flex-direction: column; gap: 14px; padding: 14px 16px 16px; }

/* ---------- Abas ---------- */
.abas { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--folha); border: 1px solid var(--traco-forte); border-radius: 10px; padding: 3px; gap: 3px; }
.abas a {
  text-align: center;
  padding: 9px 4px;
  border-radius: 7px;
  color: var(--mudo);
  text-decoration: none;
  font-weight: 500;
  font-size: 14.5px;
}
.abas a[aria-current="page"] { background: var(--tinta); color: var(--papel); }

/* ---------- Pilulas e chips ---------- */
.pilula { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 500; background: var(--petroleo-fundo); color: var(--petroleo); white-space: nowrap; }
.pilula.bom { background: var(--bom-fundo); color: var(--bom); }
.pilula.ruim { background: var(--ruim-fundo); color: var(--ruim); }
.pilula.neutra { background: var(--traco); color: var(--tinta); }
.pilula.cota { background: var(--aviso-fundo); color: var(--aviso-texto); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--traco-forte); background: var(--folha); color: var(--tinta); border-radius: 999px; padding: 7px 14px; font-size: 14.5px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--tinta); color: var(--papel); border-color: var(--tinta); }

/* ---------- Lista de estudos ---------- */
.busca { margin-bottom: 14px; }
.lista { display: flex; flex-direction: column; gap: 10px; }
.linha-estudo {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 14px 14px 14px 18px;
  background: var(--folha);
  border: 1px solid var(--traco);
  border-left: 5px solid var(--traco-forte);
  border-radius: 6px 10px 10px 6px;
  text-decoration: none;
  color: inherit;
}
.linha-estudo.concluido { border-left-color: var(--bom); }
.linha-estudo.rascunho { border-left-color: var(--cota); }
.linha-estudo h3 { font-size: 17px; overflow-wrap: anywhere; }
.linha-estudo .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--mudo); grid-column: 1 / -1; }
.linha-estudo .res { text-align: right; font-size: 14px; }
.linha-estudo .res b { display: block; font-weight: 600; }
.linha-estudo .res small { color: var(--mudo); font-size: 12px; }
.res.bom b, .bom-txt { color: var(--bom); }
.res.ruim b, .ruim-txt { color: var(--ruim); }

.vazio { text-align: center; padding: 36px 18px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.vazio svg { width: 64px; height: 64px; color: var(--traco-forte); }
.vazio p { color: var(--mudo); max-width: 34ch; }

/* ---------- Resumo (totais dos formularios) ---------- */
.totais { display: flex; flex-direction: column; }
.totais .l { display: flex; justify-content: space-between; gap: 12px; padding: 9px 16px; border-top: 1px solid var(--traco); font-size: 15px; }
.totais .l:first-child { border-top: 0; }
.totais .l.forte { font-weight: 600; background: var(--petroleo-fundo); }
.totais .l.forte:last-child { border-radius: 0 0 9px 9px; }
.totais .l span:last-child { text-align: right; }

/* ---------- Opcoes ---------- */
.card-opcao { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 14px 14px 12px 16px; }
.card-opcao h3 { font-size: 17px; overflow-wrap: anywhere; }
.card-opcao .a { grid-column: 1 / -1; display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 13.5px; color: var(--mudo); }
.card-opcao .a b { color: var(--tinta); font-weight: 600; }
.card-opcao .acoes { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 6px; }

/* ---------- Tabela comparativa ---------- */
.tabela { font-size: 14px; }
.tabela .cab, .tabela .lin { display: grid; grid-template-columns: minmax(84px, 1.25fr) repeat(3, minmax(0, 1fr)); gap: 6px; padding: 9px 12px; align-items: baseline; }
.tabela .cab { font-size: 12.5px; color: var(--mudo); border-bottom: 1px solid var(--traco-forte); font-weight: 500; }
.tabela .cab span:not(:first-child), .tabela .lin > span:not(:first-child) { text-align: right; }
.tabela .lin { border-bottom: 1px solid var(--traco); }
.tabela .lin:last-child { border-bottom: 0; }
.tabela .grupo { padding: 12px 12px 4px; font-size: 13px; font-weight: 600; color: var(--petroleo); }
.tabela .lin.sub { font-weight: 600; background: var(--petroleo-fundo); }
.tabela .lin.total { font-weight: 700; background: var(--tinta); color: var(--papel); border-radius: 0 0 9px 9px; }
.tabela .lin.total .bom-txt, .tabela .lin.total .ruim-txt { color: inherit; }
.tabela .delta small { display: block; font-weight: 400; font-size: 11.5px; opacity: 0.85; }
.tabela-rolagem { overflow-x: auto; }
.tab-simples { width: 100%; border-collapse: collapse; font-size: 14px; }
.tab-simples th { font-size: 12.5px; color: var(--mudo); font-weight: 500; text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--traco-forte); }
.tab-simples td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--traco); }
.tab-simples th:first-child, .tab-simples td:first-child { text-align: left; }
.tab-simples tr:last-child td { border-bottom: 0; }

/* ---------- Comparativo: ranking, cota, graficos ---------- */
.ranking { display: flex; flex-direction: column; gap: 8px; }
.item-rank { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 12px; align-items: center; padding: 12px 14px; background: var(--folha); border: 1px solid var(--traco); border-radius: 10px; text-align: left; width: 100%; cursor: pointer; }
.item-rank[aria-pressed="true"] { border-color: var(--petroleo); box-shadow: 0 0 0 2px var(--petroleo-fundo), 0 0 0 3px var(--petroleo); }
.item-rank .pos { font-family: var(--fonte-titulo); font-weight: 650; font-size: 22px; color: var(--traco-forte); width: 24px; }
.item-rank .nome { font-weight: 600; overflow-wrap: anywhere; }
.item-rank .nome small { display: block; color: var(--mudo); font-weight: 400; font-size: 12.5px; }
.item-rank .val { text-align: right; font-weight: 600; }
.item-rank .val small { display: block; font-weight: 400; font-size: 12.5px; }

.veredito { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.veredito h2 { font-size: 21px; }
.veredito h2.bom-txt { color: var(--bom); }
.veredito h2.ruim-txt { color: var(--ruim); }
.veredito .apoio { color: var(--mudo); font-size: 14.5px; }
.cota-svg { width: 100%; height: auto; display: block; }
.cota-svg .barra-atual { fill: var(--traco-forte); }
.cota-svg .barra-futuro { fill: var(--petroleo); }
.cota-svg .linha-cota { stroke: var(--cota); stroke-width: 2; fill: none; }
.cota-svg .seta-cota { fill: var(--cota); }
.cota-svg .ext { stroke: var(--cota); stroke-width: 1; stroke-dasharray: 3 3; }
.cota-svg text { fill: var(--tinta); font-family: var(--fonte-texto); }
.cota-svg .t-mudo { fill: var(--mudo); font-size: 12px; }
.cota-svg .t-valor { font-size: 13px; font-weight: 600; }
.cota-svg .t-cota { font-size: 14px; font-weight: 700; }
.cota-svg .t-cota.bom { fill: var(--bom); }
.cota-svg .t-cota.ruim { fill: var(--ruim); }

.metricas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--traco); }
.metricas > div { padding: 12px 10px 12px 16px; border-left: 1px solid var(--traco); }
.metricas > div:first-child { border-left: 0; }
.metricas .k { font-size: 12.5px; color: var(--mudo); line-height: 1.3; }
.metricas .v { font-family: var(--fonte-titulo); font-weight: 620; font-size: 18px; margin-top: 2px; line-height: 1.2; }
.metricas .v small { display: block; font-family: var(--fonte-texto); font-weight: 400; font-size: 12px; color: var(--mudo); }

.graf { display: flex; flex-direction: column; gap: 12px; padding: 4px 16px 16px; }
.graf-linha .nome { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; margin-bottom: 4px; }
.graf-linha .nome span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.graf-linha .nome span:last-child { font-weight: 600; white-space: nowrap; }
.trilho { display: flex; height: 16px; background: var(--petroleo-fundo); border-radius: 4px; overflow: hidden; }
.trilho i { display: block; height: 100%; }
.trilho .c-rec { background: var(--petroleo); }
.trilho .c-dep { background: var(--cota); }
.trilho .c-atual { background: var(--traco-forte); }
.trilho .c-melhor { background: var(--bom); }
.legenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--mudo); padding: 0 16px 14px; }
.legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

details.recolher > summary { list-style: none; cursor: pointer; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; font-family: var(--fonte-titulo); font-weight: 620; font-size: 16px; }
details.recolher > summary::-webkit-details-marker { display: none; }
details.recolher > summary::after { content: "+"; font-size: 22px; color: var(--petroleo); line-height: 1; }
details.recolher[open] > summary::after { content: "\2212"; }

/* ---------- Usuarios ---------- */
.linha-usuario { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 13px 14px; width: 100%; text-align: left; background: var(--folha); border: 1px solid var(--traco); border-radius: 10px; cursor: pointer; }
.linha-usuario.inativo { opacity: 0.6; }
.linha-usuario .nome { font-weight: 600; overflow-wrap: anywhere; }
.linha-usuario .det { grid-column: 1 / -1; font-size: 13px; color: var(--mudo); }
.senha-temp { font-family: var(--fonte-titulo); font-size: 26px; font-weight: 650; letter-spacing: 0.04em; background: var(--petroleo-fundo); border: 1px dashed var(--petroleo); border-radius: 8px; padding: 12px; text-align: center; user-select: all; overflow-wrap: anywhere; }
.reg { display: grid; grid-template-columns: 1fr; gap: 1px; padding: 10px 14px; border-bottom: 1px solid var(--traco); font-size: 14px; }
.reg:last-child { border-bottom: 0; }
.reg .quando { font-size: 12.5px; color: var(--mudo); }

/* ---------- Sheets e avisos ---------- */
.veu { position: fixed; inset: 0; z-index: 60; background: rgba(6, 18, 30, 0.55); display: flex; align-items: flex-end; justify-content: center; animation: veu-in 0.15s ease-out; }
.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--papel);
  border-radius: 18px 18px 0 0;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  animation: sheet-in 0.2s ease-out;
}
.sheet .pega { width: 40px; height: 4px; border-radius: 2px; background: var(--traco-forte); margin: 0 auto 12px; }
.sheet h2 { margin-bottom: 4px; }
.sheet .corpo { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.sheet .botoes { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.sheet .botoes .btn { flex: 1 1 140px; }
@keyframes veu-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (min-width: 620px) { .veu { align-items: center; } .sheet { border-radius: 18px; } }

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 84px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 80;
  width: min(92vw, 460px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  max-width: 100%;
  background: var(--tinta);
  color: var(--papel);
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 14.5px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transition: opacity 0.3s;
}
.toast.erro { background: var(--ruim); color: #fff; }
.toast.sai { opacity: 0; }

.carregando { display: grid; place-items: center; padding: 60px 0; color: var(--mudo); gap: 10px; }
.giro { width: 26px; height: 26px; border: 3px solid var(--traco); border-top-color: var(--petroleo); border-radius: 50%; animation: gira 0.8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
@media (min-width: 760px) {
  .conteudo { padding-left: 24px; padding-right: 24px; }
  .fab { right: calc(50% - 336px); }
}

/* No celular, enquanto o teclado esta aberto, as barras fixas saem da frente do campo. */
@media (pointer: coarse) {
  body.digitando .nav, body.digitando .barra-salvar, body.digitando .fab { display: none; }
}

/* ---------- v2: sinal (+/-), listas ano a ano, estado da depreciacao ---------- */
.entrada .btn-sinal { flex: none; border: 1px solid var(--traco-forte); background: var(--petroleo-fundo); color: var(--petroleo); border-radius: 6px; font-size: 15px; font-weight: 600; min-width: 34px; height: 30px; line-height: 1; padding: 0 6px; margin-left: 4px; cursor: pointer; }
.entrada .btn-sinal:active { filter: brightness(0.92); }
.grade { border: 1px solid var(--traco); border-radius: 10px; background: var(--folha); }
.grade + .grade, .campo + .grade, .grade + .campo { margin-top: 0; }
.grade-det > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; }
.grade-det > summary::-webkit-details-marker { display: none; }
.grade-det > summary::after { content: "+"; font-size: 20px; color: var(--petroleo); line-height: 1; margin-left: 4px; }
.grade-det[open] > summary::after { content: "\2212"; }
.grade-nome { font-weight: 600; font-size: 15px; flex: 1; }
.grade-total { color: var(--mudo); font-size: 13.5px; white-space: nowrap; }
.grade-dica { padding: 0 14px 6px; margin: 0; }
.grade-preencher { display: flex; gap: 8px; align-items: center; padding: 0 14px 10px; }
.grade-preencher .entrada { flex: 1; min-width: 0; }
.grade-celulas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; padding: 4px 14px 14px; }
.grade-cel { display: flex; flex-direction: column; gap: 3px; }
.grade-ano { font-size: 12.5px; color: var(--mudo); }
.grade-cel .entrada input { font-size: 16px; padding: 8px 0; }
@media (min-width: 560px) { .grade-celulas { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.estado-dep { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--mudo); flex-wrap: wrap; }
.totais small.mudo { font-size: 12.5px; }

/* ---------- v2.1: tela Ano a ano ---------- */
.tab-anos { border-collapse: collapse; font-size: 13.5px; }
.tab-anos th, .tab-anos td { padding: 8px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--traco); }
.tab-anos thead th { color: var(--mudo); font-weight: 500; border-bottom: 1px solid var(--traco-forte); }
.tab-anos th:first-child, .tab-anos td:first-child { text-align: left; position: sticky; left: 0; background: var(--folha); z-index: 1; box-shadow: 1px 0 0 var(--traco); }
.tab-anos tr.linha-atual td { background: var(--petroleo-fundo); font-weight: 600; }
.tab-anos tr.linha-atual td:first-child { background: var(--petroleo-fundo); }
.tab-anos tr.linha-melhor td:first-child { color: var(--bom); font-weight: 700; }

/* ---------- v2.3: celula do Ano 1 com recorrente + total separados ---------- */
.tab-anos td.cel-invest { padding-top: 6px; padding-bottom: 6px; }
.tab-anos .cel-rec { display: block; font-size: 11.5px; font-weight: 400; color: var(--mudo); line-height: 1.3; }
.tab-anos .cel-tot { display: block; font-weight: 700; line-height: 1.3; padding-top: 2px; margin-top: 2px; border-top: 1px dashed var(--traco-forte); }
