/* Auditoria de Segurança — "Cockpit denso" (variante 1a do handoff Claude Design).
   Faixa de situação em uma linha, triagem de anomalias acima da dobra e log em
   tabela. Substitui o layout antigo (.audit-*, ainda em views.css até a limpeza).
   Escopo: .aud / .aud-*.

   Geometria (grades, paddings, raios, escala tipográfica) vem do desenho tal e
   qual. Cor de superfície/texto/linha vem dos tokens do portal para não destoar
   do resto do sistema; só os acentos semânticos (âmbar/vermelho/verde/índigo)
   ficam literais, porque tokens.css não tem equivalente para todos eles. */

.aud {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: min(1400px, 100%);
  margin: 0 auto;
  padding: 20px 24px 40px;
  font-family: 'Inter', var(--font-ui, system-ui), sans-serif;
  color: var(--text-primary);
  /* Item de grid (.workspace-main): sem isto herda min-width:auto e estoura a
     largura em telas com escala 125%/150%. Mesmo padrão do system-map. */
  min-width: 0;

  /* Apelidos curtos: o handoff é escrito em surface/border/muted, que não
     existem em tokens.css. */
  --aud-surface: var(--bg-surface, #fff);
  --aud-subtle: var(--md-sys-color-surface-container-low, #f8fafc);
  --aud-border: color-mix(in srgb, var(--line-soft) 45%, transparent);
  --aud-rule: color-mix(in srgb, var(--line-soft) 28%, transparent);
  --aud-muted: color-mix(in srgb, var(--text-secondary) 68%, transparent);
  --aud-brand: var(--brand-500, #3b5ea3);
  --aud-radius: 14px;
  --aud-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);

  --aud-danger: #ef4444;
  --aud-warn: #f59e0b;
  --aud-ok: #059669;
  --aud-indigo: #6366f1;
  --aud-indigo-ink: #4338ca;

  /* Grade da tabela do log: uma variável só, usada pelo cabeçalho e por cada
     linha — desalinhar as duas é o jeito mais fácil de quebrar esta tela.
     Ordem: hora, usuário, ação, alvo, relatório, resultado, IP. As flexíveis vão
     de minmax(0,1fr) para o texto longo poder cortar com reticências em vez de
     empurrar a coluna (1fr sozinho respeita o conteúdo mínimo e estoura). */
  --aud-cols: 76px minmax(0, 1fr) 168px minmax(0, 1fr) minmax(0, 1fr) 92px 116px;

  /* Compatibilidade: as regras do multiselect em views.css referenciam estas
     variáveis, que antes vinham de .audit-root (agora extinto). */
  --audit-text: var(--text-primary);
  --audit-text-secondary: var(--aud-muted);
  --audit-accent: var(--aud-brand);
  --audit-card-bg: var(--aud-surface);
}

#adminAuditTab { min-width: 0; max-width: 100%; }

.aud-mono {
  font-family: 'JetBrains Mono', 'Geist Mono', var(--font-mono, monospace);
  font-variant-numeric: tabular-nums;
}

.aud-eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--aud-muted);
}

.aud-card {
  background: var(--aud-surface);
  border: 1px solid var(--aud-border);
  border-radius: var(--aud-radius);
  box-shadow: var(--aud-shadow);
}

.aud-link {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--aud-brand);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.aud-link:hover { text-decoration: underline; }

/* ── Cabeçalho ── */
.aud-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.aud-head__title { display: flex; flex-direction: column; gap: 2px; }
.aud-head__title h2 {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.aud-head__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.aud-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--aud-border);
  color: var(--text-primary);
  font: 600 0.8125rem/1 'Inter', var(--font-ui, sans-serif);
  cursor: pointer;
  transition: background var(--trans-fast, 140ms), border-color var(--trans-fast, 140ms);
}
.aud-btn:hover { background: var(--aud-subtle); }
.aud-btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.aud-btn svg { flex-shrink: 0; }

