/* ============================================================
   XML Core — app.css
   Design: Industrial Minimal — slate + amber accent
   ============================================================ */

:root {
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 72px;

  --bg:        #0f1117;
  --bg-2:      #181c26;
  --bg-3:      #1f2435;
  --border:    #2a3045;
  --border-2:  #3a4260;

  --text:      #e8eaf0;
  --text-muted:#7a85a0;
  --text-dim:  #4a5570;

  --accent:    #f59e0b;
  --accent-dk: #d97706;
  --accent-lt: #fcd34d;

  --success:   #10b981;
  --danger:    #ef4444;
  --warning:   #f59e0b;
  --info:      #3b82f6;

  /* Variantes "-lt" pra TEXTO em cima de fundo com tinta da própria cor
     (alerts, badges, ícones de card) — no escuro são só um tom mais claro
     de cada cor pra contrastar com o fundo escuro; no claro (ver bloco
     [data-theme="light"] abaixo) viram um tom bem mais escuro, senão o
     texto fica ilegível sobre o fundo quase branco (era exatamente esse
     o bug: verde-claro em cima de verde-bem-clarinho). Mesma ideia do
     --accent/--accent-lt logo abaixo. */
  --success-lt: #6ee7b7;
  --danger-lt:  #fca5a5;
  --info-lt:    #93c5fd;
  --purple-lt:  #a78bfa;
  --teal-lt:    #2dd4bf;

  --radius:    8px;
  --radius-lg: 14px;
  --shadow:    0 4px 24px rgba(0,0,0,.45);
}

/* ============================================================
   TEMA CLARO — mesma paleta "slate + amber", luminância invertida.
   Troca via [data-theme="light"] no <html> (ver app.js: alternarTema()).
   Todo o resto do CSS já usa só estas variáveis, então não precisa
   repetir regra nenhuma — só os valores mudam.
   ============================================================ */
:root[data-theme="light"] {
  --bg:        #f4f5f8;
  --bg-2:      #ffffff;
  --bg-3:      #eef0f5;
  --border:    #e1e4ec;
  --border-2:  #c7cce0;

  --text:      #1a1d29;
  --text-muted:#5b6478;
  --text-dim:  #98a0b3;

  /* Mesmo tom de âmbar, mais escuro pra manter contraste ~4.6:1 em fundo
     branco — em texto/ícone o --accent original (#f59e0b) fica claro
     demais pra ler direito sobre branco. */
  --accent:    #b45309;
  --accent-dk: #92400e;
  --accent-lt: #d97706;

  /* Mesmo raciocínio do --accent-lt acima: tons escuros o bastante pra
     manter contraste em cima do próprio fundo tintado (rgba(...,.12-.18)
     sobre um --bg-2 quase branco) — os tons claros usados no tema escuro
     ficavam ilegíveis aqui. */
  --success-lt: #047857;
  --danger-lt:  #b91c1c;
  --info-lt:    #1d4ed8;
  --purple-lt:  #6d28d9;
  --teal-lt:    #0f766e;

  --shadow:    0 4px 20px rgba(20,24,40,.10);
}

:root[data-theme="light"] .btn-close {
  filter: none; /* o ícone padrão do Bootstrap já é escuro — serve pro fundo claro sem inverter */
}

:root[data-theme="light"] .btn-primary,
:root[data-theme="light"] .logo-icon,
:root[data-theme="light"] .user-avatar,
:root[data-theme="light"] .auth-logo-icon {
  color: #fff; /* texto branco sobre o âmbar mais escuro do tema claro (preto ficaria com pouco contraste) */
}

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

html, body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform .25s ease, width .2s ease;
  /* Sem overflow aqui — só .sidebar-nav rola (regra abaixo). O rodapé
     (identificação de quem está logado) fica fixo embaixo, sempre
     visível, nunca sai de vista rolando junto com a lista de itens. */
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .02em;
}

.logo-icon {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #000;
  font-size: 14px;
}

.logo-text { color: var(--text); }

.sidebar-toggle {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 16px; cursor: pointer;
}

/* Botão de recolher/expandir (desktop — o "X" acima é só pro drawer mobile) */
.sidebar-collapse-toggle {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 14px; cursor: pointer;
  width: 28px; height: 28px;
  align-items: center; justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
}
.sidebar-collapse-toggle:hover { background: var(--bg-3); color: var(--text); }

/* Identificação do usuário — hoje só usada no rodapé flutuante
   (.sidebar-footer-user), não mais no topo do sidebar. */
