/* ═══════════════════════════════════════════════════════════════════════════
   APP FISCAL — Design System Jaguar Industrial
   Paleta: #373435 (preto marca), #f4be0c (dourado), #ffffff (branco)
   WCAG AA garantido em todos os pares texto/fundo documentados
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. TOKENS ─────────────────────────────────────────────────────────── */
:root {
  /* Paleta principal */
  --jaguar-black:        #373435;
  --jaguar-black-brand:  #373435;
  --jaguar-gold:         #f4be0c;
  --jaguar-yellow:       #f4be0c;
  --jaguar-white:        #ffffff;

  /* Cinzas */
  --jaguar-gray-dark:    #333333;
  --jaguar-gray-text:    #4a4a4a;
  --jaguar-gray-mid:     #595959;  /* 7.0:1 sobre branco — AA ✓ */
  --jaguar-gray-light:   #d6d6d6;
  --jaguar-gray-lt:      #d6d6d6;
  --jaguar-gray-bg:      #f5f5f5;
  --jaguar-red:          #c82333;

  /* Sidebar — todos calculados para 4.5:1 mínimo sobre #373435 */
  --sidebar-bg:          #373435;
  --sidebar-text:        #c8c8c8;  /* 6.3:1 — AA ✓ */
  --sidebar-sub:         #adadad;  /* 5.1:1 — AA ✓ */
  --sidebar-muted:       #aaaaaa;  /* 4.8:1 — AA ✓ */
  --sidebar-border:      rgba(255,255,255,.12);

  /* Superfície e sombras */
  --surface:             #fdfdfd;
  --surface-subtle:      #f9f9f9;
  --border:              rgba(55,52,53,.10);
  --border-strong:       rgba(55,52,53,.18);
  --shadow-xs:           0 1px 2px rgba(55,52,53,.06);
  --shadow-sm:           0 1px 6px rgba(55,52,53,.10);
  --shadow-soft:         0 18px 44px rgba(55,52,53,.08);
  --shadow-md:           0 4px 16px rgba(55,52,53,.10);
  --border-soft:         1px solid rgba(55,52,53,.10);

  /* Tipografia */
  --font:                Arial, Helvetica, sans-serif;
  --font-body:           Arial, Helvetica, sans-serif;
  --font-heading:        Arial, Helvetica, sans-serif;
  --font-mono:           ui-monospace, 'Cascadia Code', Consolas, monospace;

  /* Radius */
  --radius:              6px;
  --radius-md:           10px;
  --radius-panel:        16px;
  --radius-control:      12px;
  --radius-full:         9999px;
}

/* ── 2. RESET ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--jaguar-black);
  background: #f3f3f1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, p { margin: 0; }
img { max-width: 100%; display: block; }

/* ── 3. ACESSIBILIDADE ─────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--jaguar-gold);
  outline-offset: 2px;
  border-radius: 2px;
}
:focus:not(:focus-visible) { outline: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── 4. HELPERS ────────────────────────────────────────────────────────── */
.svg-icon { flex-shrink: 0; display: block; pointer-events: none; }

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 13px; height: 13px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}

.auth-page, .dashboard-page { min-height: 100dvh; }

/* ── 5. LAYOUT PRINCIPAL ───────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100dvh;
}

/* ── 6. SIDEBAR ────────────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-width: 220px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  z-index: 100;
}

/* Logo */
.sidebar-logo {
  padding: 18px 20px 14px;
  border-bottom: 2px solid var(--jaguar-gold);
  flex-shrink: 0;
}

.sidebar-logo-img {
  display: block;
  height: 32px;
  width: auto;
  object-fit: contain;
  object-position: left center;
}

.logo-sub {
  display: block;
  font-size: 10px;
  color: var(--sidebar-muted); /* 4.8:1 — AA ✓ */
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 6px;
}

/* Badge de empresa */
.sidebar-company {
  padding: 8px 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--sidebar-sub);  /* 5.1:1 — AA ✓ */
  border-bottom: 1px solid var(--sidebar-border);
  background: rgba(255,255,255,.04);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  letter-spacing: .3px;
}

