/* Base visual do Sistema de Gestão Escolar (atividade 3.6), conforme o guia de layout.
 * Só tokens (tokens.css): nenhum código de cor aqui. Tamanhos de letra em rem.
 * Larguras (guia, seção 5): celular até 767 px · tablet em pé 768–1023 px · computador a partir de 1024 px.
 */

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

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--fundo); color: var(--texto);
  font-family: var(--fonte-texto); font-size: 1.03125rem; line-height: 1.5;
}
h1, h2, h3 { font-family: var(--fonte-titulo); color: var(--texto-forte); line-height: 1.15; margin: 0; }
a { color: inherit; }
img { max-width: 100%; }
svg.icone { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.9;
            stroke-linecap: round; stroke-linejoin: round; flex: none; }

:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
      clip-path: inset(50%); white-space: nowrap; }
.pular { position: absolute; left: .5rem; top: -4rem; z-index: 50; background: var(--superficie); color: var(--texto-forte);
         padding: .75rem 1rem; border-radius: var(--raio); font-weight: 600; }
.pular:focus { top: .5rem; }

.faixa-ambiente { background: var(--suave); color: var(--texto-forte); text-align: center; padding: .375rem 1rem;
                  font-size: .875rem; font-weight: 600; border-bottom: 1px solid var(--linha); }