.aud-btn--primary {
  padding: 8px 14px;
  background: linear-gradient(180deg, var(--aud-brand) 0%, var(--brand-600, #345699) 100%);
  border: none;
  color: #fff;
  box-shadow: var(--aud-shadow);
}
.aud-btn--primary:hover { filter: brightness(1.06); background: linear-gradient(180deg, var(--aud-brand) 0%, var(--brand-600, #345699) 100%); }

/* Live ligado: o botão vira "parar" e ganha o mesmo pulso do ponto de status. */
.aud-btn--live-on {
  background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
}
.aud-btn--live-on:hover { background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%); }

/* ── Faixa de situação ── */
.aud-strip {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr;
  align-items: stretch;
}
.aud-strip__cell {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid var(--aud-rule);
  text-align: left;
  background: none;
  border-top: none;
  border-left: none;
  border-bottom: none;
  font-family: inherit;
  color: inherit;
}
.aud-strip__cell:last-child { border-right: none; }
button.aud-strip__cell { cursor: pointer; }
button.aud-strip__cell:hover { background: var(--aud-subtle); }
button.aud-strip__cell:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.aud-strip__cell.is-active { box-shadow: inset 0 -2px 0 var(--aud-brand); }
.aud-strip__cell.is-warn { background: rgba(245, 158, 11, 0.06); }
.aud-strip__cell.is-warn:hover { background: rgba(245, 158, 11, 0.1); }

.aud-strip__figure { display: flex; align-items: baseline; gap: 6px; }
.aud-strip__value {
  font-family: 'JetBrains Mono', 'Geist Mono', var(--font-mono, monospace);
  font-size: 1.375rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  line-height: 1.15;
}
.aud-strip__value.is-warn { color: var(--aud-warn); }
.aud-strip__hint { font-size: 0.8125rem; color: var(--aud-muted); }
.aud-strip__hint.is-up { color: var(--aud-ok); }
.aud-strip__hint.is-down { color: var(--aud-danger); }

/* Célula "Situação": texto, não número — escala própria. */
.aud-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.aud-status__label { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.02em; }
.aud-status__detail { font-size: 0.8125rem; color: var(--text-secondary); }
.aud-dot { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }
.aud-dot--ok { background: var(--aud-ok); }
.aud-dot--warn { background: var(--aud-warn); animation: audPulse 2s ease-in-out infinite; }
.aud-dot--danger { background: var(--aud-danger); animation: audPulse 2s ease-in-out infinite; }

@keyframes audPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@media (prefers-reduced-motion: reduce) {
  .aud-dot--warn, .aud-dot--danger { animation: none; }
}

/* ── Triagem: anomalias + online ── */
.aud-split {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  align-items: stretch;
}
.aud-panel { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.aud-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.aud-panel__head .aud-eyebrow { color: var(--text-secondary); }
.aud-panel__meta { font-size: 0.8125rem; color: var(--aud-muted); }
.aud-panel__body { display: flex; flex-direction: column; gap: 8px; }

.aud-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.1);
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: inherit;
  transition: border-color var(--trans-fast, 140ms);
}
.aud-alert:hover { border-color: var(--aud-danger); }
.aud-alert:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.aud-alert--warn { background: rgba(245, 158, 11, 0.06); border-color: rgba(245, 158, 11, 0.1); }
.aud-alert--warn:hover { border-color: var(--aud-warn); }
.aud-alert svg { flex-shrink: 0; }
.aud-alert__text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.aud-alert__title { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.aud-alert__sub { font-size: 0.8125rem; color: var(--text-secondary); }
.aud-alert__cta { font-size: 0.8125rem; font-weight: 600; color: var(--aud-brand); flex-shrink: 0; }

.aud-online-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.aud-online-row__dot { width: 6px; height: 6px; border-radius: 999px; background: var(--aud-ok); flex-shrink: 0; }
.aud-online-row__name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aud-online-row__time { font-size: 0.72rem; color: var(--aud-muted); }
.aud-panel__body .aud-link { align-self: flex-start; margin-top: 2px; }

.aud-empty {
  font-size: 0.8125rem;
  color: var(--aud-muted);
  padding: 6px 0;
}

/* ── Barra de filtros ── */
.aud-filters { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.aud-filters__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.aud-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 240px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--aud-rule);
  background: var(--aud-subtle);
}
.aud-search:focus-within { border-color: var(--aud-brand); }
.aud-search svg { flex-shrink: 0; }
.aud-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  outline: none;
  font: 400 0.8125rem/1.6 'Inter', var(--font-ui, sans-serif);
  color: var(--text-primary);
}
.aud-search input::placeholder { color: var(--aud-muted); }

/* Dropdowns. O multiselect (.audit-ms-*) é o componente que já existia — o
   markup vem de createMultiSelect e a base fica em views.css; aqui só trocamos
   a métrica do gatilho para a do desenho e soltamos a largura, que lá era 100%
   porque o filtro antigo morava numa grade de campos. */
.aud .audit-ms { width: auto; min-width: 0; }
.aud .audit-ms-button,
.aud-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 0;
  width: auto;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid var(--aud-rule);
  background: var(--aud-surface);
  font: 500 0.8125rem/1 'Inter', var(--font-ui, sans-serif);
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
}
.aud .audit-ms-button:hover,
.aud-select:hover { border-color: var(--line-strong); }
.aud .audit-ms-popover { min-width: 220px; right: auto; }
.aud .audit-ms-chip { background: rgba(99, 102, 241, 0.1); color: var(--aud-indigo-ink); }

/* No painel "Mais filtros" o multiselect volta a ocupar a largura do campo. */
.aud-more .audit-ms,
.aud-more .audit-ms-button { width: 100%; }
.aud-more .audit-ms-popover { left: 0; right: 0; }

.aud-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.aud-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--aud-indigo-ink);
  font-size: 0.72rem;
  font-weight: 600;
  border: none;
  font-family: inherit;
}
.aud-chip__x { cursor: pointer; opacity: 0.6; background: none; border: none; color: inherit; font: inherit; padding: 0; line-height: 1; }
.aud-chip__x:hover { opacity: 1; }
.aud-chips__summary { font-size: 0.8125rem; color: var(--aud-muted); }
.aud-chips .aud-link { margin-left: auto; }

