@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: var(--sp-surface);
  --surface: var(--sp-white);
  --surface-2: var(--sp-surface);
  --primary: var(--sp-action);
  --primary-dark: var(--sp-primary-dark);
  --primary-light: #e6f3d7;
  --primary-50: var(--sp-surface);
  --primary-100: #e6f3d7;
  --text: var(--sp-text);
  --text-muted: var(--sp-muted);
  --border: var(--sp-border);
  --danger: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;
  --success: #16A34A;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 24px rgba(0,0,0,0.10);
  --sidebar-bg: var(--sp-forest);
  --sidebar-dark: var(--sp-forest-deep);
  /* Aliases de compatibilidade */
  --muted: var(--sp-muted);
  --primary-bg: var(--sp-surface);
  --primary-soft: #e6f3d7;
  --borda: var(--sp-border);
  --verde: var(--sp-primary);
  --card-bg: var(--sp-white);
}

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

body {
  font-family: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }

/* Orientação e busca por telas, disponíveis também na navegação por teclado. */
body :is(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}
.sidebar a:focus-visible { outline-color: var(--sp-white); outline-offset: -3px; }
.sidebar a.ativo:focus-visible { outline-color: var(--sp-white); }
.somente-leitor {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.atalhos-navegacao {
  display: flex; align-items: center; gap: 24px; margin-bottom: 24px;
  padding-bottom: 20px; border-bottom: 1px solid var(--border);
}
.busca-telas-container { position: relative; flex: 0 1 400px; min-width: 240px; }
.busca-telas-container label { display: block; font-weight: 600; margin-bottom: 6px; }
.busca-telas-container input {
  width: 100%; height: 42px; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface); color: var(--text); font: inherit;
}
.dica-busca-telas { display: block; color: var(--muted); font-size: 11px; margin-top: 5px; }
.orientacao-secao { flex: 1; max-width: 600px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.resultados-busca-telas {
  position: absolute; left: 0; top: 100%; width: min(520px, calc(100vw - 48px));
  z-index: 40; max-height: 350px; overflow-y: auto; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg);
}
.resultados-busca-telas[hidden] { display: none; }
.resultado-tela {
  display: block; width: 100%; padding: 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text); text-align: left; cursor: pointer; font: inherit;
}
.resultado-tela:hover, .resultado-tela:focus-visible { background: var(--primary-50); }
.resultado-tela strong, .resultado-tela span { display: block; }
.resultado-tela span { color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 3px; }
.busca-telas-vazia { padding: 14px; color: var(--muted); }
.estado-lista { text-align: center; padding: 24px 12px; white-space: normal; }
.estado-lista strong { display: block; color: var(--text); font-size: 14px; }
.estado-lista p { color: var(--muted); margin: 6px 0 14px; }
.estado-lista .btn { margin: 2px 4px; }
.atalhos-dashboard { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
@media (max-width: 900px) {
  .atalhos-navegacao { align-items: stretch; flex-direction: column; gap: 10px; }
  .busca-telas-container { flex-basis: auto; min-width: 0; }
  .resultados-busca-telas { width: 100%; max-height: 45vh; }
  .topo > div:not(.topo-textos) { flex-wrap: wrap; }
}

/* Custom scrollbars */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sp-border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a99a; }

/* ── LOGIN ── */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(130% 120% at 50% 0%, var(--sp-forest) 0%, var(--sp-forest-deep) 100%);
  position: relative; overflow: hidden;
}
.login-screen::before {
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.025) 1px, transparent 0);
  background-size: 28px 28px;
}
.login-card {
  position: relative; z-index: 1;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  width: 420px; max-width: 92vw;
  box-shadow: 0 24px 48px rgba(0,0,0,0.4);
  text-align: center;
  border: 1px solid rgba(255,255,255,0.06);
}
.login-card .logo { margin-bottom: 10px; }
.login-card .logo img { height: 64px; width: auto; display: block; margin: 0 auto; }
.login-card .subtitulo {
  color: var(--text-muted); margin-bottom: 28px;
  font-size: 13.5px; font-weight: 500;
}

/* ── CAMPOS ── */
.campo { text-align: left; margin-bottom: 16px; }
.campo label {
  display: block; font-size: 12px; color: var(--text-muted);
  margin-bottom: 6px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.campo input, .campo select, .campo textarea {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 13.5px; outline: none; height: 36px;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit; color: var(--text);
  background: #fff;
}
.campo textarea { height: auto; }
.campo input:focus, .campo select:focus, .campo textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,163,74,0.1);
}
/* Realce de foco fora de .campo — antes era onfocus/onblur inline, que a CSP
   (script-src-attr 'none') bloqueia. */
.textarea-foco:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,163,74,0.1);
}

/* ── BOTOES ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: 10px; padding: 8px 20px;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: all 0.2s ease; font-family: inherit; height: 38px;
  white-space: nowrap; letter-spacing: 0.01em;
}
.btn-primary {
  background: linear-gradient(135deg, var(--sp-action) 0%, var(--sp-primary-dark) 100%);
  color: #fff; border-color: transparent;
  box-shadow: 0 2px 6px rgba(22,163,74,0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--sp-primary-dark) 0%, var(--sp-forest) 100%);
  box-shadow: 0 4px 12px rgba(22,163,74,0.35);
  transform: translateY(-1px);
}
.btn-primary:active { transform: scale(0.98) translateY(0); box-shadow: 0 1px 3px rgba(22,163,74,0.2); }

.btn-secondary {
  background: var(--surface); color: var(--text);
  border-color: var(--border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.btn-secondary:hover {
  border-color: #94a99a; background: var(--surface-2);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent; color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary-50); }

.btn-danger {
  background: #FEF2F2; color: var(--danger);
  border-color: #FECACA;
}
.btn-danger:hover { background: #FEE2E2; }

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

/* ── AVISOS FLUTUANTES (impersonation / cobrança) ── */
.aviso-flutuante {
  position: fixed; left: 20px; z-index: 200;
  display: flex; align-items: center; gap: 10px;
}
.aviso-flutuante-icone {
  width: 42px; height: 42px; border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer; color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25); flex-shrink: 0;
}
.aviso-flutuante-texto {
  max-width: 0; overflow: hidden; white-space: nowrap;
  background: #fff; color: var(--sp-text); font-size: 12.5px; font-weight: 600;
  border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  padding: 0; opacity: 0;
  transition: max-width 0.2s ease, opacity 0.2s ease, padding 0.2s ease;
}
.aviso-flutuante:hover .aviso-flutuante-texto,
.aviso-flutuante.expandido .aviso-flutuante-texto {
  max-width: 320px; padding: 10px 14px; opacity: 1;
}
#banner-impersonation .aviso-flutuante-icone {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
}
#banner-cobranca.aviso .aviso-flutuante-icone {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}
#banner-cobranca.atrasado .aviso-flutuante-icone {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
}
/* Tarefas pendentes: âmbar quando só há opcionais, vermelho com obrigatórias */
#banner-tarefas .aviso-flutuante-icone {
  position: relative;
  background: linear-gradient(135deg, #f59e0b, #d97706);
}
#banner-tarefas.obrigatoria .aviso-flutuante-icone {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
}
/* Contador de pendentes no canto do ícone */
#banner-tarefas .aviso-flutuante-icone::after {
  content: attr(data-qtd);
  position: absolute; top: -3px; right: -3px;
  background: var(--sp-text); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff; padding: 0 3px; box-sizing: border-box;
}

/* ── BANNER DE ATUALIZAÇÃO (Service Worker) ── */
.banner-update {
  position: fixed; left: 20px; bottom: 20px; z-index: 400;
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(0,0,0,0.18);
  padding: 16px; width: 340px; max-width: calc(100vw - 40px);
  animation: toast-entrar 0.25s ease;
}
.banner-update-icone {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary-50); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.banner-update-corpo { flex: 1; min-width: 0; }
.banner-update-titulo {
  font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px;
}
.banner-update-texto {
  font-size: 12.5px; color: var(--text-muted); line-height: 1.5; margin-bottom: 12px;
}
.banner-update-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary); color: #fff; border: none; border-radius: 8px;
  padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
}
.banner-update-btn:hover { background: var(--primary-dark); }
.banner-update-fechar {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 15px; line-height: 1; cursor: pointer; padding: 4px 6px; flex-shrink: 0;
  border-radius: 6px; margin-top: -2px;
}
.banner-update-fechar:hover { background: var(--surface-2); color: var(--text); }

