/* Base: reset, tipografia e componentes usados em todas as telas. */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--altura-barra) + 72px); }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--fundo);
  color: var(--texto);
  font: 400 var(--t-md)/1.55 var(--fonte);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--dur-2) var(--suave), color var(--dur-2) var(--suave);
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.015em; text-wrap: balance; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
svg { display: block; flex: none; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--marca); outline-offset: 2px; border-radius: var(--raio-p); }

main { flex: 1; width: 100%; outline: none; }

.pular {
  position: absolute; left: var(--e4); top: -60px; z-index: 50;
  padding: var(--e2) var(--e4); border-radius: var(--raio-p);
  background: var(--marca); color: var(--sobre-marca); font-weight: 600;
  transition: top var(--dur-1) var(--suave);
}
.pular:focus { top: var(--e2); }

.so-leitor {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* Barra superior */
.barra {
  position: sticky; top: 0; z-index: 20;
  height: var(--altura-barra);
  display: flex; align-items: center; justify-content: space-between; gap: var(--e4);
  padding: 0 max(var(--e4), env(safe-area-inset-left));
  background: color-mix(in srgb, var(--fundo) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--borda);
}
.barra__marca { display: flex; align-items: center; gap: var(--e3); min-height: 44px; font-weight: 600; letter-spacing: -0.01em; }
.barra__simbolo {
  display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: 10px; background: var(--marca); color: var(--sobre-marca);
  font-size: 1.05rem; font-weight: 700; line-height: 1;
  transition: transform var(--dur-2) var(--suave);
}
.barra__marca:hover .barra__simbolo { transform: rotate(-6deg) scale(1.05); }
.barra__acoes { display: flex; align-items: center; gap: var(--e1); }

.botao-icone {
  display: grid; place-items: center; width: 44px; height: 44px;
  border-radius: var(--raio-m); color: var(--texto-2);
  transition: background-color var(--dur-1) var(--suave), color var(--dur-1) var(--suave), transform var(--dur-1) var(--suave);
}
.botao-icone:hover { background: var(--superficie-2); color: var(--texto); }
.botao-icone:active { transform: scale(0.94); }

/* Botões */
.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--e2);
  min-height: 44px; padding: 0 var(--e4);
  border-radius: var(--raio-m); font-size: var(--t-sm); font-weight: 600; white-space: nowrap;
  transition: background-color var(--dur-1) var(--suave), color var(--dur-1) var(--suave),
    transform var(--dur-1) var(--suave), box-shadow var(--dur-1) var(--suave);
}
.botao:active { transform: scale(0.97); }
.botao--primario { background: var(--marca); color: var(--sobre-marca); box-shadow: var(--sombra-1); }
.botao--primario:hover { background: var(--marca-forte); box-shadow: var(--sombra-2); }
.botao--suave { background: var(--marca-suave); color: var(--marca-forte); }
.botao--suave:hover { background: color-mix(in srgb, var(--marca) 22%, var(--superficie)); }

/* Controle segmentado */
.segmentado {
  display: inline-flex; padding: 3px; gap: 2px; max-width: 100%;
  background: var(--superficie-2); border-radius: var(--raio-m);
}
.segmentado__opcao {
  min-height: 38px; padding: 0 var(--e4); border-radius: 9px;
  font-size: var(--t-sm); font-weight: 500; color: var(--texto-2); white-space: nowrap;
  transition: background-color var(--dur-2) var(--suave), color var(--dur-1) var(--suave), box-shadow var(--dur-2) var(--suave);
}
.segmentado__opcao:hover { color: var(--texto); }
.segmentado__opcao[aria-checked="true"] { background: var(--superficie); color: var(--texto); font-weight: 600; box-shadow: var(--sombra-1); }

/* Etiquetas */
.etiqueta {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: var(--raio-total);
  font-size: var(--t-xs); font-weight: 600; line-height: 1.6; white-space: nowrap;
  background: var(--superficie-2); color: var(--texto-2);
}
.etiqueta--marca { background: var(--marca-suave); color: var(--marca-forte); }
.etiqueta--atencao { background: var(--atencao-suave); color: var(--atencao); }
.etiqueta--alerta { background: var(--alerta-suave); color: var(--alerta); }
.etiqueta--info { background: var(--info-suave); color: var(--info); }

/* Listas de texto */
.lista { display: grid; gap: var(--e2); }
.lista > li { position: relative; padding-left: var(--e5); color: var(--texto-2); }
.lista > li::before {
  content: ""; position: absolute; left: 4px; top: 0.68em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--borda-forte);
}