/* ---------- Estrutura: menu + área ---------- */
.app { display: flex; min-height: 100vh; }
.area { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topo { display: flex; flex-wrap: wrap; align-items: center; gap: .625rem; padding: .875rem 1rem .5rem; }
.topo-logo { flex: 1; min-width: 0; display: flex; align-items: center; min-height: var(--alvo); text-decoration: none; }
.topo-logo img { height: 2.125rem; width: auto; display: block; }
.topo-logo .nome-escola { font-family: var(--fonte-titulo); font-weight: 700; font-size: 1.25rem; color: var(--texto-forte); }
.topo-titulo { order: 3; flex-basis: 100%; font-size: 1.625rem; }
.topo-titulo.so-leitor { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.conteudo { flex: 1; display: flex; flex-direction: column; gap: .875rem; padding: .375rem 1rem 6.5rem; width: 100%; max-width: 75rem; }
.rodape { padding: .5rem 1rem 6rem; }

/* Logo certo para o tema: colorido no claro, para fundo escuro no escuro */
.logo-escuro { display: none !important; }
[data-tema="escuro"] .logo-claro { display: none !important; }
[data-tema="escuro"] .logo-escuro { display: block !important; }

/* ---------- Botões ---------- */
.botao { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: var(--alvo);
         padding: 0 1rem; border-radius: var(--raio); border: 1.5px solid var(--borda); background: var(--superficie);
         color: var(--texto); font: inherit; font-size: .96875rem; font-weight: 600; cursor: pointer; text-decoration: none; }
.botao:hover { border-color: var(--texto); }
.botao-principal { background: var(--botao-principal); border-color: var(--botao-principal); color: var(--botao-principal-texto); }
.botao-principal:hover { border-color: var(--botao-principal); filter: brightness(1.08); }
.botao-largo { width: 100%; min-height: 3.25rem; }
.botao-icone { width: var(--alvo); height: var(--alvo); padding: 0; border-radius: var(--raio-icone); border: 1px solid var(--borda);
               background: var(--superficie); color: var(--texto); display: inline-flex; align-items: center; justify-content: center;
               cursor: pointer; flex: none; }
.link { color: var(--texto-forte); font-weight: 600; text-underline-offset: 3px; }
.topo form { margin: 0; }
.icone-sol { display: none; }
[data-tema="escuro"] .icone-sol { display: block; }
[data-tema="escuro"] .icone-lua { display: none; }

.avatar { width: var(--alvo); height: var(--alvo); border-radius: 50%; background: var(--suave); color: var(--texto-forte);
          border: 1px solid var(--borda); display: inline-flex; align-items: center; justify-content: center;
          font: inherit; font-weight: 600; font-size: .875rem; cursor: pointer; flex: none; }

/* Menu da conta (avatar) */
.conta { position: relative; }
.conta-menu { position: absolute; right: 0; top: calc(100% + .375rem); z-index: 30; min-width: 15rem; background: var(--superficie);
              border: 1px solid var(--linha); border-radius: var(--raio); box-shadow: var(--sombra-flutuante); padding: .75rem; }
.conta-menu p { margin: 0 0 .25rem; }
.conta-menu .nome { font-weight: 600; color: var(--texto-forte); }
.conta-menu .detalhe { font-size: .875rem; color: var(--texto-apagado); }
.conta-menu form { margin-top: .75rem; }
.conta-menu .botao { width: 100%; }

/* ---------- Cartões, títulos, textos ---------- */
.cartao { background: var(--superficie); border: 1px solid var(--cartao-borda); border-radius: var(--raio-cartao);
          box-shadow: var(--sombra); padding: 1rem; }
.cartao > h2, .cartao-titulo { font-size: 1.125rem; margin: 0 0 .5rem; }
.sub, .dica { color: var(--texto-apagado); font-size: .875rem; margin: .25rem 0 0; }
.sub { margin-bottom: .75rem; }
p { margin: 0 0 .75rem; }
p:last-child { margin-bottom: 0; }

/* ---------- Formulários ---------- */
.campo { display: flex; flex-direction: column; gap: .25rem; margin-top: .875rem; }
label { font-weight: 600; font-size: .9375rem; color: var(--texto-forte); }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; min-height: var(--alvo); padding: .5rem .875rem; border: 1px solid var(--borda); border-radius: var(--raio);
  background: var(--superficie); color: var(--texto-forte); font: inherit; }
input[type=checkbox] { width: 1.375rem; height: 1.375rem; accent-color: var(--botao-principal); margin: 0; flex: none; }
.opcao { display: flex; gap: .625rem; align-items: center; min-height: var(--alvo); font-weight: 400; color: var(--texto); }
.campo + .opcao { margin-top: .75rem; }              /* respiro entre o último campo e a caixa de marcar */
.opcao + .dica { margin: 0 0 0 2rem; }                /* dica da caixa de marcar, alinhada ao texto */
.acoes-form { margin-top: 1.25rem; display: flex; flex-wrap: wrap; gap: .625rem; }
.acoes-form + .dica { margin-top: 1rem; }            /* respiro entre o botão e a dica de baixo */

/* ---------- Avisos ---------- */
.aviso { display: flex; gap: .625rem; align-items: flex-start; border-radius: var(--raio); padding: .75rem .875rem; font-size: .9375rem; }
.aviso-erro { background: var(--alerta-fundo); color: var(--alerta-tinta); border: 1.5px solid var(--alerta); border-left-width: 6px; }
.aviso-ok { background: var(--ok-fundo); color: var(--ok); }
.aviso-nota { background: var(--suave); color: var(--texto); border-left: 6px solid var(--etiqueta-incompleto); }

/* ---------- Etiquetas ---------- */
.etiqueta { display: inline-flex; align-items: center; gap: .3125rem; border-radius: 999px; padding: .1875rem .625rem;
            font-size: .875rem; font-weight: 600; white-space: nowrap; line-height: 1.5; background: var(--suave); color: var(--texto); }
.etiqueta-ok { background: var(--ok-fundo); color: var(--ok); }
.etiqueta-saude { background: var(--alerta-fundo); color: var(--alerta-tinta); border: 1.5px solid var(--alerta); font-size: .90625rem; }
.etiqueta-incompleto { border: 1.5px solid var(--etiqueta-incompleto); }
.selo-em-breve { display: inline-block; font-family: var(--fonte-texto); font-size: .875rem; font-weight: 600; line-height: 1.4;
                 border: 1px solid currentColor; border-radius: 999px; padding: 0 .4375rem; white-space: nowrap; }

/* ---------- Saudação (Início) ---------- */
.saudacao { position: relative; overflow: hidden; background: var(--saudacao-fundo); color: var(--saudacao-texto);
            border-radius: var(--raio-cartao); padding: 1.125rem 1.125rem 1.25rem; }
.saudacao h2 { color: var(--saudacao-texto); font-size: 1.625rem; padding-right: 5.25rem; }
.saudacao p { margin: .25rem 0 0; color: var(--saudacao-destaque); font-size: .90625rem; font-weight: 500; padding-right: 5.25rem; }
.saudacao .selo { position: absolute; right: -.375rem; bottom: -.625rem; width: 5.375rem; height: auto; }

/* ---------- Listas em linhas (Pessoas) ---------- */
.linha-lista { display: flex; flex-wrap: wrap; gap: .625rem; align-items: center; padding: .75rem 0; border-top: 1px solid var(--linha); }
.linha-lista:first-of-type { border-top: 0; }
.linha-lista .quem { flex: 1 1 14rem; min-width: 0; }
.linha-lista .quem b { display: block; color: var(--texto-forte); font-weight: 600; }
.linha-lista .quem small { display: block; color: var(--texto-apagado); font-size: .875rem; overflow-wrap: anywhere; }
.linha-lista .acoes { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.vazio { text-align: center; color: var(--texto-apagado); padding: 1.5rem .5rem; }
.vazio b { display: block; color: var(--texto-forte); margin-bottom: .25rem; }

/* ---------- Powered by ---------- */
.powered { display: flex; justify-content: center; align-items: center; gap: .375rem; font-size: .71875rem; color: var(--texto-apagado); }
.powered img { height: .875rem; width: auto; display: block; }
.powered .rentus-fundo-escuro { display: none; }
[data-tema="escuro"] .powered .rentus-fundo-claro, .menu .powered .rentus-fundo-claro { display: none; }
[data-tema="escuro"] .powered .rentus-fundo-escuro, .menu .powered .rentus-fundo-escuro { display: block; }

/* ---------- Menu de módulos ---------- */
.menu { display: none; background: var(--menu-fundo); color: var(--menu-texto); flex-direction: column; gap: .25rem; padding: 1.125rem .875rem; }
.menu :focus-visible { outline-color: var(--foco-menu); }
.menu-topo { display: flex; align-items: center; gap: .5rem; padding: 0 .25rem .75rem; }
.menu-marca { flex: 1; min-width: 0; min-height: var(--alvo); display: flex; align-items: center; text-decoration: none; }
.menu-marca img { width: 100%; height: auto; display: block; }
.menu-marca .selo-recolhido { display: none; }
.menu-marca .nome-escola { font-family: var(--fonte-titulo); font-weight: 700; font-size: 1.25rem; color: var(--menu-texto); }
.menu .botao-icone { background: transparent; color: var(--menu-texto); border-color: currentColor; }
.botao-novo { display: flex; align-items: center; justify-content: center; gap: .5rem; min-height: 3.25rem; margin: .125rem 0 .75rem;
              border-radius: var(--raio); background: var(--botao-novo); color: var(--botao-novo-texto);
              font-weight: 700; font-size: 1.1875rem; text-decoration: none; position: relative; }
.botao-novo svg.icone { width: 1.375rem; height: 1.375rem; stroke-width: 2.4; }
.botao-novo .selo-em-breve { position: absolute; top: -.625rem; right: .5rem; font-size: .6875rem; font-weight: 600;
                             background: var(--menu-fundo); color: var(--menu-texto); opacity: 1; }
.menu-grupo { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--menu-destaque); font-weight: 600;
              padding: .625rem .75rem .125rem; margin: 0; font-family: var(--fonte-texto); }
.menu-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .125rem; }
.menu-item { display: flex; align-items: center; gap: .625rem; min-height: var(--alvo); padding: .5rem .75rem; border-radius: var(--raio);
             font-weight: 500; font-size: .9375rem; color: var(--menu-texto); text-decoration: none; position: relative; }
