*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Tokens ──────────────────────────────────────────
   Identidade VPM Logística Integrada (PRD de identidade visual, 15/09/2026).
   O azul da marca é a cor estrutural (navegação, ação primária, foco); o
   vermelho é acento em dose pequena (marcador do item ativo, obrigatório).
   Verde, vermelho e amarelo abaixo são cores de STATUS (conforme / divergente
   / ausente) — não são cores de marca. Toda cor da aplicação sai daqui. */
:root {
  /* Marca */
  --primary: #013e82; /* brand-blue-700 — Azul VPM */
  --primary-hover: #0b4e9c; /* brand-blue-600 */
  --primary-active: #01326b; /* brand-blue-800 */
  --primary-deep: #012a5c; /* brand-blue-900 */
  --primary-light: #eff5fc; /* brand-blue-50 */
  --primary-soft: #d7e6f7; /* brand-blue-100 */
  --link: #1565c0; /* brand-blue-500 */
  --accent: #c2202b; /* brand-red-600 — vermelho de interface */
  --accent-hover: #a8161f; /* brand-red-700 */
  --accent-brand: #e8353d; /* brand-red-500 — só logo e faixas ≥ 24px */

  /* Status */
  --green: #166534; /* success-fg: texto/ícone sobre --green-light (6.5:1) */
  --green-mid: #15803d; /* success-solid: fundo sólido com texto branco */
  --green-light: #dcfce7; /* success-bg */
  --red: #b91c1c; /* danger-solid (5.5:1 sobre --red-light) */
  --red-light: #fee2e2; /* danger-bg */
  --yellow: #92400e; /* warning-fg (6.4:1 sobre --yellow-light) */
  --yellow-light: #fef3c7; /* warning-bg */

  /* Neutros */
  --bg: #f8fafc; /* neutral-50 */
  --surface: #ffffff; /* neutral-0 */
  --surface2: #f1f5f9; /* neutral-100 */
  --border: #e2e8f0; /* neutral-200 */
  --border-input: #cbd5e1; /* neutral-300 */
  --text: #0f172a; /* neutral-900 */
  --text-secondary: #475569; /* neutral-600 */
  --text-muted: #64748b; /* neutral-500 */

  /* Navegação */
  --sidebar-bg: var(--primary);
  --sidebar-deep: var(--primary-deep);
  --sidebar-text: #e2e8f0;
  --sidebar-muted: #aecdef; /* brand-blue-200 */
  --sidebar-active-bg: var(--primary-active);
  --sidebar-active: #ffffff;
  --sidebar-marker: var(--accent-brand);
  --header-bg: #ffffff;

  /* Forma */
  --radius-sm: 4px;
  --radius-md: 6px; /* botão, input */
  --radius: 8px; /* card */
  --radius-xl: 12px; /* modal */
  --shadow-xs: 0 1px 2px rgba(1, 27, 61, 0.05);
  --shadow-sm: 0 1px 3px rgba(1, 27, 61, 0.08), 0 1px 2px rgba(1, 27, 61, 0.04);
  --shadow: var(--shadow-sm);
  --shadow-md: 0 4px 8px rgba(1, 27, 61, 0.08), 0 2px 4px rgba(1, 27, 61, 0.04);
  --shadow-lg: 0 12px 24px rgba(1, 27, 61, 0.1), 0 4px 8px rgba(1, 27, 61, 0.05);
  --shadow-focus: 0 0 0 3px rgba(1, 62, 130, 0.25);
}

/* ── Tokens: Dark ────────────────────────────────── */
[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #111b2e;
  --surface2: #172338;
  --border: #24324a;
  --border-input: #33445e;
  --text: #e2e8f0;
  --text-secondary: #b6c2d3;
  --text-muted: #94a3b8;
  --primary-light: #0f2a4d;
  --primary-soft: #143a66;
  --link: #7faee4;
  --sidebar-bg: #01326b;
  --sidebar-deep: #001b3d;
  --header-bg: #111b2e;
  --green: #4ade80;
  --green-mid: #86efac;
  --green-light: #0b2e1a;
  --red: #f87171;
  --red-light: #3a1414;
  --yellow: #fbbf24;
  --yellow-light: #3a2606;
  --shadow-focus: 0 0 0 3px rgba(127, 174, 228, 0.35);
}

body {
  font-family:
    Inter,
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  transition:
    background 0.25s,
    color 0.25s;
}

