:root {
  --fundo: #f5f6f8; --cartao: #fff; --texto: #1f2328; --suave: #5f6670;
  --borda: #dde1e6; --destaque: #4b3f8f; --destaque-claro: #eeebfa;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fundo); color: var(--texto);
       font-family: -apple-system, system-ui, "Segoe UI", sans-serif; font-size: 15px; }
a { color: var(--destaque); }

/* Barra superior */
.topo { display: flex; align-items: center; justify-content: space-between; gap: 16px;
        height: 52px; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--borda); }
.marca { font-weight: 700; color: var(--texto); text-decoration: none; }
.usuario { display: flex; align-items: center; gap: 16px; font-size: 14px; color: var(--suave); }
.usuario form { margin: 0; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--destaque);
              cursor: pointer; text-decoration: underline; }

/* Página da biblioteca */
.pagina { max-width: 1140px; margin: 0 auto; padding: 28px 24px 48px; }
.pagina h1 { font-size: 24px; margin: 0 0 4px; }
.subtitulo { margin: 0 0 20px; color: var(--suave); }
.filtros { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.filtros input, .filtros select, .botao {
  font: inherit; font-size: 14px; padding: 8px 12px; border: 1px solid var(--borda);
  border-radius: 8px; background: #fff; color: var(--texto); }
.filtros input[type=search] { flex: 1; min-width: 220px; }
.botao { background: var(--destaque); color: #fff; border-color: var(--destaque);
         cursor: pointer; text-decoration: none; }
.botao.secundario { background: #fff; color: var(--destaque); }

.grade { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.cartao { display: flex; flex-direction: column; background: var(--cartao);
          border: 1px solid var(--borda); border-radius: 10px; overflow: hidden;
          color: inherit; text-decoration: none; transition: box-shadow .15s; }
.cartao:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.cartao .imagem { height: 180px; background: #e9ebee center/cover no-repeat; position: relative; }
.cartao .sem-imagem { display: flex; align-items: center; justify-content: center;
                      height: 100%; color: var(--suave); font-size: 13px; }
.cartao .info { padding: 12px 14px 14px; }
.cartao .codigo { font-size: 12px; color: var(--suave); letter-spacing: .02em; }
.cartao h2 { font-size: 16px; margin: 2px 0 8px; }
.cartao .assunto { margin: 6px 0 0; font-size: 13px; color: var(--suave); }
.etiquetas { display: flex; flex-wrap: wrap; gap: 5px; }
.etiqueta { font-size: 12px; padding: 2px 8px; border-radius: 99px;
            background: var(--destaque-claro); color: var(--destaque); }
.aviso-rascunho { position: absolute; top: 8px; left: 8px; background: #444; color: #fff;
                  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.vazio { padding: 48px; text-align: center; color: var(--suave); background: #fff;
         border: 1px dashed var(--borda); border-radius: 10px; }

/* Visualizador */
body.tela-cheia { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.visualizador { flex: 1; display: flex; min-height: 0; }
#lamina { flex: 1; background: #111; position: relative; }
.ficha { width: 340px; overflow-y: auto; background: #fff; border-left: 1px solid var(--borda);
         padding: 18px 20px 32px; font-size: 14px; }
.ficha h1 { font-size: 19px; margin: 4px 0 10px; }
.ficha h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em;
            color: var(--suave); margin: 20px 0 6px; }
.ficha p, .ficha ul { margin: 0; line-height: 1.5; white-space: pre-line; }
.ficha ul { padding-left: 18px; white-space: normal; }
.ficha .faixa-rascunho { background: #fff4d6; border: 1px solid #f0d58a; padding: 8px 10px;
                         border-radius: 8px; margin-bottom: 12px; }
.ficha .restrito { background: #f4f2fb; border-radius: 8px; padding: 10px 12px; }
.pendente { color: #ddd; display: flex; align-items: center; justify-content: center; height: 100%; }
@media (max-width: 800px) {
  .visualizador { flex-direction: column; }
  .ficha { width: auto; max-height: 40vh; border-left: 0; border-top: 1px solid var(--borda); }
}

/* Login */
.caixa-login { max-width: 380px; margin: 80px auto; background: #fff; padding: 28px;
               border: 1px solid var(--borda); border-radius: 12px; }
.caixa-login h1 { font-size: 21px; margin: 0 0 18px; }
.caixa-login label { display: block; font-size: 14px; margin: 12px 0 4px; }
.caixa-login input { width: 100%; font: inherit; padding: 9px 11px;
                     border: 1px solid var(--borda); border-radius: 8px; }
.caixa-login .botao { width: 100%; margin-top: 18px; padding: 10px; }
.erro { background: #fdecee; color: #a4161a; padding: 9px 12px; border-radius: 8px; font-size: 14px; }

/* Navegação */
.links-topo { display: flex; gap: 18px; margin-right: auto; margin-left: 28px; }
.links-topo a { color: var(--suave); text-decoration: none; font-size: 14px; }
.links-topo a.ativo, .links-topo a:hover { color: var(--destaque); }

/* Selos */
.selos { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.selo-site { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.selo-site.azul { background: #e3edfb; color: #1a5fb4; }
.selo-site.verde { background: #e2f3e6; color: #1f6b31; }
.selo-site.verde-claro { background: #f0f8f1; color: #26803b; }
.selo-site.amarelo { background: #fbf1d6; color: #7a5a00; }
.selo-site.cinza { background: #eceef1; color: #555; }
.selo-site.vermelho-claro { background: #fdecee; color: #a4161a; }

/* Lista de desafios */
.lista-desafios { display: flex; flex-direction: column; gap: 10px; }
.item-desafio { display: flex; justify-content: space-between; align-items: center; gap: 16px;
                background: #fff; border: 1px solid var(--borda); border-radius: 10px;
                padding: 14px 18px; color: inherit; text-decoration: none; }
.item-desafio:hover { box-shadow: 0 4px 16px rgba(0,0,0,.07); }
.item-desafio h2 { font-size: 16px; margin: 0 0 3px; }
.datas { margin: 0; font-size: 13px; color: var(--suave); }

/* Página do desafio */
.ficha-desafio { width: 420px; }
.mensagem { margin-top: 12px; padding: 9px 12px; border-radius: 8px; font-size: 14px; }
.mensagem.success { background: #e2f3e6; color: #1f6b31; }
.mensagem.error { background: #fdecee; color: #a4161a; }
.perguntas { margin-top: 18px; }
.pergunta { border: 1px solid var(--borda); border-radius: 10px; padding: 12px 14px 14px;
            margin: 0 0 12px; }
.pergunta.com-erro { border-color: #e5a0a6; background: #fff8f8; }
.pergunta legend { font-weight: 600; padding: 0 4px; line-height: 1.4; }
.alternativa { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px;
               border-radius: 6px; cursor: pointer; line-height: 1.4; }
.alternativa:hover { background: #f6f5fb; }
.alternativa.certa { background: #e2f3e6; }
.alternativa.errada { background: #fdecee; }
.alternativa .marca { margin-left: auto; color: #1f6b31; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pergunta textarea { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--borda);
                     border-radius: 8px; resize: vertical; }
.resposta-enviada { background: #f7f7f9; border-radius: 8px; padding: 8px 10px; }
.resposta-enviada.vazia { color: var(--suave); }
.erro-campo { color: #a4161a; font-size: 13px; margin: 6px 0 0; }
.comentario-pergunta { margin: 10px 0 0; font-size: 13px; background: #f4f2fb;
                       border-radius: 8px; padding: 8px 10px; }
.placar { margin: 14px 0 0; }
.comentario-professor { margin-top: 14px; background: #fff8e1; border-radius: 8px; padding: 4px 12px 10px; }
@media (max-width: 800px) { .ficha-desafio { width: auto; max-height: 55vh; } }
.ficha p.datas { white-space: normal; margin-top: 2px; }

/* Prazo de acesso */
.prazo-acesso { margin: 6px 0 0; font-size: 12px; color: var(--suave); }
.prazo-acesso.proximo { color: #a4161a; font-weight: 600; }

/* Rodapé e página de privacidade */
.rodape { text-align: center; padding: 18px 24px 28px; font-size: 13px; }
.rodape a { color: var(--suave); }
body.tela-cheia .rodape { display: none; }
.nota-privacidade { font-size: 13px; color: var(--suave); line-height: 1.45; margin: 18px 0 0; }
.texto-legal { max-width: 760px; line-height: 1.6; }
.texto-legal h2 { font-size: 17px; margin: 28px 0 6px; }
.texto-legal ul { padding-left: 20px; }
.texto-legal li { margin: 4px 0; }
.texto-legal .resumo { background: #fff; border: 1px solid var(--borda); border-radius: 10px; padding: 14px 18px; }
.texto-legal .pendente-config { background: #fbf1d6; color: #7a5a00; padding: 1px 6px; border-radius: 4px; }