.user-avatar {
  width: 38px; height: 38px;
  background: var(--accent);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  color: #000;
  flex-shrink: 0;
}

.user-info { min-width: 0; }
.user-name  { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-badge { font-size: 10px; color: var(--accent); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
/* Nav */
.sidebar-nav {
  list-style: none;
  padding: 8px 0;
  flex: 1;
  overflow-y: auto;
  min-height: 0; /* sem isso um flex item não encolhe/rola direito dentro de uma coluna flex */
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .15s;
}

.sidebar-nav li a i { width: 16px; text-align: center; font-size: 13px; }

.sidebar-nav li a:hover {
  color: var(--text);
  background: var(--bg-3);
}

.sidebar-nav li.active a {
  color: var(--accent);
  background: rgba(245,158,11,.08);
  border-left-color: var(--accent);
}

.nav-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-dim);
  padding: 10px 20px 4px;
  cursor: pointer;
  user-select: none;
}
.nav-label:hover { color: var(--text-muted); }

.nav-label-chevron {
  font-size: 9px;
  transition: transform .15s;
}

/* Grupo colapsável (acordeão) — <ul> aninhado dentro do <li> logo após o
   rótulo. Reseta o padding/list-style padrão de <ul> aninhado e usa
   display:none pra fechar (ver app.js: clique no .nav-label alterna). O
   estado (aberto/fechado por grupo) é persistido em localStorage e
   aplicado ANTES do primeiro paint (script no <head> de main.php), pra
   não "piscar" tudo aberto e depois fechar. */
.nav-group { list-style: none; margin: 0; padding: 0; }

html[data-fechado-principal] .nav-group[data-group="principal"],
html[data-fechado-cadastros] .nav-group[data-group="cadastros"],
html[data-fechado-conta] .nav-group[data-group="conta"] {
  display: none;
}
html[data-fechado-principal] .nav-label[data-toggle="principal"] .nav-label-chevron,
html[data-fechado-cadastros] .nav-label[data-toggle="cadastros"] .nav-label-chevron,
html[data-fechado-conta] .nav-label[data-toggle="conta"] .nav-label-chevron {
  transform: rotate(-90deg);
}

/* Rodapé flutuante — fixo embaixo do sidebar, não faz parte da área que
   rola (.sidebar-nav rola por conta própria). flex-shrink:0 garante que
   nunca fica espremido mesmo se a lista de itens for grande. */
.sidebar-footer {
  flex-shrink: 0;
  padding: 12px 20px 14px;
  border-top: 1px solid var(--border);
}

.sidebar-footer-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-footer-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 4px;
  margin: -4px;
  border-radius: var(--radius);
  color: inherit; /* sem isso o nome herda o azul padrão de link do <a> */
  text-decoration: none;
  transition: background .15s;
}
.sidebar-footer-user:hover { background: var(--bg-3); }

.sidebar-footer-logout {
  flex-shrink: 0;
  width: 30px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text-muted);
  transition: background .15s, color .15s;
}
.sidebar-footer-logout:hover { background: rgba(239,68,68,.12); color: var(--danger-lt); }

.sidebar-cnpj {
  display: block;
  margin-top: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-empresa-logo {
  margin-bottom: 8px;
}
.sidebar-empresa-logo img {
  max-width: 100%;
  max-height: 40px;
  background: #fff;
  border-radius: var(--radius);
  padding: 4px 8px;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .2s ease;
}

/* Botão de abrir o menu no mobile — sem faixa/header por trás de
   propósito (removida de todas as telas); só o ícone, sentado no fluxo
   normal da página, antes de .page-content. */
.mobile-menu-btn {
  align-self: flex-start; /* .main-content é flex-column c/ align-items:stretch —
                              sem isso o botão estica e o text-align:center
                              padrão de <button> centraliza o ícone na tela */
  background: none; border: none;
  color: var(--text-muted); font-size: 18px; cursor: pointer;
  padding: 16px 16px 0;
}

.page-content {
  padding: 28px;
  flex: 1;
}

/* ============================================================
   CARDS & PANELS
   ============================================================ */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: none;
}

.card-header {
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.card-body { padding: 20px; }

/* Stats */
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: border-color .2s, transform .2s;
  /* Card é um <a href> (link pra tela correspondente) — sem isso herdaria
     a cor/sublinhado padrão do navegador pra link, brigando com a cor de
     texto que .stat-value/.stat-label já usam. */
  color: inherit;
  text-decoration: none;
}