/* Foco visível em tudo que recebe teclado: anel azul da marca, nunca o outline do navegador. */
:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
  outline: none;
}

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

/* ── Sidebar ─────────────────────────────────────── */
:root {
  --sidebar-w: 224px;
  --sidebar-collapsed-w: 58px;
}

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  border-right: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
  transition: width 0.22s ease;
}
.sidebar.collapsed {
  width: var(--sidebar-collapsed-w);
}

.sidebar-logo {
  padding: 14px 16px;
  background: var(--sidebar-deep);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.sidebar-logo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.sidebar-logo-box {
  width: 48px;
  height: 44px;
  border-radius: var(--radius);
  flex-shrink: 0;
  background: transparent; /* a logo já vem com o fundo azul da marca */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  transition:
    opacity 0.18s,
    width 0.22s,
    margin 0.22s;
}
.logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  transition:
    opacity 0.18s,
    max-height 0.22s,
    margin 0.22s;
}
.sidebar-brand-name {
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  line-height: 1.3;
  letter-spacing: 0.01em;
}
.sidebar-brand-sub {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--sidebar-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.sidebar.collapsed .sidebar-logo-box {
  opacity: 0;
  width: 0;
  margin: 0 auto;
  pointer-events: none;
}
.sidebar.collapsed .sidebar-logo-row {
  justify-content: center;
}
.sidebar.collapsed .sidebar-brand {
  opacity: 0;
  max-height: 0;
  margin: 0;
  pointer-events: none;
}

.btn-sidebar-toggle {
  background: rgba(255, 255, 255, 0.06);
  border: none;
  cursor: pointer;
  color: var(--sidebar-muted);
  font-size: 13px;
  line-height: 1;
  padding: 6px 9px;
  border-radius: 6px;
  flex-shrink: 0;
  transition:
    background 0.15s,
    color 0.15s,
    transform 0.22s;
}
.btn-sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--sidebar-text);
}
.sidebar.collapsed .btn-sidebar-toggle {
  transform: rotate(180deg);
  margin: 0 auto;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--sidebar-text);
  text-align: left;
  width: 100%;
  white-space: nowrap;
  transition:
    background 0.12s,
    color 0.12s;
  position: relative;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--sidebar-active);
}
/* Item ativo: fundo um degrau mais escuro e a barra vermelha da marca à esquerda — a aplicação
   mais visível (e mais econômica) do vermelho VPM em toda a plataforma. */
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active);
  font-weight: 600;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--sidebar-marker);
}
.nav-icon {
  font-size: 17px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}
.nav-icon-flip {
  display: inline-block;
  transform: scaleX(-1);
}
.nav-label {
  max-width: 160px;
  overflow: hidden;
  transition:
    max-width 0.22s ease,
    opacity 0.15s;
}
.sidebar.collapsed .nav-label {
  max-width: 0;
  opacity: 0;
}

.sidebar.collapsed .nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(var(--sidebar-collapsed-w) + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: #1e293b;
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 7px;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 300;
}
.sidebar.collapsed .nav-item:hover::after {
  opacity: 1;
}

/* ── Grupos de menu expansíveis (Importação / Exportação) ─ */
.nav-group-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--sidebar-text);
  text-align: left;
  width: 100%;
  white-space: nowrap;
  transition:
    background 0.12s,
    color 0.12s;
  position: relative;
}
.nav-group-header:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--sidebar-active);
}
.nav-group-chevron {
  margin-left: auto;
  font-size: 11px;
  transition: transform 0.18s ease;
  flex-shrink: 0;
}
.nav-group.expanded .nav-group-chevron {
  transform: rotate(180deg);
}
.sidebar.collapsed .nav-group-chevron {
  display: none;
}

.nav-submenu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 0;
  overflow: hidden;
  padding-left: 14px;
  transition: max-height 0.22s ease;
}
.nav-group.expanded .nav-submenu {
  max-height: 200px;
}
.sidebar.collapsed .nav-submenu {
  padding-left: 0;
}
.nav-submenu .nav-item {
  font-size: 13px;
}

.nav-submenu-vazio {
  font-size: 12px;
  color: var(--sidebar-muted);
  opacity: 0.6;
  padding: 8px 12px;
  font-style: italic;
}
.sidebar.collapsed .nav-submenu-vazio {
  display: none;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: hidden;
}
.sidebar-version {
  font-size: 11px;
  color: var(--sidebar-muted);
  white-space: nowrap;
  transition: opacity 0.18s;
}
.sidebar.collapsed .sidebar-version {
  opacity: 0;
  pointer-events: none;
}