/* Painel "Mais filtros" */
.aud-more {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 12px;
  padding-top: 10px;
  border-top: 1px solid var(--aud-rule);
}
.aud-more.hidden { display: none; }
.aud-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.aud-field > label { font-size: 0.72rem; font-weight: 600; color: var(--text-secondary); }
.aud-input {
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--aud-rule);
  background: var(--aud-surface);
  font: 400 0.8125rem/1.4 'Inter', var(--font-ui, sans-serif);
  color: var(--text-primary);
}

/* ── Log + perfil ── */
.aud-main {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 12px;
  align-items: start;
}
/* Sem painel lateral (nada a mostrar) o log ocupa a largura toda. */
.aud-main.is-solo { grid-template-columns: 1fr; }

/* O log tem cabeçalho e rodapé fixos; só o miolo rola. A altura máxima vem do
   painel lateral (--aud-log-max, escrita pelo JS) para os dois cards ficarem do
   mesmo tamanho; o valor aqui é só o fallback antes do primeiro cálculo. */
.aud-log { overflow: hidden; min-width: 0; display: flex; flex-direction: column; }
.aud-log__scroll {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: var(--aud-log-max, 560px);
  overscroll-behavior: contain;
}
.aud-log__more {
  display: flex;
  justify-content: center;
  padding: 12px 16px;
}
.aud-log__more:empty { display: none; }
.aud-log__remaining { font-weight: 500; color: var(--aud-muted); }
.aud-log__end { font-size: 0.8125rem; color: var(--aud-muted); }
.aud-log__head,
.aud-row {
  display: grid;
  grid-template-columns: var(--aud-cols);
  gap: 12px;
  align-items: center;
}
/* O cabeçalho mora DENTRO da área que rola e gruda no topo. Fora dela ele não
   perderia a largura da barra de rolagem e sairia do prumo das colunas. */
.aud-log__head {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 10px 16px;
  background: var(--aud-subtle);
  border-bottom: 1px solid var(--aud-border);
}
.aud-log__head span {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--aud-muted);
}

/* Gruda logo abaixo do cabeçalho (--aud-head-h é medido no JS): rolando 20+
   eventos você continua vendo de que dia é a linha. Fundo sólido por isso. */
.aud-day {
  position: sticky;
  top: var(--aud-head-h, 34px);
  z-index: 2;
  padding: 7px 16px;
  background: var(--aud-subtle);
  border-bottom: 1px solid var(--aud-rule);
  display: flex;
  align-items: center;
  gap: 10px;
}
.aud-day__label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}
.aud-day__count { font-size: 0.72rem; color: var(--aud-muted); }

.aud-event { border-bottom: 1px solid color-mix(in srgb, var(--line-soft) 18%, transparent); }
.aud-event:last-of-type { border-bottom: none; }
.aud-row { padding: 9px 16px; }
.aud-event.is-clickable .aud-row { cursor: pointer; }
.aud-event.is-clickable:hover { background: var(--aud-subtle); }
.aud-event.is-open { background: var(--aud-subtle); }
.aud-event.is-suspicious { background: rgba(239, 68, 68, 0.06); }
.aud-event.is-suspicious.is-clickable:hover { background: rgba(239, 68, 68, 0.1); }