@media (max-width: 640px) {
  .banner-update {
    left: 12px; right: 12px; bottom: 12px; width: auto;
  }
}

/* ── LAYOUT PRINCIPAL ── */
.layout {
  display: flex; min-height: 100vh;
  /* A luz fica atrás do vidro; .main mantém o fundo sólido do conteúdo. */
  background:
    radial-gradient(ellipse 280px 380px at 20px 8%, rgba(174,221,206,.38), transparent 75%),
    radial-gradient(ellipse 300px 480px at 230px 88%, rgba(68,147,126,.36), transparent 75%),
    var(--sp-forest-deep);
  background-attachment: fixed;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 250px;
  background: var(--sp-forest);
  border-right: 1px solid var(--sp-glass-dark-border);
  color: #dce9e2;
  display: flex; flex-direction: column;
  flex-shrink: 0; position: sticky; top: 0;
  height: 100vh; overflow-y: auto; overflow-x: hidden;
  transition: width 0.22s cubic-bezier(0.16,1,0.3,1);
  box-shadow: inset 1px 0 0 rgba(255,255,255,.12), inset -1px 0 0 rgba(255,255,255,.08), 8px 0 28px rgba(5,37,29,.18);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .sidebar {
    background: linear-gradient(135deg, rgba(255,255,255,.13), rgba(255,255,255,.02) 45%, rgba(255,255,255,.06)), rgba(5,37,29,.64);
    -webkit-backdrop-filter: blur(var(--sp-glass-blur)) saturate(125%);
    backdrop-filter: blur(var(--sp-glass-blur)) saturate(125%);
  }
  @media (max-width: 900px) {
    /* A gaveta também passa sobre conteúdo claro: reforçar a base preserva o contraste. */
    .sidebar { background-color: rgba(5,37,29,.86); }
  }
}
@media (prefers-reduced-transparency: reduce) {
  .sidebar {
    background: var(--sp-forest);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
.sidebar .logo {
  padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.16);
  margin-bottom: 6px;
  background: rgba(255,255,255,.04);
  gap: 8px; min-height: 58px;
}
.sidebar .logo img {
  height: 34px; width: auto; display: block;
  filter: brightness(0) invert(1);
  opacity: 0.92; flex-shrink: 0;
  transition: opacity 0.2s, width 0.22s;
}
/* O filtro acima pinta de branco a logo do Stock Pro para o fundo floresta.
   Na logo que a farmácia cadastra ele pintava TODO pixel opaco de branco —
   logo com fundo colorido virava um quadrado branco. Logo da farmácia (qualquer
   src que não seja a do Stock Pro) aparece com as cores dela, num cartão claro. */
.sidebar .logo img:not([src="/logo.png"]) {
  filter: none; opacity: 1;
  height: 42px; max-width: 160px; object-fit: contain;
  background: #fff; border-radius: 8px; padding: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
#btn-toggle-sidebar {
  background: none; border: none; cursor: pointer;
  color: #b6c9bf; padding: 6px; border-radius: 6px;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  transition: color 0.15s, background 0.15s;
  margin-left: auto;
}
#btn-toggle-sidebar:hover { color: #fff; background: rgba(255,255,255,0.08); }

.sidebar .farmacia-nome {
  padding: 8px 14px 2px;
  font-size: 10.5px; font-weight: 700;
  color: var(--sp-white); text-transform: uppercase; letter-spacing: 0.08em;
  opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity 0.2s;
}
.sidebar .perfil-usuario {
  padding: 2px 14px 10px;
  font-size: 11.5px; color: #ceddd5;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 6px; word-break: break-all; line-height: 1.4;
  transition: opacity 0.2s;
}
.sidebar nav { flex: 1; padding: 0 8px 16px; }
.sidebar nav .nav-categoria {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: #ceddd5;
  padding: 12px 6px 4px; margin-top: 2px;
  white-space: nowrap; overflow: hidden;
  transition: opacity 0.2s, height 0.2s;
}
.sidebar nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; border-radius: 10px;
  font-size: 13.5px; font-weight: 500; color: #dce9e2;
  cursor: pointer; transition: all 0.18s ease; position: relative;
  margin-bottom: 3px; white-space: nowrap;
}
.sidebar nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar nav a:hover {
  color: var(--sp-border);
  background: rgba(255,255,255,0.07);
  transform: translateX(2px);
}
.sidebar nav a.ativo {
  background: var(--sp-glass-dark-bg);
  color: var(--sp-white);
  font-weight: 700;
  border: 1px solid var(--sp-glass-dark-border);
  border-left-width: 3px;
  padding-left: 11px;
  box-shadow:var(--sp-glass-shadow);backdrop-filter:blur(var(--sp-glass-blur));-webkit-backdrop-filter:blur(var(--sp-glass-blur));
}
.sidebar nav a .badge-lock { margin-left: auto; font-size: 11px; opacity: 0.55; }
/* Quantas vendas do Farmacia Popular estao paradas. Aparece no menu porque
   pendencia ali e dinheiro que o Ministerio ainda nao repassou — nao e aviso
   que pode esperar a proxima visita a secao. */
/* Caixas informativas do painel de configuracao.
   NAO reutilizar .fp-passo/.fp-erro: essas moram no <style> do pdv.html e nao
   existem nesta pagina — usa-las aqui renderiza texto sem estilo nenhum. */
/* .btn-success era usada no botao "Confirmar envio" do SNGPC e NAO tinha regra
   nenhuma: o botao saia sem cor, parecendo desabilitado. */