/* ── Main wrapper ────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.22s ease;
}
.main-wrapper.collapsed {
  margin-left: var(--sidebar-collapsed-w);
}

/* ── Header ──────────────────────────────────────── */
header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background 0.25s;
  display: flex;
  align-items: center;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}
.header-title {
  flex: 1;
}
.header-title h1 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.header-title p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}
/* Widgets do topo, da esquerda para a direita: clima · relógio · idioma · tema. Mesmo padrão
   das demais plataformas Conexão Tech. */
.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}
.header-widget {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 40px;
  border-left: 1px solid var(--border);
}
.header-widget:first-child {
  border-left: none;
}
.header-widget-icon {
  font-size: 20px;
  line-height: 1;
}
.header-widget-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.header-widget-main {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.header-widget-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
#header-clima[hidden] {
  display: none;
}
.btn-idiomas,
.btn-theme-group {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px;
}
.btn-flag,
.btn-theme-opt {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 6px 9px;
  border-radius: 99px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  transition:
    background 0.15s,
    color 0.15s;
}
.btn-flag .flag {
  width: 18px;
  height: 13px;
  border-radius: 2px;
  flex-shrink: 0;
  opacity: 0.55;
  transition: opacity 0.15s;
}
.btn-flag:hover,
.btn-theme-opt:hover {
  color: var(--text);
}
.btn-flag:hover .flag {
  opacity: 0.9;
}
.btn-flag.active,
.btn-theme-opt.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}
.btn-flag.active .flag {
  opacity: 1;
}
[data-theme="dark"] .btn-flag.active,
[data-theme="dark"] .btn-theme-opt.active {
  color: var(--link);
}
.btn-theme-opt {
  padding: 5px 8px;
}
.btn-theme-opt svg {
  display: block;
}

/* ── Main / Footer ───────────────────────────────── */
main {
  flex: 1;
  padding: 24px 28px 48px;
  max-width: 1300px;
  width: 100%;
}
footer {
  padding: 12px 28px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--header-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.footer-dev {
  display: flex;
  align-items: center;
  gap: 8px;
}
.footer-brand {
  font-weight: 600;
  color: var(--text-secondary);
}
.footer-linkedin {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-linkedin:hover {
  color: var(--link);
  text-decoration: underline;
}

/* ── Cards ───────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.card h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}
.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.page-header-row h2 {
  margin-bottom: 0;
}

/* Busca por código na tabela DE×PARA — fica logo após o nome do cliente,
   mantendo o botão "+ Item" encostado na direita (margin-right auto). */
/* Seletor com a classe do pai para vencer o `input[type="text"] { width: 100% }` global,
   que tem especificidade maior que uma classe sozinha e esticava o campo. */
.page-header-row .map-filtro {
  margin-left: 16px;
  margin-right: auto;
  width: 210px;
  flex: 0 0 210px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 13px;
}

/* ── Botões ──────────────────────────────────────── */
.btn-primary,
.btn-secondary {
  cursor: pointer;
  border: none;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 16px;
  min-height: 40px;
  transition:
    opacity 0.15s,
    background 0.15s,
    box-shadow 0.15s;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-sm);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: default;
  box-shadow: none;
}
.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-input);
}
.btn-secondary:hover {
  background: var(--surface2);
  border-color: var(--text-muted);
}
.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-secondary:disabled:hover {
  background: var(--surface2);
}

/* ── Upload card ─────────────────────────────────── */
#card-upload {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.ref-topo {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.ref-topo .form-group {
  margin-bottom: 0;
}

.docs-info {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  padding: 11px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-muted);
}
.docs-info strong {
  color: var(--text);
}

.itens-aviso {
  background: var(--red-light);
  border: 1px solid var(--red);
  border-left: 3px solid var(--red);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 13px;
}
.itens-aviso-titulo {
  font-weight: 700;
  color: var(--red);
  margin-bottom: 4px;
}
.itens-aviso-texto {
  color: var(--text-muted);
  margin: 0 0 8px;
}
.itens-aviso-lista {
  margin: 0 0 10px;
  padding-left: 18px;
  color: var(--text);
}
.itens-aviso-lista li {
  margin-bottom: 2px;
}
.itens-aviso-nota {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 10px;
}

