/* ═══════════════════════════════════════════
   RESET & VARIABLES
═══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Inter variable — self-hosted (fonts/InterVariable.woff2, cacheada 24h) */
@font-face {
  font-family: 'Inter';
  src: url('fonts/InterVariable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --primary:       #1D436F;
  --primary-dark:  #152F50;
  --primary-light: #D0E4F5;
  --success:       #059669;
  --warning:       #D97706;
  --danger:        #DC2626;
  --info:          #0891B2;

  --gray-50:  #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  /* Tokens semânticos — superfícies/texto/borda. Componentes novos usam
     estes; o dark mode redefine apenas este bloco + a escala de cinzas. */
  --surface:    #FFFFFF;        /* cards, modais, painéis           */
  --surface-2:  var(--gray-50); /* fundo da página, áreas recuadas  */
  --surface-3:  var(--gray-100);/* hovers, faixas, inputs disabled  */
  --text-1:     var(--gray-800);/* texto principal                  */
  --text-2:     var(--gray-500);/* texto secundário/labels          */
  --border-1:   var(--gray-200);/* bordas e divisores               */

  /* Escala de espaçamento — usar nos componentes novos */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;
  --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;

  --sb-w: 260px;
  --topbar-h: 64px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow:    0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.12), 0 4px 6px rgba(0,0,0,.05);
  --tx: all .18s ease;
}

/* ═══════════════════════════════════════════
   DARK MODE — ativado via <html data-theme="dark">
   (boot-brand.js aplica antes do primeiro paint; toggle no topbar)
   Estratégia: inverte a escala de cinzas + redefine tokens semânticos.
   A maior parte do CSS adapta sozinho por usar var(--gray-*)/tokens.
═══════════════════════════════════════════ */
html[data-theme="dark"] {
  --gray-50:  #1E293B;
  --gray-100: #243049;
  --gray-200: #334155;
  --gray-300: #475569;
  --gray-400: #64748B;
  --gray-500: #94A3B8;
  --gray-600: #CBD5E1;
  --gray-700: #E2E8F0;
  --gray-800: #F1F5F9;
  --gray-900: #F8FAFC;

  --primary-light: #1E3A5F;

  --surface:   #1E293B;
  --surface-2: #0F172A;
  --surface-3: #243049;
  --text-1:    #E2E8F0;
  --text-2:    #94A3B8;
  --border-1:  #334155;

  --shadow:    0 1px 3px rgba(0,0,0,.45), 0 1px 2px rgba(0,0,0,.35);
  --shadow-md: 0 4px 6px rgba(0,0,0,.40), 0 2px 4px rgba(0,0,0,.30);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.55), 0 4px 6px rgba(0,0,0,.35);
  color-scheme: dark; /* scrollbars e controles nativos escuros */
}

/* Elementos que usam --primary (azul-marinho #1D436F) como COR DE TEXTO ou
   borda ficam ilegíveis sobre superfícies escuras. Em dark, clareiam. */
html[data-theme="dark"] .tk-id {
  color: #FFFFFF;
}
html[data-theme="dark"] .btn-outline {
  color: #FFFFFF;
  border-color: var(--gray-300);
}
html[data-theme="dark"] .btn-outline:hover {
  background: var(--surface-3);
  border-color: var(--gray-400);
}
html[data-theme="dark"] a.link-sm,
html[data-theme="dark"] .th-sort-active {
  color: #7FB3E8; /* azul claro p/ links/sort ativos que usavam --primary */
}

html, body {
  /* Trava overflow horizontal globalmente. Qualquer elemento que por
     acidente exceda a largura do viewport (img sem max-width, banner
     fixo mal calculado, etc.) é clipado em vez de gerar barra de
     rolagem horizontal — comportamento desejado em SPA full-page. */
  overflow-x: hidden;
}
body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text-1);
  background: var(--surface-2);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════
   ÍCONES SVG (sprite assets/icons.svg — Lucide)
═══════════════════════════════════════════ */
.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  vertical-align: -3px;      /* alinha com texto inline */
  stroke-width: 2;
}
.icon-sm { width: 14px; height: 14px; vertical-align: -2px; }
.icon-lg { width: 24px; height: 24px; vertical-align: -5px; }
.icon-xl { width: 32px; height: 32px; }

/* ═══════════════════════════════════════════
   FOCO VISÍVEL (teclado) + microinterações base
═══════════════════════════════════════════ */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}
button, a, .chip, .nav-item, .row-click, .ms-opt {
  transition: var(--tx);
}
button:active:not(:disabled) { transform: scale(.97); }

/* ═══════════════════════════════════════════
   SKELETON LOADERS
═══════════════════════════════════════════ */
@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .45; }
}
.skeleton {
  display: block;
  background: var(--border-1);
  border-radius: 6px;
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}
.skeleton-row  { height: 14px; margin: 12px 0; }
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border-1);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.skeleton-w-30 { width: 30%; }
.skeleton-w-50 { width: 50%; }
.skeleton-w-70 { width: 70%; }
.skeleton-w-90 { width: 90%; }
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; opacity: .6; }
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ═══════════════════════════════════════════
   EMPTY STATES
═══════════════════════════════════════════ */
.empty-state {
  background: var(--surface);
  border: 1px solid var(--border-1);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 48px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.empty-state-icon {
  width: 44px;
  height: 44px;
  color: var(--gray-300);
  stroke-width: 1.5;
  margin-bottom: 6px;
}
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--text-1); }
.empty-state-hint  { font-size: 13px; color: var(--text-2); max-width: 420px; }
.empty-state .btn  { margin-top: 12px; }

a { text-decoration: none; color: inherit; }

/* ═══════════════════════════════════════════
   PAGES
═══════════════════════════════════════════ */
.page { display: none; min-height: 100vh; }
.page.active { display: flex; }

/* ═══════════════════════════════════════════
   LOGIN
═══════════════════════════════════════════ */
#page-login {
  position: relative;
  /* Cor de fundo base (visível quando não há imagem ou enquanto carrega) */
  background-color: #0F172A;
  /* Imagem de fundo responsiva: cover = preenche sem distorcer, seja qual for a resolução */
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  /* NB: o display NÃO fica aqui — é definido em #page-login.active para não
     sobrepor o toggle .page/.page.active (id venceria a classe e a tela de
     login nunca esconderia após o login). Vide regra .active abaixo. */
  /* Padding-bottom reserva espaço para o rodapé fixo (.app-footer-login,
     ~67 px com 2 linhas) evitando que o card invada a faixa do rodapé.
     Padding-top default (prod) é apenas folga visual — não há banner no topo. */
  padding: 24px 24px 96px;
  /* Defesa em profundidade: nenhum filho deve transbordar horizontalmente
     (banner fixo, card, overlay, etc.). overflow-x clipa qualquer
     transbordo causado por padding-right do banner ou box-shadow. */
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}
/* Layout só quando a tela de login está ativa (grid de 3 colunas: o card
   fica na coluna central → centralizado no viewport; o painel de avisos
   ocupa a coluna esquerda, sem deslocar o login). Especificidade (id+classe)
   vence .page.active sem quebrar o toggle de exibição. */
#page-login.active {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  justify-items: center;
}
/* Em ambiente de testes, o banner fixo no topo (.env-test-banner-login,
   ~36 px) precisa de espaço extra para o card não colar nele. Mantém o
   mesmo gap visual entre card↔banner e card↔rodapé. */
body.env-test #page-login {
  padding-top: 60px;
}

/* Overlay gradiente sobre a imagem — cria o efeito de marca d'água/segundo plano.
   A opacidade é controlada via CSS variable --login-overlay (padrão 1 = sem imagem). */
