/* Fontes locais — copiar arquivos .woff2 para /assets/fonts/
   Inter: https://fonts.google.com/specimen/Inter
   Barlow+Condensed: https://fonts.google.com/specimen/Barlow+Condensed
   JetBrains+Mono: https://fonts.google.com/specimen/JetBrains+Mono        */
@font-face { font-family:'Inter'; font-weight:400 700; font-style:normal;
  src: local('Inter'), url('/assets/fonts/Inter.woff2') format('woff2'); }
@font-face { font-family:'Barlow Condensed'; font-weight:600 700; font-style:normal;
  src: local('Barlow Condensed'), url('/assets/fonts/BarlowCondensed.woff2') format('woff2'); }
@font-face { font-family:'JetBrains Mono'; font-weight:400; font-style:normal;
  src: local('JetBrains Mono'), url('/assets/fonts/JetBrainsMono.woff2') format('woff2'); }

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

:root {
  --cor-sidebar:   #111111;
  --cor-acento:    #c9a84c;
  --cor-primaria:  #1a2744;
  --cor-fundo:     #f0f2f5;
  --cor-texto:     #1e2a3a;
  --cor-erro:      #c0392b;
  --cor-info:      #2563eb;
  --cor-sucesso:   #16a34a;
  --largura-sidebar: 230px;
  --fonte-ui:      'Inter', 'Segoe UI', Arial, sans-serif;
  --fonte-titulo:  'Barlow Condensed', 'Arial Narrow', Impact, sans-serif;
  --fonte-mono:    'JetBrains Mono', Consolas, 'Courier New', monospace;
  --radius:        5px;
  --sombra:        0 2px 12px rgba(0,0,0,.10);
}

body { font-family: var(--fonte-ui); background: var(--cor-fundo); color: var(--cor-texto); font-size: 14px; }

/* ============================================================
   LOGIN / TELAS CENTRAIS
   ============================================================ */
.tela-central { display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: var(--cor-sidebar); }

.login-box {
  background: #fff; border-radius: var(--radius);
  padding: .8rem 2rem 2.5rem; width: 100%; max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,.28);
}

.login-logo { text-align: center; margin-bottom: .9rem; }
.login-brasao {
  display: block; width: auto; height: 250px;
  max-width: 90%; object-fit: contain; margin: 0 auto .6rem;
  mix-blend-mode: multiply;
}
.logo-sigla {
  display: block; font-family: var(--fonte-titulo); font-size: 1.05rem;
  font-weight: 700; color: var(--cor-sidebar); letter-spacing: 1px;
  text-transform: uppercase; line-height: 1.25;
}
.logo-sub { font-size: .7rem; color: #888; letter-spacing: 1px; text-transform: uppercase; margin-top: .3rem; }

.info-box { background: #eff6ff; border-left: 3px solid var(--cor-info); color: #1e3a6e;
  padding: .7rem 1rem; border-radius: var(--radius); margin-bottom: 1.2rem; font-size: .85rem; }

.regras-senha { font-size: .78rem; color: #666; margin: -.3rem 0 1rem 1.2rem; }
.regras-senha li { margin-bottom: .2rem; }

/* 2FA — QR Code de cadastro */
.qr-2fa-wrap { display: flex; justify-content: center; margin-bottom: .9rem; }
.qr-2fa-imagem {
  width: 200px; height: 200px; padding: .6rem;
  background: #fff; border: 1px solid #e5e7eb; border-radius: var(--radius);
}
.qr-2fa-manual {
  font-size: .76rem; color: #6b7280; text-align: center;
  margin: -.4rem 0 1.1rem; word-break: break-all;
}
.qr-2fa-manual code {
  font-family: var(--fonte-mono, monospace); background: #f3f4f6;
  padding: .1rem .35rem; border-radius: 3px; letter-spacing: .5px;
}

/* Campo de código 2FA (6 dígitos) — destaque central */
#codigo-2fa-setup, #codigo-2fa-verificar {
  text-align: center; letter-spacing: .6rem; font-size: 1.3rem !important;
  font-family: var(--fonte-mono, monospace); padding-left: .4rem !important;
}

.campo { margin-bottom: 1rem; }
.campo label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .3rem; }
.campo input, .campo select, .campo textarea {
  width: 100%; padding: .6rem .8rem;
  border: 1px solid #d1d5db; border-radius: var(--radius);
  font-size: .9rem; font-family: var(--fonte-ui); transition: border-color .15s;
  background: #fff;
}
.campo textarea { resize: vertical; }
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: none; border-color: var(--cor-primaria); }
/* Checkboxes/radios não devem herdar width:100%/padding/min-height de
   texto — do contrário esticam para preencher a linha (visto em telas com
   listas de checkboxes dentro de .campo, ex.: seleção de perfis/CIAs). */