.stat-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.amber  { background: rgba(245,158,11,.15); color: var(--accent); }
.stat-icon.green  { background: rgba(16,185,129,.15); color: var(--success-lt); }
.stat-icon.blue   { background: rgba(59,130,246,.15); color: var(--info-lt); }
.stat-icon.red    { background: rgba(239,68,68,.15);  color: var(--danger-lt); }

.stat-value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  font-family: 'DM Mono', monospace;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ============================================================
   TABLE
   ============================================================ */
.table-dark-custom {
  color: var(--text);
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.table-dark-custom thead th {
  background: var(--bg-3);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table-dark-custom tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 13.5px;
}

.table-dark-custom tbody tr:last-child td { border-bottom: none; }

.table-dark-custom tbody tr:hover td { background: var(--bg-3); }

.cnpj-badge {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--text-muted);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}

.form-control, .form-select {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 9px 14px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  transition: border-color .2s, box-shadow .2s;
}

.form-control:disabled, .form-select:disabled {
  background: var(--bg-2);
  color: var(--text-muted);
  opacity: 1;
  cursor: not-allowed;
}

.form-control:focus, .form-select:focus {
  background: var(--bg-3);
  border-color: var(--accent);
  color: var(--text);
  box-shadow: 0 0 0 3px rgba(245,158,11,.18);
  outline: none;
}

.form-control::placeholder { color: var(--text-dim); }

.form-select option { background: var(--bg-3); }

.form-control.is-invalid, .form-select.is-invalid {
  border-color: var(--danger);
}

/* Bootstrap usa var(--bs-body-color) (escuro) por padrão em .form-check-label,
   sem herdar o tema escuro do app — força as cores corretas aqui. */
.form-check-label {
  color: var(--text);
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}

.form-check-input {
  background-color: var(--bg-3);
  border: 1px solid var(--border);
}

.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius);
  padding: 8px 18px;
  transition: all .2s;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.btn-primary {
  background: var(--accent);
  color: #000;
}
.btn-primary:hover { background: var(--accent-dk); color: #000; }

.btn-outline-secondary {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text-muted);
}
.btn-outline-secondary:hover { border-color: var(--text-muted); color: var(--text); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-sm { padding: 5px 12px; font-size: 12px; }
/* inline-grid, não grid: "grid" sozinho vira caixa de BLOCO, então botões
   .btn-icon vizinhos na mesma célula empilham verticalmente em vez de
   ficar lado a lado (só não aparecia antes porque cada célula tinha 1 só) */
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-grid; place-items: center; }

/* ============================================================
   BADGES
   ============================================================ */