#page-login::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #0F172A 0%, #1E3A8A 45%, #2563EB 100%);
  opacity: var(--login-overlay, 1);
  transition: opacity .4s ease;
  z-index: 0;
}

/* Garante que o card de login fique acima do overlay */
.login-bg {
  position: relative;
  z-index: 1;
  /* Limita a largura ao do card pra não criar caixa lateralmente
     maior que o conteúdo (evita scroll horizontal) */
  width: 100%;
  max-width: 420px;
}

/* Painel lateral de avisos/status — card próprio à esquerda do login.
   Fica fora do card de login para não aumentar a altura dele. */
.login-aside {
  position: relative;
  z-index: 1;
  grid-column: 1;        /* coluna esquerda */
  justify-self: end;     /* encosta na borda do card central */
  margin-right: 24px;    /* gap até o login */
  width: 300px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--surface);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: var(--shadow-lg);
}
.login-aside.hidden { display: none; }
/* Card de login sempre na coluna central → centralizado no viewport */
.login-bg { grid-column: 2; }
.login-aside-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  letter-spacing: .02em;
  color: var(--text-1);
}
/* Reset das margens internas (que eram afinadas p/ ficar dentro do login-card) */
.login-aside .login-status { margin: 0 auto; }
.login-aside .login-notice { margin: 0; }
/* Telas estreitas: empilha o painel acima do login (mantém login centrado) */
@media (max-width: 1080px) {
  #page-login.active { display: flex; flex-direction: column; justify-content: center; gap: 20px; }
  .login-aside { grid-column: auto; justify-self: auto; margin-right: 0; width: 100%; max-width: 420px; }
}

.login-card {
  background: var(--surface);
  border-radius: 16px;
  /* topo mais enxuto para não sobrar espaço acima da marca; rodapé do
     card também reduzido para encurtar a altura total e evitar colisão
     com o rodapé fixo da página */
  padding: 28px 40px 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  justify-content: center;
  /* Permite quebra do logo/nome em viewports estreitos sem gerar
     overflow horizontal no card */
  flex-wrap: wrap;
}
/* Tamanhos específicos da identidade na tela de login (e nas telas
   forgot/request que herdam .login-brand). Logo recebe destaque maior;
   texto fica em peso secundário para não competir. Sidebar e outras
   áreas usam regras próprias e não são afetadas. */
.login-brand .brand-logo-lg { width: 120px; height: 120px; }
.login-brand .brand-icon    { font-size: 56px; }
.login-brand .brand-name    { font-size: 24px; font-weight: 600; }
.brand-icon { font-size: 30px; }
.link-sm { font-size: 13px; color: var(--primary); text-decoration: none; }
.link-sm:hover { text-decoration: underline; }
.brand-name  { font-size: 26px; font-weight: 700; color: var(--primary); letter-spacing: -.5px; }
.brand-logo    { display: none; object-fit: contain; }
.brand-logo:not(.hidden) { display: block; }
.brand-logo-lg { width: 56px; height: 56px; }
.brand-logo-sm { width: 32px; height: 32px; }
.sidebar .brand-logo { filter: brightness(0) invert(1); }

.login-title { font-size: 20px; font-weight: 700; text-align: center; color: var(--gray-900); margin-bottom: 6px; }
.login-sub   { font-size: 14px; text-align: center; color: var(--gray-500); margin-bottom: 28px; }

/* Status do sistema (badge centralizado) — cor por data-status */
.login-status {
  display: flex; align-items: center; gap: 6px;
  width: fit-content; margin: -10px auto 16px;
  padding: 4px 12px; border-radius: 999px;
  background: var(--surface-3); font-size: 12px; font-weight: 600;
}
.login-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gray-400); flex-shrink: 0; }
.login-status[data-status="operational"] { color: var(--success); }
.login-status[data-status="operational"] .login-status-dot { background: var(--success); }
.login-status[data-status="degraded"]    { color: var(--warning); }
.login-status[data-status="degraded"]    .login-status-dot { background: var(--warning); }
.login-status[data-status="maintenance"] { color: var(--danger); }
.login-status[data-status="maintenance"] .login-status-dot { background: var(--danger); }

/* Comunicado (mural) — borda esquerda colorida por data-type */
.login-notice {
  margin: 0 0 18px; padding: 10px 14px;
  border-radius: 8px; border-left: 3px solid var(--info);
  background: var(--surface-3); color: var(--text-1);
  font-size: 13px; line-height: 1.5; text-align: center;
  overflow-wrap: anywhere;
}
.login-notice[data-type="info"]        { border-left-color: var(--info); }
.login-notice[data-type="success"]     { border-left-color: var(--success); }
.login-notice[data-type="warning"]     { border-left-color: var(--warning); }
.login-notice[data-type="maintenance"] { border-left-color: var(--danger); }

/* Divisória entre blocos num mesmo card de config */
.cfg-divider { border: none; border-top: 1px solid var(--gray-200); margin: 18px 0; }

/* ═══════════════════════════════════════════
   FORMS
═══════════════════════════════════════════ */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.req { color: var(--danger); }