a.menu-item:hover { background: var(--menu-ativo-fundo); }
.menu-item[aria-current="page"] { background: var(--menu-ativo-fundo); color: var(--menu-destaque); font-weight: 600; }
.menu-item[aria-current="page"]::before { content: ""; position: absolute; left: -.875rem; top: .5rem; bottom: .5rem; width: 4px;
                                         border-radius: 0 4px 4px 0; background: var(--marca-destaque); }
.menu-rotulo { display: flex; align-items: center; gap: .375rem; flex: 1; min-width: 0; }
.menu-item .selo-em-breve { margin-left: auto; font-size: .6875rem; }
.menu-item.em-breve { opacity: .85; cursor: default; }
.menu-rodape { margin-top: auto; padding-top: 1rem; display: flex; flex-direction: column; gap: .75rem; }
.menu-rodape .powered { color: var(--menu-texto); }
.menu-sair .botao { width: 100%; background: transparent; color: var(--menu-texto); border-color: currentColor; }
.veu { display: none; }

/* ---------- Barra inferior (celular) ---------- */
.barra-inferior { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--superficie); border-top: 1px solid var(--linha);
                  display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom, 0); }
.barra-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .125rem; min-height: 4.375rem;
              padding: .375rem .25rem; font: inherit; font-size: .875rem; font-weight: 500; color: var(--texto-apagado);
              background: none; border: 0; text-decoration: none; position: relative; cursor: pointer; }