/* Seletor de empresa (multi-empresa) */
.sidebar-company-form {
  padding: 6px 12px;
  border-bottom: 1px solid var(--sidebar-border);
  background: rgba(255,255,255,.04);
  flex-shrink: 0;
}
.sidebar-company-select {
  width: 100%;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  color: var(--sidebar-sub);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius);
  cursor: pointer;
  appearance: auto;
}
.sidebar-company-select:focus {
  outline: 2px solid var(--jaguar-gold);
  outline-offset: 1px;
}

/* Barra de filtros em Documentos */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  padding: 14px 20px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.filter-bar label {
  font-size: 11px;
  font-weight: 600;
  color: var(--jaguar-gray-mid);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.filter-bar input,
.filter-bar select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--jaguar-black);
  background: var(--surface);
  min-width: 120px;
}
.filter-bar input:focus,
.filter-bar select:focus {
  outline: 2px solid var(--jaguar-gold);
  outline-offset: -1px;
}
.filter-bar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: auto;
}

/* Ações em lote */
.bulk-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 20px;
  background: var(--jaguar-gray-bg);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.bulk-actions .bulk-count {
  font-size: 12px;
  color: var(--jaguar-gray-mid);
  margin-right: 4px;
}

/* Navegação */
.sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  min-height: 42px;
  color: var(--sidebar-text); /* 6.3:1 — AA ✓ */
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  border-left: 3px solid transparent;
  cursor: pointer;
  user-select: none;
  transition: background .15s ease, color .15s ease;
}

.nav-item:hover {
  background: rgba(244,190,12,.12);
  color: var(--jaguar-gold);
}

.nav-item.active {
  background: rgba(244,190,12,.18);
  color: var(--jaguar-gold);
  border-left-color: var(--jaguar-gold);
  font-weight: 600;
}

.nav-icon {
  width: 20px;
  min-width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-label { flex: 1; }

/* Submenu */
.sidebar-submenu { padding: 0 0 4px; }

.nav-subitem {
  display: flex;
  align-items: center;
  padding: 8px 16px 8px 49px;
  min-height: 36px;
  color: var(--sidebar-sub);  /* 5.1:1 — AA ✓ */
  font-size: 12px;
  text-decoration: none;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}

.nav-subitem:hover {
  color: var(--jaguar-gold);
  background: rgba(244,190,12,.07);
}

.nav-subitem.active {
  color: var(--jaguar-gold);
  border-left-color: var(--jaguar-gold);
  background: rgba(244,190,12,.12);
  font-weight: 600;
}

/* Rodapé da sidebar — position: static cancela herança de blocos antigos */
.sidebar-footer {
  flex-shrink: 0;
  padding: 14px 20px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: static;
  bottom: auto;
  left: auto;
  right: auto;
}

.user-email {
  font-size: 11px;
  color: var(--sidebar-muted); /* 4.8:1 — AA ✓ */
  word-break: break-all;
  line-height: 1.4;
}

.btn-logout {
  font-size: 12px;
  font-weight: 500;
  color: var(--sidebar-text);
  background: transparent;
  border: none;
  padding: 4px 0;
  cursor: pointer;
  text-align: left;
  width: 100%;
  min-height: 32px;
  display: flex;
  align-items: center;
  font-family: var(--font-body);
  transition: color .15s ease;
}

.btn-logout:hover { color: var(--jaguar-gold); }

/* ── 7. CONTEÚDO PRINCIPAL ─────────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 28px 32px;
  overflow-x: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ── 8. HAMBÚRGUER + OVERLAY (mobile) ─────────────────────────────────── */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 2000;
  background: var(--jaguar-black);
  color: var(--jaguar-gold);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius);
  width: 40px; height: 40px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .15s ease;
}

.sidebar-toggle:hover { background: #4a4748; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1500;
}

/* ── 9. AUTH ───────────────────────────────────────────────────────────── */
.auth-layout {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(320px, 0.95fr);
}

.auth-panel {
  position: relative;
  padding: 48px;
}

.auth-brand-panel {
  background:
    linear-gradient(140deg, rgba(244,190,12,.18) 0%, rgba(244,190,12,.04) 46%, rgba(255,255,255,.92) 100%),
    var(--surface);
  border-right: var(--border-soft);
  overflow: hidden;
}

.brand-rail {
  position: absolute;
  inset: 0 auto 0 0;
  width: 14px;
  background: var(--jaguar-yellow);
}