.campo input[type="checkbox"], .campo input[type="radio"] {
  width: auto; min-width: auto; height: auto; min-height: auto;
  padding: 0; flex: 0 0 auto; accent-color: var(--cor-primaria);
}
.campo input.invalido { border-color: var(--cor-erro); }

/* Caixa alta automática em todos os campos de texto livre */
input[type="text"], input:not([type]), textarea { text-transform: uppercase; }
/* Campos de senha mantêm case original mesmo quando tipo é alternado para "text" pelo botão olho */
.campo-senha input { text-transform: none !important; }

/* Campos de data e hora — ícone do calendário/relógio visível no tema escuro */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(0.75);
  cursor: pointer;
  opacity: .85;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* Campo senha com botão olho */
.campo-senha .input-wrap { position: relative; }
.campo-senha .input-wrap input { padding-right: 2.6rem; }
.btn-olho {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: #9ca3af; padding: .25rem; display: flex; align-items: center;
  border-radius: 3px; transition: color .15s;
}
.btn-olho:hover { color: var(--cor-texto); }
.btn-olho:focus { outline: 2px solid var(--cor-primaria); outline-offset: 1px; }

.msg-erro  { color: var(--cor-erro);   font-size: .82rem; margin-bottom: .8rem; padding: .5rem .8rem;
  background: #fef2f2; border-radius: var(--radius); }
.msg-info  { color: var(--cor-info);   font-size: .82rem; margin-bottom: .8rem; padding: .5rem .8rem;
  background: #eff6ff; border-radius: var(--radius); }
.msg-sucesso{ color: var(--cor-sucesso);font-size: .82rem; margin-bottom: .8rem; padding: .5rem .8rem;
  background: #f0fdf4; border-radius: var(--radius); }

.btn-primario, button[type="submit"], #btn-login, #btn-troca, #btn-esqueci {
  width: 100%; padding: .72rem;
  background: var(--cor-sidebar); color: #fff;
  border: none; border-radius: var(--radius);
  font-size: .95rem; font-weight: 600; font-family: var(--fonte-ui);
  cursor: pointer; transition: background .15s; letter-spacing: .5px;
}
.btn-primario:hover, button[type="submit"]:hover, #btn-login:hover, #btn-troca:hover, #btn-esqueci:hover {
  background: #2a2a2a; }
.btn-primario:disabled, button[type="submit"]:disabled { background: #9ca3af; cursor: not-allowed; }

.link-aux { display: block; text-align: center; margin-top: .9rem;
  font-size: .82rem; color: #6b7280; text-decoration: none; }
.link-aux:hover { color: var(--cor-primaria); text-decoration: underline; }

.campo-lembrar { margin: -.2rem 0 .9rem; }
.lembrar-label {
  display: flex; align-items: center; gap: .45rem;
  font-size: .8rem; color: #6b7280; cursor: pointer; user-select: none;
}
.lembrar-label input[type="checkbox"] { cursor: pointer; width: 14px; height: 14px; }

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
#tela-principal { display: flex; min-height: 100vh; }

#sidebar {
  width: var(--largura-sidebar);
  background: var(--cor-sidebar); color: #e5e7eb;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  padding: 1rem .9rem .8rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-align: center;
}
.sidebar-brasao {
  display: block; width: 140px; height: auto;
  object-fit: contain; margin: 0 auto .6rem;
}
.sidebar-logo {
  display: block; font-family: var(--fonte-titulo); font-size: .6rem;
  font-weight: 700; color: var(--cor-acento); letter-spacing: .5px;
  text-transform: uppercase; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-sub {
  font-size: .58rem; color: #9ca3af; letter-spacing: .6px;
  text-transform: uppercase; margin-top: .2rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

#menu-nav { list-style: none; flex: 1; padding: .5rem 0; }
#menu-nav li a {
  display: block; padding: .65rem 1.2rem;
  color: #d1d5db; text-decoration: none;
  font-size: .875rem; transition: background .12s, color .12s;
  border-left: 3px solid transparent;
}
#menu-nav li a:hover   { background: rgba(255,255,255,.06); color: #fff; }
#menu-nav li a.ativo   { background: rgba(201,168,76,.12); color: var(--cor-acento);
  border-left-color: var(--cor-acento); }

.menu-sep { margin-top: .8rem; }
.menu-grupo { display: block; padding: .4rem 1.2rem .2rem;
  font-size: .68rem; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 1.2px; }

/* Submenu Dashboards */
.menu-grupo-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: .65rem 1.2rem;
  background: none; border: none; border-left: 3px solid transparent;
  color: #d1d5db; font-size: .875rem; font-family: var(--fonte-ui);
  cursor: pointer; transition: background .12s, color .12s;
}
.menu-grupo-btn:hover { background: rgba(255,255,255,.06); color: #fff; }
.menu-seta { font-size: .72rem; transition: transform .2s; }
.menu-sub {
  list-style: none; overflow: hidden;
  max-height: 0; opacity: 0;
  transition: max-height .25s ease, opacity .2s ease;
}
.menu-sub.aberto { max-height: 220px; opacity: 1; }
#menu-nav .menu-sub li a {
  padding-left: 1.9rem; font-size: .83rem;
  color: #9ca3af; /* mais suave que os itens de topo, só pra diferenciar */
}
#menu-nav .menu-sub li a:hover { color: #e5e7eb; }
#menu-nav .menu-sub li a.ativo { color: var(--cor-acento); }

.sidebar-footer {
  padding: .9rem 1rem; border-top: 1px solid rgba(255,255,255,.08);
  display: flex; flex-direction: column; gap: .5rem;
}
.footer-usuario { display: flex; flex-direction: column; gap: .2rem; }
#usuario-nome  { font-size: .82rem; font-weight: 600; color: #e5e7eb; }
.badge-perfil  { font-size: .68rem; color: var(--cor-acento); text-transform: uppercase; letter-spacing: .8px; }

#btn-logout {
  background: transparent; border: 1px solid rgba(255,255,255,.2);
  color: #9ca3af; padding: .38rem .8rem; border-radius: var(--radius);
  cursor: pointer; font-size: .78rem; font-family: var(--fonte-ui); transition: all .15s;
}
#btn-logout:hover { background: rgba(255,255,255,.08); color: #fff; }

/* flex:1 aqui garante que a área de conteúdo (que contém o cabeçalho
   mobile + #conteudo-principal) sempre ocupe o espaço restante ao lado da
   sidebar fixa — sem isso, um filho sem flex-grow explícito dentro de
   #tela-principal (display:flex) encolhe para o tamanho do próprio
   conteúdo em vez de esticar, e o modo Apresentação (que esconde a
   sidebar) deixava uma faixa vazia à direita em vez de usar a tela toda. */
#area-principal { flex: 1; min-width: 0; }
#conteudo-principal { margin-left: var(--largura-sidebar); flex: 1; padding: 2rem; min-width: 0; }

.placeholder-msg { color: #9ca3af; font-style: italic; }

/* ============================================================
   TOPBAR DESKTOP — ícone de perfil + timer de sessão
   (no mobile, os mesmos elementos vivem dentro de #header-mobile)
   ============================================================ */
#topbar-desktop { display: none; }
@media (min-width: 1025px) {
  #topbar-desktop {
    display: flex; align-items: center; justify-content: flex-end; gap: 1rem;
    padding: .6rem 1.5rem; background: #fff; border-bottom: 1px solid #e5e7eb;
    position: sticky; top: 0; z-index: 40;
  }
  .topbar-spacer { flex: 1; }
}

.sessao-timer {
  font-family: var(--fonte-mono, monospace); font-size: .82rem; font-weight: 600;
  color: #6b7280; cursor: pointer; padding: .3rem .8rem; border-radius: 999px;
  border: 1px solid #d1d5db; background: #f9fafb;
  transition: background .15s, color .15s, border-color .15s;
  user-select: none; min-width: 44px; text-align: center;
}
.sessao-timer:hover { background: #f3f4f6; border-color: #9ca3af; }
.sessao-timer.sessao-timer-alerta { color: var(--cor-erro); border-color: var(--cor-erro); }

.btn-abrir-perfil {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; min-width: 44px; min-height: 44px;
  background: var(--cor-sidebar); color: #fff; border: none; border-radius: 50%;
  cursor: pointer; transition: opacity .15s;
}
.btn-abrir-perfil:hover { opacity: .85; }
.btn-abrir-perfil-icone { display: flex; line-height: 1; }
#header-mobile .btn-abrir-perfil { width: 36px; height: 36px; background: transparent; }
#header-mobile .sessao-timer {
  color: #d1d5db; font-size: .74rem; padding: .2rem .55rem;
  background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.25);
}
#header-mobile .sessao-timer:hover { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.4); }
#header-mobile .sessao-timer.sessao-timer-alerta { border-color: var(--cor-erro); }