/* Estado vazio e erro */
.vazio {
  display: grid; justify-items: center; gap: var(--e3);
  padding: var(--e16) var(--e4); text-align: center; color: var(--texto-2);
}
.vazio__icone {
  display: grid; place-items: center; width: 64px; height: 64px;
  border-radius: 50%; background: var(--superficie-2); color: var(--texto-3);
}
.vazio__titulo { font-size: var(--t-lg); font-weight: 600; color: var(--texto); }
.vazio p { max-width: 38ch; }

/* Esqueleto de carregamento */
.esqueleto-pagina { max-width: var(--largura-pagina); margin: 0 auto; padding: var(--e12) var(--e4); display: grid; gap: var(--e5); }
.esqueleto-grade { display: grid; gap: var(--e3); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.esqueleto {
  border-radius: var(--raio-m);
  background: linear-gradient(100deg, var(--superficie-2) 30%, var(--borda) 50%, var(--superficie-2) 70%);
  background-size: 300% 100%;
  animation: brilho 1.4s var(--suave) infinite;
}
.esqueleto--titulo { height: 40px; width: min(420px, 80%); }
.esqueleto--campo { height: 56px; }
.esqueleto--cartao { height: 84px; }
@keyframes brilho { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* Aviso flutuante */
.aviso-flutuante {
  position: fixed; left: 50%; bottom: max(var(--e6), env(safe-area-inset-bottom)); z-index: 60;
  display: flex; align-items: center; gap: var(--e2);
  padding: var(--e3) var(--e5); border-radius: var(--raio-total);
  background: var(--texto); color: var(--fundo); font-size: var(--t-sm); font-weight: 600;
  box-shadow: var(--sombra-3);
  transform: translate(-50%, 20px); opacity: 0;
  transition: transform var(--dur-2) var(--suave), opacity var(--dur-2) var(--suave);
}
.aviso-flutuante.visivel { transform: translate(-50%, 0); opacity: 1; }
.aviso-flutuante { width: max-content; max-width: calc(100vw - var(--e8)); }
.aviso-flutuante > svg { flex: none; }
.aviso-flutuante__acao {
  flex: none; min-height: 44px; margin: -10px calc(var(--e3) * -1) -6px var(--e2); padding: 0 var(--e4);
  border-radius: var(--raio-total); background: var(--fundo); color: var(--texto); font-weight: 600;
  transition: transform var(--dur-1) var(--suave), opacity var(--dur-1) var(--suave);
}
.aviso-flutuante__acao:hover { opacity: 0.9; }
.aviso-flutuante__acao:active { transform: scale(0.96); }

/* Gaveta lateral (folha inferior no celular) */
.gaveta { position: fixed; inset: 0; z-index: 40; display: flex; justify-content: flex-end; align-items: flex-end; }
.gaveta__fundo { position: absolute; inset: 0; background: var(--veu); opacity: 0; transition: opacity var(--dur-2) var(--suave); }
.gaveta__painel {
  position: relative; width: 100%; max-height: 88dvh;
  display: flex; flex-direction: column;
  background: var(--superficie); border-radius: var(--raio-g) var(--raio-g) 0 0;
  box-shadow: var(--sombra-3);
  transform: translateY(100%);
  transition: transform var(--dur-3) var(--suave);
}
.gaveta.aberta .gaveta__fundo { opacity: 1; }
.gaveta.aberta .gaveta__painel { transform: none; }
.gaveta__cabeca {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--e3);
  padding: var(--e5) var(--e5) var(--e4); border-bottom: 1px solid var(--borda);
}
.gaveta__titulo { font-size: var(--t-xl); font-weight: 700; }
.gaveta__sub { margin-top: 2px; font-size: var(--t-sm); color: var(--texto-3); }
.gaveta__corpo { overflow-y: auto; overscroll-behavior: contain; padding: var(--e5); padding-bottom: max(var(--e6), env(safe-area-inset-bottom)); }

@media (min-width: 720px) {
  .gaveta { align-items: stretch; }
  .gaveta__painel { width: 460px; max-height: none; border-radius: 0; transform: translateX(100%); }
}

/* Entrada suave dos blocos */
.entra { animation: entra var(--dur-3) var(--suave) both; animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes entra { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.rodape { padding: var(--e8) var(--e4) var(--e10); text-align: center; color: var(--texto-3); font-size: var(--t-xs); }
.rodape p { max-width: 62ch; margin: 0 auto; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
}