.brand-copy {
  padding-left: 28px;
  display: grid;
  gap: 20px;
  align-content: center;
  min-height: calc(100dvh - 96px);
  max-width: 560px;
}

.brand-logo-img {
  display: block;
  height: 44px;
  width: auto;
  object-fit: contain;
  object-position: left center;
}

.brand-copy h1 {
  font-family: var(--font-heading);
  font-size: clamp(2.4rem, 4vw, 4rem);
  font-weight: 700;
  line-height: 1.05;
  max-width: 10ch;
  color: var(--jaguar-black);
}

.auth-form-panel {
  display: grid;
  place-items: center;
}

.form-shell {
  width: min(100%, 420px);
  background: rgba(255,255,255,.95);
  border: var(--border-soft);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-soft);
  padding: 36px;
  display: grid;
  gap: 16px;
}

.form-shell h2 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.1;
  color: var(--jaguar-black);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form-secondary { margin-top: -4px; }

.auth-form label {
  font-size: .9rem;
  font-weight: 700;
  color: var(--jaguar-gray-dark);
}

.auth-form input {
  height: 50px;
  border-radius: var(--radius-control);
  border: 1.5px solid var(--border-strong);
  padding: 0 14px;
  font-size: 1rem;
  color: var(--jaguar-black);
  background: #fff;
  width: 100%;
  font-family: var(--font-body);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--jaguar-gold);
  box-shadow: 0 0 0 3px rgba(244,190,12,.22);
}

.auth-form button {
  min-height: 50px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--jaguar-black);
  color: var(--jaguar-white);
  font-weight: 700;
  font-size: .98rem;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background .15s ease, transform .1s ease;
}

.auth-form button:hover  { background: #4a4748; }
.auth-form button:active { transform: scale(.98); }

.secondary-button {
  background: transparent !important;
  color: var(--jaguar-black) !important;
  border: 1.5px solid var(--border-strong) !important;
}

.secondary-button:hover { background: rgba(244,190,12,.10) !important; }

/* ── 10. TIPOGRAFIA AUXILIAR ───────────────────────────────────────────── */
.eyebrow,
.section-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--jaguar-gray-mid); /* 7.0:1 sobre branco — AA ✓ */
  line-height: 1;
}

.lead,
.support-copy,
.sidebar-copy,
.section-head p {
  color: var(--jaguar-gray-text);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 52ch;
}

.brand-list {
  margin: 4px 0 0;
  padding: 0 0 0 18px;
  color: var(--jaguar-gray-dark);
  line-height: 1.9;
}

/* ── 11. CABEÇALHO DE PÁGINA ──────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-header h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 2.5vw, 2.1rem);
  font-weight: 700;
  color: var(--jaguar-black);
  margin: 6px 0 0;
  line-height: 1.1;
}

.page-subtitle {
  color: var(--jaguar-gray-mid);
  font-size: 13px;
  margin-top: 4px;
  line-height: 1.4;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* ── 12. ALERTAS (flash messages) ─────────────────────────────────────── */
.alert {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 0;
}