.badge-status {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.badge-status.ativo   { background: rgba(16,185,129,.15); color: var(--success-lt); }
.badge-status.inativo { background: rgba(239,68,68,.15);  color: var(--danger-lt); }

.badge-perfil {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.badge-perfil.admin    { background: rgba(245,158,11,.18); color: var(--accent); }
.badge-perfil.cliente  { background: rgba(59,130,246,.15); color: var(--info-lt); }
.badge-perfil.operador { background: rgba(124,58,237,.15); color: var(--purple-lt); }
.badge-perfil.terceiro { background: rgba(20,184,166,.15);  color: var(--teal-lt); }

.badge-acao {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.badge-acao.success { background: rgba(16,185,129,.15); color: var(--success-lt); }
.badge-acao.danger  { background: rgba(239,68,68,.15);  color: var(--danger-lt); }
.badge-acao.warning { background: rgba(245,158,11,.18); color: var(--accent); }
.badge-acao.info    { background: rgba(59,130,246,.15); color: var(--info-lt); }
.badge-acao.neutral { background: rgba(122,133,160,.15); color: var(--text-muted); }
.badge-acao.primary { background: rgba(124,58,237,.15);  color: var(--purple-lt); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  border: none;
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-success { background: rgba(16,185,129,.12); color: var(--success-lt); }
.alert-danger   { background: rgba(239,68,68,.12);  color: var(--danger-lt); }
.alert-warning  { background: rgba(245,158,11,.12); color: var(--accent-lt); }
.alert-info     { background: rgba(59,130,246,.12); color: var(--info-lt); }
.btn-close { filter: invert(1) brightness(.6); }

/* ============================================================
   BREADCRUMB / PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-left h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

.page-header-left p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 2px 0 0;
}

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 20% 20%, rgba(245,158,11,.07) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(59,130,246,.05) 0%, transparent 50%);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.auth-logo-icon {
  width: 40px; height: 40px;
  background: var(--accent);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #000;
  font-size: 18px;
}

.auth-logo-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-bar .form-group { flex: 1; min-width: 180px; }
.filter-bar .form-group label { font-size: 11px; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 5px; text-transform: uppercase; letter-spacing: .06em; }

/* ============================================================
   MODAL (confirm/alert bonitos — substitui confirm()/alert() nativos,
   ver confirmar()/avisar() em app.js)
   ============================================================ */
.modal-content {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  box-shadow: var(--shadow);
}
.modal-header, .modal-footer { border-color: var(--border); }
.modal-title { font-size: 16px; font-weight: 700; }
.modal-body { font-size: 13.5px; color: var(--text-muted); line-height: 1.6; }
.modal-backdrop.show { opacity: .65; }

/* ============================================================
   SIDEBAR OVERLAY (mobile)
   ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 999;
}
.sidebar-overlay.show { display: block; }

/* ============================================================
   IMPORTAÇÃO MANUAL DE XML (documentos/importar.php)
   ============================================================ */
.import-dropzone {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.import-dropzone:hover,
.import-dropzone.dragover {
  border-color: var(--accent);
  background: rgba(245,158,11,.06);
}
.import-dropzone i { font-size: 28px; color: var(--text-dim); margin-bottom: 10px; display: block; }
.import-dropzone .import-dropzone-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.import-dropzone .import-dropzone-sub { font-size: 12px; color: var(--text-muted); }

.import-picker-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.import-picker-actions label { cursor: pointer; }

/* Os <input type=file> reais (name="arquivos[]") ficam escondidos — quem
   os aciona é o <label for="..."> nativo do HTML, não JS (ver comentário
   em documentos/importar.php). display:none é seguro aqui porque o
   disparo é via <label>, não via .click() programático. */
.import-input-real { display: none; }

.import-lista {
  list-style: none;
  margin-top: 16px;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.import-lista:empty { display: none; }
.import-lista li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border);
}
.import-lista li:last-child { border-bottom: none; }
.import-lista li span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-file-size { color: var(--text-muted); font-family: 'DM Mono', monospace; font-size: 11px; white-space: nowrap; }

.import-resumo { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .page-content { padding: 16px; }
}

/* ============================================================
   SIDEBAR COLAPSADA (desktop) — html.sidebar-collapsed, alternado pelo
   botão #sidebarCollapseToggle (ver app.js) e persistido em localStorage.
   Só se aplica a partir de 992px: no mobile o menu já é off-canvas (regra
   acima), colapsar não faz sentido ali — o toggle de colapso nem aparece
   (.d-none .d-lg-inline-flex no botão).
   ============================================================ */
@media (min-width: 992px) {
  html.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
  html.sidebar-collapsed .main-content { margin-left: var(--sidebar-w-collapsed); }

  html.sidebar-collapsed .logo-text,
  html.sidebar-collapsed .user-info,
  html.sidebar-collapsed .nav-label,
  html.sidebar-collapsed .nav-text {
    display: none;
  }

  html.sidebar-collapsed .sidebar-header { justify-content: center; padding: 20px 0 16px; }
  html.sidebar-collapsed .sidebar-logo { justify-content: center; }
  html.sidebar-collapsed .sidebar-nav li a { justify-content: center; padding: 6px 0; }

  /* Ícone-only some com os rótulos (regra acima), então o acordeão fica
     inacessível — força todo grupo a ficar visível aqui, senão um grupo
     fechado deixaria ícones inalcançáveis sem como reabrir. */
  html.sidebar-collapsed .nav-group { display: block !important; }
  html.sidebar-collapsed .sidebar-nav li.active a { border-left: none; }

  /* Rodapé no ícone-only: some a empresa/CNPJ (sem espaço/sem texto pra
     mostrar) mas mantém avatar (link pro perfil) + botão de sair — senão
     ficariam inalcançáveis com o grupo "Conta" já removido do menu. */
  html.sidebar-collapsed .sidebar-empresa-logo,
  html.sidebar-collapsed .sidebar-cnpj {
    display: none;
  }
  html.sidebar-collapsed .sidebar-footer { padding: 12px 0; }
  html.sidebar-collapsed .sidebar-footer-row { flex-direction: column; gap: 10px; }
  html.sidebar-collapsed .sidebar-footer-user { justify-content: center; padding: 0; margin: 0; }
}