.aud-cell-time { font-family: 'JetBrains Mono', 'Geist Mono', var(--font-mono, monospace); font-size: 0.8125rem; font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.aud-cell-actor {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aud-cell-actor button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.aud-cell-actor button:hover { color: var(--aud-brand); text-decoration: underline; }
.aud-cell-action { font-size: 0.875rem; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Coluna Alvo: o que a ação atingiu (usuário afetado, DAG, aba). "—" quando a
   ação não tem alvo (login). */
.aud-cell-target { font-size: 0.875rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Coluna Relatório: vazia na maioria das linhas (só evento de relatório
   preenche), então o nome vem em tom cheio para puxar o olho. */
.aud-cell-report {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aud-cell-ip {
  font-family: 'JetBrains Mono', 'Geist Mono', var(--font-mono, monospace);
  font-size: 0.8125rem;
  color: var(--aud-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aud-cell-ip.is-suspicious { color: var(--aud-danger); font-weight: 500; }

.aud-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  width: fit-content;
  background: rgba(16, 185, 129, 0.1);
  color: var(--aud-ok);
}
.aud-badge--error { background: rgba(239, 68, 68, 0.1); color: var(--aud-danger); }
.aud-badge--denied { background: rgba(245, 158, 11, 0.12); color: #b45309; }

/* Detalhe expandido: alinhado à coluna "Ator" (76px da Hora + 12px do gap). */
.aud-detail { padding: 4px 16px 14px 88px; display: flex; flex-direction: column; gap: 6px; }
.aud-diff {
  display: grid;
  grid-template-columns: 160px 1fr 20px 1fr;
  gap: 10px;
  align-items: center;
  font-family: 'JetBrains Mono', 'Geist Mono', var(--font-mono, monospace);
  font-size: 0.8125rem;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--aud-surface);
  border: 1px solid var(--aud-rule);
}
.aud-diff__key { color: var(--aud-muted); overflow: hidden; text-overflow: ellipsis; }
.aud-diff__before { color: var(--aud-danger); overflow-wrap: anywhere; }
.aud-diff__arrow { color: var(--aud-muted); text-align: center; }
.aud-diff__after { color: var(--aud-ok); overflow-wrap: anywhere; }
.aud-detail__meta {
  font-family: 'JetBrains Mono', 'Geist Mono', var(--font-mono, monospace);
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--aud-surface);
  border: 1px solid var(--aud-rule);
  border-radius: 8px;
  padding: 8px 10px;
  white-space: pre-wrap;
  overflow-x: auto;
  margin: 0;
}
.aud-detail__none { font-size: 0.8125rem; color: var(--aud-muted); }

.aud-log__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--aud-subtle);
  flex-wrap: wrap;
}
.aud-log__count { font-size: 0.8125rem; color: var(--aud-muted); }

/* Evento novo chegando pelo Live: pisca uma vez e assenta. */
.aud-event.is-new { animation: audFlash 1.2s ease-out; }
@keyframes audFlash {
  0% { background: rgba(99, 102, 241, 0.16); }
  100% { background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .aud-event.is-new { animation: none; }
}

/* ── Perfil do usuário (lateral) ── */
.aud-profile { overflow: hidden; position: sticky; top: 12px; }
.aud-profile.hidden { display: none; }
.aud-profile__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--aud-border);
}
.aud-profile__id { display: flex; align-items: center; gap: 9px; min-width: 0; }
.aud-profile__who { min-width: 0; }
.aud-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  color: var(--aud-indigo-ink);
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.aud-profile__name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aud-profile__email {
  font-size: 0.72rem;
  color: var(--aud-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aud-profile__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--aud-muted);
  display: inline-flex;
  padding: 2px;
  flex-shrink: 0;
}
.aud-profile__close:hover { color: var(--text-primary); }
.aud-profile__body { padding: 14px; display: flex; flex-direction: column; gap: 16px; }
.aud-profile__tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.aud-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--aud-subtle);
  border: 1px solid var(--aud-rule);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 500;
}
.aud-tag--role {
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  border-color: transparent;
  color: var(--aud-indigo-ink);
  font-weight: 700;
}
.aud-profile__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.aud-profile__stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.aud-profile__stat-value {
  font-family: 'JetBrains Mono', 'Geist Mono', var(--font-mono, monospace);
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-primary);
}
.aud-profile__section { display: flex; flex-direction: column; gap: 8px; }
.aud-profile__section .aud-eyebrow { color: var(--text-secondary); }

.aud-chart__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.aud-chart__note { font-size: 0.72rem; color: var(--aud-muted); }