.alert-success { background: #d4edda; color: #155724; border-left: 4px solid #28a745; }
.alert-error   { background: #f8d7da; color: #721c24; border-left: 4px solid var(--jaguar-red); }
.alert-danger  { background: #f8d7da; color: #721c24; border-left: 4px solid var(--jaguar-red); }
.alert-info    { background: #d1ecf1; color: #0c5460; border-left: 4px solid #17a2b8; }
.alert-warning { background: #fff3cd; color: #6b4e00; border-left: 4px solid var(--jaguar-gold); }

/* ── 13. BOTÕES ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 18px;
  min-height: 38px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 600;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  user-select: none;
  transition: background .15s ease, opacity .15s ease, color .15s ease, transform .12s ease, border-color .15s ease;
}

.btn:active   { transform: scale(.97); }
.btn:disabled,
.btn[disabled] { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn-primary   { background: var(--jaguar-black); color: #fff; border-color: var(--jaguar-black); }
.btn-primary:hover { background: #4a4748; border-color: #4a4748; color: #fff; }

.btn-secondary { background: var(--jaguar-gold); color: var(--jaguar-black); border-color: var(--jaguar-gold); }
.btn-secondary:hover { background: #e0ac0a; border-color: #e0ac0a; }

.btn-ghost  { background: transparent; color: var(--jaguar-black); border-color: var(--jaguar-gray-light); }
.btn-ghost:hover { background: var(--jaguar-gray-bg); }

.btn-danger { background: transparent; color: var(--jaguar-red); border-color: var(--jaguar-red); }
.btn-danger:hover { background: #fef2f2; }

.btn-sm    { min-height: 32px; padding: 0 12px; font-size: 12px; }
.btn-block { width: 100%; }

/* ── 14. BOTÕES DE AÇÃO (tabela) ────────────────────────────────────── */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 11px;
  border-radius: var(--radius-full);
  font-size: .78rem;
  font-weight: 600;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--font-body);
  transition: background .15s ease;
  user-select: none;
}

.action-btn-approve {
  background: rgba(244,190,12,.22);
  color: var(--jaguar-black);
}
.action-btn-approve:hover { background: rgba(244,190,12,.40); }

.action-btn-revoke {
  background: rgba(200,35,51,.10);
  color: #a41c2a;  /* 5.5:1 sobre fundo — AA ✓ */
}
.action-btn-revoke:hover { background: rgba(200,35,51,.20); }

.action-btn-download {
  background: rgba(55,52,53,.08);
  color: var(--jaguar-black);
}
.action-btn-download:hover { background: rgba(55,52,53,.16); }

/* ── 15. FORMULÁRIOS ────────────────────────────────────────────────── */
.form-card {
  background: rgba(255,255,255,.95);
  border: var(--border-soft);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-soft);
  padding: 24px 28px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--jaguar-black);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.form-hint {
  font-size: 11px;
  color: var(--jaguar-gray-mid); /* 7.0:1 sobre branco — AA ✓ */
  margin-top: 2px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--jaguar-black);
  background: #fff;
  min-height: 40px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--jaguar-gold);
  box-shadow: 0 0 0 3px rgba(244,190,12,.15);
}

.form-row { display: flex; gap: 20px; }
.form-col  { flex: 1; }

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--jaguar-gray-light);
}

/* ── 16. BADGE DE OPERADOR ──────────────────────────────────────────── */
.operator-badge {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: var(--radius-full);
  background: rgba(244,190,12,.18);
  color: var(--jaguar-black);
  font-weight: 700;
  font-size: 13px;
}

/* ── 17. MÉTRICAS ────────────────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  background: rgba(255,255,255,.95);
  border: var(--border-soft);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  display: grid;
  gap: 8px;
}

.metric-label {
  color: var(--jaguar-gray-mid);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--jaguar-black);
}

/* ── 18. SEÇÕES / CARDS ─────────────────────────────────────────────── */
.dashboard-section {
  background: rgba(255,255,255,.95);
  border: var(--border-soft);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  display: grid;
  gap: 16px;
  overflow-x: auto;
}

.section-head { display: grid; gap: 6px; }
.section-head h3 { font-size: 1.1rem; font-weight: 700; }

/* ── 19. TABELA FISCAL (documentos) ─────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.fiscal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.fiscal-table th,
.fiscal-table td {
  padding: 10px 13px;
  text-align: left;
  border-bottom: 1px solid rgba(55,52,53,.07);
  white-space: nowrap;
}

.fiscal-table thead tr {
  background: var(--jaguar-black) !important;
}

.fiscal-table th {
  color: var(--jaguar-gold) !important;
  font-size: .72rem !important;
  font-weight: 700;
  text-transform: uppercase !important;
  letter-spacing: .08em;
  white-space: nowrap;
}

.fiscal-table tbody tr:last-child td { border-bottom: 0; }
.fiscal-table tbody tr:hover { background: rgba(244,190,12,.06); }

/* Status chips */
.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  background: rgba(244,190,12,.18);
  font-weight: 700;
  font-size: .75rem;
  white-space: nowrap;
  color: var(--jaguar-black);
}

.status-chip-muted {
  background: rgba(77,77,77,.10);
  color: var(--jaguar-gray-text); /* 7.7:1 sobre fundo — AA ✓ */
}

/* Mono */
.mono-small {
  font-family: var(--font-mono);
  font-size: .78rem;
  word-break: break-all;
}

/* ── 20. PANEL TABLES (usuários, auditoria) ─────────────────────────── */
.panel-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.panel-table {
  display: grid;
  border: 1px solid rgba(55,52,53,.12);
  border-radius: var(--radius-md);
  overflow: hidden;
  min-width: 0;
}