/* ============================================================
   SINO DE NOTIFICAÇÕES
   ============================================================ */
.btn-notificacoes {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; min-width: 44px; min-height: 44px;
  background: var(--cor-sidebar); color: #fff; border: none; border-radius: 50%;
  cursor: pointer; transition: opacity .15s;
}
.btn-notificacoes:hover { opacity: .85; }
.btn-notificacoes-icone { display: flex; line-height: 1; }
#header-mobile .btn-notificacoes { width: 36px; height: 36px; background: transparent; }

.badge-notificacao {
  position: absolute; top: 4px; right: 4px; width: 10px; height: 10px;
  background: #22c55e; border-radius: 50%; border: 2px solid var(--cor-sidebar);
  animation: badge-notificacao-pulsar 1.4s infinite;
}
#header-mobile .badge-notificacao { border-color: #000; }
@keyframes badge-notificacao-pulsar {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .5; transform: scale(.8); }
}
@media (prefers-reduced-motion: reduce) {
  .badge-notificacao { animation: none; }
}

.painel-notificacoes {
  position: fixed; top: 60px; right: 1rem; width: 360px; max-width: calc(100vw - 2rem);
  max-height: 70vh; overflow-y: auto; background: #fff; border: 1px solid #e5e7eb;
  border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.18); z-index: 200;
}
.painel-notificacoes-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .8rem 1rem; border-bottom: 1px solid #e5e7eb;
  font-weight: 700; color: var(--cor-sidebar); font-size: .95rem;
}
.btn-link { background: none; border: none; color: var(--cor-primaria); font-size: .78rem; cursor: pointer; padding: 0; }
.btn-link:hover { text-decoration: underline; }
.lista-notificacoes { padding: .4rem; }
.notificacao-item { padding: .7rem .8rem; border-radius: 8px; margin-bottom: .3rem; cursor: pointer; transition: background .12s; }
.notificacao-item:hover { background: #f9fafb; }
.notificacao-item.nao-lida { background: #f0fdf4; border-left: 3px solid #22c55e; }
.notificacao-item-meta { display: flex; justify-content: space-between; gap: .5rem; font-size: .72rem; color: #9ca3af; margin-bottom: .25rem; }
.notificacao-item-remetente { font-weight: 700; color: var(--cor-sidebar); }
.notificacao-item-conteudo { font-size: .86rem; color: var(--cor-texto); white-space: pre-wrap; word-break: break-word; }
.painel-notificacoes-footer { padding: .7rem 1rem; border-top: 1px solid #e5e7eb; }

/* ============================================================
   MODAL "MEU PERFIL"
   ============================================================ */
.perfil-destaque { text-align: center; margin-bottom: 1.2rem; padding-bottom: 1rem; border-bottom: 1px solid #e5e7eb; }
.perfil-nome-guerra { font-family: var(--fonte-titulo); font-size: 1.3rem; font-weight: 700;
  color: var(--cor-sidebar); text-transform: uppercase; letter-spacing: .5px; }
.perfil-cargo { font-size: .8rem; color: var(--cor-acento); text-transform: uppercase; letter-spacing: .8px; margin-top: .2rem; }
.perfil-dado { padding: .5rem .7rem; background: #f9fafb; border-radius: var(--radius); font-size: .9rem; color: var(--cor-texto); }

@keyframes conteudo-fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.conteudo-fade-in { animation: conteudo-fade-in .22s ease; }
@media (prefers-reduced-motion: reduce) {
  .conteudo-fade-in { animation: none; }
}

/* ============================================================
   MOBILE — cabeçalho fixo, navegação inferior, menu em drawer
   Estrutura desktop permanece inalterada; tudo aqui é adicionado
   via media query ou começa oculto (display:none) em telas largas.
   ============================================================ */

/* Área de toque mínima (44x44px, padrão de acessibilidade mobile) —
   vale também em desktop, já que notebooks com tela touch existem. */
.btn, button, #menu-nav li a, .btn-icone,
.campo input, .campo select, .filtro-select, .paginacao button {
  min-height: 44px;
}
.btn-icone {
  min-width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: #e5e7eb; font-size: 1.4rem; line-height: 1;
  cursor: pointer; border-radius: 50%; transition: background .15s, opacity .1s;
}
.btn-icone:active { background: rgba(255,255,255,.12); }

/* Feedback de toque — leve escurecimento imediato ao pressionar,
   já que :hover não existe em telas de toque. */
.btn:active, button:active,
#menu-nav li a:active, .dash-card:active {
  opacity: .72; transition: opacity .05s;
}

#header-mobile   { display: none; }
#sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 190; opacity: 0; transition: opacity .25s ease;
}
#sidebar-overlay.aberto { opacity: 1; }

@media (max-width: 1024px) {
  /* --- Sidebar vira um drawer deslizante ---
     height usa dvh (viewport dinâmico), não vh: no celular, vh é calculado
     pela MAIOR altura possível (com a barra de endereço recolhida) — se a
     barra estiver visível no momento (recarregou a página, rolou pra cima),
     o valor real visível é menor que 100vh, e o rodapé do menu (usuário/
     Sair) ficava desenhado abaixo da área visível, sem nada pra rolar até
     ele (o conteúdo cabia dentro da CAIXA de 100vh, só que a caixa em si
     era maior que a tela). dvh sempre acompanha a altura visível de verdade. */
  #sidebar {
    width: min(82vw, 300px);
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    z-index: 200;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  #sidebar.aberto { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.3); }
  #sidebar-overlay { display: block; pointer-events: none; }
  #sidebar-overlay.aberto { pointer-events: auto; }
  .sidebar-header { position: relative; flex-shrink: 0; }
  .sidebar-footer { flex-shrink: 0; }
  #menu-nav { flex-shrink: 1; }
  .sidebar-brasao { flex-shrink: 0; }
  #btn-fechar-menu-mobile { display: flex !important; position: absolute; top: .4rem; right: .4rem; }

  /* --- Área principal ocupa a tela toda (sem reservar a sidebar) --- */
  #area-principal { display: flex; flex-direction: column; min-height: 100dvh; width: 100%; }
  #conteudo-principal {
    margin-left: 0;
    padding: 1rem 1rem calc(env(safe-area-inset-bottom) + 1.2rem);
    flex: 1; min-width: 0;
  }

  /* --- Cabeçalho fixo mobile: título da tela + voltar + menu --- */
  #header-mobile {
    display: flex; align-items: center; justify-content: space-between; gap: .4rem;
    position: sticky; top: 0; z-index: 50;
    background: var(--cor-sidebar);
    padding: calc(env(safe-area-inset-top) + .4rem) .3rem .4rem;
    box-shadow: 0 2px 10px rgba(0,0,0,.18);
  }
  #header-mobile-titulo {
    flex: 1; text-align: center; font-family: var(--fonte-titulo);
    font-size: 1rem; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
    color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }

}

/* ============================================================
   COMPONENTES COMPARTILHADOS
   ============================================================ */

/* Página header */
.pagina-header { display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; }
.pagina-titulo { font-family: var(--fonte-titulo); font-size: 1.5rem; font-weight: 700;
  color: var(--cor-texto); letter-spacing: 1px; text-transform: uppercase; }

/* Toolbar */
.toolbar { display: flex; gap: .75rem; align-items: center; margin-bottom: 1.2rem; flex-wrap: wrap; }
.toolbar-busca { flex: 1; min-width: 200px; max-width: 360px; position: relative; }
.toolbar-busca input {
  width: 100%; padding: .52rem .8rem .52rem 2rem;
  border: 1px solid #d1d5db; border-radius: var(--radius);
  font-size: .875rem; font-family: var(--fonte-ui);
}
.toolbar-busca::before { content: '🔍'; position: absolute; left: .6rem; top: 50%;
  transform: translateY(-50%); font-size: .75rem; }

/* Botões */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem 1rem;
  border: none; border-radius: var(--radius); font-size: .85rem; font-family: var(--fonte-ui);
  font-weight: 600; cursor: pointer; transition: all .15s; white-space: nowrap; }