input[type=checkbox], input[type=radio] {
  width: auto; padding: 0; border: none; box-shadow: none;
  background: none; appearance: auto; -webkit-appearance: auto;
}
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--surface);
  transition: var(--tx);
  outline: none;
  appearance: none;
}
input:not([type=checkbox]):not([type=radio]):focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29,67,111,.15);
}
input:not([type=checkbox]):not([type=radio])::placeholder, textarea::placeholder { color: var(--gray-400); }
textarea { resize: vertical; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

/* ═══════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--tx);
  font-family: inherit;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-outline   { background: var(--surface); color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-full { width: 100%; }
.btn-sm  { padding: 6px 12px; font-size: 13px; }
.btn-lg  { padding: 12px 20px; font-size: 15px; }

/* ═══════════════════════════════════════════
   CHIPS / BADGES
═══════════════════════════════════════════ */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.chip-blue  { background: #DBEAFE; color: #1D4ED8; }
.chip-sky   { background: #E0F2FE; color: #0369A1; }
.chip-teal  { background: #CCFBF1; color: #0F766E; }
.chip-green      { background: #D1FAE5; color: #065F46; }
.chip-green-dark { background: #A7F3D0; color: #064E3B; }
.chip-amber { background: #FEF3C7; color: #92400E; }
.chip-red   { background: #FEE2E2; color: #991B1B; }
.chip-purple{ background: #EDE9FE; color: #5B21B6; }
.chip-gray  { background: #F3F4F6; color: #374151; }
.chip-orange{ background: #FFEDD5; color: #9A3412; }
.chip-sm    { padding: 2px 7px; font-size: 11px; }

/* ═══════════════════════════════════════════
   CHAR COUNTER
═══════════════════════════════════════════ */
.char-counter          { font-size: 12px; color: var(--gray-400); transition: color .2s; }
.char-counter.warn     { color: #D97706; font-weight: 600; }
.char-counter.danger   { color: #DC2626; font-weight: 700; }
textarea.char-limit-reached { border-color: #DC2626 !important; }

/* ═══════════════════════════════════════════
   IDLE WARNING BANNER
═══════════════════════════════════════════ */
.idle-warning {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 99999;
  background: #FEF3C7;
  color: #92400E;
  border-bottom: 2px solid #F59E0B;
  text-align: center;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  animation: idle-slide-in .3s ease;
}
@keyframes idle-slide-in {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}

/* ═══════════════════════════════════════════
   ALERTS
═══════════════════════════════════════════ */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 14px;
}
.alert-error   { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.alert-success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-warn    { background: #FFFBEB; color: #92400E; border: 1px solid #FCD34D; }
.alert-ok      { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; border-radius: 8px; padding: 10px 14px; font-size: 13px; }
.mfa-icon      { font-size: 40px; text-align: center; margin-bottom: 8px; }
.hidden { display: none !important; }

/* ═══════════════════════════════════════════
   DEMO BOX
═══════════════════════════════════════════ */
.demo-box { border-top: 1px solid var(--gray-200); margin-top: 24px; padding-top: 18px; }
.demo-title { font-size: 12px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }
.demo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  color: var(--gray-600);
  transition: var(--tx);
  margin-bottom: 8px;
}
.demo-row:hover { background: var(--primary-light); border-color: var(--primary); }

/* ═══════════════════════════════════════════
   LAYOUT — SIDEBAR + MAIN
═══════════════════════════════════════════ */
.layout { flex-direction: row; }

/* Sidebar */
.sidebar {
  width: var(--sb-w);
  background: #1D436F;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform .25s ease;
}

.sb-header {
  display: flex;
  align-items: center;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; }
.sidebar .brand-logo-sm { width: calc(var(--sb-w) * 0.4); height: auto; max-height: 64px; }
.sidebar .brand-info { display: flex; flex-direction: column; gap: 5px; align-items: center; flex: 1; }
.sidebar .brand-name { color: #fff; font-size: 16px; font-weight: 700; line-height: 1.2; }
.sidebar .brand-icon { font-size: 20px; }

.sb-nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  color: rgba(255,255,255,.65);
  transition: var(--tx);
  cursor: pointer;
  font-size: 14px;
  border-radius: 0;
  user-select: none;
}
.nav-item:hover  { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.ni { font-size: 17px; flex-shrink: 0; display: flex; align-items: center; }
.ni .icon { width: 18px; height: 18px; }

.sb-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.sb-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sb-name { font-size: 13px; font-weight: 600; color: #fff; }
.sb-role { font-size: 11px; color: rgba(255,255,255,.45); }

/* Avatar */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.avatar-admin { background: var(--success); }
.avatar-sm {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.btn-logout {
  width: 100%;
  padding: 8px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--radius);
  color: rgba(255,255,255,.65);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: var(--tx);
}
.btn-logout:hover { background: rgba(239,68,68,.2); border-color: rgba(239,68,68,.3); color: #FCA5A5; }

/* Linha do rodapé da sidebar: toggle de tema + sair lado a lado */
.sb-actions { display: flex; gap: 8px; }
.sb-actions .btn-logout { flex: 1; width: auto; }
.btn-theme {
  padding: 8px 10px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--radius);
  color: rgba(255,255,255,.65);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: var(--tx);
}
.btn-theme:hover { background: rgba(255,255,255,.15); color: #fff; }
/* Mostra lua no claro / sol no escuro */
.btn-theme .icon-sun  { display: none; }
html[data-theme="dark"] .btn-theme .icon-sun  { display: block; }
html[data-theme="dark"] .btn-theme .icon-moon { display: none; }

/* ── Sino de notificações ─────────────────────────────────── */
.btn-notif { position: relative; }
.notif-badge {
  position: absolute;
  top: -5px; right: -5px;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.notif-badge.hidden { display: none; }
.notif-panel {
  position: fixed;
  left: calc(var(--sb-w) + 14px);
  bottom: 14px;
  width: 370px;
  max-width: calc(100vw - 24px);
  max-height: 62vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 130;
}
.notif-panel.hidden { display: none; }
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-1);
}
/* Mostra ~5 itens; o resto (até 50) fica acessível por rolagem. */
.notif-lista { overflow-y: auto; max-height: 410px; }
.notif-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-1);
  cursor: pointer;
  transition: var(--tx);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-3); }
.notif-item.unread { background: var(--primary-light); }
.notif-item.unread:hover { filter: brightness(.97); }
.notif-item-title { font-size: 13px; color: var(--text-1); }
.notif-item.unread .notif-item-title { font-weight: 600; }
.notif-item-meta { font-size: 11px; color: var(--text-2); }
.notif-empty { padding: 28px 16px; text-align: center; color: var(--text-2); font-size: 13px; }
@media (max-width: 768px) {
  .notif-panel { left: 12px; right: 12px; width: auto; bottom: 70px; }
}

/* Main Wrap */
.main-wrap {
  flex: 1;
  margin-left: var(--sb-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 14px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
.hamburger {
  display: none;
  background: none; border: none;
  font-size: 20px; cursor: pointer;
  color: var(--gray-600); padding: 4px;
}
/* Hamburger flutuante (sem topbar) — só mobile */
.hamburger-float {
  position: fixed;
  top: 12px; left: 12px;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 6px 10px;
  box-shadow: var(--shadow);
}
.topbar-title { font-size: 18px; font-weight: 700; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

/* Content */
.content { flex: 1; padding: 0; }
.sec { display: none; padding: 24px; }
.sec.active { display: block; }

/* Section header */
.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.sec-head h2 { font-size: 20px; font-weight: 700; color: var(--gray-900); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input  { min-width: 180px; width: auto; }
.filters select { min-width: 150px; width: auto; }
.filter-label { font-size: 13px; color: var(--gray-600); white-space: nowrap; }

/* ── Multi-select dropdown (filtro de status) ─────────────── */
.ms-wrap { position: relative; }
.ms-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 150px;
  padding: 10px 13px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--surface);
  cursor: pointer;
  transition: var(--tx);
}
.ms-btn:hover { border-color: var(--gray-400); }
.ms-btn:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,67,111,.15); outline: none; }
.ms-caret { margin-left: auto; font-size: 10px; color: var(--gray-500); }
.ms-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 50;
  width: max-content;
  min-width: 100%;
  max-width: 320px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 6px;
}
.ms-panel.hidden { display: none; }
/* display:flex + gap explícitos para vencer estilos globais de <label> */
.ms-opt {
  display: flex !important;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin: 0;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 400;
  color: var(--gray-700);
  text-align: left;
  cursor: pointer;
  user-select: none;
}
.ms-opt:hover { background: var(--gray-50); }
/* min-width:0 anula o `.filters input { min-width:180px }` global que
   esticava o checkbox e empurrava o texto para longe */
.ms-opt input[type="checkbox"] {
  flex: 0 0 auto;
  min-width: 0 !important;
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
}
.ms-opt span  { flex: 0 1 auto; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Grupos de filtro por data (abertura / resolução) ─────── */
.filter-date-group { display: flex; align-items: center; gap: 4px; }
.filter-date-lbl { font-size: 12px; color: var(--gray-500); white-space: nowrap; }
.filter-date-sep { font-size: 12px; color: var(--gray-400); }
.filters .filter-date-group input[type="date"] {
  min-width: 0;
  width: 135px;
  padding: 8px 8px;
  font-size: 13px;
}

/* ═══════════════════════════════════════════
   STATS ROW
═══════════════════════════════════════════ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 16px;
  margin-bottom: 0;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
}
.stat-icon { font-size: 34px; color: var(--stat-c, var(--primary)); display: flex; align-items: center; }
.stat-val  { font-size: 30px; font-weight: 800; line-height: 1; color: var(--stat-c, var(--primary)); }
.stat-lbl  { font-size: 13px; color: var(--gray-500); margin-top: 3px; }

/* ═══════════════════════════════════════════
   CARDS
═══════════════════════════════════════════ */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}
.card-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.card-head h3 { font-size: 14px; font-weight: 700; color: var(--gray-800); }
.card-body { padding: 20px; }
.card-body.p0 { padding: 0; }
.mt { margin-top: 16px; }

/* ═══════════════════════════════════════════
   GRID HELPERS
═══════════════════════════════════════════ */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Coluna direita do dashboard: chart Por Prioridade (altura natural) + 2 mini
   indicadores embaixo, ocupando o espaço em branco que sobrava. */
.dash-prio-col { display: flex; flex-direction: column; gap: 16px; }
.dash-prio-col .card { margin: 0; }
/* Atendimento ocupa a maior parte (prioridades lado a lado); Reação com
   largura mínima garantida para o rótulo não quebrar em 2 linhas. */
.dash-mini-row { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(200px, 1fr); gap: 16px; }
/* Padding/gap reduzidos para evitar quebra de texto nos rótulos */
.dash-mini-row .stat-card { margin: 0; padding: 14px 12px; gap: 10px; }
.dash-mini-row .stat-icon { font-size: 28px; }
.dash-mini-row .stat-val  { font-size: 26px; }
/* Card de atendimento: ícone alinhado ao topo, conteúdo cresce */
.stat-card-atd { align-items: flex-start; }
.stat-card-grow { flex: 1; min-width: 0; }
.stat-lbl-head { font-weight: 600; color: var(--gray-700); margin-bottom: 10px; }

/* Breakdown de TMA por prioridade — itens lado a lado (1 linha), label/tempo empilhados */
.prio-breakdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(74px, 1fr)); gap: 8px 12px; }
.prio-bd-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.prio-bd-lbl { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prio-bd-dot { width: 8px; height: 8px; padding: 0; border: none; border-radius: 50%; flex-shrink: 0; background: var(--chip-fg, #6B7280); }
.prio-bd-val { font-size: 16px; font-weight: 700; color: var(--gray-800); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ═══════════════════════════════════════════
   DATA TABLE
═══════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }

/* Tabela com header congelado: scroll vertical interno + thead sticky.
   max-height limita a área de rolagem; o thead gruda no topo do container. */
.table-wrap-sticky {
  max-height: calc(100vh - 240px);
  overflow: auto;
}
.tbl-sticky-head thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  /* bg opaco obrigatório — senão linhas aparecem por trás ao rolar */
  background: var(--gray-50);
  /* border-bottom não "gruda" com sticky; box-shadow simula a divisória */
  box-shadow: inset 0 -1px 0 var(--gray-200);
}
table.tbl {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}
.tbl th {
  background: var(--gray-50);
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.tbl.tbl-sm th { padding: 8px 10px; font-size: 11px; }
.tbl.tbl-sm td { padding: 8px 10px; font-size: 12px; }
.tbl td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
  color: var(--gray-700);
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl .row-click { cursor: pointer; }
.tbl .row-click:hover td { background: var(--gray-50); }
.tbl th.th-sortable { cursor: pointer; user-select: none; }
.tbl th.th-sortable:hover { background: var(--gray-100); color: var(--gray-700); }
.tbl th.th-sort-active { color: var(--primary); }

/* ── Tour de onboarding (driver.js) — ajustes de tema ────────── */
.driver-popover { font-family: inherit; }
html[data-theme="dark"] .driver-popover {
  background-color: var(--surface);
  color: var(--text-1);
}
html[data-theme="dark"] .driver-popover-title { color: var(--text-1); }
html[data-theme="dark"] .driver-popover-description,
html[data-theme="dark"] .driver-popover-progress-text { color: var(--text-2); }
html[data-theme="dark"] .driver-popover-arrow-side-left  { border-left-color:   var(--surface); }
html[data-theme="dark"] .driver-popover-arrow-side-right { border-right-color:  var(--surface); }
html[data-theme="dark"] .driver-popover-arrow-side-top   { border-top-color:    var(--surface); }
html[data-theme="dark"] .driver-popover-arrow-side-bottom{ border-bottom-color: var(--surface); }

/* ── Command palette (Ctrl+K) ────────────────────────────────── */
.cmdk-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 23, 42, .55);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 16px 16px;
}
.cmdk-overlay.hidden { display: none; }
.cmdk-box {
  width: 560px;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
/* Fonte explícita em todo o palette — input/button/kbd não herdam
   font-family por default e caíam na fonte do sistema. */
.cmdk-box,
.cmdk-box input,
.cmdk-box button,
.cmdk-box kbd {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}
.cmdk-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 14px;
  border-bottom: 1px solid var(--border-1);
  color: var(--text-2);
}
.cmdk-input-row input,
.cmdk-input-row input:focus {
  border: none;
  box-shadow: none;
  padding: 12px 0;
  font-size: 15px;
  background: transparent;
}
.cmdk-kbd {
  font-family: inherit;
  font-size: 11px;
  color: var(--text-2);
  border: 1px solid var(--border-1);
  border-radius: 5px;
  padding: 2px 6px;
  flex-shrink: 0;
}
.cmdk-list { max-height: 46vh; overflow-y: auto; padding: 6px; }
.cmdk-group {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-2);
  padding: 8px 10px 4px;
}
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 8px;
  padding: 9px 10px;
  font-family: inherit; /* <button> não herda fonte por default (caía em Arial) */
  font-size: 14px;
  color: var(--text-1);
  cursor: pointer;
}
.cmdk-item .icon { color: var(--text-2); }
.cmdk-item.active,
.cmdk-item:hover { background: var(--surface-3); }
.cmdk-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item-hint  { font-size: 12px; color: var(--text-2); flex-shrink: 0; }
.cmdk-empty { padding: 22px 14px; text-align: center; color: var(--text-2); font-size: 13px; }
.cmdk-foot {
  padding: 8px 14px;
  border-top: 1px solid var(--border-1);
  font-size: 11.5px;
  color: var(--text-2);
}

/* ── Pesquisa de satisfação (estrelas) ───────────────────────── */
.star-rating { display: flex; gap: 4px; margin-top: 4px; }
.star-btn {
  background: none;
  border: none;
  padding: 0 2px;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  color: var(--gray-300);
  transition: color .12s ease, transform .12s ease;
}
.star-btn:hover { transform: scale(1.15); }
.star-btn.star-on { color: #F59E0B; }     /* âmbar para estrela preenchida */
.stars-ro { color: #F59E0B; font-size: 15px; letter-spacing: 1px; white-space: nowrap; }
.survey-done-icon { font-size: 48px; margin: 8px 0 4px; }

/* ── Densidade de tabelas (toggle na sidebar) ────────────────── */
/* Modo compacto: mais linhas por tela em todas as tabelas .tbl/.table.
   Preferência persistida em localStorage ('tableDensity'). */
/* Botão da sidebar destacado enquanto o modo compacto está ativo */
body.density-compact [data-action="toggle-density"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
body.density-compact .tbl th   { padding: 6px 8px; font-size: 10.5px; }
body.density-compact .tbl td   { padding: 5px 8px; font-size: 12.5px; }
body.density-compact .table th { padding: 5px 8px; }
body.density-compact .table td { padding: 5px 8px; font-size: 12.5px; }
body.density-compact .tbl .btn-sm { padding: 3px 9px; font-size: 12px; }
body.density-compact .tbl .chip   { padding: 2px 8px; font-size: 11px; }

/* ── Colunas reordenáveis + redimensionáveis ─────────────────── */
.tbl.tbl-resizable { table-layout: fixed; }
.tbl.tbl-resizable th { position: relative; }
/* Tabela redimensionável E com header congelado: sticky vence (position:
   sticky também ancora o handle absolute, como relative faria). Sem esta
   regra, o `relative` acima — mais específico que .tbl-sticky-head — matava
   o congelamento do header em Gerenciar Chamados. */
.tbl.tbl-resizable.tbl-sticky-head thead th { position: sticky; }
.tbl.tbl-resizable th.th-dragging  { opacity: 0.4; }
.tbl.tbl-resizable th.th-drag-over { background: #DBEAFE !important; box-shadow: inset 3px 0 0 0 #2563EB; }
.tbl.tbl-resizable .th-label { display: inline-block; cursor: grab; padding-right: 6px; }
.tbl.tbl-resizable th.th-dragging .th-label { cursor: grabbing; }
.tbl.tbl-resizable td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.col-resize-handle {
  position: absolute;
  top: 0; right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 2;
}
.col-resize-handle:hover { background: rgba(37, 99, 235, 0.35); }
.col-resize-handle.col-resize-active { background: rgba(37, 99, 235, 0.6); }
.tk-id { font-family: monospace; font-weight: 700; color: var(--primary); font-size: 13px; }
.user-cell { display: flex; align-items: center; gap: 8px; }
.tk-title { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-text  { max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-text-sm { max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-sub { max-width: 220px; margin-top: 3px; font-size: 11px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ═══════════════════════════════════════════
   BAR CHART (inline CSS chart)
═══════════════════════════════════════════ */
.bar-chart { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-lbl { width: 120px; font-size: 12px; color: var(--gray-600); text-align: right; flex-shrink: 0; }
.bar-track { flex: 1; height: 18px; background: var(--gray-100); border-radius: 4px; overflow: hidden; }
.bar-fill  { height: 100%; border-radius: 4px; transition: width .5s ease; min-width: 2px; }
.bar-count { width: 72px; font-size: 12px; font-weight: 700; color: var(--gray-700); white-space: nowrap; flex-shrink: 0; }

/* ═══════════════════════════════════════════
   FORM ACTIONS
═══════════════════════════════════════════ */
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* ═══════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════ */
.empty { text-align: center; color: var(--gray-400); padding: 40px 20px; font-size: 14px; }
.empty-sm { text-align: center; color: var(--gray-400); padding: 16px; font-size: 13px; }

/* ═══════════════════════════════════════════
   MODAL
═══════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 24px;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 920px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 22px 24px;
  border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; background: var(--surface); z-index: 10;
}
.modal-id { font-size: 11px; color: var(--primary); font-weight: 700; font-family: monospace; letter-spacing: .08em; margin-bottom: 4px; }
.modal-header h2 { font-size: 17px; font-weight: 700; color: var(--gray-900); }
.modal-close {
  background: var(--gray-100); border: none;
  border-radius: 50%; width: 32px; height: 32px;
  cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: var(--tx);
}
.modal-close:hover { background: var(--gray-200); }
.modal-body { padding: 24px; }
.modal-grid {
  display: grid;
  grid-template-columns: 1fr 270px;
  gap: 24px;
  /* Filhos do grid não esticam verticalmente — necessário para
     position: sticky funcionar no .modal-side (sem isto, o item
     esticaria à altura total da coluna e nunca "sairia" do viewport
     para grudar). Combinado com align-self: start, defesa em dupla
     camada. */
  align-items: start;
}
.modal-main { display: flex; flex-direction: column; gap: 20px; }
.modal-side { display: flex; flex-direction: column; gap: 14px; }

/* Sidebar do modal acompanha o scroll do conteúdo (desktop).
   `align-self: start` impede o grid item de esticar até a altura
   total da coluna — sem isso, position: sticky não tem efeito
   (item nunca "sai" do viewport pra grudar).

   Sem max-height/overflow interno: sidebar não tem barra de rolagem
   própria. Rola junto com o modal normalmente; em telas onde cabe
   inteiro, fica fixo enquanto o conteúdo principal scrolla. Padrão
   adotado pelo Jira/Zendesk. */
@media (min-width: 768px) {
  .modal-side {
    position: sticky;
    /* O .modal-header é sticky em top:0 (altura ~80px com padding 22+22
       e duas linhas de texto). A sidebar precisa grudar ABAIXO do header
       para Status/Prioridade não ficarem cobertos visualmente. */
    top: 96px;
    align-self: start;
  }
}

.detail-block h4.detail-block-title {
  font-size: 11px; font-weight: 700;
  color: var(--gray-500); text-transform: uppercase;
  letter-spacing: .06em; margin-bottom: 10px;
}
.detail-block p { font-size: 14px; color: var(--gray-700); white-space: pre-wrap; line-height: 1.65; }

/* Info card (right panel) */
.info-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px;
}
.info-card-title { font-size: 13px; font-weight: 700; color: var(--gray-700); margin-bottom: 12px; }
.info-row {
  display: flex; align-items: center;
  justify-content: space-between;
  /* flex-wrap: valor longo cai numa linha própria de largura total (cabe
     o texto inteiro) em vez de quebrar no meio do token; curtos seguem inline */
  flex-wrap: wrap;
  padding: 7px 0;
  border-bottom: 1px solid var(--gray-200);
  gap: 2px 8px;
}
.info-row:last-child { border-bottom: none; }
.info-label { font-size: 12px; color: var(--gray-500); font-weight: 500; flex-shrink: 0; }
.info-val   { font-size: 13px; color: var(--gray-800); text-align: right; }
/* Valor (2º span da linha): cresce/encolhe; só parte o token se nem na
   linha cheia couber (ex: nome de fila TECH_SUPORTE_SAP_OUTBOUND) */
.info-row > span:last-child {
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}
.info-card { overflow: hidden; }   /* defesa extra contra transbordo */

/* Admin actions inside modal */
#admin-acoes .field { margin-bottom: 12px; }

/* Ticket history timeline */
.ticket-history { display: flex; flex-direction: column; }
.history-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
}
.history-item:last-child { border-bottom: none; }
.history-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.history-body { display: flex; flex-direction: column; gap: 2px; }
.history-text { font-size: 13px; color: var(--gray-800); }
.history-meta { font-size: 11px; color: var(--gray-400); }

/* ═══════════════════════════════════════════
   CHAT-STYLE COMMENTS (histórico de comentários)
   Layout estilo WhatsApp/Telegram:
     - Solicitante (role=user)         → esquerda (cinza claro)
     - Suporte (admin/solucionador/    → direita (cor primária)
       gerente)
     - Mensagens automáticas do        → card central, neutro
       sistema (🔄 prioridade,
       ✅ resolução, etc.)
   ═══════════════════════════════════════════ */
.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 2px;
}

.chat-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 100%;
}

.chat-msg.chat-left  { justify-content: flex-start; }
/* Estilo WhatsApp: mensagens da equipe (resposta) NÃO mostram avatar,
   liberando o bubble para encostar na borda direita do thread. Resultado
   é mais aderente ao padrão de chat moderno onde o "eu" não vê o próprio
   avatar repetido em cada bolha. */
.chat-msg.chat-right { justify-content: flex-end; }
.chat-msg.chat-right .chat-avatar { display: none; }

.chat-avatar {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gray-300);
  color: var(--gray-700);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}

.chat-bubble {
  position: relative;
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
}

.chat-msg.chat-left  .chat-bubble { border-bottom-left-radius: 4px; }
.chat-msg.chat-right .chat-bubble {
  background: var(--primary-light);
  border-color: #B5D2EC;
  border-bottom-right-radius: 4px;
  /* Encosta na borda do thread — sem avatar do lado direito */
  margin-right: 4px;
}

.chat-bubble-hdr {
  display: flex; align-items: baseline;
  gap: 8px; margin-bottom: 4px;
}
.chat-bubble-hdr strong { font-size: 12px; color: var(--gray-800); }
.chat-bubble-date { font-size: 11px; color: var(--gray-500); margin-left: auto; }
.chat-bubble-txt  { font-size: 13px; color: var(--gray-800); white-space: pre-wrap; line-height: 1.45; }

/* Nota interna — destaque âmbar mantido, contorno mais sutil pra
   não competir com o bubble. */
.chat-msg.chat-internal .chat-bubble {
  background: #FFFBEB;
  border-color: #FCD34D;
}
/* Dark mode: bg creme fixo deixava o texto da nota (gray-800 invertido =
   claro) sem contraste. Fundo âmbar escuro mantém o texto legível. */
[data-theme="dark"] .chat-msg.chat-internal .chat-bubble {
  background: #3B2F14;
  border-color: #7C5E1A;
}
.chat-internal-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600; color: #D97706;
  background: #FEF3C7; border-radius: 4px; padding: 1px 6px; margin-bottom: 4px;
}

/* Mensagens automáticas do sistema — fora do diálogo */
.chat-msg.chat-sys { justify-content: center; }
.chat-sys-card {
  background: var(--gray-100);
  border: 1px dashed var(--gray-300);
  border-radius: 8px;
  padding: 8px 14px;
  text-align: center;
  max-width: 80%;
}
.chat-sys-content { font-size: 12px; color: var(--gray-700); font-style: italic; }
.chat-sys-meta    { font-size: 10px; color: var(--gray-500); margin-top: 3px; }

/* Mobile: bubbles ocupam mais largura */
@media (max-width: 600px) {
  .chat-bubble  { max-width: 85%; }
  .chat-sys-card { max-width: 95%; }
}

/* Compat: form de novo comentário continua igual */
.comment-form {
  margin-top: 12px;
  display: flex; flex-direction: column; gap: 8px;
}

body.modal-open { overflow: hidden; }

/* ═══════════════════════════════════════════
   TOAST
═══════════════════════════════════════════ */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 13px 20px;
  border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  z-index: 2000;
  box-shadow: var(--shadow-lg);
  animation: slideUp .25s ease;
}
.toast-ok  { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.toast-err { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
@keyframes slideUp {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ═══════════════════════════════════════════
   SIDEBAR OVERLAY (mobile)
═══════════════════════════════════════════ */
.sb-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 150;
}

/* ═══════════════════════════════════════════
   FILE UPLOAD ZONE
═══════════════════════════════════════════ */
.upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--tx);
  background: var(--gray-50);
  user-select: none;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.upload-zone.has-files { border-style: solid; border-color: var(--primary); }
.upload-icon { font-size: 30px; margin-bottom: 8px; }
.upload-text { font-size: 14px; color: var(--gray-700); font-weight: 500; margin-bottom: 4px; }
.upload-hint { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

.preview-anexos { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.file-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
}
.file-item-internal { background: #FFFBEB; border-color: #FCD34D; }
.file-icon { font-size: 22px; flex-shrink: 0; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 13px; font-weight: 500; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: 11px; color: var(--gray-400); }
.file-remove {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: var(--danger);
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 6px;
  transition: var(--tx);
  line-height: 1;
  flex-shrink: 0;
}
.file-remove:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.file-dl {
  font-size: 12px; color: var(--primary); text-decoration: none;
  padding: 3px 8px; border-radius: 4px; background: var(--primary-light);
  font-weight: 500; white-space: nowrap; flex-shrink: 0;
}
.file-dl:hover { background: #BFDBFE; }
/* Dark mode: --primary (texto) ficava azul-escuro sobre --primary-light
   (navy escuro). Texto claro + hover navy mantém o contraste. */
[data-theme="dark"] .file-dl { color: #BFDBFE; }
[data-theme="dark"] .file-dl:hover { background: #2A4A73; }
/* Anexo interno: bg creme fixo deixava o texto (gray-800 invertido = claro)
   ilegível. Fundo âmbar escuro recupera o contraste no dark. */
[data-theme="dark"] .file-item-internal { background: #3B2F14; border-color: #7C5E1A; }
[data-theme="dark"] .badge-internal-text { color: #C4B5FD; }
.field-hint { font-size: 12px; color: var(--gray-400); margin-top: 5px; }

/* ═══════════════════════════════════════════
   USER MANAGEMENT
═══════════════════════════════════════════ */
.modal-sm { max-width: 480px; }
.papel-chip { display: inline-flex; }
.user-actions { display: flex; gap: 6px; }
.btn-icon {
  background: none; border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 5px 9px;
  cursor: pointer; font-size: 14px; transition: var(--tx);
  line-height: 1;
}
.btn-icon:hover { background: var(--gray-100); }
.btn-icon.danger:hover { background: #FEF2F2; border-color: #FECACA; }
.btn-icon.reactivate {
  border-color: #86efac; color: #16a34a;
}
.btn-icon.reactivate:hover { background: #f0fdf4; border-color: #4ade80; }
/* Linha de usuário bloqueado: atenua células de dados, preserva coluna de ação */
tr.usuario-bloqueado td:not(.user-actions-cell) { opacity: .45; }
tr.usuario-pendente { background: #FFFBEB; }
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 6px 0; }

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 900px) {
  .modal-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .hamburger { display: block; }
  .grid2 { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .filters { flex-direction: column; align-items: flex-start; }
  .filters input, .filters select { width: 100%; min-width: unset; }
  .sec-head { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; }
}

/* ═══════════════════════════════════════════
   NOVOS ESTILOS — v2
═══════════════════════════════════════════ */

/* Chip personalizado (prioridades com cor dinâmica) */
.chip-custom {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid currentColor;
}

/* Colunas de tempo no dashboard */
.col-tempo {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--gray-600);
}

/* Linhas inativas na tabela de parâmetros */
.row-inativo td { opacity: .5; }

/* Tabs de parâmetros */
.param-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 0;
  border-bottom: 2px solid var(--gray-200);
}
.param-tab {
  padding: 8px 18px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--tx);
}
.param-tab:hover  { color: var(--primary); }
.param-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* Tab bar de e-mails — muitos eventos (17+); permite quebra em múltiplas linhas
   e impede que cada label seja quebrada no meio. */
#email-tabs {
  flex-wrap: wrap;
  row-gap: 2px;
}
#email-tabs .param-tab {
  white-space: nowrap;
  padding: 8px 12px;
  font-size: 12.5px;
}

/* Knowledge Base — sugestões em novo chamado (Fase 4) */
.kb-sugestoes {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.kb-sug-head {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--gray-800, #1f2937);
}
.kb-sug-list { display: flex; flex-direction: column; gap: 6px; }
.kb-sug-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  transition: var(--tx);
}
.kb-sug-card:hover { border-color: var(--primary); background: #f9fafb; }
/* Dark: o box amarelo-claro hardcoded deixava o título/hint (texto claro
   na escala invertida) ilegível. Vira "warning" translúcido escuro. */
html[data-theme="dark"] .kb-sugestoes {
  background: rgba(217, 119, 6, .14);
  border-color: #A16207;
}
html[data-theme="dark"] .kb-sug-card:hover { background: var(--surface-3); }
.kb-sug-title { font-weight: 500; font-size: 14px; color: var(--gray-900); margin-bottom: 4px; }
.kb-sug-meta  { display: flex; gap: 12px; font-size: 12px; }
.kb-sug-hint  { font-size: 12px; margin-top: 8px; }

/* Helpful vote block no viewer de artigo */
.kb-helpful-block {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--gray-50, #f9fafb);
  border-radius: 8px;
}
.kb-helpful-label { font-weight: 500; font-size: 14px; }
.kb-vote-active { background: var(--primary) !important; color: #fff !important; }

/* Knowledge Base — anexos no editor + viewer */
.kb-anexo-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--gray-200, #e5e7eb);
  font-size: 14px;
}
.kb-anexo-row:last-child { border-bottom: 0; }
.kb-anexo-row a { color: var(--primary); text-decoration: none; }
.kb-anexo-row a:hover { text-decoration: underline; }
.btn-xs {
  padding: 2px 8px;
  font-size: 11px;
  line-height: 1.4;
  border-radius: 4px;
}

/* Knowledge Base — blocos do visualizador de artigo */
.kb-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  font-size: 13px;
  color: var(--gray-700);
}
.kb-meta .chip { font-size: 12px; }
.kb-block {
  background: var(--gray-50, #f7f8fa);
  border-left: 3px solid var(--primary);
  padding: 12px 14px;
  border-radius: var(--radius, 8px);
  font-size: 14px;
  line-height: 1.55;
  color: var(--gray-800, #1f2937);
  white-space: pre-wrap;
  word-break: break-word;
}
.muted { color: var(--gray-500, #6b7280); font-size: 13px; }
.mt-4  { margin-top: 4px; }

/* Upload zone compacto para o modal */
.upload-zone-sm {
  padding: 12px 16px;
  min-height: unset;
}
.upload-zone-sm .upload-text { font-size: 13px; }

/* Seção de configurações — info-row */
.cfg-info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
}
.cfg-info-row:last-child { border-bottom: none; }

/* ── E-mail templates ──────────────────────── */
#email-body {
  font-family: monospace;
  font-size: 13px;
  resize: vertical;
  min-height: 180px;
}

/* Grade de variáveis disponíveis */
.email-vars-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  align-items: baseline;
  font-size: 13px;
}
.email-vars-grid code {
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  color: var(--primary);
}
.email-vars-grid span {
  color: var(--gray-500);
}

/* ── Aparência — preview da imagem de fundo ── */
.bg-preview-wrap {
  position: relative;
  width: 100%;
  max-width: 420px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--gray-200);
  background: var(--gray-100);
}
.bg-preview-img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}
.bg-preview-badge {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 11px;
  color: #fff;
  background: rgba(0,0,0,.55);
  padding: 2px 8px;
  border-radius: 4px;
}
input[type="range"] {
  width: 100%;
  margin-top: 6px;
  accent-color: var(--primary);
  cursor: pointer;
}
.bg-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.bg-spec-chip {
  font-size: 12px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: 20px;
  padding: 3px 10px;
  font-weight: 500;
}

/* ── LGPD — ações do titular ───────────────── */
.lgpd-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.lgpd-action-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}
.lgpd-action-item:last-child { border-bottom: none; }
.lgpd-action-item strong { font-size: 14px; }
.lgpd-action-item .field-hint { margin-top: 4px; }
.lgpd-action-item button { white-space: nowrap; flex-shrink: 0; }

/* Botão destrutivo */
.btn-danger {
  background: #DC2626;
  color: #fff;
  border: none;
}
.btn-danger:hover { background: #B91C1C; }

/* ── Tabela de auditoria ───────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  padding: 8px 12px;
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-100);
  font-weight: 600;
  color: var(--gray-600);
  white-space: nowrap;
}
.table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--gray-50); }

/* ═══════════════════════════════════════════════════════════
   UTILITY CLASSES (Phase C — substitui style="..." inline)
═══════════════════════════════════════════════════════════ */
.t-center        { text-align: center; }
.t-right         { text-align: right; }

.mt-4            { margin-top: 4px; }
.mt-8            { margin-top: 8px; }
.mt-12           { margin-top: 12px; }
.mt-16           { margin-top: 16px; }
.mt-20           { margin-top: 20px; }
.mb-4            { margin-bottom: 4px; }
.mb-8            { margin-bottom: 8px; }
.mb-12           { margin-bottom: 12px; }
.mb-16           { margin-bottom: 16px; }
.mb-20           { margin-bottom: 20px; }
.mt-neg-8        { margin-top: -8px; }
.my-16           { margin: 16px 0; }
.my-8            { margin: 8px 0; }
.my-6            { margin: 6px 0; }
.mt-2            { margin-top: 2px; }
.mt-6            { margin-top: 6px; }
.mb-2            { margin-bottom: 2px; }
.mb-6            { margin-bottom: 6px; }
.p-10            { padding: 10px; }
.mr-4            { margin-right: 4px; }
.mr-6            { margin-right: 6px; }
.mr-12           { margin-right: 12px; }
.ml-8            { margin-left: 8px; }
.ml-12           { margin-left: 12px; }

.flex            { display: flex; }
.flex-col        { display: flex; flex-direction: column; }
.flex-center     { display: flex; align-items: center; justify-content: center; }
.flex-between    { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap       { flex-wrap: wrap; }
.gap-4           { gap: 4px; }
.gap-6           { gap: 6px; }
.gap-8           { gap: 8px; }
.gap-12          { gap: 12px; }
.gap-20          { gap: 20px; }
.items-center    { align-items: center; }

.fz-11           { font-size: 11px; }
.fz-12           { font-size: 12px; }
.fz-13           { font-size: 13px; }
.fz-14           { font-size: 14px; }
.fz-15           { font-size: 15px; }
.fw-500          { font-weight: 500; }
.fw-600          { font-weight: 600; }
.fw-400-light    { font-weight: 400; color: var(--gray-400); }

.c-gray-300      { color: var(--gray-300); }
.c-gray-400      { color: var(--gray-400); }
.c-gray-500      { color: var(--gray-500); }
.c-gray-600      { color: var(--gray-600); }
.c-gray-700      { color: var(--gray-700); }
.c-danger        { color: var(--danger); }

.lh-1-5          { line-height: 1.5; }
.lh-1-7          { line-height: 1.7; }

.d-none          { display: none; }

/* ── Banner "Ambiente de Testes e Validação" ──
   Aparece somente quando NODE_ENV !== 'production'.
   No login: faixa fixa no topo da página.
   No topbar admin/solucionador/gerente: centralizado no header. */
.env-test-banner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-weight: 700;
  color: var(--danger);
  font-size: 14px;
  letter-spacing: .02em;
  white-space: nowrap;
  pointer-events: none;
}
.env-test-banner-login {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 90;
  text-align: center;
  background: var(--surface);
  color: var(--danger);
  font-weight: 700;
  font-size: 14px;
  padding: 8px 16px;
  border-bottom: 2px solid var(--danger);
  letter-spacing: .02em;
}

/* Banner de testes no portal do usuário final (sem topbar): faixa fixa
   sobre a área de conteúdo (desconta a sidebar em desktop). O conteúdo
   ganha respiro extra via body.env-test para não ficar coberto. */
.env-test-banner-user {
  position: fixed;
  top: 0;
  left: var(--sb-w);
  right: 0;
  z-index: 90;
  text-align: center;
  background: var(--surface);
  color: var(--danger);
  font-weight: 700;
  font-size: 14px;
  padding: 8px 16px;
  border-bottom: 2px solid var(--danger);
  letter-spacing: .02em;
}
body.env-test #page-user .content { padding-top: 56px; }
@media (max-width: 768px) {
  .env-test-banner-user { left: 0; }
}

/* ── Rodapé global ────────────────────────── */
.app-footer {
  padding: 14px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--gray-500);
  border-top: 1px solid var(--gray-200);
  background: var(--surface);
  white-space: pre-line;
}
.app-footer:empty { display: none; }
.app-footer-login {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: transparent;
  border-top: none;
  color: #fff;
  font-size: 14px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
  z-index: 5;
}

/* Em viewports curtas, o card de login + banner + rodapé fixo não
   cabem todos na tela. Quando o usuário rola para alcançar o botão
   Entrar, o rodapé transparente (position: fixed) ficava sobreposto
   ao conteúdo do card. Fix: em altura ≤ 720px, rodapé flui
   naturalmente abaixo do card (position: static) e #page-login
   dispensa o padding-bottom reservado para o fixed-footer. */
@media (max-height: 720px) {
  .app-footer-login {
    position: static;
    margin-top: 24px;
  }
  #page-login {
    padding-bottom: 24px;
  }
}

/* Anti-FOUC: esconde placeholders de marca até o boot-brand.js
   ou applyBrand() aplicarem o valor real. body.brand-ready é
   adicionada nessa hora e revela os elementos com fade curto. */
body:not(.brand-ready) [id^="brand-icon-"],
body:not(.brand-ready) [id^="brand-name-"],
body:not(.brand-ready) [id^="brand-logo-"]:not(.hidden) { opacity: 0; }
[id^="brand-icon-"], [id^="brand-name-"], [id^="brand-logo-"] {
  transition: opacity .12s ease-out;
}
.d-block         { display: block; }
.d-inline-flex-gap-6 { display: inline-flex; align-items: center; gap: 6px; }

.w-140           { width: 140px; min-width: 0; }
.w-180-min       { min-width: 180px; }
.w-220-min       { min-width: 220px; }
.w-60            { width: 60px; }
.h-36            { height: 36px; }
/* Override .filters input/select min-width quando classe utilitária aplicada */
.filters input.w-140,
.filters select.w-140 { width: 140px; min-width: 0; }

/* Caixas / badges informativos repetidos */
.info-box-blue {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 8px;
}
.info-box-blue p { margin: 0 0 12px; font-size: 14px; color: #1e3a5f; line-height: 1.5; }

/* Bloco de ações dentro de info-card */
.info-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* Cluster de botões agrupados em row (flex-wrap em telas estreitas).
   Necessário como classe — `style="..."` inline é bloqueado pelo CSP
   strict (styleSrcAttr: 'none'). */
.btn-cluster {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* QR code do MFA */
.mfa-qr {
  width: 180px;
  height: 180px;
  border: 4px solid var(--gray-200);
  border-radius: 8px;
}
.mfa-secret {
  font-family: monospace;
  font-size: 13px;
  background: var(--gray-100);
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 4px;
  word-break: break-all;
  color: var(--gray-700);
}

/* Footer dos modais centralizado (cancelamento) — ocupa o espaço
   disponível e centraliza horizontal + verticalmente os botões. */
.modal-footer-center {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 24px;
  min-height: 84px;
  width: 100%;
}

/* Form-actions com gap maior, comum em modais */
.form-actions-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0;
}

/* Botão amber/warning (force MFA) */
.btn-warning {
  background: var(--warning);
  color: #fff;
  border: none;
  cursor: pointer;
}

/* Reuso comum: label com checkbox horizontal */
.label-row-flex { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.label-row-8    { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.cursor-pointer { cursor: pointer; }

/* Lista de checkboxes (filas, categorias da fila) */
.checkbox-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 10px;
}

/* Card inputs */
.input-disabled  { background: var(--gray-100); }
.color-picker    { width: 60px; height: 36px; padding: 2px; cursor: pointer; }
.checkbox-15     { width: 15px; height: 15px; }
.checkbox-16     { width: 16px; height: 16px; }

.c-primary       { color: var(--primary); }
.c-error         { color: var(--danger); }
.c-374151        { color: #374151; }
.c-6b7280        { color: #6b7280; }

/* QR codes */
.qr-medium       { width: 180px; height: 180px; border: 1px solid var(--gray-200); border-radius: 8px; }
.preview-180     { max-width: 180px; margin-bottom: 12px; }
.bg-preview-img  { object-fit: contain; }

/* Form upload row */
.upload-actions-row { margin-bottom: 0; flex-wrap: wrap; gap: 8px; }
.upload-actions-row-mb16 { margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }

/* Card footer com padding e borda topo */
.audit-paginacao-style { padding: 12px 16px; border-top: 1px solid var(--gray-100); }
.link-inherit-underline { color: inherit; text-decoration: underline; cursor: pointer; }

/* MFA step loading */
.mfa-step-loading { text-align: center; padding: 24px 0; }
.mfa-step-center  { text-align: center; margin-bottom: 12px; }
.word-break-all   { word-break: break-all; }
.nowrap           { white-space: nowrap; }
.fz-9             { font-size: 9px; }
.fz-15            { font-size: 15px; }
.opacity-disabled { opacity: .35; cursor: not-allowed; }
.badge-novo {
  background: #ef4444; color: #fff;
  font-size: 9px; font-weight: 700;
  padding: 1px 6px; border-radius: 10px;
  vertical-align: middle; line-height: 1.6;
  letter-spacing: .3px;
}
.badge-internal-text { color: #9333ea; }
.badge-internal-mr   { margin-right: 4px; }
.code-pill {
  font-size: 12px;
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
}
.flex-nowrap-end-12 {
  display: flex; gap: 8px; flex-shrink: 0;
}
.flex-1-min0 { flex: 1; min-width: 0; }
.flex-start-between {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.flex-center-mb-4 {
  display: flex; align-items: center; gap: 8px; margin-bottom: 4px;
}
.flex-wrap-gap-4-center {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
}
.empty-cell {
  text-align: center;
  color: var(--gray-400);
  padding: 24px;
}
.users-rodape {
  font-size: 12px;
  color: var(--gray-500);
  padding: 6px 12px;
  margin: 0;
  border-top: 1px solid var(--gray-100);
}
.btn-red-strong {
  background: var(--red-600, #dc2626);
  color: #fff;
  border: none;
  cursor: pointer;
}
.parent-tag {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 2px;
}
.color-chip-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.audit-meta {
  font-size: 12px;
  color: var(--gray-500);
}
.audit-ip {
  font-size: 12px;
  color: var(--gray-400);
}
.audit-actions-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}
.queue-card-name { font-weight: 600; font-size: 15px; }
.queue-card-desc { font-size: 13px; color: var(--gray-500); margin: 0 0 8px; }
.queue-cat-label { font-size: 12px; color: var(--gray-400); margin-right: 4px; }
.session-row-end {
  color: var(--danger);
  border-color: var(--danger);
  padding: 4px 8px;
  font-size: 11px;
}
.overflow-x-auto { overflow-x: auto; }
.emaillog-sel-status { width: 150px; }
.emaillog-sel-event  { width: 210px; }

/* Larguras de coluna da tabela de log de e-mails */
.emaillog-table { table-layout: fixed; width: 100%; }
.emaillog-table th:nth-child(1),
.emaillog-table td:nth-child(1) { width: 140px; white-space: nowrap; }
.emaillog-table th:nth-child(2),
.emaillog-table td:nth-child(2) { width: 155px; }
.emaillog-table th:nth-child(3),
.emaillog-table td:nth-child(3) { width: 100px; white-space: nowrap; }
.emaillog-table th:nth-child(4),
.emaillog-table td:nth-child(4) { width: 22%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emaillog-table th:nth-child(5),
.emaillog-table td:nth-child(5) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emaillog-table th:nth-child(6),
.emaillog-table td:nth-child(6) { width: 88px; }
.emaillog-table th:nth-child(7),
.emaillog-table td:nth-child(7) { width: 155px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-c-gray { color: var(--gray-400); font-size: 13px; }
.deadline-overdue { color: #dc2626; font-weight: 600; }
/* (bar-fill e stat-val já definidos acima — usam --bar-w/--bar-c/--stat-c
    setados via JS pós-render por applyDynamicStyles) */

/* Filename na lista de anexos com max-width */
.attach-name {
  max-width: 200px;
  font-size: 12px;
  color: var(--gray-400);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Coluna de tempo em tabelas */
.col-tempo-cell  { white-space: nowrap; font-size: 13px; }

/* CSS variables — para valores dinâmicos setados via JS
   sem quebrar o CSP estrito (setProperty é permitido) */
.bar-fill        { width: var(--bar-w, 0%); background: var(--bar-c, var(--gray-500)); }
.chip-custom     {
  background: var(--chip-bg, var(--gray-100));
  color: var(--chip-fg, var(--gray-700));
  border-color: var(--chip-bd, var(--gray-300));
}
.color-swatch    {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
  background: var(--swatch-c, var(--gray-300));
}
.priority-bullet {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bullet-c, var(--gray-400));
  display: inline-block;
  margin-right: 6px;
}

