/* WorkHub BPO27 — shell de entrada (login + portais + Portal SPED).
   Consome os tokens de marca de tokens.css. Duas "peles" controladas por
   classe no body: .modo-login (foto de Vitória + overlay escuro) e
   .modo-shell (fundo claro padrão do sistema). */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body { font-family: var(--font); color: var(--text); background: var(--bg-section); }

button { font-family: inherit; cursor: pointer; }
a { color: inherit; }

/* O atributo hidden e' um presentational hint da UA — QUALQUER display de
   autor (ex.: o flex do #shell-topo) o anularia. Guarda explicita: */
[hidden] { display: none !important; }

/* estado inicial, antes do gate api/me responder */
#tela-carregando {
  min-height: 60vh; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px;
}

/* ============================== LOGIN =============================== */
/* A foto só baixa quando esta regra casa (body.modo-login) — usuário já
   logado nunca paga o download. Gradiente por cima garante contraste da
   coluna de texto mesmo onde o cover cortar áreas claras da foto. */
body.modo-login { background: var(--brand-dark); }
body.modo-login #tela-login {
  min-height: 100vh;
  background:
    linear-gradient(100deg, rgba(4,30,66,.85) 0%, rgba(4,30,66,.5) 55%,
                    rgba(7,48,108,.6) 100%),
    url('../img/vitoria-hero.jpg') center / cover no-repeat;
  display: grid;
  grid-template-columns: 1fr minmax(340px, 420px);
  align-items: center;
  gap: 48px;
  padding: 48px clamp(24px, 7vw, 96px);
}

.institucional { color: #fff; max-width: 560px; }
.institucional .logo-login { height: 64px; margin-bottom: 28px; }
.institucional h1 { font-size: 34px; font-weight: 700; letter-spacing: .3px; }
.institucional .tagline {
  margin-top: 12px; font-size: 15px; line-height: 1.65;
  color: rgba(255,255,255,.88);
}
.stats {
  list-style: none; display: flex; gap: 36px; margin-top: 30px; flex-wrap: wrap;
}
.stats b { display: block; font-size: 26px; color: var(--gold-soft); }
.stats span { font-size: 12px; color: rgba(255,255,255,.75); }
.local { margin-top: 34px; font-size: 12px; color: rgba(255,255,255,.55); }

.cartao-login {
  background: #fff; border-radius: 16px; padding: 32px 30px;
  box-shadow: var(--shadow);
}
.cartao-login h2 { font-size: 18px; color: var(--brand-strong); margin-bottom: 18px; }
.cartao-login label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text-secondary); margin: 14px 0 5px;
}
.cartao-login input {
  width: 100%; padding: 10px 12px; font-size: 14px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg-page);
}
.cartao-login input:focus {
  outline: 2px solid var(--brand-mid); outline-offset: 1px;
  border-color: var(--brand-mid);
}
/* sempre presente no DOM (role=alert so anuncia mudanca de CONTEUDO num nodo
   ja vivo — revelar via hidden nao dispara em varios leitores de tela);
   vazio => invisivel via :empty */
#login-erro {
  margin-top: 12px; padding: 9px 12px; font-size: 13px;
  color: var(--red); background: var(--error-bg);
  border: 1px solid var(--error-border); border-radius: 9px;
}
#login-erro:empty { display: none; }
#btn-entrar {
  width: 100%; margin-top: 20px; padding: 11px; font-size: 14.5px;
  font-weight: 600; color: #fff; background: var(--brand-primary);
  border: 0; border-radius: 10px;
}
#btn-entrar:hover { background: var(--brand-hover); }
#btn-entrar:disabled { opacity: .6; cursor: wait; }
.cartao-login .ajuda {
  margin-top: 18px; font-size: 11.5px; color: var(--muted); line-height: 1.5;
}

/* ============================== HEADER ============================== */
#shell-topo {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 22px;
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 10px clamp(16px, 4vw, 40px);
}
#shell-topo .marca img { height: 40px; display: block; }
.trilha { flex: 1; font-size: 13px; color: var(--muted); }
.trilha a { color: var(--brand-primary); text-decoration: none; }
.trilha a:hover { text-decoration: underline; }
.trilha [aria-current="page"] { color: var(--text); font-weight: 600; }
.usuario { display: flex; align-items: center; gap: 10px; font-size: 13px; }
#usuario-nome { font-weight: 600; }
.chip {
  font-size: 10.5px; font-weight: 700; letter-spacing: .4px;
  color: var(--brand-strong); background: var(--brand-light);
  border-radius: 999px; padding: 3px 10px;
}
#btn-sair {
  padding: 7px 14px; font-size: 12.5px; border: 1px solid var(--border);
  border-radius: 9px; background: var(--bg-page); color: var(--text-secondary);
}
#btn-sair:hover { border-color: var(--brand-mid); color: var(--brand-strong); }