.btn-novo    { background: var(--cor-sidebar); color: #fff; }
.btn-novo:hover    { background: #2a2a2a; }
.btn-acento  { background: var(--cor-acento); color: #1a1a1a; }
.btn-acento:hover  { background: #b8953e; }
.btn-outline { background: transparent; border: 1px solid #d1d5db; color: var(--cor-texto); }
.btn-outline:hover { background: #f3f4f6; }
.btn-perigo  { background: #dc2626; color: #fff; }
.btn-perigo:hover  { background: #b91c1c; }
.btn-sm { padding: .3rem .6rem; font-size: .78rem; }

/* Filtros select */
.filtro-select {
  padding: .52rem .8rem; border: 1px solid #d1d5db; border-radius: var(--radius);
  font-size: .85rem; font-family: var(--fonte-ui); background: #fff; cursor: pointer;
}

/* Tabela */
.tabela-container { background: #fff; border-radius: var(--radius); box-shadow: var(--sombra); overflow: auto; }
.tabela { width: 100%; border-collapse: collapse; font-size: .85rem; }
.tabela th { background: #f9fafb; padding: .7rem 1rem; text-align: left;
  font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .6px;
  color: #6b7280; border-bottom: 1px solid #e5e7eb; white-space: nowrap; }
.tabela td { padding: .7rem 1rem; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.tabela tr:last-child td { border-bottom: none; }
.tabela tr:hover td { background: #fafafa; }

/* Badges de status */
.badge { display: inline-block; padding: .18rem .6rem; border-radius: 20px;
  font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.badge-ativo    { background: #dcfce7; color: #166534; }
.badge-inativo  { background: #f3f4f6; color: #6b7280; }
.badge-bloqueado{ background: #fef2f2; color: #dc2626; }
.badge-perfil-tag { background: rgba(201,168,76,.15); color: #92711a; font-family: var(--fonte-mono);
  font-size: .7rem; padding: .15rem .5rem; border-radius: 3px; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
  padding: 1rem;
}
.modal {
  background: #fff; border-radius: var(--radius); width: 100%; max-width: 600px;
  max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-lg { max-width: 820px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 1.5rem; border-bottom: 1px solid #e5e7eb;
}
.modal-titulo { font-family: var(--fonte-titulo); font-size: 1.1rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; }
.modal-fechar { background: none; border: none; font-size: 1.4rem; cursor: pointer;
  color: #9ca3af; line-height: 1; padding: 0 .2rem; }
.modal-fechar:hover { color: var(--cor-texto); }
.modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid #e5e7eb;
  display: flex; justify-content: flex-end; gap: .75rem; }

/* Tabs */
.tabs { display: flex; border-bottom: 2px solid #e5e7eb; margin-bottom: 1.2rem; }
.tab-btn { padding: .6rem 1.2rem; background: none; border: none; border-bottom: 2px solid transparent;
  margin-bottom: -2px; font-family: var(--fonte-ui); font-size: .875rem; font-weight: 600;
  color: #6b7280; cursor: pointer; transition: all .15s; }
.tab-btn.ativa { color: var(--cor-primaria); border-bottom-color: var(--cor-primaria); }
.tab-content { display: none; }
.tab-content.ativa { display: block; }

/* Grid de formulário */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid .campo-full { grid-column: 1 / -1; }
.form-row { margin-bottom: 1rem; }

/* Login footer e título da agência */
.logo-sigla { font-size: .82rem !important; }
.login-footer {
  margin-top: 1rem; padding-top: .75rem;
  border-top: 1px solid #2a2a2a;
  font-size: .6rem; color: #555; text-align: center; line-height: 1.65;
}
.login-footer div { white-space: nowrap; }

/* Permissões matrix */
.perm-modulo { margin-bottom: 1.2rem; }
.perm-modulo-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .5rem .8rem; background: #f9fafb; border-radius: var(--radius);
  margin-bottom: .5rem; cursor: pointer;
}
.perm-modulo-nome { font-weight: 600; font-size: .85rem; }
.perm-acoes { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0 .5rem; }
.perm-item { display: flex; align-items: center; gap: .35rem; }
.perm-item input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--cor-primaria); cursor: pointer; }
.perm-item label { font-size: .82rem; cursor: pointer; text-transform: capitalize; }
.perm-item.herdado label { color: #9ca3af; font-style: italic; }
.perm-item.herdado input { opacity: .5; }
.perm-toggle-all { font-size: .75rem; color: var(--cor-acento); cursor: pointer;
  text-decoration: underline; background: none; border: none; font-family: var(--fonte-ui); }

/* Alertas inline */
.alerta { padding: .7rem 1rem; border-radius: var(--radius); font-size: .85rem; margin-bottom: 1rem; }
.alerta-erro    { background: #fef2f2; color: #dc2626; border-left: 3px solid #dc2626; }
.alerta-sucesso { background: #f0fdf4; color: #166534; border-left: 3px solid #16a34a; }

/* Paginação */
.paginacao { display: flex; align-items: center; gap: .5rem; padding: .8rem 1rem;
  border-top: 1px solid #e5e7eb; font-size: .82rem; color: #6b7280; }
.paginacao button { padding: .3rem .65rem; border: 1px solid #d1d5db; border-radius: var(--radius);
  background: #fff; cursor: pointer; font-size: .82rem; }
.paginacao button:hover { background: #f3f4f6; }
.paginacao button:disabled { opacity: .4; cursor: not-allowed; }
.paginacao-info { margin: 0 auto; }

/* Loading spinner */
.spinner { display: inline-block; width: 18px; height: 18px;
  border: 2px solid #e5e7eb; border-top-color: var(--cor-primaria);
  border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { display: flex; align-items: center; justify-content: center;
  padding: 3rem; color: #9ca3af; gap: .75rem; }