.panel-row {
  display: grid;
  gap: 14px;
  padding: 12px 16px;
  align-items: center;
  background: #fff;
  border-top: 1px solid rgba(55,52,53,.07);
}

.panel-row:first-child { border-top: 0; }

.panel-row-head {
  background: var(--jaguar-black);
  color: var(--jaguar-gold);
  font-weight: 700;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  border-top: 0;
}

.panel-table--users .panel-row,
.panel-table--users .panel-row-head {
  grid-template-columns: 2fr 1.2fr 1fr .7fr .7fr;
}

.panel-table--docs .panel-row,
.panel-table--docs .panel-row-head {
  grid-template-columns: 2.4fr 1fr 0.8fr 1fr 0.7fr;
}

.panel-table--audit .panel-row,
.panel-table--audit .panel-row-head {
  grid-template-columns: 1.1fr 1fr .7fr 2fr;
}

.panel-table--fiscal-docs .panel-row,
.panel-table--fiscal-docs .panel-row-head {
  grid-template-columns: 36px 100px 180px 110px 90px 1fr 90px;
}

.panel-table--mnt-empresas .panel-row,
.panel-table--mnt-empresas .panel-row-head {
  grid-template-columns: 1fr 1fr 90px 60px 1fr 100px;
}

.panel-table--mnt-certs .panel-row,
.panel-table--mnt-certs .panel-row-head {
  grid-template-columns: 1fr 2fr 120px 100px 90px;
}

.panel-table--mnt-sync .panel-row,
.panel-table--mnt-sync .panel-row-head {
  grid-template-columns: 1fr 100px 140px 120px 1fr;
}

.audit-chip {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: var(--radius);
  background: rgba(55,52,53,.08);
  white-space: nowrap;
}

.audit-detail {
  font-size: .85rem;
  color: var(--jaguar-gray-text);
  word-break: break-word;
  white-space: normal;
}

/* ── 21. LEGACY COMPAT (dead code mantido para segurança) ───────────── */
.dashboard-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 300px 1fr;
}
.dashboard-sidebar {
  background: #f8f8f6;
  border-right: var(--border-soft);
  padding: 28px 24px;
  position: relative;
}
.sidebar-mark { position: absolute; inset: 0 auto 0 0; width: 12px; background: var(--jaguar-yellow); }
.sidebar-head { padding-left: 18px; display: grid; gap: 12px; }
.sidebar-head h1 { font-size: 2rem; font-family: var(--font-heading); font-weight: 700; }
.sidebar-nav .legacy a {
  text-decoration: none;
  color: var(--jaguar-gray-dark);
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 12px;
  cursor: pointer;
}
.sidebar-nav .legacy a.is-active,
.sidebar-nav .legacy a:hover {
  background: rgba(244,190,12,.16);
  color: var(--jaguar-black);
}
.dashboard-main { padding: 36px; display: grid; gap: 24px; }
.dashboard-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.dashboard-header h2 { font-family: var(--font-heading); font-weight: 700; font-size: clamp(2rem,3vw,3rem); max-width: 14ch; }
.logout-btn {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(55,52,53,.18);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--jaguar-gray-mid);
  font-size: .9rem;
  cursor: pointer;
}
.logout-btn:hover { background: rgba(180,30,30,.08); color: #b41e1e; }

/* ── 22. RESPONSIVO ─────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .sidebar-toggle { display: flex; }

  .layout .sidebar {
    position: fixed;
    left: -240px;
    top: 0;
    height: 100%;
    transition: left .25s ease;
    z-index: 1600;
    box-shadow: none;
  }

  .layout.sidebar-open .sidebar {
    left: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,.30);
  }
  .layout.sidebar-open .sidebar-overlay { display: block; }

  .main-content { padding: 20px 16px; }

  .panel-table-scroll { overflow-x: auto; }
  .panel-table--users, .panel-table--audit { min-width: 600px; }
}

@media (max-width: 768px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-brand-panel { display: none; }
  .auth-form-panel { padding: 24px; }

  .page-header { flex-direction: column; gap: 12px; }
  .header-actions { align-self: flex-end; }
}

@media (max-width: 640px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .dashboard-section { padding: 14px 16px; }
  .main-content { gap: 14px; }
}