/* ========================= GRADE DE PORTAIS ========================= */
#tela-portais, #tela-portal {
  max-width: 1180px; margin: 0 auto;
  padding: 36px clamp(16px, 4vw, 40px) 72px;
}
#tela-portais h1, #conteudo-portal h1 {
  font-size: 24px; color: var(--brand-strong);
}
#tela-portais h1:focus, #conteudo-portal h1:focus { outline: none; }
#tela-portais .subtitulo { color: var(--muted); font-size: 13.5px; margin-top: 6px; }

.grade-portais {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px; margin-top: 28px;
}
.card-portal {
  display: flex; flex-direction: column; gap: 10px;
  background: #fff; border: 1px solid var(--border); border-radius: 16px;
  padding: 26px 24px; box-shadow: var(--shadow-soft);
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
a.card-portal:hover {
  transform: translateY(-3px); box-shadow: var(--shadow);
  border-color: var(--brand-mid);
}
.card-portal h2 { font-size: 16.5px; color: var(--brand-strong); }
.card-portal p { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.card-portal .meta { font-size: 11.5px; color: var(--brand-strong); font-weight: 600; }
.card-portal .ir, .card-modulo .ir {
  margin-top: auto; font-size: 12px; font-weight: 600; color: var(--brand-primary);
}
a.card-portal:hover .ir, a.card-modulo:hover .ir { color: var(--brand-hover); }

/* ======================== DENTRO DO PORTAL ========================== */
.descricao-portal { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
#conteudo-portal section { margin-top: 36px; }
#conteudo-portal h2 {
  font-size: 15px; color: var(--brand-strong);
  padding-bottom: 8px; border-bottom: 2px solid var(--bg-cold);
}
.grade-modulos {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px; margin-top: 18px;
}
.card-modulo {
  display: flex; flex-direction: column; gap: 8px;
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  padding: 18px 16px; box-shadow: var(--shadow-soft);
  text-decoration: none; font-size: 12.5px;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
a.card-modulo:hover {
  transform: translateY(-2px); box-shadow: var(--shadow);
  border-color: var(--brand-mid);
}
.card-modulo h3 { font-size: 13.5px; color: var(--text); line-height: 1.35; }
.card-modulo p { color: var(--muted); line-height: 1.5; }
.monograma {
  align-self: flex-start; font-size: 11px; font-weight: 700;
  color: var(--brand-strong); background: var(--brand-light);
  border-radius: 8px; padding: 5px 9px; letter-spacing: .3px;
}

/* ============================ "EM BREVE" ============================ */
/* Sem opacity (derrubaria o contraste abaixo do AA): a distincao visual vem
   do fundo acinzentado + ausencia de sombra/hover; o texto mantem cores que
   passam WCAG (muted 4.9:1 sobre branco). */
.card--breve {
  cursor: default; box-shadow: none;
  background: var(--bg-section); border-style: dashed;
}
.card--breve:hover { transform: none; }
.card--breve h2, .card--breve h3 { color: var(--text-secondary); }
.card--breve .monograma { background: var(--border-soft); color: var(--text-secondary); }
.badge-breve {
  align-self: flex-start; margin-top: auto;
  font-size: 11px; font-weight: 600; color: var(--brand-strong);
  background: var(--gold-soft); border-radius: 999px; padding: 2px 10px;
}

/* ============================ RESPONSIVO ============================ */
@media (max-width: 860px) {
  body.modo-login #tela-login {
    grid-template-columns: 1fr;
    gap: 28px; padding: 32px 20px; align-content: center;
  }
  .institucional { max-width: none; text-align: center; }
  .institucional .logo-login { height: 52px; }
  .institucional h1 { font-size: 26px; }
  .stats { justify-content: center; gap: 24px; }
  .local { display: none; }
  #shell-topo { flex-wrap: wrap; gap: 10px; }
  .trilha { order: 3; flex-basis: 100%; }
}