.barra-item[aria-current="page"] { color: var(--texto-forte); font-weight: 600; }
.barra-item[aria-current="page"]::before { content: ""; position: absolute; top: 0; width: 1.75rem; height: 4px; border-radius: 0 0 4px 4px;
                                          background: var(--indicador-ativo); }
.barra-item.em-breve { cursor: default; }
.barra-item .selo-em-breve { font-size: .875rem; border: 0; padding: 0; font-weight: 500; }

/* ---------- Telas de entrada (login, primeiro acesso, criar senha) ---------- */
.entrada-tema { position: absolute; top: .75rem; right: 1rem; }
.entrada-tema form { margin: 0; }
.entrada { position: relative; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.25rem; padding: 1.5rem 1rem; }
.entrada .cartao { width: 100%; max-width: 27rem; padding: 1.5rem; }
.entrada-cabeca { text-align: center; }
.entrada-cabeca .sistema { font-family: var(--fonte-titulo); font-weight: 700; font-size: 1.625rem; color: var(--texto-forte); margin: 0; }
.entrada-logo { margin: 0; display: flex; justify-content: center; }
.entrada-logo img { height: 3.5rem; width: auto; max-width: 100%; }
.entrada h1 { font-size: 1.5rem; margin-bottom: .25rem; }
.entrada .aviso { margin-top: 1rem; }

/* ===================== Celular: menu abre por "Mais" ===================== */
@media (max-width: 767px) {
  body[data-menu="aberto"] { overflow: hidden; }
  body[data-menu="aberto"] .menu { display: flex; position: fixed; inset: 0 0 0 auto; width: min(20rem, 88vw); z-index: 40;
                                   overflow-y: auto; box-shadow: var(--sombra-flutuante); }
  body[data-menu="aberto"] .veu { display: block; position: fixed; inset: 0; z-index: 35; background: var(--veu); }
  .menu-alternar { display: none; }
  /* Piso de 14 px no celular (guia, seção 3) */
  .menu-item { font-size: 1rem; }
  .menu-grupo, .menu-item .selo-em-breve, .botao-novo .selo-em-breve { font-size: .875rem; }
  .menu-grupo { letter-spacing: .04em; }
  .botao-novo { margin-top: .75rem; }
}