/* ── Grade de documentos ─────────────────────────── */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.doc-slot {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  position: relative;
  transition:
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface2);
}
.doc-slot:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: var(--shadow-focus);
}
.doc-slot.loaded {
  border-style: solid;
  border-color: var(--green);
  background: var(--green-light);
}
.doc-slot.master {
  border-color: var(--primary);
  border-style: solid;
  background: var(--primary-light);
}
[data-theme="dark"] .doc-slot {
  background: var(--surface2);
}
[data-theme="dark"] .doc-slot.master {
  background: var(--primary-light);
}
[data-theme="dark"] .doc-slot.loaded {
  background: var(--green-light);
}

.doc-slot-num {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.doc-slot.master .doc-slot-num {
  color: var(--primary);
}
.doc-slot-nome {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.doc-slot-desc {
  font-size: 11px;
  color: var(--text-muted);
}
.doc-slot-status {
  font-size: 11px;
  font-weight: 600;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.doc-slot-status.vazio {
  color: var(--text-muted);
}
.doc-slot-status.carregado {
  color: var(--green);
}
.doc-slot-badge-mestre {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: 0.06em;
}
.doc-slot-badge-opcional {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: 0.06em;
}
.doc-file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

/* ── Upload actions ──────────────────────────────── */
.upload-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.upload-contador {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.btn-analisar {
  padding: 10px 32px;
  font-size: 14px;
  white-space: nowrap;
}

/* ── Form / Inputs ───────────────────────────────── */
.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 5px;
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="tel"],
select {
  width: 100%;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  min-height: 40px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
input:hover,
select:hover {
  border-color: var(--text-muted);
}
input::placeholder {
  color: #94a3b8; /* neutral-400: só para placeholder */
}
input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}
.obrigatorio {
  color: var(--accent);
}

/* ── Processando ─────────────────────────────────── */
.processando-content {
  text-align: center;
  padding: 48px 0;
}
.processando-content h3 {
  margin: 16px 0 8px;
  font-size: 16px;
  color: var(--text);
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Resultado header ────────────────────────────── */
.resultado-header {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.resultado-ref {
  flex: 1;
}
.label-ref {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.resultado-ref h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 20px;
}
.resultado-cliente-info {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}
.metricas {
  display: flex;
  gap: 8px;
}
.metrica {
  text-align: center;
  padding: 12px 16px;
  border-radius: 10px;
  min-width: 82px;
}
.metrica.conforme {
  background: var(--green-light);
  color: var(--green);
}
.metrica.divergente {
  background: var(--red-light);
  color: var(--red);
}
.metrica.ausente {
  background: var(--yellow-light);
  color: var(--yellow);
}
.metrica.taxa {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.metrica.conforme,
.metrica.divergente,
.metrica.ausente {
  cursor: pointer;
  border: 2px solid transparent;
  transition:
    border-color 0.15s,
    transform 0.1s;
  user-select: none;
}
.metrica.conforme:hover,
.metrica.divergente:hover,
.metrica.ausente:hover {
  transform: translateY(-1px);
}
.metrica.conforme.filtro-ativo {
  border-color: var(--green);
}
.metrica.divergente.filtro-ativo {
  border-color: var(--red);
}
.metrica.ausente.filtro-ativo {
  border-color: var(--yellow);
}
.metrica-valor {
  display: block;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.metrica-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.resultado-acoes {
  display: flex;
  gap: 10px;
}

/* ── Doc badges ──────────────────────────────────── */
.doc-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
  margin: 3px 3px 3px 0;
  background: var(--surface2);
  color: var(--text);
}
.badge-tipo {
  font-weight: 600;
}
.badge-conf {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 99px;
  font-weight: 700;
}
.conf-high {
  background: var(--green-light);
  color: var(--green);
}
.conf-medium {
  background: var(--yellow-light);
  color: var(--yellow);
}
.conf-low {
  background: var(--red-light);
  color: var(--red);
}
.btn-ver-pdf {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition:
    background 0.12s,
    border-color 0.12s;
  white-space: nowrap;
}
.btn-ver-pdf:hover {
  background: var(--green-light);
  border-color: var(--primary);
  color: var(--primary);
}

.alerta-extraction {
  margin-top: 6px;
  padding: 8px 12px;
  background: var(--yellow-light);
  border-left: 3px solid var(--yellow);
  border-radius: 4px;
  font-size: 12px;
  color: var(--yellow);
}
[data-theme="dark"] .alerta-extraction {
  color: #f5b942;
}

/* ── Doc card (documentos processados) ───────────────── */
.doc-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  margin-bottom: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.doc-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.doc-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  flex-wrap: wrap;
}
.doc-filename {
  font-size: 12px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.toggle-note-btn {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  white-space: nowrap;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--primary);
  pointer-events: none;
}
.audit-custo-toggle {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.audit-custo-toggle:hover {
  color: var(--text);
}

/* painel de campos */
.doc-fields-panel {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  background: var(--surface);
}
.doc-fields-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.doc-fields-table tr + tr td {
  border-top: 1px solid var(--border);
}
.df-label {
  color: var(--text-muted, #6b7280);
  padding: 5px 10px 5px 0;
  white-space: nowrap;
  width: 150px;
  font-weight: 500;
}
.df-val {
  color: var(--text);
  padding: 5px 0;
  word-break: break-word;
}
.df-val.field-absent {
  color: var(--text-muted, #9ca3af);
  font-style: italic;
}
.item-row td {
  background: var(--surface2);
}
.doc-fields-nota {
  margin-top: 10px;
  padding: 7px 10px;
  background: var(--yellow-light);
  border-left: 3px solid var(--yellow);
  border-radius: 4px;
  font-size: 11px;
  color: var(--yellow);
}
[data-theme="dark"] .doc-fields-nota {
  color: #f5b942;
}

/* ── Tabelas ─────────────────────────────────────── */
.grupo-secao-titulo {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin: 24px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--primary);
}
.grupo-secao-titulo:first-child {
  margin-top: 0;
}

/* ── Filtro de comparações por documento ─────────── */
.filtro-doc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.filtro-doc-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 99px;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}
.filtro-doc-chip:hover {
  background: var(--border);
}
.filtro-doc-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.comparacao-card {
  margin-bottom: 14px;
}
.comparacao-card-header {
  margin-bottom: 4px;
}
.comparacao-card-header h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.comparacao-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.itens-collapse-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
}
.itens-collapse-header:hover {
  background: var(--border);
}
.itens-collapse-header.open > span:first-child {
  color: var(--primary);
}
.itens-collapse-status-resumo {
  display: flex;
  gap: 6px;
}
.itens-collapse-status-resumo .status-badge {
  font-size: 10.5px;
  padding: 3px 8px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  padding: 9px 12px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
tr:last-child td {
  border-bottom: none;
}
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}
.status-diff-pct {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
}
.status-ajuste-link {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--link);
  text-decoration: underline;
}
.status-ajuste-link:hover {
  color: var(--primary-hover);
}
.status-ajuste-nota {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 3px;
}
.status-conforme {
  background: var(--green-light);
  color: var(--green);
}
.status-divergente {
  background: var(--red-light);
  color: var(--red);
}
.status-ausente {
  background: var(--yellow-light);
  color: var(--yellow);
}
.val-null {
  color: var(--text-muted);
  font-style: italic;
}
.diff-pct {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Histórico ───────────────────────────────────── */
.dash-filtros,
.hist-filtros {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.hist-filtro-campo {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 200px;
}
.hist-filtro-campo label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.hist-filtro-campo select,
.hist-filtro-campo input[type="text"] {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 13px;
}
.hist-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-radius: 8px;
  margin: 1px 0;
  transition: background 0.12s;
}
.hist-row:last-child {
  border-bottom: none;
}
.hist-row:hover {
  background: var(--surface2);
}
.hist-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.hist-ref {
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
}
.hist-audit-line {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 1px;
}
.hist-metricas {
  display: flex;
  gap: 5px;
  margin-top: 5px;
  flex-wrap: wrap;
}
.hm {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
}
.hm.conforme {
  background: var(--green-light);
  color: var(--green);
}
.hm.divergente {
  background: var(--red-light);
  color: var(--red);
}
.hm.ausente {
  background: var(--yellow-light);
  color: var(--yellow);
}
.hm.taxa {
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.hist-acoes {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-left: 16px;
}
.btn-excluir {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 5px 7px;
  border-radius: 6px;
  color: var(--text-muted);
  transition:
    background 0.12s,
    color 0.12s;
  line-height: 1;
}
.btn-excluir:hover {
  background: var(--red-light);
  color: var(--red);
}
.btn-excluir-bloqueado {
  font-size: 13px;
  padding: 5px 7px;
  color: var(--text-muted);
  opacity: 0.55;
  cursor: default;
  line-height: 1;
}
.status-pill {
  padding: 3px 11px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.pill-concluida {
  background: var(--green-light);
  color: var(--green);
}
.pill-processando {
  background: var(--yellow-light);
  color: var(--yellow);
}
.pill-erro {
  background: var(--red-light);
  color: var(--red);
}
.hist-validado {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  margin-top: 4px;
  display: block;
}
.hist-pendente {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}
.hist-custo {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
  margin-top: 4px;
  display: block;
}

/* ── Configurações ───────────────────────────────── */
.config-section {
  margin-bottom: 28px;
}
.config-section h3 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cfg-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #6b7280);
  margin: 0 0 16px;
}
.cfg-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.cfg-section-header .cfg-section-title {
  margin: 0;
}

/* ── Formulário novo usuário ─────────────────────── */
.novo-usuario-form {
  display: none;
  margin-bottom: 24px;
  padding: 24px;
  background: var(--surface2);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.novo-usuario-form-title {
  margin: 0 0 20px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.novo-usuario-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 20px;
}
.novo-usuario-grid .form-group {
  margin-bottom: 0;
}
.novo-usuario-grid label {
  font-size: 12px;
}

.senha-gerar-wrap {
  display: flex;
  gap: 8px;
}
.senha-gerar-wrap input {
  flex: 1;
  min-width: 0;
}
.btn-gerar-senha {
  flex-shrink: 0;
  padding: 0 16px;
  background: var(--surface3, #e5e7eb);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-gerar-senha:hover {
  background: var(--surface, #f3f4f6);
}

.novo-usuario-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.novo-usuario-actions .btn-primary,
.novo-usuario-actions .btn-secondary {
  padding: 11px 22px;
  font-size: 14px;
}

.novo-usuario-msg {
  font-size: 13px;
  margin-top: 10px;
  min-height: 18px;
}

/* ── Dashboard ─────────────────────────────────────── */
/* Uso do plano no mês: o mesmo número que vai para a fatura. */
.uso-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
  margin-bottom: 16px;
}
.uso-topo {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.uso-numero {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 4px;
}
.uso-valor {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.uso-de {
  font-size: 14px;
  color: var(--text-secondary);
}
.uso-lado {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: right;
  line-height: 1.5;
}
.uso-lado strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.uso-trilho {
  height: 6px;
  border-radius: 99px;
  background: var(--border);
  margin-top: 14px;
  overflow: hidden;
}
.uso-barra {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: var(--primary);
}
.uso-card.uso-perto .uso-barra {
  background: var(--yellow);
}
.uso-card.uso-excedeu .uso-barra {
  background: var(--accent);
}
.uso-nota {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}
.uso-nota:empty {
  display: none;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.kpi-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}
.kpi-card.kpi-taxa {
  background: var(--green-light);
  border-color: transparent;
}
.kpi-card.kpi-taxa .kpi-value {
  color: var(--green); /* conformidade é status, não marca */
}
.kpi-card.kpi-taxa .kpi-label {
  color: var(--green);
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.bar-row {
  display: grid;
  grid-template-columns: 160px 1fr 40px 48px;
  align-items: center;
  gap: 12px;
}
.bar-label-wrap {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 1px;
}
.bar-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-label-sub {
  font-size: 10px;
  color: var(--text-muted, #6b7280);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-track {
  height: 12px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  transition: width 0.3s ease;
}
.bar-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  text-align: right;
}
.bar-taxa {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted, #6b7280);
  text-align: right;
}

.dash-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* Tendência (gráfico de barras verticais) */
.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 130px;
  padding-top: 8px;
}
.trend-bar-wrap {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.trend-bar {
  width: 100%;
  max-width: 18px;
  background: var(--primary);
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: height 0.3s ease;
}
.trend-day {
  font-size: 9px;
  color: var(--text-muted, #6b7280);
  white-space: nowrap;
}

/* Distribuição (barra empilhada) */
.dist-bar {
  display: flex;
  height: 22px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface2);
  margin-bottom: 14px;
}
.dist-seg {
  height: 100%;
  transition: width 0.3s ease;
}
.dist-conforme {
  background: var(--green);
}
.dist-divergente {
  background: var(--red);
}
.dist-ausente {
  background: var(--yellow);
}
.dist-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dist-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}
.dist-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

/* Ranking de campos divergentes */
.rank-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rank-row {
  display: grid;
  grid-template-columns: 22px 130px 1fr 30px;
  align-items: center;
  gap: 10px;
}
.rank-pos {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-muted, #6b7280);
  text-align: center;
}
.rank-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank-track {
  height: 10px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
}
.rank-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red-light), var(--red));
  border-radius: 99px;
}
.rank-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--red);
  text-align: right;
}

/* Atividade recente */
.ativ-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.ativ-row:last-child {
  border-bottom: none;
}
.ativ-row:hover {
  background: var(--surface2);
}
.ativ-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.ativ-ref {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}
.ativ-cliente {
  font-size: 12px;
}
.ativ-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.ativ-taxa {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.ativ-validado {
  color: var(--green);
  font-weight: 800;
  font-size: 13px;
}

@media (max-width: 900px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .bar-row {
    grid-template-columns: 100px 1fr 32px 40px;
    gap: 8px;
  }
  .dash-row-2col {
    grid-template-columns: 1fr;
  }
  .rank-row {
    grid-template-columns: 20px 90px 1fr 26px;
  }
}

/* ── Tabela de usuários ───────────────────────────── */
.tabela-usuarios {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.tabela-usuarios thead th {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #6b7280);
}
.tabela-usuarios tbody tr {
  border-bottom: 1px solid var(--border);
}
.tabela-usuarios tbody tr:hover {
  background: var(--surface2);
}
.tabela-usuarios tbody td {
  padding: 14px;
  vertical-align: middle;
}
.tu-nome {
  font-weight: 600;
  color: var(--text);
}
.tu-email {
  color: var(--text-muted, #6b7280);
}
.tu-perfil-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
}
.tu-perfil-select {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  cursor: pointer;
}
.tu-perfil-select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.tu-status {
  font-size: 13px;
  font-weight: 600;
}
.tu-status-ativo {
  color: var(--green);
}
.tu-status-inativo {
  color: var(--red);
}
.tu-acoes {
  text-align: right;
  white-space: nowrap;
}
.tu-btn-acao {
  font-size: 12px;
  padding: 6px 12px;
  margin-left: 6px;
}
.tu-btn-excluir {
  color: var(--red);
}
.tu-btn-excluir:hover {
  background: var(--red-light);
  border-color: var(--red);
}
.tu-voce {
  font-size: 12px;
  font-style: italic;
}
.config-table {
  width: 100%;
  border-collapse: collapse;
}
.config-table th {
  background: var(--surface2);
}
.config-table td,
.config-table th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.config-table tr:last-child td {
  border-bottom: none;
}
.cfg-input {
  width: 80px !important;
  text-align: center;
  padding: 6px 8px !important;
  font-size: 13px !important;
}
.cfg-input:disabled {
  background: var(--surface2);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* ─── Cadastros ─── */
.cadastros-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 768px) {
  .cadastros-layout {
    grid-template-columns: 1fr;
  }
}
/* Busca de cliente — ocupa a largura do painel (280px), por isso fica em linha
   própria abaixo do cabeçalho, e não ao lado do título como na tabela DE×PARA. */
.cadastros-clientes .cliente-filtro {
  width: 100%;
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 13px;
}
.cadastros-clientes .cliente-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}
.cadastros-clientes .cliente-row:hover {
  background: var(--surface2);
}
.cadastros-clientes .cliente-row.active {
  background: rgba(26, 122, 74, 0.12);
}
.cliente-nome {
  font-weight: 600;
  font-size: 13px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cliente-cnpj,
.cliente-cidade {
  font-weight: 500;
  font-size: 11px;
}
.cliente-maps {
  font-size: 12px;
}
.cnpj-erro {
  font-size: 12px;
  color: var(--red);
  margin-top: 5px;
}
.cliente-acoes {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.12s;
}
.cliente-row:hover .cliente-acoes {
  opacity: 1;
}
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
}
.btn-icon:hover {
  background: var(--border);
}
.mapeamento-table td {
  font-size: 13px;
}
.mapeamento-table code {
  font-size: 12px;
  background: var(--surface2);
  padding: 2px 6px;
  border-radius: 4px;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
}
.cfg-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
}
.cfg-feedback {
  margin-top: 14px;
  padding: 10px 16px;
  background: var(--green-light);
  color: var(--green);
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
}

/* ── Auditoria ───────────────────────────────────── */
.audit-card h3 {
  margin-bottom: 16px;
}
.audit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 40px;
  margin-bottom: 20px;
}
.audit-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.audit-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.audit-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.audit-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ── Erro ────────────────────────────────────────── */
.erro-content {
  text-align: center;
  padding: 32px 0;
}
.erro-icon {
  font-size: 40px;
}
.erro-content h3 {
  margin: 12px 0 8px;
  color: var(--text);
}
.erro-content .btn-primary {
  margin-top: 16px;
}

/* ── Usuário na sidebar ──────────────────────────── */
.sidebar-usuario {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 4px;
  overflow: hidden;
}
.usuario-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
}
.usuario-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  transition:
    opacity 0.18s,
    max-width 0.22s;
  overflow: hidden;
}
.usuario-nome {
  font-size: 12px;
  font-weight: 600;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.usuario-perfil-badge {
  font-size: 10px;
  color: var(--sidebar-muted);
  font-weight: 600;
  white-space: nowrap;
}
.btn-logout {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--sidebar-text);
  opacity: 0.45;
  font-size: 14px;
  padding: 4px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: opacity 0.2s;
}
.btn-logout:hover {
  opacity: 1;
  color: var(--red);
}
.sidebar.collapsed .usuario-info {
  opacity: 0;
  max-width: 0;
}
.sidebar.collapsed .btn-logout {
  opacity: 0;
  pointer-events: none;
}

/* ── Modal de usuário ────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(1, 27, 61, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
.modal-logo {
  margin-bottom: 20px;
}
.modal-box h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}
.modal-box p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Configurações usuário ───────────────────────── */
.cfg-usuario-ativo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.cfg-usuario-ativo span {
  flex: 1;
}

/* ── Utils ───────────────────────────────────────── */
.hidden {
  display: none !important;
}
.muted {
  color: var(--text-muted);
}
[id^="page-"]:not(.hidden) {
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ── Print ───────────────────────────────────────── */
@media print {
  .sidebar,
  header,
  footer,
  .resultado-acoes,
  #card-upload,
  #card-processando,
  .btn-primary,
  .btn-secondary {
    display: none !important;
  }
  .main-wrapper {
    margin-left: 0;
  }
  body,
  main {
    background: #fff !important;
    color: #000 !important;
    padding: 0;
  }
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }
}

/* ── Suporte (assistente de IA) ──────────────────── */
.suporte-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(26, 122, 74, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}
.suporte-fab:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 18px rgba(26, 122, 74, 0.5);
}

.suporte-painel {
  position: fixed;
  bottom: 90px;
  right: 24px;
  z-index: 900;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 130px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.suporte-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}
.suporte-fechar {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  opacity: 0.85;
}
.suporte-fechar:hover {
  opacity: 1;
}

.suporte-mensagens {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.suporte-msg {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.suporte-msg-bot {
  align-self: flex-start;
  background: var(--surface2);
  color: var(--text);
  border-bottom-left-radius: 3px;
}
.suporte-msg-user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 3px;
}
.suporte-msg-carregando {
  color: var(--text-muted);
  font-style: italic;
}

.suporte-sugestoes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 10px;
}
.suporte-sugestao-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 99px;
  cursor: pointer;
}
.suporte-sugestao-chip:hover {
  background: var(--border);
}

.suporte-input-row {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--border);
}
.suporte-input-row input {
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 13px;
}
.suporte-input-row .btn-primary {
  padding: 0 14px;
  border-radius: 10px;
}

@media print {
  .suporte-fab,
  .suporte-painel {
    display: none !important;
  }
}

/* Ações do aviso de itens não cadastrados: o botão de cadastro em massa fica ao lado do
   atalho para a tela de Cadastros, e os dois quebram juntos em telas estreitas. */
.itens-aviso-acoes {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* Filtro de data do histórico: o ✕ fica colado ao campo para limpar sem abrir o calendário. */
.hist-filtro-data {
  display: flex;
  align-items: center;
  gap: 6px;
}
.hist-filtro-data input[type="date"] {
  flex: 1;
  min-width: 0;
}
.btn-limpar-data {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 8px 10px;
  flex-shrink: 0;
  transition:
    background 0.12s,
    color 0.12s;
}
.btn-limpar-data:hover {
  background: var(--surface2);
  color: var(--text);
}