.aud-hours { display: flex; align-items: flex-end; gap: 2px; height: 48px; }
/* Poucas barras (diário) ganham corpo; 24 barras (horário) ficam em filete. */
.aud-hours.is-daily { gap: 4px; }
.aud-hours__bar {
  flex: 1;
  min-width: 0;
  background: rgba(99, 102, 241, 0.25);
  border: none;
  border-radius: 2px;
  min-height: 2px;
  padding: 0;
}
.aud-hours__bar.is-active { background: var(--aud-indigo); }
button.aud-hours__bar { cursor: pointer; }
button.aud-hours__bar:hover { background: var(--aud-indigo-ink); }
button.aud-hours__bar:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.aud-hours__labels {
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono', 'Geist Mono', var(--font-mono, monospace);
  font-size: 0.72rem;
  color: var(--aud-muted);
}
/* Um rótulo por barra: mesma métrica das barras pra número cair sob a coluna. */
.aud-hours__labels.is-per-bar { gap: 4px; }
.aud-hours__labels.is-per-bar span { flex: 1; min-width: 0; text-align: center; }

.aud-rank {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.8125rem;
  color: var(--text-primary);
}
.aud-rank__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aud-rank__count { font-family: 'JetBrains Mono', 'Geist Mono', var(--font-mono, monospace); color: var(--aud-muted); flex-shrink: 0; }

.aud-recent { display: flex; flex-direction: column; gap: 6px; }
.aud-recent__row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 0.8125rem; color: var(--text-secondary); }
.aud-recent__what { color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aud-recent__when { font-family: 'JetBrains Mono', 'Geist Mono', var(--font-mono, monospace); font-size: 0.72rem; color: var(--aud-muted); flex-shrink: 0; }

.aud-loading { padding: 24px 16px; text-align: center; font-size: 0.8125rem; color: var(--aud-muted); }
.aud-error { padding: 16px; font-size: 0.8125rem; color: var(--aud-danger); }

/* ── Responsivo ──
   O log é grade fixa de 6 colunas: abaixo de ~1180px o painel de perfil vira
   bloco e, no tablet, as colunas IP/Alvo saem antes de espremer a leitura. */
@media (max-width: 1180px) {
  .aud-main { grid-template-columns: 1fr; }
  .aud-profile { position: static; }
}

/* Colunas por ordem: 1 hora, 2 usuário, 3 ação, 4 alvo, 5 relatório,
   6 resultado, 7 IP. Ao esconder coluna, a contagem de faixas em --aud-cols tem
   que cair na mesma medida, senão cabeçalho e linha saem do prumo (conferido
   medindo os offsets no navegador, não no olho). Alvo e IP caem primeiro;
   Relatório fica até o fim, é o que o pessoal olha. */
@media (max-width: 980px) {
  .aud { padding: 16px 12px 32px; }
  .aud-strip { grid-template-columns: 1fr 1fr; }
  .aud-strip__cell { border-right: none; border-bottom: 1px solid var(--aud-rule); }
  .aud-strip__cell:nth-child(odd) { border-right: 1px solid var(--aud-rule); }
  .aud-split { grid-template-columns: 1fr; }
  /* Saem Alvo (4) e IP (7): sobram 5 faixas. */
  .aud { --aud-cols: 68px minmax(0, 1fr) 156px minmax(0, 1fr) 92px; }
  .aud-log__head span:nth-child(4),
  .aud-row > *:nth-child(4),
  .aud-log__head span:nth-child(7),
  .aud-row > *:nth-child(7) { display: none; }
  .aud-detail { padding-left: 16px; }
  .aud-diff { grid-template-columns: 1fr; gap: 2px; }
  .aud-diff__arrow { text-align: left; }
}

@media (max-width: 640px) {
  /* Saem Ação (3), Alvo (4), Resultado (6) e IP (7): sobram Hora, Usuário e
     Relatório — 3 faixas. */
  .aud { --aud-cols: 56px minmax(0, 1fr) minmax(0, 1fr); }
  .aud-log__head span:nth-child(3),
  .aud-row > *:nth-child(3),
  .aud-log__head span:nth-child(4),
  .aud-row > *:nth-child(4),
  .aud-log__head span:nth-child(6),
  .aud-row > *:nth-child(6),
  .aud-log__head span:nth-child(7),
  .aud-row > *:nth-child(7) { display: none; }
  .aud-strip { grid-template-columns: 1fr; }
  .aud-strip__cell:nth-child(odd) { border-right: none; }
}