/* ===================== Tablet e computador ===================== */
@media (min-width: 768px) {
  body { font-size: .9375rem; }
  .barra-inferior { display: none; }
  .conteudo { padding: .25rem 1.5rem 1.5rem; }
  .rodape { padding: .5rem 1.5rem 1.5rem; }
  .topo { padding: 1.25rem 1.5rem .75rem; flex-wrap: nowrap; }
  .topo-logo { display: none; }
  .topo-titulo { order: 0; flex: 1; font-size: 1.75rem; }
  .topo-titulo.so-leitor { position: static !important; width: auto; height: auto; overflow: visible; clip-path: none; }
  .sub, .dica, .linha-lista .quem small { font-size: .84375rem; }
  .etiqueta { font-size: .78125rem; }
  .etiqueta-saude { font-size: .8125rem; }
  .cartao { padding: 1.125rem 1.25rem; }

  .menu { display: flex; position: sticky; top: 0; height: 100vh; overflow-y: auto; flex: none; }
  .menu-fechar { display: none; }
}

/* Tablet em pé: menu recolhido em ícones; o botão abre o menu completo por cima */
@media (min-width: 768px) and (max-width: 1023px) {
  body:not([data-menu="aberto"]) .menu { width: var(--menu-recolhido); padding: .875rem .625rem; align-items: center;
       overflow: visible; }   /* os nomes escondidos ficam fora do menu: sem isso sobrava uma barra de rolagem (C3 do Sloan) */
  body:not([data-menu="aberto"]) .menu-topo { flex-direction: column; padding: 0 0 .75rem; }
  body:not([data-menu="aberto"]) .menu-marca { display: none; }
  body:not([data-menu="aberto"]) .botao-novo { width: var(--alvo); min-height: var(--alvo); margin: 0 0 .5rem; }
  body:not([data-menu="aberto"]) .botao-novo .rotulo-novo { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  body:not([data-menu="aberto"]) .menu-grupo { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  body:not([data-menu="aberto"]) .menu-lista { border-top: 1px solid var(--menu-ativo-fundo); padding-top: .375rem; margin-top: .375rem; }
  body:not([data-menu="aberto"]) .menu-item { width: var(--alvo); padding: 0; justify-content: center; }
  body:not([data-menu="aberto"]) .menu-item[aria-current="page"]::before { left: -.625rem; }
  /* O nome vira dica ao passar o mouse ou focar; o leitor de tela lê sempre */
  body:not([data-menu="aberto"]) .menu-rotulo { position: absolute; left: calc(100% + .625rem); top: 50%; transform: translateY(-50%);
       z-index: 45; background: var(--texto-forte); color: var(--superficie); padding: .375rem .625rem; border-radius: var(--raio-filtro);
       white-space: nowrap; opacity: 0; pointer-events: none; flex: none; }
  body:not([data-menu="aberto"]) .menu-item:hover .menu-rotulo,
  body:not([data-menu="aberto"]) .menu-item:focus-visible .menu-rotulo { opacity: 1; }
  body:not([data-menu="aberto"]) .menu-item .selo-em-breve { margin-left: .375rem; }
  body:not([data-menu="aberto"]) .menu-rodape .powered, body:not([data-menu="aberto"]) .menu-sair { display: none; }
  body[data-menu="aberto"] .menu { position: fixed; inset: 0 auto 0 0; width: var(--menu-largura); z-index: 40; box-shadow: var(--sombra-flutuante); }
  body[data-menu="aberto"] .veu { display: block; position: fixed; inset: 0; z-index: 35; background: var(--veu); }
  body[data-menu="aberto"] .menu-alternar { display: none; }
  body[data-menu="aberto"] .menu-fechar { display: inline-flex; }
  body[data-menu="aberto"] .area { margin-left: var(--menu-recolhido); }
}

/* Computador e tablet deitado: menu completo, fixo */
@media (min-width: 1024px) {
  .menu { width: var(--menu-largura); }
  .menu-alternar, .menu-fechar { display: none !important; }
  .rodape { display: none; }
}
