/* Casca do painel: o menu lateral e, no celular, a barra de cima com o botão
   que abre o menu como gaveta. Os tokens e o resto da casca ainda moram no
   <style> do base.html; levar tudo para cá é tarefa própria. */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ===================== MENU LATERAL ===================== */
.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100vh; overflow-y: auto; scrollbar-width: thin;
  display: flex; flex-direction: column;
  padding: 20px 14px 14px;
  background: linear-gradient(180deg, var(--navy-deep), var(--navy-deep-2));
  border-right: 1px solid var(--menu-borda);
  color: var(--menu-texto);
}

/* marca: a chama + In<b>Halt</b> */
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; }
.side-brand .mark { width: 28px; height: 28px; flex: none; }
.side-brand .logo { font-size: 1.2rem; font-weight: 700; letter-spacing: -.03em; line-height: 1; color: var(--menu-texto-forte); }
.side-brand .logo b { color: var(--flame); }

.side-nav { display: flex; flex-direction: column; gap: 16px; }
.side-grupo { display: flex; flex-direction: column; gap: 2px; }
.side-label { padding: 0 12px 6px; font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--menu-rotulo); }

.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  height: 40px; padding: 0 12px; border-radius: 10px;
  color: var(--menu-texto); font-size: .9rem; font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-item .ic { width: 19px; height: 19px; opacity: .8; }
.nav-item:hover { background: var(--menu-hover); color: var(--menu-texto-forte); }
.nav-item:focus-visible { outline: 2px solid var(--brand-hover); outline-offset: -2px; }
.nav-item.active { background: var(--menu-ativo); color: var(--menu-texto-forte); font-weight: 600; }
.nav-item.active .ic { opacity: 1; color: var(--menu-icone-ativo); }
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand-hover);
}
.nav-txt { flex: 1; min-width: 0; }

/* número = pendência a resolver; ponto pulsando = algo acontecendo agora */
.nav-aviso {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: grid; place-items: center;
  font-size: .7rem; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--warn); color: var(--navy-deep);
}
.nav-vivo { position: relative; width: 8px; height: 8px; flex: none; margin-right: 4px; border-radius: 50%; background: var(--good); }
.nav-vivo::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 2px solid var(--good); animation: nav-pulso 1.6s ease-out infinite;
}
@keyframes nav-pulso { from { transform: scale(.5); opacity: .8; } to { transform: scale(1.4); opacity: 0; } }

/* pé: quem está no painel e o sair */
.side-foot { margin-top: auto; padding-top: 16px; }
.side-user {
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px;
  border-radius: 12px; background: var(--menu-cartao); border: 1px solid var(--menu-borda);
}
.avatar {
  width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center;
  font-weight: 700; color: var(--menu-texto-forte);
  background: linear-gradient(135deg, var(--brand-hover), var(--brand-strong));
}
.side-user-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.side-user-txt b { color: var(--menu-texto-forte); font-size: .86rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-txt small { color: var(--menu-rotulo); font-size: .74rem; font-weight: 500; }
.side-user form { margin: 0; }

/* botões de ícone do menu: sem o azul do botão padrão */
.side-sair, .menu-botao {
  width: 34px; height: 34px; padding: 0; border: 0; border-radius: 9px;
  background: transparent; color: var(--menu-texto);
}
.side-sair:hover, .menu-botao:hover { background: var(--menu-hover); color: var(--menu-texto-forte); }
.side-sair .ic { width: 18px; height: 18px; }

/* ===================== CELULAR: MENU EM GAVETA ===================== */
.barra-movel { display: none; }
@media (max-width: 900px) {
  .barra-movel {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 4px; height: 56px; padding: 0 10px;
    background: var(--navy-deep); border-bottom: 1px solid var(--menu-borda);
  }
  .barra-movel .side-brand { padding: 0 6px; }
  .menu-botao { width: 40px; height: 40px; color: var(--menu-texto-forte); }
  .menu-botao .ic { width: 22px; height: 22px; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50;
    width: min(288px, 86vw); height: 100%;
    transform: translateX(-100%); visibility: hidden;
    /* fechando: some depois de deslizar; abrindo: visível na hora, para o foco entrar */
    transition: transform .22s ease, visibility 0s linear .22s;
    box-shadow: var(--shadow-lg);
  }
  body.menu-aberto { overflow: hidden; }
  body.menu-aberto .sidebar { transform: none; visibility: visible; transition: transform .22s ease, visibility 0s; }
  .menu-fundo { position: fixed; inset: 0; z-index: 40; background: var(--menu-fundo); }
}

@media (prefers-reduced-motion: reduce) {
  .nav-vivo::after { animation: none; }
  .sidebar { transition: none; }
}