.btn-success {
  background: #16a34a; color: #fff; border: 1px solid #15803d;
}
.btn-success:hover { background: #15803d; }

.nota-info, .nota-erro, .nota-atencao {
  padding: 10px 12px; font-size: 13px; line-height: 1.5;
  border-radius: 6px; margin: 10px 0;
}
.nota-info    { background: #eff6ff; border-left: 3px solid #2563eb; }
.nota-atencao { background: #fffbeb; border-left: 3px solid #f59e0b; }
.nota-erro    { background: #fef2f2; border-left: 3px solid #dc2626; }
.nota-info ul, .nota-atencao ul, .nota-erro ul { margin: 6px 0 0 18px; padding: 0; }
.nota-info li, .nota-atencao li, .nota-erro li { margin-bottom: 3px; }

/* Empurra o que vem depois para a direita. O pdv.html tem a sua; a do app
   faltava, e sem ela o badge de situacao colava no titulo do painel. */
.spacer { flex: 1; }

.sidebar nav a .nav-contador {
  margin-left: auto; min-width: 18px; padding: 1px 5px;
  background: #B91C1C; color: #fff; border-radius: 999px;
  font-size: 10px; font-weight: 800; text-align: center;
  font-variant-numeric: tabular-nums;
}
.sidebar.minimizada nav a .nav-contador { display: none; }
.sidebar nav a .nav-label { transition: opacity 0.2s; }
.sidebar .rodape {
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.04);
}
.sidebar .rodape .btn-secondary {
  background: rgba(255,255,255,0.07);
  color: #dce9e2;
  border-color: rgba(255,255,255,0.08);
}
.sidebar .rodape .btn-secondary:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* Sidebar minimizada — recurso só de desktop. No mobile a sidebar é uma gaveta
   (ver "SIDEBAR MOBILE" no fim do arquivo) e reduzir para 60px de ícones ali só
   deixaria a gaveta pela metade, então a classe fica inerte abaixo de 900px. */
@media (min-width: 901px) {
  .sidebar.minimizada { width: 60px; }
  .sidebar.minimizada .logo img { opacity: 0; width: 0; padding: 0; box-shadow: none; }
  .sidebar.minimizada .farmacia-nome,
  .sidebar.minimizada .perfil-usuario { opacity: 0; height: 0; padding: 0; margin: 0; overflow: hidden; }
  .sidebar.minimizada nav .nav-categoria { opacity: 0; height: 0; padding: 0; margin: 0; }
  .sidebar.minimizada nav a { justify-content: center; padding: 8px 0; gap: 0; border-left: none !important; }
  .sidebar.minimizada nav a.ativo { padding-left: 0; }
  .sidebar.minimizada nav a .nav-label { opacity: 0; width: 0; overflow: hidden; }
  .sidebar.minimizada nav a .badge-lock { display: none; }
  .sidebar.minimizada .rodape { padding: 12px 8px; }
  .sidebar.minimizada #btn-toggle-sidebar svg { transform: rotate(180deg); }
}

/* Modulo bloqueado */
.sidebar nav a.modulo-bloqueado { opacity: 0.55; }
.sidebar nav a.modulo-bloqueado .badge-lock { margin-left: auto; font-size: 11px; }

/* ── MAIN ── */
.main {
  flex: 1; background: var(--bg);
  padding: 28px 32px; overflow-y: auto; min-width: 0;
}
.topo {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.topo h1 {
  font-size: 24px; font-weight: 800; color: var(--text); letter-spacing: -0.03em;
}

.secao { display: none; }
.secao.ativa {
  display: block;
  animation: content-fade 0.25s ease;
}
@keyframes content-fade {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── CARDS KPI (dashboard novo) ── */
.dash-kpi-card {
  background: linear-gradient(135deg, #FFFFFF 0%, var(--sp-surface) 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 4px;
  position: relative; overflow: hidden;
  transition: all 0.25s ease;
}
.dash-kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--sp-action), rgba(255,255,255,.76));
  opacity: 0;
  transition: opacity .25s;
}
.dash-kpi-card:hover {
  box-shadow: 0 8px 24px rgba(22,163,74,0.12);
  transform: translateY(-3px);
}
.dash-kpi-card:hover::before { opacity: 1; }
.dash-kpi-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.kpi-icon-blue  { background: #DBEAFE; }
.kpi-icon-green { background: #D1FAE5; }
.kpi-icon-yellow { background: #FEF3C7; }
.kpi-icon-purple { background: #EDE9FE; }
.dash-kpi-label {
  font-size: 11px; color: var(--text-muted);
  font-weight: 700; margin-bottom: 2px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.dash-kpi-valor {
  font-size: 28px; font-weight: 800; color: var(--text); line-height: 1.1; letter-spacing: -0.03em;
}
.dash-kpi-trend { font-size: 11px; margin-top: 2px; }
.trend-up { color: #16a34a; }
.trend-down { color: #dc2626; }

/* ── CARDS DE METRICAS (generico) ── */
.cards-metricas {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 20px;
}
.card {
  background: linear-gradient(135deg, #FFFFFF 0%, var(--sp-surface) 100%);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 22px 24px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: all 0.25s ease;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--sp-action), rgba(255,255,255,.76));
  opacity: 0;
  transition: opacity .25s;
}
.card:hover {
  box-shadow: 0 8px 24px rgba(22,163,74,0.12);
  transform: translateY(-3px);
}
.card:hover::before { opacity: 1; }
.card .rotulo {
  font-size: 11px; color: var(--text-muted); margin-bottom: 8px;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
}
.card .valor { font-size: 30px; font-weight: 800; color: var(--text); letter-spacing: -0.03em; }
.card .icone-card {
  position: absolute; top: 20px; right: 20px;
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-50);
}

/* ── PAINEIS ── */
.painel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px 24px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.painel h2 {
  font-size: 16px; font-weight: 800; margin-bottom: 18px; color: var(--text); letter-spacing: -0.02em;
}

/* ── CABEÇALHO DE PAINEL (ícone + título + descrição) ──
   Mesmo padrão do assistente fiscal, disponível para todos os módulos. */
.painel-topo, .fiscal-card-topo {
  display: flex; gap: 12px; align-items: flex-start;
  padding-bottom: 16px; margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.painel-topo .acoes-topo { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.painel-icone, .fiscal-card-icone {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-50); color: var(--primary);
}
.painel-icone.azul  { background: #DBEAFE; color: #2563EB; }
.painel-icone.roxo  { background: #EDE9FE; color: #7C3AED; }
.painel-icone.ambar { background: #FEF3C7; color: #B45309; }
.painel-icone.rosa  { background: #FCE7F3; color: #BE185D; }
.painel-titulo, .fiscal-card-titulo {
  font-size: 16px; font-weight: 700; margin: 0; color: var(--text);
  letter-spacing: -0.01em; line-height: 1.3;
}
.painel-sub, .fiscal-card-sub {
  font-size: 12.5px; color: var(--text-muted); margin: 6px 0 0; line-height: 1.5;
}
.painel-topo h2 { margin-bottom: 0; }
/* O ícone alinha pela primeira linha do título, não pelo topo do bloco */
.painel-topo .painel-icone, .fiscal-card-topo .fiscal-card-icone { margin-top: 1px; }

/* Subtítulo da tela, abaixo do H1.
   O respiro vem da margem do próprio subtítulo (e não de gap no flex) para
   valer também nos topos que não usam .topo-textos, como o Financeiro. */
.topo-textos { display: flex; flex-direction: column; gap: 0; }
.topo-sub { font-size: 13px; color: var(--text-muted); margin: 6px 0 0; line-height: 1.5; }

/* Grade padrão de campos em formulários */
.grid-campos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.grid-campos.duas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 720px) {
  .grid-campos, .grid-campos.duas { grid-template-columns: 1fr; }
}

/* Cabecalho interno de painel (flex row) */
.painel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 8px;
}
.painel-header h2, .painel-header h3 { margin-bottom: 0; }

/* ── PAINEL ALERTAS ── */
.painel-alerta {
  background: #FEF2F2; border: 1px solid #FECACA;
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}
.painel-alerta h2 { font-size: 14px; margin-bottom: 10px; color: var(--danger); font-weight: 600; }
.painel-alerta .item { font-size: 13px; padding: 4px 0; color: #991B1B; }
.painel-alerta.vazio { background: var(--primary-50); border-color: #BBF7D0; }
.painel-alerta.vazio h2, .painel-alerta.vazio .item { color: var(--primary-dark); }

/* ── TABELAS ── */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
/* Listas de vendedores/usuários (admin): rolagem horizontal isolada em telas
   estreitas, em vez de estourar o layout ou o painel inteiro. */
#lista-vendedores,
#resultado-rel-vendedores,
#modal-rel-vendedor-lista {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#lista-vendedores table,
#resultado-rel-vendedores table,
#modal-rel-vendedor-lista table {
  min-width: 480px;
}
/* Header leve: fundo claro e texto discreto em vez de barra verde sólida —
   a tabela vira parte do card, não uma planilha embutida nele. */
thead th {
  text-align: left; font-size: 12px;
  letter-spacing: 0.01em; color: var(--text-muted); font-weight: 600;
  padding: 12px 16px; background: transparent;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 15px 16px; font-size: 13.5px;
  border-bottom: 1px solid var(--sp-surface); color: var(--text);
  font-weight: 450;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s ease; }
/* Sem zebra e sem barra lateral no hover: era o que mais dava aspecto de
   spreadsheet. Só um realce suave na linha sob o cursor. */
tbody tr:hover { background: var(--primary-50); }

/* Primeira coluna com um pouco mais de peso — costuma ser o nome do registro */
tbody td:first-child { font-weight: 500; }

/* Ações em tabela viram pills discretas em vez de botões cheios */
tbody td .btn-sm {
  border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600;
}

/* ── FEED DE MOVIMENTAÇÕES ──
   Lista de eventos (vendas do dia) no lugar de tabela: ícone + descrição à
   esquerda, valor + contraparte à direita. */
.feed { display: flex; flex-direction: column; }
.feed-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--sp-surface);
}
.feed-item:last-child { border-bottom: none; }
.feed-item.cancelada { opacity: 0.7; }
.feed-icone {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.feed-icone.verde { background: #DCFCE7; color: #16A34A; }
.feed-icone.vermelho { background: #FEE2E2; color: #DC2626; }
.feed-icone.azul { background: #DBEAFE; color: #2563EB; }
.feed-corpo { flex: 1; min-width: 0; }
.feed-titulo { font-size: 14px; font-weight: 600; color: var(--text); }
/* O que foi vendido. Fica entre o título e a data porque é a informação que
   diferencia uma venda da outra — "Venda realizada" é igual em todas. */
.feed-itens {
  font-size: 12.5px; font-weight: 500; color: var(--text); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.feed-meta {
  font-size: 12.5px; color: var(--text-muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.feed-lado { text-align: right; flex-shrink: 0; }
.feed-valor { font-size: 14.5px; font-weight: 700; color: var(--text); }
.feed-valor.negativo { color: var(--danger); }
.feed-sub {
  font-size: 12.5px; color: var(--text-muted); margin-top: 2px;
  max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Ação só aparece no hover, pra lista não virar um paredão de botões */
.feed-acao {
  flex-shrink: 0; opacity: 0; transition: opacity .15s ease;
  background: transparent; border: 1px solid var(--danger); color: var(--danger);
  border-radius: 999px; padding: 5px 12px;
  font-size: 12px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.feed-item:hover .feed-acao { opacity: 1; }
.feed-acao:hover { background: var(--danger); color: #fff; }
/* Ações principais (baixar, confirmar) ficam sempre visíveis */
.feed-acoes { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.feed .btn-sm { border-radius: 999px; padding: 6px 14px; font-size: 12px; font-weight: 600; }
/* Linha clicável (histórico de caixas abre as vendas daquele caixa) */
.feed-item.clicavel { cursor: pointer; border-radius: 10px; }
.feed-item.clicavel:hover { background: var(--primary-50); }
.feed-vazio { font-size: 13.5px; color: var(--text-muted); padding: 16px 4px; }
/* Em telas de toque não há hover: o botão fica sempre visível */
@media (hover: none) {
  .feed-acao { opacity: 1; }
}
@media (max-width: 480px) {
  .feed-meta { white-space: normal; }
  .feed-sub { max-width: 100px; }
}

/* ── CÉLULA COM ÍCONE (grids de dados) ──
   Mesma linguagem visual do feed, mas preservando a leitura em coluna. */
.cel-nome { display: flex; align-items: center; gap: 11px; }
.cel-icone {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-50); color: var(--primary);
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
}
.cel-icone.cinza { background: var(--sp-surface); color: var(--sp-muted); }
.cel-icone.azul { background: #DBEAFE; color: #2563EB; }
.cel-icone.roxo { background: #EDE9FE; color: #7C3AED; }
.cel-nome-texto { min-width: 0; }
/* Nome do registro com uma linha de apoio embaixo (ex.: produtos) */
.cel-linha-principal { display: block; }
.cel-descricao {
  display: block; margin-top: 3px;
  font-size: 11.5px; font-weight: 400; color: var(--text-muted);
  line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
tr.linha-zerada .cel-descricao { color: #C2410C; }
@media (max-width: 600px) {
  .cel-icone { display: none; }
}

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 4px 12px; border-radius: 20px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
  letter-spacing: 0.02em;
}
.badge-ok, .badge-ativa   { background: #DCFCE7; color: #15803D; }
.badge-alerta, .badge-expirado { background: #FEF2F2; color: #B91C1C; }
.badge-controlado, .badge-trial { background: #FEF3C7; color: #92400E; }
.badge-inativo { background: var(--surface-2); color: var(--text-muted); }
.badge-zerado { background: #FEE2E2; color: #B91C1C; }

/* ── ASSISTENTE FISCAL (NFC-e / NF-e) ── */
.fiscal-wizard {
  display: grid; grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px; align-items: start;
}

/* Trilha de etapas */
.fiscal-passos {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 20px;
  margin-bottom: 20px; overflow-x: auto;
}
.fiscal-passo {
  display: flex; align-items: center; gap: 10px; flex: 0 0 auto;
  background: none; border: none; padding: 4px 6px; cursor: pointer;
  font-family: inherit; text-align: left; border-radius: 10px;
}
.fiscal-passo:hover { background: var(--surface-2); }
.fiscal-passo-num {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border); transition: all 0.2s ease;
}
.fiscal-passo.concluido .fiscal-passo-num,
.fiscal-passo.ativo .fiscal-passo-num {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.fiscal-passo.ativo .fiscal-passo-num { box-shadow: 0 0 0 4px var(--primary-50); }
.fiscal-passo-titulo { font-size: 13px; font-weight: 700; color: var(--text); line-height: 1.25; }
.fiscal-passo-sub { font-size: 11px; color: var(--text-muted); }
.fiscal-passo:not(.ativo):not(.concluido) .fiscal-passo-titulo { color: var(--text-muted); }
.fiscal-passo-seta { color: var(--sp-border); flex: 1 0 22px; text-align: center; }

/* Cartões de etapa */
.fiscal-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px 24px;
  margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.fiscal-card-topo {
  display: flex; gap: 12px; align-items: flex-start;
  padding-bottom: 16px; margin-bottom: 18px; border-bottom: 1px solid var(--border);
}
.fiscal-card-icone {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-50); color: var(--primary);
}
.fiscal-card-titulo { font-size: 16px; font-weight: 700; margin: 0; }
.fiscal-card-sub { font-size: 12.5px; color: var(--text-muted); margin: 2px 0 0; }
.fiscal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.fiscal-grid.duas { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fiscal-acoes {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; margin-top: 8px;
}

/* Coluna lateral */
.fiscal-lateral { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px; }
.fiscal-resumo-topo { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.fiscal-anel { position: relative; width: 92px; height: 92px; flex-shrink: 0; }
.fiscal-anel svg { transform: rotate(-90deg); }
.fiscal-anel-texto {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; line-height: 1.1;
}
.fiscal-anel-pct { font-size: 18px; font-weight: 800; color: var(--text); }
.fiscal-anel-label { font-size: 10px; color: var(--text-muted); }
.fiscal-checklist { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.fiscal-check { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-muted); }
.fiscal-check .marca {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #fff; font-weight: 700;
}
.fiscal-check.ok { color: var(--text); font-weight: 600; }
.fiscal-check.ok .marca { background: var(--primary); border-color: var(--primary); }
.fiscal-check.ativo { color: var(--text); font-weight: 600; }
.fiscal-check.ativo .marca { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.fiscal-ajuda { background: #EFF6FF; border: 1px solid #BFDBFE; border-radius: 12px; padding: 14px 16px; }
.fiscal-ajuda h4 { font-size: 13px; font-weight: 700; color: #1E40AF; margin: 0 0 6px; display: flex; align-items: center; gap: 7px; }
.fiscal-ajuda p { font-size: 12px; color: #1E3A8A; margin: 0; line-height: 1.55; }
.fiscal-atalho {
  display: flex; align-items: center; gap: 11px; width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 13px; cursor: pointer;
  font-family: inherit; text-align: left; transition: all 0.15s ease;
}
.fiscal-atalho:hover { border-color: var(--primary); background: var(--primary-50); }
.fiscal-atalho-icone {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-50); color: var(--primary);
}
.fiscal-atalho-titulo { font-size: 12.5px; font-weight: 700; color: var(--text); line-height: 1.3; }
.fiscal-atalho-sub { font-size: 11px; color: var(--text-muted); }

@media (max-width: 1100px) {
  .fiscal-wizard { grid-template-columns: 1fr; }
  .fiscal-lateral { position: static; }
}
@media (max-width: 720px) {
  .fiscal-grid, .fiscal-grid.duas { grid-template-columns: 1fr; }
  .fiscal-passo-textos { display: none; }
  .fiscal-card { padding: 18px 16px; }
}

/* ── HISTÓRICO DE COBRANÇAS (assinatura) ── */
/* Rolagem isolada: a tabela nunca empurra o layout em telas estreitas */
.tabela-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabela-cobrancas { min-width: 520px; }
.tabela-cobrancas tbody td { padding: 12px 16px; vertical-align: middle; }
/* Data com o prazo logo abaixo, em vez de uma coluna só de números */
.cel-data-cobranca { display: flex; flex-direction: column; line-height: 1.3; }
.cel-data-cobranca small {
  font-size: 11px; color: var(--text-muted); font-weight: 500; margin-top: 2px;
}
.cel-valor-cobranca {
  text-align: right; font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
/* Cobrança vencida chama atenção na linha inteira, não só na badge */
tr.linha-vencida > td { background: #FEF2F2; }
tr.linha-vencida:hover > td { background: #FEE2E2; }
tr.linha-vencida > td:first-child { box-shadow: inset 3px 0 0 #DC2626; }
tr.linha-vencida .cel-data-cobranca span { color: #B91C1C; font-weight: 600; }
tr.linha-vencida .cel-data-cobranca small { color: #DC2626; }
tr.linha-vencida .cel-icone { background: #FEE2E2; color: #B91C1C; }

/* ── LINHA DE PRODUTO ZERADO ── */
/* Destaca em vermelho, nas tabelas de Estoque e Produtos, o item sem saldo. */
tr.linha-zerada > td { background: #FEF2F2; }
tr.linha-zerada:hover > td { background: #FEE2E2; }
tr.linha-zerada > td:first-child { box-shadow: inset 3px 0 0 #DC2626; }
tr.linha-zerada .cel-nome-texto { color: #B91C1C; font-weight: 600; }
tr.linha-zerada .cel-icone { background: #FEE2E2; color: #B91C1C; }
.qtd-zerada { color: #B91C1C; font-weight: 700; }
.badge-categoria {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 8px;
  font-size: 11px; font-weight: 600; color: #fff; white-space: nowrap;
}

/* ── FILTROS ── */
.filtros {
  display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
  align-items: center;
}
.filtros select, .filtros input {
  padding: 7px 12px; height: 36px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 13.5px; outline: none;
  font-family: inherit; color: var(--text); background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.filtros select:focus, .filtros input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,163,74,0.1);
}

/* ── MODAIS (drawer lateral) ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: stretch; justify-content: flex-end;
  z-index: 100;
}
.modal-overlay.escondido { display: none; }
.modal {
  background: var(--surface);
  width: 500px; max-width: 100%;
  display: flex; flex-direction: column;
  overflow-y: auto;
  box-shadow: -8px 0 32px rgba(15,23,42,0.12);
  animation: drawer-entrar 0.25s cubic-bezier(0.16,1,0.3,1);
  border-left: 1px solid var(--border);
  padding: 0;
}
.modal h2 {
  font-size: 18px; font-weight: 800; color: var(--text);
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  margin: 0; letter-spacing: -0.02em;
}
.modal form, .modal > div:not([style*="display:none"]) {
  padding: 24px;
  flex: 1;
}
/* Para modais que usam padding interno direto */
.modal > .campo, .modal > p { padding: 0 24px; }
.modal .acoes {
  display: flex; gap: 8px;
  padding: 16px 24px; border-top: 1px solid var(--border);
  justify-content: flex-end; flex-wrap: wrap;
  margin-top: auto;
}
/* Compatibilidade: acoes dentro de form */
.modal form .acoes {
  padding: 16px 0 0; border-top: 1px solid var(--border); margin-top: 20px;
}

@keyframes drawer-entrar {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── MODAIS CENTRADOS ── */
.modal-overlay.modal-centro {
  justify-content: center; align-items: center;
}
.modal-centro .modal {
  height: auto; max-height: 90vh;
  width: 480px; border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(15,23,42,0.18);
  animation: modal-centro-entrar 0.25s cubic-bezier(0.16,1,0.3,1);
  border: 1px solid var(--border); border-left: 1px solid var(--border);
  overflow-y: auto;
}
.modal-centro .modal h2 {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
@keyframes modal-centro-entrar {
  from { opacity: 0; transform: scale(0.97) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── MODAL PDV (fullscreen, iframe) ── */
.modal-overlay.modal-pdv {
  align-items: center; justify-content: center;
  padding: 16px;
}
.modal-pdv .modal-pdv-conteudo {
  position: relative;
  width: 100%; height: 100%;
  max-width: 1300px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(15,23,42,0.25);
  animation: modal-centro-entrar 0.2s cubic-bezier(0.16,1,0.3,1);
}
.modal-pdv .iframe-pdv {
  width: 100%; height: 100%;
  border: 0; display: block; background: var(--surface);
}
@media (max-width: 900px) {
  .modal-overlay.modal-pdv { padding: 0; }
  .modal-pdv .modal-pdv-conteudo { max-width: 100%; border-radius: 0; }
}

/* ── MODAL UPGRADE ── */
.modal-upgrade-box {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 40px 32px; width: 100%; max-width: 420px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(15,23,42,0.18);
  animation: modal-centro-entrar 0.25s cubic-bezier(0.16,1,0.3,1);
  border: 1px solid var(--border);
}
.modal-upgrade-box .upgrade-icon {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px; color: var(--primary);
}
.upgrade-wa-btn { display: flex; align-items: center; }
.modal-upgrade-box h2 {
  margin-bottom: 10px; font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -0.02em;
}
.modal-upgrade-box p {
  font-size: 13.5px; color: var(--text-muted); margin-bottom: 8px; line-height: 1.6;
}

/* ── TOASTS ── */
.toast-container {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px; z-index: 999;
}
.toast {
  padding: 12px 20px; border-radius: var(--radius); color: #fff;
  font-size: 13.5px; font-weight: 600; max-width: 340px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  animation: toast-entrar 0.2s ease;
}
.toast-sucesso { background: var(--primary); }
.toast-erro    { background: var(--danger); }
.toast-info    { background: var(--info); }
@keyframes toast-entrar {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── CARREGANDO (logo animada) ── */
.logo-loader {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 9px; padding: 26px 12px; text-align: center;
  color: var(--muted); font-size: 12px; font-weight: 500;
}
.logo-loader img {
  width: 38px; height: 38px; -webkit-user-drag: none; user-select: none;
  animation: logo-pulsar 1.25s ease-in-out infinite;
}
.logo-loader.mini { padding: 12px 8px; gap: 6px; font-size: 11px; }
.logo-loader.mini img { width: 26px; height: 26px; }
@keyframes logo-pulsar {
  0%, 100% { transform: scale(0.9);  opacity: .55; }
  50%      { transform: scale(1.06); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .logo-loader img { animation: logo-pulsar 2.6s ease-in-out infinite; }
}

/* ── SPINNER (mantido como alias da logo animada) ── */
.spinner {
  width: 38px; height: 38px; margin: 32px auto;
  background: url('/icon-192.png') center / contain no-repeat;
  animation: logo-pulsar 1.25s ease-in-out infinite;
}

/* ── UTILITARIOS ── */
.acoes-tabela { display: flex; gap: 6px; }
.escondido { display: none !important; }

/* ── PDV (dentro do app) ── */
.pdv-grid {
  display: grid; grid-template-columns: 1.4fr 1fr;
  gap: 16px; align-items: start;
}
@media (max-width: 900px) { .pdv-grid { grid-template-columns: 1fr; } }
.busca-produto { position: relative; margin-bottom: 16px; }
.resultados-busca {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); max-height: 260px; overflow-y: auto;
  z-index: 20; box-shadow: var(--shadow-md);
}
.resultados-busca .item-resultado {
  padding: 10px 14px; cursor: pointer; font-size: 13.5px;
  border-bottom: 1px solid var(--border); transition: background 0.1s;
}
.resultados-busca .item-resultado:last-child { border-bottom: none; }
.resultados-busca .item-resultado:hover { background: var(--primary-50); }

/* ── CARRINHO ── */
.carrinho-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.carrinho-item .nome { flex: 1; font-weight: 500; }
.carrinho-item input[type="number"] {
  width: 60px; padding: 6px; border: 1px solid var(--border);
  border-radius: 8px; text-align: center; font-family: inherit;
  font-size: 13px;
}

/* ── TOTAIS ── */
.totais { margin-top: 16px; font-size: 13.5px; }
.totais .linha {
  display: flex; justify-content: space-between;
  padding: 7px 0; color: var(--text-muted);
}
.totais .linha.total {
  font-weight: 700; font-size: 20px;
  border-top: 1.5px solid var(--border); padding-top: 12px; margin-top: 8px;
  color: var(--primary-dark);
}

/* ── KPIs FINANCEIRO ── */
.kpis-financeiro {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px; margin-bottom: 16px;
}
.kpi {
  background: linear-gradient(135deg, #FFFFFF 0%, var(--sp-surface) 100%);
  border: 1px solid var(--border);
  border-radius: 14px; padding: 20px;
  box-shadow: var(--shadow);
  transition: all 0.25s ease;
  position: relative; overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--sp-action), rgba(255,255,255,.76));
  opacity: 0;
  transition: opacity .25s;
}
.kpi:hover {
  box-shadow: 0 8px 24px rgba(22,163,74,0.12);
  transform: translateY(-2px);
}
.kpi:hover::before { opacity: 1; }
.kpi .rotulo {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 8px; font-weight: 700;
}
.kpi .valor { font-size: 24px; font-weight: 800; color: var(--text); letter-spacing: -0.03em; }
.kpi .valor.azul { color: var(--info); }
.kpi .valor.verde { color: var(--primary); }

/* ── FINANCEIRO: cabeçalho de seção, filtros e gráficos ── */
.topo-sub {
  font-size: 14px; color: var(--text-muted); margin-top: 4px;
}
.fin-secao-topo {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.fin-secao-titulo { font-size: 19px; font-weight: 800; color: var(--text); letter-spacing: -0.02em; }
.fin-secao-sub { font-size: 13.5px; color: var(--text-muted); margin-top: 3px; }
.fin-periodo { display: flex; gap: 8px; flex-wrap: wrap; }
.fin-periodo-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 16px;
  font-size: 13.5px; font-weight: 600; color: var(--text);
  cursor: pointer; font-family: inherit;
  transition: all .15s ease;
}
.fin-periodo-btn:hover { border-color: var(--info); color: var(--info); }
.fin-periodo-btn.ativo {
  background: var(--info); border-color: var(--info); color: #fff;
}
/* Subtítulo solto logo abaixo de um <h2> do painel (padrão antigo do Financeiro):
   a margem negativa compensa os 18px do título. Escopo restrito a esse caso —
   dentro de .painel-topo o subtítulo tem espaçamento próprio, e a regra global
   antiga puxava o texto para cima do título. */
.painel > h2 + .painel-sub {
  font-size: 13px; color: var(--text-muted); margin-top: -12px; margin-bottom: 18px;
}
.fin-graficos {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
.fin-graficos .painel { margin-bottom: 20px; }
.fin-grafico-area { position: relative; height: 260px; }
.fin-legenda { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
/* Empty state dos gráficos (círculo cinza com "$") */
.fin-vazio {
  height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
}
.fin-vazio-icone {
  width: 64px; height: 64px; border-radius: 16px;
  background: var(--sp-surface); color: #94a99a;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700;
}
.fin-vazio p { font-size: 13.5px; color: var(--text-muted); }
@media (max-width: 900px) {
  .fin-graficos { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .fin-secao-topo { align-items: stretch; }
  .fin-periodo { width: 100%; }
  .fin-periodo-btn { flex: 1; justify-content: center; }
}

/* ── STATUS CARD ── */
.status-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; border-radius: var(--radius);
  border: 1px solid var(--border);
}
.status-card.ok { background: var(--primary-50); border-color: #BBF7D0; }
.status-card.atraso { background: #FEF2F2; border-color: #FECACA; }
.status-card .ponto {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.status-card.ok .ponto {
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(22,163,74,0.15);
}
.status-card.atraso .ponto {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(239,68,68,0.15);
}

/* ── GRADE DE PLANOS ── */
.grid-planos-app {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-top: 20px;
}

/* ── ESTADOS VAZIOS ── */
.estado-vazio {
  text-align: center; padding: 48px 20px;
  color: var(--text-muted); font-size: 13.5px;
}
.estado-vazio svg { margin-bottom: 14px; opacity: 0.3; }

/* ── DIVIDER ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── TABS ESTOQUE ── */
.tab-btn {
  padding: 6px 14px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--surface); cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  height: 32px;
}
.tab-btn.tab-ativa {
  background: var(--sp-glass-bg); color: var(--sp-forest); border-color: var(--sp-glass-border);
  box-shadow:var(--sp-glass-shadow);backdrop-filter:blur(var(--sp-glass-blur));-webkit-backdrop-filter:blur(var(--sp-glass-blur));
}

/* ── BOTAO INFO (tooltip) ── */
.btn-info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: #E0F2FE; color: #0369A1;
  border: 1px solid #BAE6FD; cursor: pointer;
  font-size: 10px; font-weight: 700; line-height: 1;
  vertical-align: middle; margin-left: 5px;
  transition: background 0.12s; position: relative;
}
.btn-info:hover { background: #BAE6FD; }
.btn-info .tooltip-info {
  display: none; position: absolute;
  bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--sp-text); color: var(--sp-surface);
  font-size: 12px; font-weight: 400; line-height: 1.5;
  padding: 8px 12px; border-radius: 8px;
  width: 240px; text-align: left; z-index: 999;
  box-shadow: var(--shadow-md);
  pointer-events: none; white-space: normal;
  border: 1px solid rgba(255,255,255,0.06);
}
.btn-info:hover .tooltip-info,
.btn-info:focus .tooltip-info { display: block; }
.btn-info .tooltip-info::after {
  content: '';
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--sp-text);
}

/* ── BOTAO PERIODO GRAFICO ── */
.btn-periodo {
  font-size: 11px; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); cursor: pointer; transition: all 0.12s;
}
.btn-periodo.ativo {
  background: var(--sp-glass-bg); color: var(--sp-forest); border-color: var(--sp-glass-border);
  box-shadow:var(--sp-glass-shadow);backdrop-filter:blur(var(--sp-glass-blur));-webkit-backdrop-filter:blur(var(--sp-glass-blur));
}

/* ── RESPONSIVO ── */
@media (max-width: 900px) {
  .dash-grid-graficos { grid-template-columns: 1fr !important; }
  .dash-grid-tabelas { grid-template-columns: 1fr !important; }
}
@media (max-width: 768px) {
  .cards-metricas { grid-template-columns: repeat(2, 1fr); }
  .modal-centro .modal { width: 100%; border-radius: var(--radius) var(--radius) 0 0; }
  .modal-overlay.modal-centro { align-items: flex-end; }
}
@media (max-width: 600px) {
  .grid-planos-app { grid-template-columns: 1fr; }
  .painel { padding: 16px; }
}

/* ══════════════════════════════════════════
   SIDEBAR MOBILE — gaveta deslizante
   ------------------------------------------
   Até 900px a sidebar sai do fluxo e vira uma gaveta fora da tela, aberta pelo
   hambúrguer da barra fixa do topo. Antes ela era uma coluna de 250px que comia
   um terço da largura no tablet, e abaixo de 600px virava um bloco de largura
   total com os 13 itens do menu embrulhados em linhas — o conteúdo da página só
   começava depois de tudo isso.

   Empilhamento: a gaveta e o fundo escuro ficam ABAIXO de .modal-overlay
   (z-index 100), senão a barra do topo apareceria por cima dos modais.
══════════════════════════════════════════ */
.topbar-mobile { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 900px) {
  .topbar-mobile {
    display: flex; align-items: center; gap: 12px;
    position: fixed; top: 0; left: 0; right: 0; height: 56px;
    padding: 0 14px; z-index: 90;
    background: var(--sidebar-dark);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  }
  .topbar-mobile-menu {
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer;
    color: rgba(255,255,255,0.92); padding: 8px; margin-left: -8px;
    border-radius: 8px; flex-shrink: 0;
  }
  .topbar-mobile-menu:active { background: rgba(255,255,255,0.12); }
  .topbar-mobile-logo {
    height: 26px; width: auto; display: block;
    filter: brightness(0) invert(1); opacity: 0.92;
  }

  .sidebar-backdrop {
    display: block; position: fixed; inset: 0; z-index: 95;
    background: rgba(2,20,14,0.55);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    opacity: 0; visibility: hidden;
    transition: opacity .26s ease, visibility .26s ease;
  }
  .sidebar-backdrop.visivel { opacity: 1; visibility: visible; }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 272px; max-width: 82vw; height: 100vh; height: 100dvh;
    z-index: 96; transform: translateX(-100%);
    transition: transform .26s cubic-bezier(0.16,1,0.3,1);
  }
  .sidebar.aberta { transform: translateX(0); }
  /* O chevron da sidebar fecha a gaveta no mobile, então aponta para trás. */
  .sidebar #btn-toggle-sidebar svg { transform: none; }

  /* Abre espaço para a barra fixa do topo. */
  .main { padding: 72px 16px 24px; }

  /* Trava o scroll do fundo enquanto a gaveta está aberta. */
  body.menu-aberto { overflow: hidden; }
  /* Os avisos flutuantes (z-index 200) e o botão de suporte passariam por cima
     da gaveta; somem enquanto ela está aberta. */
  body.menu-aberto .aviso-flutuante { display: none; }
  body.menu-aberto #suporte-widget { display: none !important; }
}

@media (max-width: 600px) {
  .main { padding: 68px 12px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar-backdrop { transition: none; }
}

/* ── Pedidos: badges de status ──
   Uma cor por etapa do fluxo, na mesma linguagem visual dos badges já existentes.
   A progressão vai de cinza (parado) a verde (concluído), passando por azul e
   âmbar no meio — assim dá para ler o andamento da listagem sem ler o texto. */
.badge-ped-rascunho               { background: var(--surface-2); color: var(--text-muted); }
.badge-ped-enviado                { background: #DBEAFE; color: #1D4ED8; }
.badge-ped-aguardando_faturamento { background: #FEF3C7; color: #B45309; }
.badge-ped-faturado               { background: #EDE9FE; color: #6D28D9; }
.badge-ped-enviado_fornecedor     { background: #CFFAFE; color: #0E7490; }
.badge-ped-recebido               { background: #DCFCE7; color: #15803D; }
.badge-ped-cancelado              { background: #FEE2E2; color: #B91C1C; }

/* Linha de item dentro do modal de pedido — inputs compactos na tabela */
#pedido-itens-corpo input {
  width: 100%; padding: 6px 8px; border: 1.5px solid var(--border);
  border-radius: 6px; font-size: 13px; font-family: inherit;
}
#pedido-itens-corpo td { padding: 8px 10px; vertical-align: middle; }
#pedido-sugestoes .sugestao-item { padding: 9px 12px; cursor: pointer; font-size: 13.5px; border-bottom: 1px solid var(--sp-surface); }
#pedido-sugestoes .sugestao-item:last-child { border-bottom: none; }
#pedido-sugestoes .sugestao-item:hover { background: var(--primary-50); }

/* Linha do tempo do histórico do pedido */
.ped-hist { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--sp-surface); }
.ped-hist:last-child { border-bottom: none; }
.ped-hist-bola { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex-shrink: 0; }
.ped-hist-texto { font-size: 13px; }
.ped-hist-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

/* ══════════════════════════════════════════
   FINANCEIRO — abas, DRE, despesas e Curva ABC
══════════════════════════════════════════ */

/* Abas da seção (Visão geral · DRE · Curva ABC). Mesmo padrão .tab-btn da
   Nota Fiscal e do Estoque, só com o espaçamento do topo da seção. */
.fin-abas { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }

/* Barra de período das telas gerenciais: atalhos + intervalo manual */
.fin-barra-periodo {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-bottom: 18px;
}
.fin-barra-periodo .fin-datas {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-left: auto;
}
.fin-barra-periodo input[type="date"] {
  padding: 7px 10px; border: 1.5px solid var(--border); border-radius: 6px;
  font-size: 13px; font-family: inherit; background: var(--surface); color: var(--text);
}
@media (max-width: 600px) {
  .fin-barra-periodo .fin-datas { margin-left: 0; width: 100%; }
  .fin-barra-periodo input[type="date"] { flex: 1 1 130px; min-width: 0; }
}

/* ── DRE em cascata ──
   Cada linha é rótulo à esquerda e valor à direita; o operador (−) / (=) fica
   numa coluna fixa para as linhas alinharem mesmo com rótulos de tamanhos
   diferentes. Subtotal e resultado ganham fundo para o olho achar o fecho. */
.dre-bloco { display: flex; flex-direction: column; }
.dre-linha {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 11px 6px; border-bottom: 1px solid var(--sp-surface); font-size: 13.5px;
}
.dre-linha:last-child { border-bottom: none; }
.dre-rotulo { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.dre-op {
  width: 26px; flex-shrink: 0; color: var(--text-muted);
  font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums;
}
.dre-valor { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.dre-linha.negativa .dre-valor { color: var(--danger); }
.dre-linha.subtotal {
  background: var(--surface-2); border-radius: 10px; border-bottom: none;
  padding: 13px 12px; margin: 8px 0;
}
.dre-linha.subtotal .dre-rotulo { font-weight: 700; }
.dre-linha.subtotal .dre-valor { font-weight: 800; font-size: 15px; }
.dre-linha.resultado {
  border-radius: 12px; border: 1.5px solid var(--border); border-bottom: 1.5px solid var(--border);
  padding: 16px 14px; margin-top: 10px;
}
.dre-linha.resultado .dre-rotulo { font-weight: 800; font-size: 15px; }
.dre-linha.resultado .dre-valor { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.dre-linha.resultado.positivo { background: var(--primary-50); border-color: #BBF7D0; }
.dre-linha.resultado.positivo .dre-valor { color: var(--primary-dark); }
.dre-linha.resultado.negativo { background: #FEF2F2; border-color: #FECACA; }
.dre-linha.resultado.negativo .dre-valor { color: #B91C1C; }
.dre-pct { font-size: 11.5px; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.dre-lado { display: flex; align-items: baseline; gap: 10px; }
.dre-categorias {
  list-style: none; margin: 0 0 10px; padding: 2px 6px 0 30px;
  display: flex; flex-direction: column;
}
.dre-categoria {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12.5px; color: var(--text-muted); padding: 5px 0;
}
.dre-categoria .valor { font-variant-numeric: tabular-nums; }
.dre-aviso {
  background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E;
  border-radius: 10px; padding: 12px 14px; font-size: 12.5px; line-height: 1.5;
  margin-bottom: 16px; display: flex; gap: 9px; align-items: flex-start;
}
.dre-aviso svg { flex-shrink: 0; margin-top: 1px; }
/* No celular a margem desce para baixo do valor: lado a lado, rótulo + margem +
   valor não cabem em 320px e a linha estourava para fora do card. */
@media (max-width: 480px) {
  .dre-lado { flex-direction: column; align-items: flex-end; gap: 2px; }
  .dre-linha.resultado .dre-valor { font-size: 18px; }
  .dre-categorias { padding-left: 18px; }
}

/* ── Curva ABC ── */
.abc-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px; margin-bottom: 18px;
}
.abc-card {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px;
}
.abc-card.classe-a { border-left-color: #16A34A; }
.abc-card.classe-b { border-left-color: #F59E0B; }
.abc-card.classe-c { border-left-color: #94a99a; }
.abc-card-topo { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.abc-card-letra { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; }
.abc-card-frase { font-size: 13.5px; margin-top: 8px; color: var(--text); line-height: 1.45; }
.abc-card-valor { font-size: 12px; color: var(--text-muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.abc-card-dica { font-size: 12px; color: var(--text-muted); margin-top: 10px; line-height: 1.45; }
.abc-barra { height: 5px; border-radius: 99px; background: var(--surface-2); margin-top: 12px; overflow: hidden; }
.abc-barra span { display: block; height: 100%; border-radius: 99px; }
.abc-card.classe-a .abc-barra span { background: #16A34A; }
.abc-card.classe-b .abc-barra span { background: #F59E0B; }
.abc-card.classe-c .abc-barra span { background: #94a99a; }
.badge-classe-a { background: #DCFCE7; color: #15803D; }
.badge-classe-b { background: #FEF3C7; color: #92400E; }
.badge-classe-c { background: var(--surface-2); color: var(--text-muted); }

/* Tabelas largas: rolagem horizontal isolada no card, sem estourar o layout
   no celular (mesma solução já usada nas listas de vendedores). */
.tabela-abc { min-width: 780px; }
.tabela-despesas { min-width: 560px; }
.tabela-parados { min-width: 420px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
thead th.num { text-align: right; }

/* ══════════════════════════════════════════
   CASHBACK — configuração e extrato do cliente
══════════════════════════════════════════ */
.cb-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.cb-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.cb-switch .trilho {
  width: 42px; height: 24px; border-radius: 99px; background: var(--sp-border);
  position: relative; transition: background 0.15s; flex-shrink: 0;
}
.cb-switch .trilho::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform 0.15s; box-shadow: var(--shadow-sm);
}
.cb-switch input:checked + .trilho { background: var(--primary); }
.cb-switch input:checked + .trilho::after { transform: translateX(18px); }
.cb-switch input:focus-visible + .trilho { box-shadow: 0 0 0 3px var(--primary-50); }
.cb-switch .texto { font-size: 13.5px; font-weight: 600; }

.cb-saldo {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  background: var(--primary-50); border: 1px solid #BBF7D0;
  border-radius: 12px; padding: 14px 16px; margin-bottom: 12px;
}
.cb-saldo .valor { font-size: 22px; font-weight: 800; color: var(--primary-dark); letter-spacing: -0.02em; }
.cb-saldo .rotulo { font-size: 11px; font-weight: 700; color: var(--primary-dark); letter-spacing: 0.04em; text-transform: uppercase; }
.cb-expira { font-size: 12px; color: #92400E; background: #FFFBEB; border: 1px solid #FDE68A; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }
.cb-extrato { display: flex; flex-direction: column; max-height: 230px; overflow-y: auto; }
.cb-mov { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--sp-surface); }
.cb-mov:last-child { border-bottom: none; }
.cb-mov-tipo { font-size: 13px; font-weight: 600; }
.cb-mov-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }
.cb-mov-valor { font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cb-mov-valor.entrada { color: var(--primary-dark); }
.cb-mov-valor.saida { color: var(--danger); }

/* Destaques translúcidos mantêm texto legível mesmo sem suporte a blur. */
.sidebar nav a.ativo:hover { background: var(--sp-glass-dark-hover); }
.tab-btn.tab-ativa:hover, .btn-periodo.ativo:hover { background: var(--sp-glass-hover); }
.badge-plano-popular { background: var(--sp-glass-bg); color: var(--sp-forest); border: 1px solid var(--sp-glass-border); box-shadow:var(--sp-glass-shadow);backdrop-filter:blur(var(--sp-glass-blur));-webkit-backdrop-filter:blur(var(--sp-glass-blur)); }

/* ===========================================================================
   Tutoriais por módulo (public/app/tutoriais.js)
   O painel fica DENTRO da seção, recolhido, e o cliente consulta enquanto
   trabalha. Por isso nada aqui usa position:fixed nem cobre a tela: o que ele
   precisa ler e o que ele precisa clicar têm de caber juntos.
   =========================================================================== */

.btn-tutorial {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); color: var(--primary-dark);
  border: 1px solid var(--primary); border-radius: var(--radius);
  padding: 8px 14px; font-size: 14px; font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.btn-tutorial:hover { background: var(--primary-50); }
.btn-tutorial span[aria-hidden] {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 11px; font-weight: 700;
}

.tutorial-painel {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-lg); padding: 20px 22px; margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.tutorial-painel.escondido { display: none; }
.tutorial-cabecalho { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tutorial-cabecalho h3 { font-size: 16px; font-weight: 700; color: var(--text); margin: 0; }
.tutorial-fechar {
  background: none; border: none; cursor: pointer; line-height: 1;
  font-size: 22px; color: var(--muted); padding: 0 4px;
}
.tutorial-fechar:hover { color: var(--text); }
.tutorial-resumo { font-size: 14px; color: var(--muted); line-height: 1.6; margin: 6px 0 14px; }

.tutorial-passos { list-style: none; padding: 0; margin: 0; counter-reset: none; }
.tutorial-passos li {
  display: flex; gap: 12px; align-items: flex-start;
  font-size: 14px; line-height: 1.65; color: var(--text);
  padding: 7px 0;
}
.tutorial-num {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; margin-top: 1px; border-radius: 50%;
  background: var(--primary-100); color: var(--primary-dark);
  font-size: 12px; font-weight: 700;
}
.tutorial-passos code {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px; font-size: 12.5px;
}

.tutorial-aviso {
  background: #fffbeb; border: 1px solid #fde68a; border-left-width: 4px;
  border-radius: 8px; padding: 12px 14px; margin-top: 12px;
  font-size: 13.5px; line-height: 1.6; color: #78350f;
}
.tutorial-acoes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* Avisos reaproveitáveis fora do tutorial (modal do estoque inicial) */
.aviso-forte {
  background: #fffbeb; border: 1px solid #fcd34d; border-left: 4px solid var(--warning);
  border-radius: 8px; padding: 14px 16px;
  font-size: 13.5px; line-height: 1.6; color: #78350f;
}
.aviso-neutro {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px;
  font-size: 13.5px; line-height: 1.6; color: var(--text);
}

/* Guia em modal, só na primeira visita ao módulo */
.guia-etapa {
  font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--primary-dark); margin: 4px 0 0;
}
.guia-pontos { display: flex; gap: 6px; margin-top: 16px; }
.guia-ponto {
  width: 7px; height: 7px; border-radius: 50%; background: var(--border);
}
.guia-ponto.ativo { background: var(--primary); }

@media (max-width: 640px) {
  .tutorial-painel { padding: 16px; }
  .btn-tutorial { padding: 7px 11px; font-size: 13px; }
}

/* ===================== CONFIGURAÇÕES: DADOS RECOLHIDOS =====================
   Dados cadastrais e acesso ao SNGPC abrem só no clique (ver index.html,
   #form-configuracoes). */
.config-dobra {
  border: 1px solid var(--border); border-radius: 12px;
  background: #fff; margin-bottom: 12px; overflow: hidden;
}
.config-dobra > summary {
  list-style: none; cursor: pointer; padding: 14px 44px 14px 16px;
  display: flex; flex-direction: column; gap: 2px; position: relative;
}
.config-dobra > summary::-webkit-details-marker { display: none; }
.config-dobra > summary::after {
  content: ''; position: absolute; right: 18px; top: 50%;
  width: 8px; height: 8px; margin-top: -6px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .2s;
}
.config-dobra[open] > summary::after { transform: rotate(-135deg); margin-top: -2px; }
.config-dobra > summary:hover { background: var(--sp-surface, #f3f6f0); }
.config-dobra > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.config-dobra-titulo { font-weight: 700; font-size: 14.5px; color: var(--text); }
.config-dobra-sub { font-size: 12.5px; color: var(--muted); }
.config-dobra-corpo { padding: 4px 16px 16px; border-top: 1px solid var(--border); }
.config-dobra-corpo .campo:first-child { margin-top: 12px; }

/* ===================== AVISO DE INSTALAR O APP (PWA) =====================
   Montado por instalar-app.js só para quem ainda usa pelo navegador. */
.aviso-instalar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 900; width: min(560px, calc(100% - 32px));
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: 16px;
  color: #fff;
  background: rgba(8,45,36,.92);
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 12px 34px rgba(5,37,29,.35);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  animation: aviso-instalar-entra .3s ease-out;
}
@keyframes aviso-instalar-entra {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.aviso-instalar img { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; }
.aviso-instalar-texto { flex: 1; min-width: 0; font-size: 13px; line-height: 1.45; }
.aviso-instalar-texto strong { display: block; font-size: 14px; margin-bottom: 2px; }
.aviso-instalar-acoes { display: flex; gap: 6px; flex-shrink: 0; }
.aviso-instalar button {
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  border-radius: 9px; padding: 8px 12px; border: 1px solid transparent;
}
.aviso-instalar .aviso-instalar-sim { background: #fff; color: var(--sp-forest); }
.aviso-instalar .aviso-instalar-nao { background: transparent; color: #cfe0d6; border-color: rgba(255,255,255,.22); }
.aviso-instalar button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width: 640px) {
  .aviso-instalar { flex-wrap: wrap; bottom: 12px; }
  .aviso-instalar-acoes { width: 100%; justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) { .aviso-instalar { animation: none; } }
