/* ============================================================
 * CEAF v8 — Estilos
 * Três temas via [data-theme]: sepia (padrão), light, dark
 * ============================================================ */

:root, [data-theme="sepia"] {
  --bg: #f5efe6;
  --surface: #fdfaf3;
  --surface-2: #f0e8d8;
  --border: #d9cfb8;
  --border-2: #c5b896;
  --text: #3a2f20;
  --text-2: #6b5d44;
  --text-3: #8a7a5d;
  --primary: #8b6332;
  --primary-2: #6d4f25;
  --primary-bg: #efe7f7;
  --line: #d9cfb8;              /* borda dos cards avf/cesaf (faltava — "voando") */
  --ok: #4d7028;
  --warn: #b87333;
  --danger: #a83232;
  --accent: #6b4f7a;
  --shadow: 0 1px 3px rgba(80,60,30,.15);
  --shadow-lg: 0 4px 12px rgba(80,60,30,.2);
  --radius: 6px;
}
[data-theme="light"] {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #ccd3de;    /* v8.115.1 — era #e1e5ea (pálido demais no tema claro,
                           "tudo voando"): reforça as linhas de grade/cards */
  --border-2: #b0bac8;
  --text: #1a202c;
  --text-2: #4a5568;
  --text-3: #718096;
  --primary: #4f46e5;   /* v8.31.0 — índigo (era azul #2563eb; diferencia da SIAL BI) */
  --primary-2: #4338ca; /* índigo-700 (hover) */
  --primary-bg: #eef0fc; /* v8.115.1 — fundo índigo claro (faltava no tema Claro) */
  --line: #d5dbe4;       /* v8.115.1 — borda dos cards avf/cesaf/cancelar (faltava
                            no Claro → cards sem borda, "tudo voando") */
  --ok: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --accent: #7c3aed;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.08);
}
[data-theme="dark"] {
  --bg: #0f1419;
  --surface: #1a1f26;
  --surface-2: #232831;
  --border: #2d333d;
  --border-2: #3a4150;
  --text: #e2e8f0;
  --text-2: #a0aec0;
  --text-3: #718096;
  --primary: #6366f1;   /* v8.31.0 — índigo-500 (era azul #3b82f6) */
  --primary-2: #818cf8; /* índigo-400 (hover) */
  --primary-bg: #262a3a;
  --line: #2d333d;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --accent: #a78bfa;
  --shadow: 0 2px 6px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.5);
}

/* ============================================================
 * v8.17.0 — Tema "Soft Modern"
 *
 * Inspiração: Linear, Notion, Vercel, Arc. Paleta roxa moderna
 * com off-white pêssego no claro e roxo-noite no escuro.
 *
 * Tem 2 sub-variantes (data-tema interna não usada agora — fica
 * pra futuro se quiser separar Soft Claro vs Soft Escuro). Por
 * enquanto é só 1 modo: claro com pêssego.
 * ============================================================ */
[data-theme="soft"] {
  --bg:         #FBF8F5;            /* off-white pêssego — fundo da app */
  --surface:    #FFFFFF;            /* superfície de cards */
  --surface-2:  #F5F2EE;            /* superfície secundária (hover, bg-sunken) */
  --border:     #E8E2D8;            /* borda padrão (suave) */
  --border-2:   #D6CFC2;            /* borda mais forte (focus, separadores) */
  --text:       #18181B;            /* texto principal */
  --text-2:     #52525B;            /* texto secundário */
  --text-3:     #8E8E94;            /* texto terciário (muted) */
  --primary:    #7C3AED;            /* roxo Vercel/Notion */
  --primary-2:  #6D28D9;            /* roxo escuro (hover) */
  --primary-bg: #F3EEFC;            /* fundo claro pra estados ativos */
  --ok:         #16A34A;            /* verde sucesso */
  --warn:       #EA580C;            /* laranja warn */
  --danger:     #DC2626;            /* vermelho perigo */
  --accent:     #DB2777;            /* magenta accent (complementar ao roxo) */
  --shadow:     0 1px 2px rgba(20,17,30,.04), 0 1px 3px rgba(20,17,30,.06);
  --shadow-lg:  0 4px 12px rgba(20,17,30,.08), 0 2px 6px rgba(20,17,30,.04);
  --radius:     8px;
  /* Token novo só pro Soft: usado em componentes específicos abaixo */
  --soft-font:  'Inter', 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --soft-mono:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  transition: background .2s, color .2s;
}

#app { min-height: 100vh; display: flex; flex-direction: column; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  background: var(--surface-2);
  padding: 1px 5px;
  border-radius: 3px;
}

/* === LOADING (centered card — mantido como estava pra splash inicial) === */
.loading-screen, .login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.loading-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
  width: 360px;
  max-width: 100%;
}
.brand {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  color: var(--primary);
  letter-spacing: .5px;
}
.brand-sub {
  font-size: 12px;
  color: var(--text-3);
  text-align: center;
  margin-top: 4px;
  margin-bottom: 24px;
  line-height: 1.4;
}

/* === LOGIN v8.24.2 — 2 colunas (institucional | form) ===
   Mesmo padrão visual da Dashboard de Programações (Streamlit) e da
   Plataforma Onco (Fastify+EJS). As 3 plataformas devem se reconhecer
   como sistemas da mesma família institucional. */
.login-shell {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 3rem;
  width: 100%;
  max-width: 1080px;
  align-items: stretch;
}

/* ── COLUNA ESQUERDA — institucional ── */
.login-left {
  padding: 1.4rem 1.6rem 0.6rem 0.2rem;
  display: flex;
  flex-direction: column;
  min-height: 480px;
  /* v8.28.3 — fundo institucional sutil (idea 1): brilho suave no canto
     + textura diagonal quase imperceptível. Só CSS, adapta ao tema via
     var(--primary). Se color-mix não existir, a regra cai sem fundo (ok). */
  background:
    radial-gradient(520px 380px at 0% 0%,
      color-mix(in srgb, var(--primary) 9%, transparent), transparent 72%),
    repeating-linear-gradient(45deg,
      color-mix(in srgb, var(--primary) 3%, transparent) 0 2px, transparent 2px 17px);
  border-radius: 14px;
}
.login-org {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--primary);
  text-transform: uppercase;
  margin-bottom: 1.2rem;
  line-height: 1.4;
}
.login-org .sep {
  color: var(--text-3);
  margin: 0 8px;
  font-weight: 400;
}
.login-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin: 0 0 0.85rem 0;
}
.login-tagline {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  color: var(--text-2);
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 1.4rem;
}
.login-tagline b {
  color: var(--primary);
  font-weight: 700;
}
.login-rule {
  width: 64px;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--text-3));
  border-radius: 2px;
  margin-bottom: 1.8rem;
}
.login-trust {
  list-style: none;
  padding: 0;
  margin: 0 0 auto 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-trust li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  color: var(--text-2);
  font-weight: 500;
}
.login-trust li::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  border: 1px solid var(--primary);
}
.login-version {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  color: var(--text-3);
  letter-spacing: 0.04em;
  margin-top: 1.8rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  line-height: 1.5;
}
/* v8.28.3 — selo "PRODUÇÃO" (idea 3) ao lado da versão no login. Verde,
   par do .ver-amb-homolog (amarelo) já existente. */
.ver-amb-prod {
  background: rgba(77, 112, 40, .14);
  color: var(--ok);
  border: 1px solid rgba(77, 112, 40, .34);
  padding: 1px 8px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
}

/* ── COLUNA DIREITA — formulário ── */
.login-right {
  padding: 1.4rem 0.2rem 0.6rem 2rem;
  border-left: 1px solid var(--border-2);
  border-image: linear-gradient(
    to bottom,
    transparent 0%,
    var(--border-2) 12%,
    var(--border-2) 88%,
    transparent 100%
  ) 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 480px;
}
.login-section-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--primary);
  text-transform: uppercase;
  margin-bottom: 0.6rem;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.login-section-label::before {
  content: '';
  display: inline-block;
  width: 22px;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}
.login-right-sub {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: var(--text-3);
  margin-bottom: 1.4rem;
  font-weight: 500;
}
.login-actions-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border) 50%, transparent);
  margin: 1.4rem 0 0.8rem 0;
}
.login-actions {
  display: flex;
  justify-content: center;
}
.login-action-hint {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  color: var(--text-3);
  font-style: italic;
  text-align: center;
  max-width: 320px;
  line-height: 1.45;
}

/* Em telas estreitas (<880px) empilha */
@media (max-width: 880px) {
  .login-shell {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    max-width: 480px;
  }
  .login-right {
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0.2rem;
    padding-top: 1.8rem;
    min-height: auto;
  }
  .login-left {
    min-height: auto;
    padding-right: 0.2rem;
  }
  .login-title { font-size: 2.2rem; }
}

/* ── v8.170.0 — Escolha de programa (CEAF/CBAF), pós-login ──
   Mesma família visual do login (.login-wrap já centraliza a tela). */
.programa-shell {
  width: 100%;
  max-width: 640px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.programa-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  margin: 1rem 0 0.4rem 0;
}
.programa-sub {
  font-size: 0.95rem;
  color: var(--text-2);
  margin: 0 0 2rem 0;
}
.programa-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
  width: 100%;
}
.programa-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 2rem 1.4rem;
  border: 1px solid var(--border-2);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.programa-card:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 20px rgba(0,0,0,.08);
  transform: translateY(-2px);
}
.programa-card .pc-emoji {
  font-size: 2.6rem;
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.18));
}
.programa-card .pc-nome {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}
.programa-card .pc-desc {
  font-size: 0.82rem;
  color: var(--text-3);
  line-height: 1.4;
}
@media (max-width: 560px) {
  .programa-cards { grid-template-columns: 1fr; }
}

.input-group { margin-bottom: 14px; }
.input-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.input-group input,
.input-group textarea,
.input-group select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text);
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
}
.input-group textarea {
  min-height: 68px;
  resize: vertical;
}
.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139,99,50,.15);
}
.input-group input:disabled {
  background: var(--surface-2);
  color: var(--text-3);
  cursor: not-allowed;
}

.btn-primary, .btn, .btn-ok, .btn-danger {
  padding: 8px 14px;
  border: 0;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, transform .05s;
}
.btn-primary { background: var(--primary); color: white; width: 100%; padding: 10px; margin-top: 8px; }
.btn-primary:hover { background: var(--primary-2); }
.btn-primary:disabled, .btn-ok:disabled, .btn:disabled { opacity: .6; cursor: wait; }

.btn {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-2);
}
.btn:hover { background: var(--border); }

.btn-ok { background: var(--ok); color: white; }
/* reafirma fundo/cor no hover pra .btn:hover não clarear o fundo e sumir o texto
   branco quando o botão tem as duas classes (btn btn-ok) — bug no tema claro. */
.btn-ok:hover { background: var(--ok); color: white; filter: brightness(1.1); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger); color: white; filter: brightness(1.1); }

.error-msg {
  background: rgba(168,50,50,.08);
  border: 1px solid rgba(168,50,50,.3);
  color: var(--danger);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  margin-bottom: 12px;
}

.login-footer {
  text-align: center;
  margin-top: 14px;
  font-size: 10px;
  color: var(--text-3);
}

/* === LAYOUT PRINCIPAL === */
.app-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  flex: 1;
  min-height: 100vh;
  background: var(--bg);
}
/* Recolher a sidebar (botão ☰ no topo) — main ocupa a tela toda. */
.app-layout.sidebar-collapsed {
  grid-template-columns: 1fr;
}
.app-layout.sidebar-collapsed > .sidebar {
  display: none;
}

/* ===========================================================
   v8.28.0 — RAIL: sidebar recolhida em ícones (60px) que abre no
   hover sobrepondo o conteúdo (sem empurrar a tela). É o modo
   padrão; o ☰ "fixa" a sidebar aberta (modo pinned). Operador
   pediu pra recuperar largura de tela sem perder a navegação rápida.
   =========================================================== */
.app-layout.sidebar-rail {
  grid-template-columns: 56px 1fr;   /* v8.115.0 — rail no tamanho da SIONCO */
}
/* v8.28.4 — FIX CRÍTICO (tela branca ao logar). No modo rail a sidebar
   vira position:fixed e SAI do fluxo do grid; com isso o auto-placement
   jogava o <main> na 1ª coluna (60px) em vez da 2ª (1fr), esmagando o
   conteúdo em ~4px → tela aparentemente "em branco". Forçar o main na
   coluna 2 resolve. min-width:0 evita que o conteúdo interno (tabelas
   largas) estoure a coluna. Regressão introduzida na v8.28.0. */
.app-layout.sidebar-rail > .main {
  grid-column: 2;
  min-width: 0;
}
.app-layout.sidebar-rail > .sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 56px;
  overflow-x: hidden;
  overflow-y: auto;
  z-index: 50;                 /* abaixo de modais (1000) e toasts (2000) */
  transition: width .16s ease, box-shadow .16s ease;
}
.app-layout.sidebar-rail > .sidebar:hover {
  width: 244px;
  box-shadow: 6px 0 24px rgba(0, 0, 0, .18);
}
/* barra de rolagem fininha no rail (não rouba os 60px) */
.app-layout.sidebar-rail > .sidebar::-webkit-scrollbar { width: 6px; }
.app-layout.sidebar-rail > .sidebar::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 3px;
}

/* --- recolhido: ícone MAIOR e centralizado nos 60px --- */
.app-layout.sidebar-rail .sidebar-item {
  padding-left: 0;
  padding-right: 0;
  /* v8.28.4 — padding vertical menor no rail. São 24 itens; com 8px
     (40px/item) eles estouravam telas de laptop (~720px de altura) e
     o operador "não via tudo". 5px (~34px/item) cabe muito mais antes
     de precisar rolar. No hover o padding volta a 8px (regra abaixo). */
  padding-top: 5px;
  padding-bottom: 5px;
  justify-content: center;
}
/* v8.28.4 — títulos de seção colapsam de verdade no rail (recolhido).
   Antes ficavam com opacity:0 mas PRESERVAVAM a altura (6 seções ×
   35px = ~210px desperdiçados), agravando o overflow. Agora height:0;
   no hover (regra mais abaixo) eles reaparecem com a sidebar expandida. */
.app-layout.sidebar-rail .sidebar-section {
  height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  overflow: hidden;
}
.app-layout.sidebar-rail > .sidebar:hover .sidebar-section {
  height: auto;
  padding: 14px 20px 6px;
}
.app-layout.sidebar-rail .sidebar-icon {
  margin-right: 0;
  /* v8.28.5 — ícone do rail recolhido = MESMO tamanho do estado aberto
     (20px). Antes era 24px no rail e 20px no hover; o operador notou a
     diferença e preferiu o tamanho do aberto. Agora é consistente. */
  width: 18px;
  height: 18px;
  opacity: 1;
}
.app-layout.sidebar-rail .sidebar-icon svg { width: 18px; height: 18px; }
/* rótulo do item, badge e bloco nome/cargo: tiram do fluxo (display:none)
   pra largura não impedir a centralização do ícone */
.app-layout.sidebar-rail .sidebar-item > span:not(.sidebar-icon),
.app-layout.sidebar-rail .sidebar-tag,
.app-layout.sidebar-rail .user-block > div:not(.user-avatar) {
  display: none;
}
.app-layout.sidebar-rail .user-block { justify-content: center; }
/* brand, títulos de seção e linha de botões/versão do rodapé: fade
   (não atrapalham o ícone; a altura preservada vira respiro entre grupos) */
.app-layout.sidebar-rail .sidebar-brand-name,
.app-layout.sidebar-rail .sidebar-brand-version,
.app-layout.sidebar-rail .sidebar-brand-tag,
.app-layout.sidebar-rail .sidebar-brand-sub,
.app-layout.sidebar-rail .sidebar-section,
.app-layout.sidebar-rail .sidebar-footer > div:not(.user-block) {
  opacity: 0;
  white-space: nowrap;
  transition: opacity .1s ease;
  pointer-events: none;
}

/* --- hover: restaura o layout expandido --- */
.app-layout.sidebar-rail > .sidebar:hover .sidebar-item {
  padding-left: 20px;
  padding-right: 20px;
  padding-top: 8px;     /* v8.28.4 — restaura o respiro vertical no hover */
  padding-bottom: 8px;
  justify-content: flex-start;
}
.app-layout.sidebar-rail > .sidebar:hover .sidebar-icon {
  margin-right: 12px;
  width: 18px;
  height: 18px;
}
.app-layout.sidebar-rail > .sidebar:hover .sidebar-icon svg { width: 18px; height: 18px; }
.app-layout.sidebar-rail > .sidebar:hover .sidebar-item > span:not(.sidebar-icon) { display: inline; }
.app-layout.sidebar-rail > .sidebar:hover .sidebar-tag { display: inline-block; }
.app-layout.sidebar-rail > .sidebar:hover .user-block > div:not(.user-avatar) { display: block; }
.app-layout.sidebar-rail > .sidebar:hover .user-block { justify-content: flex-start; }
.app-layout.sidebar-rail > .sidebar:hover .sidebar-brand-name,
.app-layout.sidebar-rail > .sidebar:hover .sidebar-brand-version,
.app-layout.sidebar-rail > .sidebar:hover .sidebar-brand-tag,
.app-layout.sidebar-rail > .sidebar:hover .sidebar-brand-sub,
.app-layout.sidebar-rail > .sidebar:hover .sidebar-section,
.app-layout.sidebar-rail > .sidebar:hover .sidebar-footer > div:not(.user-block) {
  opacity: 1;
  pointer-events: auto;
}
/* No rail, o ☰ vira um "alvo" mais óbvio de que dá pra fixar. */
.app-layout.sidebar-rail .sidebar-toggle {
  color: var(--primary);
}
.sidebar-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: inherit;
  font-size: 16px;
  line-height: 1;
  padding: 5px 10px;
  cursor: pointer;
  flex: 0 0 auto;
}
.sidebar-toggle:hover {
  background: var(--surface);
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 0;
  display: flex;
  flex-direction: column;
}
.sidebar-brand {
  padding: 0 20px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
/* v8.25.9 — Nome + versão inline. Versão fica como badge à direita,
   com cor sutil pra não competir com o nome do app. */
.sidebar-brand-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.sidebar-brand-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .3px;
}
.sidebar-brand-version {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.sidebar-brand-version:empty {
  display: none;   /* esconde o pill enquanto ainda não carregou */
}
.ver-amb-homolog-mini {
  background: #ffd84d;
  color: #4a3500;
  font-weight: 700;
  padding: 0 4px;
  border-radius: 3px;
  margin-left: 4px;
}
/* v8.25.11 — Tagline da plataforma. Cor da identidade institucional
   (azul-ardósia, mesma do app-topbar selo) — destaca a função sem
   competir com o nome no topo. */
.sidebar-brand-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-distrib, #34618e);
  margin-top: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.sidebar-brand-sub {
  /* v8.115.1 — passou a carregar o nome por extenso do SIDEC (explica a sigla
     dentro da plataforma). Frase → sem uppercase, com quebra e entrelinha. */
  font-size: 9.5px;
  color: var(--text-3);
  margin-top: 3px;
  text-transform: none;
  letter-spacing: .2px;
  line-height: 1.35;
}
.sidebar-section {
  padding: 14px 20px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .5px;
}
/* v8.128.0 — seções recolhíveis (accordion) */
.sidebar-sec-head {
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; user-select: none;
  transition: color .12s;
}
.sidebar-sec-head:hover { color: var(--text-2); }
.sidebar-sec-head .sec-chevron { font-size: 9px; opacity: .7; width: 9px; display: inline-block; }
.sidebar-sec-head .sec-count {
  margin-left: auto; font-size: 9.5px; line-height: 1.5;
  background: rgba(255,255,255,.10); color: var(--text-3);
  padding: 0 6px; border-radius: 8px;
}
.sidebar-sec-head .sec-count.has-active {
  background: rgba(129,140,248,.35); color: #c7d2fe;
}
/* No rail (padrão), o título da seção fica height:0 e só aparece no hover
   (regra .app-layout.sidebar-rail .sidebar-section) — aí o chevron/contador
   aparecem junto e o clique recolhe de verdade. NÃO forçar o corpo aberto:
   um !important aqui (v8.128.0) travava o recolher no rail. */
.sidebar-item {
  display: flex;
  align-items: center;
  padding: 8px 20px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  border-left: 3px solid transparent;
  user-select: none;
}
.sidebar-item:hover:not(.disabled) {
  background: var(--surface-2);
  color: var(--text);
}
.sidebar-item.active {
  background: var(--surface-2);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}
.sidebar-item.disabled {
  opacity: .55;
  cursor: not-allowed;
}
.sidebar-icon {
  width: 18px;
  height: 18px;
  margin-right: 11px;
  opacity: .82;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.sidebar-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}
.sidebar-item.active .sidebar-icon { opacity: 1; }
.sidebar-tag {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  background: var(--border);
  color: var(--text-3);
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
.user-block {
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.user-name { font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.2; }
.user-role { font-size: 10px; color: var(--text-3); margin-top: 2px; }

.select-sm, .btn-sm {
  font-size: 11px;
  padding: 4px 8px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  flex: 1;
}
.btn-sm:hover, .select-sm:hover { background: var(--surface-2); color: var(--text); }

/* === MAIN === */
.main {
  padding: 24px 28px;
  overflow: auto;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 8px;              /* v8.55.0 — topo mais enxuto (era 16) */
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;             /* v8.55.0 — era 20 */
  gap: 12px;
}
.topbar-title { font-size: 16px; font-weight: 700; }   /* v8.55.0 — era 18 */
.topbar-sub { font-size: 11px; color: var(--text-3); margin-top: 1px; }
/* v8.28.1 — Cabeçalho único: linha de ações + chip de status (substitui
   o antigo banner de largura cheia "✓ calculado"). */
.topbar-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.status-chip-ok {
  background: rgba(77, 112, 40, .12);
  border: 1px solid rgba(77, 112, 40, .32);
  color: var(--ok);
}
.status-chip-warn {
  background: rgba(184, 115, 51, .14);
  border: 1px solid rgba(184, 115, 51, .42);
  color: var(--warn);
}

/* === RODADA ATIVA — pill na topbar === */
.rodada-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  padding: 6px 12px;
  border-radius: 18px;
  font-size: 12px;
  color: var(--text-2);
}
.rodada-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(77,112,40,.18);
}
.rodada-pill .dot.aberto    { background: var(--text-3); box-shadow: 0 0 0 3px rgba(0,0,0,.06); }
.rodada-pill .dot.calculado { background: var(--primary); box-shadow: 0 0 0 3px rgba(139,99,50,.18); }
.rodada-pill .dot.fechado   { background: var(--warn); box-shadow: 0 0 0 3px rgba(184,115,51,.18); }
.rodada-pill b { color: var(--text); font-weight: 700; }
.rodada-pill .pill-sep { color: var(--text-3); }
.rodada-pill .pill-status { font-size: 10px; text-transform: uppercase; letter-spacing: .3px; }
.rodada-pill button {
  padding: 2px 8px;
  font-size: 10px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  color: var(--text-2);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
}
.rodada-pill button:hover { background: var(--border); color: var(--text); }
.rodada-pill.empty { color: var(--text-3); font-style: italic; }
.rodada-pill.empty .dot { background: var(--text-3); opacity: .4; box-shadow: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card.welcome h2 { font-size: 18px; margin-bottom: 8px; }
.card.welcome p { color: var(--text-2); margin-bottom: 8px; font-size: 13px; }
.card.welcome ul {
  margin-left: 24px;
  margin-bottom: 16px;
  color: var(--text-2);
}
.card.welcome ul li { font-size: 13px; margin-bottom: 4px; }
.card.welcome ul li b { color: var(--primary); }

.status-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.status-item {
  background: var(--surface-2);
  padding: 12px 14px;
  border-radius: var(--radius);
}
.status-label {
  font-size: 10px;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.status-value {
  font-size: 16px;
  font-weight: 700;
  margin-top: 4px;
}
.status-value.status-ok { color: var(--ok); }
.status-sub {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 2px;
}

/* === CATÁLOGO === */
.warning-banner {
  background: rgba(184,115,51,.08);
  border: 1px solid rgba(184,115,51,.3);
  color: var(--text-2);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  margin-bottom: 14px;
}

/* v8.101.0 — chips (antes: tabs de sublinhado que não pareciam clicáveis) */
.cat-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.cat-tab {
  padding: 8px 15px;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  user-select: none;
  transition: background .12s, border-color .12s, color .12s;
}
.cat-tab:not(.active):hover {
  background: var(--surface);
  border-color: var(--primary);
  color: var(--text);
}
.cat-tab.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;              /* v8.55.0 — era 12 */
  flex-wrap: wrap;
}
.toolbar input[type="text"],
.toolbar select {
  padding: 7px 10px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text);
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  min-width: 200px;
}
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
}
.counter {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-3);
  font-weight: 600;
}
.hint {
  font-size: 11px;
  color: var(--text-3);
  font-style: italic;
  margin: 8px 0;
}

/* v8.72.1 — modal de Calcular Redistribuição: texto mais nítido.
   O corpo era quase todo .hint (--text-3 faded, itálico, 11px) + .muted-sm
   (10px) → "bem clarinho" num modal cheio de informação crítica (a conta da
   reserva, o que muda). Escopado em .redist-modal pra NÃO mexer nos .hint do
   resto da app. */
.redist-modal { font-size: 12.5px; line-height: 1.55; color: var(--text-2); }
.redist-modal p { color: var(--text); font-size: 13px; margin: 10px 0; }
.redist-modal .hint {
  color: var(--text-2);
  font-style: normal;
  font-size: 12.5px;
  line-height: 1.55;
}
.redist-modal .hint b,
.redist-modal p b { color: var(--text); }
.redist-modal .muted-sm {
  font-size: 11px;
  color: var(--text-2);
  font-style: normal;
}
/* a conta do saldo/reserva vira card — é o número que o operador age em cima */
.redist-modal .redist-saldo {
  background: var(--surface-2);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 9px 11px;
  color: var(--text);
}
.redist-modal .redist-saldo b { color: var(--text); }
.redist-modal .redist-saldo .muted-sm { color: var(--text-2); }

/* v8.73.0 — painel do resultado da redistribuição, no topo da Grade da rodada
   recém-calculada: o que gerou e, sobretudo, o que NÃO gerou e por quê. */
.redist-painel {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 10px 0 12px;
  font-size: 12.5px;
  color: var(--text);
}
.redist-painel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
/* o texto ocupa a linha; o Fechar fica do tamanho dele (sem .btn-ghost no CSS,
   o botão esticava até a borda e lia como barra, não como botão) */
.redist-painel-head > span { flex: 1 1 auto; }
.redist-painel-head > button { flex: 0 0 auto; width: auto; }
.redist-painel .muted-sm { color: var(--text-2); font-style: normal; }
.redist-painel .table-wrap { max-height: 260px; }

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  max-height: calc(100vh - 320px);
  position: relative;
}
.table-wrap.no-sticky { max-height: none; overflow: hidden; }
.table-wrap table {
  width: 100%;
  border-collapse: collapse;
}
.table-wrap thead {
  position: sticky;
  top: 0;
  z-index: 2;
}
.table-wrap th {
  background: var(--surface-2);
  text-align: left;
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .3px;
  border-bottom: 1px solid var(--border);
  /* Sombra sutil aparece quando há scroll, dando profundidade ao thead fixo */
  box-shadow: 0 1px 0 var(--border);
}
.table-wrap td {
  padding: 8px 12px;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap tr:hover { background: var(--surface-2); }
.table-wrap td.muted { color: var(--text-3); font-size: 11px; }

.btn-mini {
  padding: 4px 8px;
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text-2);
  border-radius: 3px;
  cursor: pointer;
  margin-right: 4px;
  font-family: inherit;
}
.btn-mini:hover { background: var(--border); color: var(--text); }
.btn-mini.btn-danger { background: transparent; color: var(--danger); border-color: rgba(168,50,50,.3); }
.btn-mini.btn-danger:hover { background: rgba(168,50,50,.1); }

.btn-mini.btn-reactivate {
  background: rgba(77,112,40,.1);
  color: var(--ok);
  border-color: rgba(77,112,40,.3);
  font-weight: 700;
}
.btn-mini.btn-reactivate:hover { background: rgba(77,112,40,.2); }

.btn-mini.btn-promover {
  background: rgba(139,99,50,.12);
  color: var(--primary);
  border-color: rgba(139,99,50,.4);
  font-weight: 700;
}
.btn-mini.btn-promover:hover { background: rgba(139,99,50,.22); }

.row-verificada {
  background: rgba(77,112,40,.06);
}
.row-verificada td { color: var(--text-3); }

.badge {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 4px;
  background: var(--danger);
  color: white;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  vertical-align: middle;
}
.badge.badge-warn { background: var(--warn); }
.badge.badge-ok { background: var(--ok); }

/* === PLANEJAMENTOS === */
.planej-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.planej-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .15s, transform .05s;
  box-shadow: var(--shadow);
}
.planej-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}
.planej-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.planej-card-ref {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: .5px;
  text-transform: uppercase;
}
.planej-card-nome {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}
.planej-card-desc {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.planej-card-foot {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-3);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.topbar-back { margin-bottom: 4px; }
.link-back {
  font-size: 11px;
  color: var(--text-3);
  cursor: pointer;
  text-decoration: none;
}
.link-back:hover { color: var(--primary); }

.planej-arq-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.planej-arq-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.planej-arq-card.empty {
  text-align: center;
  border-style: dashed;
  background: var(--surface-2);
}
.planej-arq-card h3 {
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--text);
}
.arq-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 12px;
}
.arq-meta b { color: var(--text); margin-right: 4px; }
.aviso-line { margin-top: 4px; }

.aviso-item {
  background: var(--surface-2);
  border-left: 3px solid var(--warn);
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 12px;
  border-radius: 3px;
}

/* === PREVIEW DE IMPORT === */
.preview-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.preview-stat {
  background: var(--surface-2);
  padding: 10px 12px;
  border-radius: 4px;
  text-align: center;
}
.preview-stat b {
  display: block;
  font-size: 18px;
  font-weight: 700;
}
.preview-stat span {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.preview-stat b.status-ok { color: var(--ok); }
.preview-stat b.status-warn { color: var(--warn); }

.preview-amostra {
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: auto;
  max-height: 200px;
}
.amostra-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.amostra-table th {
  background: var(--surface-2);
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-3);
}
.amostra-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
}

.btn.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(168,50,50,.3);
}
.btn.btn-danger-outline:hover { background: rgba(168,50,50,.1); }

/* v8.20.5 — botão Reaplicar Catálogo (mais sutil que o primário) */
.btn.btn-primary-outline {
  background: transparent;
  color: var(--primary, #2563eb);
  border: 1px solid rgba(37, 99, 235, .35);
}
.btn.btn-primary-outline:hover { background: rgba(37, 99, 235, .08); }

.tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: .3px;
  background: var(--border);
  color: var(--text-2);
}
.tag-ok { background: rgba(77,112,40,.15); color: var(--ok); }
.tag-warn { background: rgba(184,115,51,.15); color: var(--warn); }
.tag-danger { background: rgba(168,50,50,.15); color: var(--danger); }
.tag-primary { background: rgba(139,99,50,.15); color: var(--primary); }
/* v8.169.0 — selo SOBRA n (sobra após rateio): o único selo SÓLIDO da grade —
   é pedido de AÇÃO (dar a sobra a uma unidade antes de exportar), não estado. */
.tag-sobra { background: var(--warn); color: #fff; border: 1px solid color-mix(in srgb, var(--warn) 70%, #000); white-space: nowrap; padding: 2px 5px; }
/* selo AVULSA na Grade (linha de fatura avulsa, fora da grade normal) — violeta, distinta das outras */
.tag-avulsa { background: rgba(139,92,246,.16); color: #7c3aed; }
[data-theme="soft"] .tag.tag-avulsa { background: #EDE9FE; color: #6D28D9; border-color: transparent; }
[data-theme="dark"] .tag.tag-avulsa { background: rgba(139,92,246,.24); color: #c4b5fd; }

.value-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
}

/* === HISTÓRICO === */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.history-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 14px;
  font-size: 12px;
}
.history-time {
  color: var(--text-3);
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, monospace;
}
.history-diff {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-2);
}
.history-motivo {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-3);
  font-style: italic;
}
.diff-add { color: var(--ok); font-weight: 600; }
.diff-del { color: var(--danger); font-weight: 600; }
.diff-old { text-decoration: line-through; color: var(--text-3); }
.diff-new { color: var(--ok); font-weight: 600; }

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-box {
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  width: 480px;
  max-width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 16px 20px;
  font-size: 14px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.modal-body {
  padding: 16px 20px;
  overflow: auto;
  font-size: 13px;
  color: var(--text-2);
}
.modal-body p { margin-bottom: 10px; }
.modal-body ul { margin-left: 20px; margin-top: 8px; }
.modal-body ul li { margin-bottom: 4px; font-size: 12px; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* === TOAST === */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-left: 4px solid var(--primary);
  border-radius: 4px;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  max-width: 360px;
}
.toast-ok { border-left-color: var(--ok); color: var(--ok); }
.toast-error { border-left-color: var(--danger); color: var(--danger); }
.toast-info { border-left-color: var(--primary); color: var(--primary); }

/* === PLANEJAMENTOS (4C) === */
.btn-link {
  background: none;
  border: 0;
  color: var(--primary);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
  font-weight: 600;
}
.btn-link:hover { text-decoration: underline; }

.btn-warn { background: var(--warn); color: white; }
.btn-warn:hover { filter: brightness(1.1); }

.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(168,50,50,.4);
}
.btn-danger-outline:hover { background: rgba(168,50,50,.1); }

.muted-sm { font-size: 10px; color: var(--text-3); }

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .05s;
}
.plan-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}
.plan-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.plan-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.plan-card-meta {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.plan-meta-item {
  font-size: 11px;
  color: var(--text-2);
}
.plan-card-desc {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 8px;
  line-height: 1.4;
  max-height: 32px;
  overflow: hidden;
}
.plan-card-footer {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 8px;
}

.plan-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.plan-summary-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.plan-summary-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-bottom: 4px;
}
.plan-summary-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.plan-summary-sub {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 3px;
}

/* Cards de importação */
.import-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
}
.import-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.import-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.import-card-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
  line-height: 1.4;
  max-width: 600px;
}
.import-card-body { padding: 12px 16px; }
/* v8.61.0 — campo rotulado (label em cima) pras toolbars de ação da aba Faturas */
.fat-field { display: flex; flex-direction: column; gap: 3px; }
.fat-field-lbl {
  font-size: 10px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .3px;
}
.fat-field input[type="file"] { font-size: 12px; }
.tbl-faturas td, .tbl-faturas th { vertical-align: middle; white-space: nowrap; }
.tbl-faturas .col-nome { white-space: normal; word-break: break-word; line-height: 1.3; }
/* Importar XLSX + Puxar do GSnet lado a lado em tela larga (1 coluna se estreito) */
.fat-acoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 14px; }
.fat-acoes .import-card { margin-bottom: 0; }
.import-card-empty {
  padding: 20px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  font-style: italic;
}
.import-meta-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

/* v8.23.1 — histórico de estoques importados (E1, E2, E3...) */
.estoque-historico {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bg-2, #f7f5f0);
  border-left: 3px solid var(--text-3, #8a8275);
  border-radius: 0 4px 4px 0;
  font-size: 12px;
}
.estoque-historico-header {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.estoque-historico-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.estoque-historico-list li {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 4px 0;
  border-top: 1px dashed var(--border, #e0d8c8);
}
.estoque-historico-list li:first-child { border-top: none; }

.import-avisos {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(184,115,51,.07);
  border: 1px solid rgba(184,115,51,.25);
  border-radius: 4px;
  font-size: 12px;
}
.import-avisos b { color: var(--warn); }
.import-avisos ul {
  margin: 6px 0 0 18px;
  font-size: 11px;
  color: var(--text-2);
}
.import-avisos li { margin-bottom: 4px; }
.aviso-items {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 2px;
  margin-left: 4px;
}
.aviso-items code { font-size: 10px; padding: 1px 4px; }

/* Preview de importação */
.preview-stats {
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
  padding: 10px;
  background: var(--surface-2);
  border-radius: 4px;
}
.preview-stat { flex: 1; text-align: center; }
.preview-stat-label {
  font-size: 9px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.preview-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

/* Tabelas de base/estoque */
.row-verificar {
  background: rgba(184,115,51,.05);
}
.row-verificar td b { color: var(--warn); }

.lote-chip {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 10px;
  margin-right: 3px;
  margin-bottom: 2px;
  font-family: ui-monospace, SFMono-Regular, monospace;
}

/* v8.82.0 — coluna LOTES: 1 lote mostra o chip direto; vários viram uma seta que
   EXPANDE os lotes como linhas logo abaixo (igual ao "Saldo por item" do IBL). */
.lotes-toggle {
  cursor: pointer;
  color: var(--primary);
  font-weight: 600;
  font-size: 11px;
  white-space: nowrap;
  user-select: none;
}
.lotes-toggle:hover { text-decoration: underline; }
.lotes-toggle .caret { display: inline-block; font-size: 9px; width: 9px; }
/* item de 1 lote: fator em texto simples, sem caixinha (o saldo já está na coluna IBL) */
.lote-uni { font-family: ui-monospace, SFMono-Regular, monospace; color: var(--text-2); font-size: 11px; }
/* linhas de lote injetadas sob o item (explosão item → lote, FEFO) */
.tbl-estoque tr.lote-row td {
  background: var(--surface-2);
  border-top: none;
  padding: 3px 8px;
  font-size: 12px;
}
.tbl-estoque tr.lote-row .lote-cell { padding-left: 20px; color: var(--text-2); }
.tbl-estoque tr.lote-row .lote-cell b { color: var(--text); }
.tbl-estoque tr.lote-row .lote-saldo {
  font-variant-numeric: tabular-nums; color: var(--text);
}

/* Tabela da Base — todas as colunas têm largura fixa, NOME quebra em linhas */
.tbl-base { table-layout: fixed; width: 100%; }
.tbl-base th, .tbl-base td {
  vertical-align: top;
  overflow: hidden;
}
.tbl-base .col-nome {
  width: 280px;
  word-break: break-word;
  white-space: normal;
  line-height: 1.35;
}

/* v8.47.0 — grade plana de Manuais (formato Grade Completa, editável inline).
   Layout FIXO (herda .tbl-base): TODAS as colunas têm largura — inclusive
   MEDICAMENTO e OBS — pra nenhuma virar "elástica" e comer o espaço. O texto
   quebra dentro da largura; a sobra distribui proporcional (sem gap gigante). */
.tbl-manuais td, .tbl-manuais th { vertical-align: middle; white-space: nowrap; }
.tbl-manuais .num { text-align: center; }
.tbl-manuais .col-nome {                             /* MEDICAMENTO — quebra dentro de 200px */
  width: 200px;
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
}
.tbl-manuais .col-obs {                              /* OBS — texto do consolidado, 240px */
  width: 240px;
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
  font-size: 12px;
  color: var(--text-2);
}
.tbl-manuais input.inp-consumo,
.tbl-manuais input.inp-rep-mn,
.tbl-manuais input.inp-estun,
.tbl-manuais input.inp-qtde-mn,
.tbl-base input.inp-par-consumo,
.tbl-base input.inp-par-rep {
  width: 68px;
  box-sizing: border-box;
  text-align: center;
  padding: 3px 4px;
}

/* v8.48.0 (Fase C) — split pai → variações (sabores) */
.tbl-manuais tr.tr-pai-split > td:first-child {
  box-shadow: inset 3px 0 0 var(--primary);   /* acento à esquerda no pai */
}
.tbl-manuais tr.tr-pai-split > td { font-weight: 500; }
.tbl-manuais tr.tr-variacao > td {
  background: color-mix(in srgb, var(--primary) 6%, transparent);
}
.tbl-manuais tr.tr-variacao-warn td {
  background: color-mix(in srgb, var(--warn, #d97706) 10%, transparent);
}
.tbl-manuais .var-arrow { color: var(--primary); font-weight: 700; margin-right: 2px; }
.tbl-manuais .var-arrow.warn { color: var(--warn, #d97706); }
.tbl-manuais .var-warn { color: var(--warn, #b45309); }
.badge-sabor {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 1px 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 16%, transparent);
  color: var(--primary);
  vertical-align: middle;
}
.tbl-manuais .split-hint { font-size: 11.5px; color: var(--text-2); }
.tbl-manuais .split-bar { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tbl-manuais .split-sum { font-size: 11px; color: var(--text-3); }
.btn-mini.btn-split,
.btn-mini.btn-move {
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.btn-mini.btn-split:hover,
.btn-mini.btn-move:hover { filter: brightness(1.08); }

/* v8.48.3 — painel de alocação por item (saldo do almox × soma das QTDEs) */
.aloc-panel {
  padding: 6px 10px;
  margin-bottom: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-wrap: nowrap;          /* v8.50.1 — 1 linha só; rola no horizontal */
  overflow-x: auto;
  gap: 6px 10px;
  align-items: center;
  font-size: 12px;
  color: var(--text-2);
}
.aloc-panel .aloc-titulo { font-weight: 600; white-space: nowrap; flex: 0 0 auto; }
.aloc-chip {
  flex: 0 0 auto;             /* v8.50.1 — não encolhe (mantém 1 linha) */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px 10px;
  white-space: nowrap;
}

/* v8.50.1 — card de ajuda recolhível (recupera espaço vertical) */
.ajuda-card {
  padding: 6px 12px;
  margin-bottom: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-2);
}
.ajuda-head { display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.ajuda-head .ajuda-seta { color: var(--text-3); margin-left: auto; }
.ajuda-corpo { margin-top: 6px; line-height: 1.45; }
/* v8.55.1 — cor do "resta" NÃO depende mais do container (.aloc-chip dos
   Manuais OU .nm-aloc-item das 2 colunas dos Nominais). Verde = sobra;
   vermelho = estourou; âmbar = no limite (resta 0, sem sobra). */
.aloc-resta { color: var(--ok); }
.aloc-resta.aloc-over { color: var(--danger); }
.aloc-resta.aloc-zero { color: var(--warn); }

/* v8.52.0 — painel dos SIAFs nominais (rascunho): coef + Enviar D1 + Voltar.
   Diferente do aloc-panel (1 linha com scroll-x), este QUEBRA linha: cada
   chip tem controles e precisa ficar visível inteiro.
   v8.53.0 — recolhível (dentro de um ajuda-card, fechado por padrão): o corpo
   perde a moldura própria pra não ficar caixa-dentro-de-caixa. */
.nm-panel { flex-wrap: wrap; overflow-x: visible; }
.nm-panel-corpo {
  margin-top: 6px;
  margin-bottom: 0;
  border: none;
  background: transparent;
  padding: 0;
}
.nm-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; }
.nm-chip .nm-coef {
  padding: 1px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
}

/* v8.55.0 — painel dos Nominais em DUAS COLUNAS (esquerda = itens, direita =
   alocação), cada uma com lista rolável (~4 itens visíveis). Devolve altura
   pra grade. */
.nm-split { display: flex; gap: 12px; align-items: stretch; margin-top: 4px; }
.nm-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.nm-col-itens { flex: 0 0 58%; }
.nm-col-head { font-size: 11px; font-weight: 600; margin-bottom: 2px; color: var(--text-2); }
.nm-list {
  overflow-y: auto;
  max-height: 166px;                 /* v8.55.0 — ~4 itens + rolagem (era 208) */
  display: flex; flex-direction: column; gap: 4px;
  padding-right: 4px;
}
/* v8.55.0 — item/alocação em UMA linha (só quebra se faltar largura mesmo):
   cards baixos, cabe mais item na lista, a barra de rolagem aparece antes. */
.nm-item, .nm-aloc-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
  background: var(--surface);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.nm-item .nm-meta { margin-right: 4px; }    /* botões logo ao lado, sem vão */
.nm-aloc-item b { flex: 0 0 auto; }
.nm-aloc-nums { font-size: 11px; color: var(--text-2); }
.nm-coef-inline {
  width: 56px;
  padding: 1px 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
}
@media (max-width: 1100px) {
  .nm-split { flex-direction: column; }
  .nm-col-itens { flex: 1 1 auto; }
}
/* v8.52.0 — botão "→N" (mover SIAF pra Nominais) na Grade Completa */
.btn-mini.btn-move-nm {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 4px;
  padding: 0 4px;
  font-size: 10px;
  line-height: 16px;
  cursor: pointer;
  vertical-align: middle;
}
.btn-mini.btn-move-nm:hover { background: var(--primary); color: #fff; }

/* v8.50.0 — item já exportado (lote ativo): marcado e travado na grade */
.tag-exportado {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--ok);
  color: #fff;
  white-space: nowrap;
}
.tbl-manuais tr.tr-exportado > td {
  background: color-mix(in srgb, var(--ok) 8%, transparent);
}

/* Aba Manuais (Pré-Dist) — linhas agrupadas por SIAF (v8.41.0) */
.tbl-manuais-grupos tr.mn-grupo {
  cursor: pointer;
  background: var(--bg-2);
  border-top: 2px solid var(--border);
}
.tbl-manuais-grupos tr.mn-grupo:hover { background: var(--surface-hover, var(--bg-2)); filter: brightness(0.98); }
.tbl-manuais-grupos tr.mn-grupo:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.tbl-manuais-grupos tr.mn-grupo td { font-size: 13px; }
.tbl-manuais-grupos tr.mn-grupo.aberto { background: var(--surface); }
.mn-chevron {
  display: inline-block;
  width: 1em;
  color: var(--text-2);
  transition: transform 0.12s ease;
}
.tbl-manuais-grupos tr.mn-filha > td:first-child { color: var(--text-2); }

/* Modal "Adicionar lote por SIAF" — seletor múltiplo (v8.41.0) */
.lt-pick-lista {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.lt-pick-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.lt-pick-row:last-child { border-bottom: none; }
.lt-pick-row:hover { background: var(--bg-2); }
.lt-pick-siaf { font-weight: 600; min-width: 80px; }
.lt-pick-nome { color: var(--text-2); flex: 1; }

/* Grupo "a preencher" (rascunho) na aba Manuais (v8.41.0) */
.tbl-manuais-grupos tr.mn-pendente {
  background: var(--bg-2);
  border-top: 2px dashed var(--border);
}
.tbl-manuais-grupos tr.mn-pendente td { font-size: 13px; }

/* Barra de saldo na planilha do SIAF (v8.42.0) */
.lt-saldo-bar {
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: 6px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.5;
}
.lt-saldo-bar .lt-saldo-linha2 { margin-top: 2px; }
.lt-saldo-bar .lt-saldo-resta { color: var(--ok, #2e7d32); }
.lt-saldo-bar.lt-saldo-over {
  background: var(--danger-bg, #fdecea);
  border-color: var(--danger, #c0392b);
}
.lt-saldo-bar.lt-saldo-over .lt-saldo-resta { color: var(--danger, #c0392b); }
.lt-saldo-aviso {
  margin-left: 8px;
  color: var(--danger, #c0392b);
  font-weight: 600;
}

/* Tabela Estoque — DESCRIÇÃO e LOTES com largura controlada */
.tbl-estoque { table-layout: fixed; width: 100%; }
.tbl-estoque th, .tbl-estoque td {
  vertical-align: top;
  overflow: hidden;
}
.tbl-estoque .col-desc {
  width: 240px;
  word-break: break-word;
  white-space: normal;
  line-height: 1.35;
}
.tbl-estoque .col-lotes {
  word-break: normal;
  white-space: normal;
}

.spinner-lg {
  display: inline-block;
  width: 36px;
  height: 36px;
  border: 3px solid rgba(139,99,50,.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin-rot 0.8s linear infinite;
}
@keyframes spin-rot {
  to { transform: rotate(360deg); }
}

/* v8.25.5 — Spinner inline pra botões em loading (modal OK durante
   operações lentas: remover/limpar planejamento, importar grande, etc.). */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin-rot 0.7s linear infinite;
  vertical-align: -3px;
  margin-right: 8px;
}
.btn-spinner-label {
  display: inline-block;
  vertical-align: middle;
}
/* Botão com aria-busy também ganha um leve pulso pra reforçar */
button[aria-busy="true"] {
  cursor: progress !important;
  opacity: 0.85;
}

/* === 4D - CÁLCULO === */
.banner-ok, .banner-warn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 13px;
}
.banner-ok {
  background: rgba(77,112,40,.10);
  border: 1px solid rgba(77,112,40,.3);
  color: var(--ok);
}
.banner-warn {
  background: rgba(184,115,51,.12);
  border: 1px solid rgba(184,115,51,.4);
  color: var(--warn);
}

.row-editada {
  background: rgba(184,115,51,.08) !important;
}
.row-editada .td-qtde-real { font-weight: 700; }

.inp-qtde {
  width: 80px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 12px;
  text-align: right;
}
.inp-qtde:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
}

/* Histórico */
.hist-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Demanda Mensal — cards de resumo */
.resumo-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.resumo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.resumo-card-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.resumo-card-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
}
.resumo-ok { border-left: 4px solid var(--ok); }
.resumo-ok .resumo-card-value { color: var(--ok); }
.resumo-warn { border-left: 4px solid var(--warn); }
.resumo-warn .resumo-card-value { color: var(--warn); }
.resumo-danger { border-left: 4px solid var(--danger); }
.resumo-danger .resumo-card-value { color: var(--danger); }

.tag-danger { background: rgba(168,50,50,.15); color: var(--danger); }

.select-mini {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
}

.legenda-flags {
  font-size: 10px;
  color: var(--text-3);
  margin-bottom: 10px;
  padding: 6px 10px;
  background: var(--surface-2);
  border-radius: 4px;
}
.legenda-flags .tag {
  font-size: 9px;
  padding: 1px 5px;
  margin: 0 2px;
}

/* Linha de subtotal nas tabelas com filtro */
.tr-subtotal td {
  background: rgba(139,99,50,.08) !important;
  border-top: 2px solid var(--primary) !important;
  font-size: 12px;
  padding: 8px 6px;
  color: var(--primary);
}
.tr-subtotal td b { color: var(--primary); }
/* v8.104.9 — subtotal QTDE ao vivo + aviso de estouro do saldo do almox */
.sub-disp { font-size: 10px; font-weight: 600; color: var(--text-3, #888); margin-top: 2px; white-space: nowrap; }
.tr-subtotal td.sub-estourou,
.tr-subtotal td.sub-estourou b { color: var(--danger) !important; }
.tr-subtotal td.sub-estourou { background: rgba(168,50,50,.10) !important; border-top-color: var(--danger) !important; }
.tr-subtotal td.sub-estourou .sub-disp { color: var(--danger); }
.hist-item {
  display: flex;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.hist-item-icon {
  font-size: 18px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}
.hist-item-title {
  font-weight: 700;
  color: var(--text);
  font-size: 13px;
}
.hist-item-meta {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 2px;
}
.hist-item-detail {
  margin-top: 4px;
  font-size: 10px;
  color: var(--text-3);
  font-family: ui-monospace, SFMono-Regular, monospace;
  background: var(--surface-2);
  padding: 4px 6px;
  border-radius: 3px;
  overflow-x: auto;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
  font-size: 12px;
}
.pag-info {
  color: var(--text-2);
}
.pag-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pag-controls .btn-mini {
  min-width: 28px;
  text-align: center;
  padding: 4px 8px;
  font-weight: 700;
}
.pag-controls .btn-mini:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.pag-page {
  margin: 0 8px;
  color: var(--text-2);
  white-space: nowrap;
}
.pag-size label {
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pag-size select {
  padding: 3px 6px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 3px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

/* ============================================================
   ENTREGA A — Rodada-pill bar, sub-tabs, pré-distribuição,
   excluídos, sidebar tweaks, sticky thead helpers
   ============================================================ */

/* Barra fina acima do conteúdo principal — onde a pill mora.
   Some quando não há rodada ativa nem usuário logado. */
/* v8.25.10 — Faixa de identificação institucional (padrão CAF/GGAF).
   Diferencia esta plataforma das outras irmãs (CEAF :8050 verde, Onco
   amarelo, Análise MS laranja). Cor azul-ardósia FIXA — não respeita
   tema do usuário, é identidade da plataforma. */
:root {
  --brand-distrib: #34618e;
}
.app-topbar {
  /* v8.115.1 — 3 zonas: aba à ESQUERDA, "SIDEC — Sistema…" CENTRALIZADO, org à
     direita. Faixa na paleta índigo (era azul --brand-distrib, fora do padrão). */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 9px 24px;
  margin: -20px -20px 14px;       /* compensa o padding do .main pra ficar full-width */
  background: linear-gradient(180deg, #edeffb, #f6f7fe);
  border-bottom: 3px solid var(--primary);
  box-shadow: 0 1px 0 rgba(0,0,0,.04);
}
.app-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  justify-self: start;
}
.app-topbar-center {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  min-width: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--primary-2);
}
.app-topbar-logo {
  /* v8.143.0 — símbolo SIDEC (marca CAF) antes do nome, no centro da topbar. */
  height: 24px;
  width: auto;
  display: block;
  flex: none;
}
.app-topbar-center .ac-sub {
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: .01em;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 1180px){ .app-topbar-center .ac-sub { display: none; } }
.app-topbar-selo {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #fff;
  background: var(--brand-distrib);
  border-radius: 6px;
  padding: 4px 11px;
  flex: none;
  box-shadow: 0 1px 2px rgba(52, 97, 142, 0.25);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}
.app-topbar-crumb {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary-2);          /* v8.115.1 — índigo escuro na faixa clara */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* v8.25.11 — Lado direito da topbar. Identifica a SES institucionalmente
   (CAF · GGAF · SES-SP). Mesma família tipográfica do crumb mas peso
   menor pra hierarquia visual. */
.app-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);             /* v8.115.1 — institucional discreto na faixa clara */
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  flex: none;
  justify-self: end;
}
.app-topbar-org {
  /* CAF · GGAF — mais destacado */
  font-weight: 800;
}
.app-topbar-sep {
  opacity: 0.4;
  font-weight: 400;
}
.app-topbar-org-2 {
  /* SES-SP — peso médio */
  font-weight: 600;
  opacity: 0.85;
}
/* v8.28.5 — selo de versão na topbar (sempre visível). Pílula discreta
   pra não competir com o crumb, mas legível à distância. */
.app-topbar-version {
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--brand-distrib);
  border-radius: 5px;
  padding: 2px 8px;
  opacity: 0.92;
}
.app-topbar-version .ver-amb-homolog-mini {
  margin-left: 5px;
  background: #ffd84d;
  color: #4a3500;
  border-radius: 3px;
  padding: 0 4px;
  font-weight: 800;
}
/* Tema escuro: clareia pra contrastar com o fundo azul-escuro */
[data-theme="dark"] .app-topbar-right {
  color: #d6dfeb;
}
/* Em telas estreitas (<720px), esconde o lado direito pra não sobrepor o crumb */
@media (max-width: 720px) {
  .app-topbar-right { display: none; }
}
/* Tema escuro: mantém a cor da plataforma mas ajusta o fundo pra escurecer */
[data-theme="dark"] .app-topbar {
  background: #1f3a55;
  background: color-mix(in srgb, var(--brand-distrib) 40%, #0f1721);
}
[data-theme="dark"] .app-topbar-crumb,
[data-theme="dark"] .app-topbar-right {
  color: #d6dfeb;
}

.rodada-pill-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin: -8px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}

/* Pill clicável (versão refinada da já existente) */
.rodada-pill { cursor: pointer; }
.rodada-pill:hover { background: var(--border); }
.rodada-pill.empty { cursor: pointer; padding: 6px 14px; }
.rodada-pill.empty:hover { background: var(--surface); }

/* Sidebar — itens "em breve" e badges contextuais */
.sidebar-item .sidebar-tag-info {
  margin-left: auto;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-3);
  background: transparent;
  padding: 0 4px;
  text-transform: lowercase;
  letter-spacing: 0;
}
.sidebar-item.disabled .sidebar-tag {
  background: rgba(184,115,51,.10);
  color: var(--warn);
  font-size: 8.5px;
}
.sidebar-section + .sidebar-section,
.sidebar-section:not(:first-of-type) {
  margin-top: 4px;
}

/* Sub-tabs — usadas dentro de Pré-Distribuição (Por SIAF / Por par / Resumo)
   e potencialmente em outras views. Visualmente menores que .cat-tabs. */
/* v8.101.0 — chips (antes: tabs de sublinhado que não pareciam clicáveis) */
.sub-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.sub-tab {
  padding: 7px 13px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  user-select: none;
  display: inline-flex;
  align-items: center;
  transition: background .12s, border-color .12s, color .12s;
}
.sub-tab:not(.active):hover {
  background: var(--surface);
  border-color: var(--primary);
  color: var(--text);
}
.sub-tab.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  font-weight: 600;
}
.sub-tab .sub-tab-count {
  margin-left: 6px;
  font-size: 10px;
  color: var(--text-3);
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.sub-tab.active .sub-tab-count {
  background: rgba(255, 255, 255, .24);
  color: #fff;
  border-color: transparent;
}
/* v8.24.0 — sub-tab desabilitado (ex: D2 sem redistribuição calculada) */
.sub-tab.sub-tab-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.sub-tab.sub-tab-disabled:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-2);
}

/* v8.106.0 — seletor de RODADA (Demanda Mensal › Resumo por item). Reusa os
   chips do .sub-tab (mesmo idioma clicável) numa escala menor, porque fica
   DENTRO de uma view que já tem sub-abas — o tamanho menor mantém a hierarquia
   visual (sub-aba > seletor). */
.rodada-tabs {
  align-items: center;
  margin: 0 0 8px;
}
.rodada-tabs .rodada-tabs-label {
  font-size: 11.5px;
  color: var(--text-3);
  margin-right: 2px;
}
.rodada-tabs .sub-tab {
  padding: 5px 11px;
  font-size: 11.5px;
  border-radius: 7px;
}
.rodada-tabs .sub-tab .sub-tab-count {
  margin-left: 5px;
  font-size: 9.5px;
}
/* Destaque das 3 colunas da rodada escolhida (as outras FICAM na tela — decisão
   do operador: "não tem que tirar o d2 quando filtro o d1"). Só uma faixa de
   fundo + borda lateral; não muda largura pra tabela não "pular" ao trocar.

   ⚠️ O tint vai em `background-IMAGE` (gradiente de cor única), NÃO em
   `background`/`background-color`. O `thead` desta tabela é `position: sticky`:
   um rgba() no `background-color` do <th> APAGA a cor opaca do cabeçalho e as
   linhas do corpo passam a aparecer POR BAIXO ao rolar ("os números ficam
   voando" — reportado pelo operador na 1ª versão). Como camada, o tint soma
   sobre o background-color opaco que o cabeçalho já tem, em qualquer tema. */
.tbl-demanda thead th.col-rodada-sel,
.tbl-demanda tbody td.col-rodada-sel {
  background-image: linear-gradient(rgba(74, 124, 158, .13),
                                    rgba(74, 124, 158, .13));
}
.tbl-demanda .tr-grupos th.col-rodada-sel {
  background-image: linear-gradient(rgba(74, 124, 158, .22),
                                    rgba(74, 124, 158, .22));
}
/* 1ª coluna do grupo destacado (marcada no HTML — :first-of-type não serve,
   ele olha a posição entre TODOS os th/td da linha, não entre os da classe). */
.tbl-demanda th.col-rodada-ini,
.tbl-demanda td.col-rodada-ini {
  border-left: 2px solid var(--primary);
}

/* ============================================================
   v8.107.0 — BASE CONFERÊNCIA (planilha pós-distribuição)
   Tabela larga (13 colunas de base + 5 por rodada + 4 de conferência): rola na
   horizontal DENTRO do .table-wrap, com o cabeçalho de grupos igual à Demanda.
   ⚠️ Sem background-color translúcido em <th> (thead é sticky) — ver a lição
   registrada no ENTREGA da v8.106.1.
   ============================================================ */
.tbl-bconf .tr-grupos th {
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
  padding: 4px 6px;
  color: var(--text-3);
  background: var(--surface-2);
}
.tbl-bconf .th-grupo-info { background: transparent; }
.tbl-bconf tbody .td-d1    { background: rgba(217, 119, 6, .06); }
.tbl-bconf tbody .td-d2    { background: rgba(37, 99, 235, .05); }
.tbl-bconf tbody .td-total { background: rgba(16, 122, 60, .06); }
/* v8.115.0 — divisor entre os grupos de rodada (D1 | D2 | D3 | Conferência):
   a coluna FATURA da rodada seguinte vinha colada na anterior, confundindo
   quem consulta. Borda na 1ª coluna de cada grupo, do cabeçalho ao corpo. */
.tbl-bconf .bconf-sep { border-left: 2px solid var(--border-2); }

/* v8.115.1 — congela as 13 colunas de identidade (até ARM) na rolagem
   horizontal, pra não perder item/unidade. table-layout:fixed dá os offsets
   exatos; fundo OPACO em cada célula (thead sticky + rgba = "números voando"). */
.tbl-bconf tr:not(.tr-grupos) > :nth-child(-n+13) { position: sticky; z-index: 2; }
.tbl-bconf tbody td:nth-child(-n+13) { background: var(--surface); }
.tbl-bconf thead tr:not(.tr-grupos) th:nth-child(-n+13) { background: var(--surface); z-index: 6; }
.tbl-bconf .tr-grupos .th-grupo-info { position: sticky; left: 0; z-index: 6; background: var(--surface-2); }

/* v8.122.0 — cabeçalho FIXO na rolagem VERTICAL (as 2 linhas do thead).
   Grupo (D1/D2/…/Conferência) gruda no topo; a linha dos TÍTULOS logo abaixo,
   com offset = altura fixa do grupo (26px) pra o `top` ser determinístico.
   Fundo OPACO obrigatório (thead sticky + rgba = "números voando", lição v8.106.1). */
/* v8.135.3 — o thead INTEIRO precisa ficar ACIMA das células congeladas do corpo
   (colunas da esquerda são position:sticky com z-index:2). Sem isso, ao rolar pra baixo
   a linha de dados congelada passava POR CIMA do cabeçalho da esquerda (SIAFISICO/COD/…) —
   por isso só o cabeçalho da direita (D1/D2) "congelava". Confirmado por elementFromPoint. */
.tbl-bconf thead { z-index: 20; }
.tbl-bconf .tr-grupos th { position: sticky; top: 0; height: 26px; box-sizing: border-box; z-index: 7; }
.tbl-bconf .tr-grupos .th-grupo-info { top: 0; z-index: 9; }               /* canto superior-esquerdo */
.tbl-bconf thead tr:not(.tr-grupos) th { position: sticky; top: 26px; z-index: 5; }
.tbl-bconf thead tr:not(.tr-grupos) th:nth-child(-n+13) { top: 26px; z-index: 8; }  /* canto: topo + esquerda */
.tbl-bconf tr:not(.tr-grupos) > :nth-child(13) { border-right: 2px solid var(--border-2); }
.tbl-bconf tr:not(.tr-grupos) > :nth-child(1)  { left: 0 }
.tbl-bconf tr:not(.tr-grupos) > :nth-child(2)  { left: 82px }
.tbl-bconf tr:not(.tr-grupos) > :nth-child(3)  { left: 140px }
.tbl-bconf tr:not(.tr-grupos) > :nth-child(4)  { left: 330px }
.tbl-bconf tr:not(.tr-grupos) > :nth-child(5)  { left: 394px }
.tbl-bconf tr:not(.tr-grupos) > :nth-child(6)  { left: 594px }
.tbl-bconf tr:not(.tr-grupos) > :nth-child(7)  { left: 646px }
.tbl-bconf tr:not(.tr-grupos) > :nth-child(8)  { left: 720px }
.tbl-bconf tr:not(.tr-grupos) > :nth-child(9)  { left: 804px }
.tbl-bconf tr:not(.tr-grupos) > :nth-child(10) { left: 882px }
.tbl-bconf tr:not(.tr-grupos) > :nth-child(11) { left: 946px }
.tbl-bconf tr:not(.tr-grupos) > :nth-child(12) { left: 1024px }
.tbl-bconf tr:not(.tr-grupos) > :nth-child(13) { left: 1102px }
.tbl-bconf .col-nome { white-space: normal; word-break: break-word; }
/* v8.108.0 — MOTIVO: texto explicativo, menor e discreto (não compete com os
   números); quebra dentro da coluna em vez de esticar a tabela. */
.tbl-bconf .bconf-motivo {
  white-space: normal;
  word-break: break-word;
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.3;
}
.tbl-bconf td .tag { white-space: nowrap; font-size: 10.5px; padding: 1px 7px; }
/* a toolbar da Base Conferência tem muitos controles: quebra em linha nova em
   telas menores em vez de espremer o campo de busca (ele odeia campo franzino) */
.bconf-toolbar { flex-wrap: wrap; row-gap: 8px; }

/* v8.135.0 — CABEÇALHO REALMENTE FIXO. A tela vira uma coluna flex de altura fixa
   (viewport − topo do app): topbar/tiles/filtros no tamanho natural e a TABELA ocupa
   o resto, rolando SÓ ela. Antes o .table-wrap tinha overflow:auto mas quem rolava era
   a JANELA (#app/.main são min-height), levando o thead sticky junto — pior com poucas
   linhas (cabiam no max-height, então não havia scroll interno). Agora não há scroll de
   página: o thead sticky do .tbl-bconf fica colado de verdade. */
.bconf-fill { display: flex; flex-direction: column; height: calc(100vh - 100px); }
.bconf-fill > * { flex: 0 0 auto; }                                   /* topbar/tiles/filtros no tamanho natural */
.bconf-fill > #bconf-corpo { flex: 1 1 auto; min-height: 200px; display: flex; flex-direction: column; }
.bconf-fill > #bconf-corpo > .table-wrap { flex: 1 1 auto; min-height: 0; max-height: none; }
/* v8.136.0 — subtotal do bconf com fundo OPACO (as células da esquerda são sticky;
   rgba translúcido faria os números "voarem" no scroll horizontal — lição v8.106.1). */
.tbl-bconf tfoot .tr-subtotal td {
  background-color: var(--surface) !important;
  background-image: linear-gradient(rgba(139,99,50,.10), rgba(139,99,50,.10)) !important;
}
.bconf-toolbar #bconf-busca { min-width: 280px; flex: 1 1 280px; }
.bconf-toolbar select.input { min-width: 210px; }
.bconf-sits {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
}
.bconf-acoes { display: inline-flex; gap: 8px; align-items: center; }
/* tiles de situação clicáveis (clique = filtra; 2º clique limpa) */
.resumo-card-click { cursor: pointer; transition: border-color .12s, transform .06s; }
.resumo-card-click:hover { border-color: var(--primary); }
.resumo-card-click:active { transform: translateY(1px); }
.resumo-card-ativo {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

/* v8.24.0 — Demanda Mensal com grupos D1 / D2 / TOTAL */
.tbl-demanda .tr-grupos th {
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
  padding: 4px 6px;
  color: var(--text-3);
  background: var(--surface-2);
}
/* v8.51.0 (A1) — cores em rgba TRANSLÚCIDO (seguem qualquer tema, sem color-mix).
   Linha de grupos D1/D2/TOTAL: tom + texto semântico. Os sub-cabeçalhos QTDE/COEF
   (.th-d1/d2/total) NÃO recebem mais fundo próprio — herdam o fundo do cabeçalho
   (antes ficavam quase-brancos e destoavam no tema soft). Só as CÉLULAS do corpo
   (.td-*) levam o tint da coluna. */
.tbl-demanda .th-grupo-d1   { color: #8a4a00; background: rgba(217, 119, 6, .16); }
.tbl-demanda .th-grupo-d2   { color: #0a5a8a; background: rgba(37, 99, 235, .14); }
/* v8.184.0 — rodadas ímpares de redistribuição (D3, D5…) num tom próprio: D2, D3
   e D4 eram iguais e ninguém sabia onde uma terminava e a outra começava. */
.tbl-demanda .th-grupo-d3   { color: #5b2a9e; background: rgba(124, 58, 237, .13); }
.tbl-demanda .th-grupo-total{ color: #095e2c; background: rgba(16, 122, 60, .14); }
.tbl-demanda .th-grupo-info { background: transparent; }

/* v8.137.0 — congela as 7 primeiras colunas da Demanda (até EST. DIA) na rolagem
   horizontal, igual a Base Conferência (pedido Debora/Rodrigo). O thead já é sticky no
   vertical; aqui só o LATERAL. thead z-index alto senão a linha congelada tapa o cabeçalho
   (lição v8.135.3). Fundo OPACO nas células fixas (rgba "voaria" no scroll, lição v8.106.1).
   Offsets = soma das larguras do colgroup (82/64/190/54/88/78/92). */
.tbl-demanda thead { z-index: 20; }
.tbl-demanda tr:not(.tr-grupos) > :nth-child(-n+7) { position: sticky; z-index: 2; }
.tbl-demanda tbody td:nth-child(-n+7) { background: var(--surface); }
.tbl-demanda thead tr:not(.tr-grupos) th:nth-child(-n+7) { z-index: 8; }
.tbl-demanda .tr-grupos .th-grupo-info { position: sticky; left: 0; z-index: 9; background: var(--surface-2); }
.tbl-demanda tr:not(.tr-grupos) > :nth-child(7) { border-right: 2px solid var(--border-2); }
.tbl-demanda tr:not(.tr-grupos) > :nth-child(1) { left: 0 }
.tbl-demanda tr:not(.tr-grupos) > :nth-child(2) { left: 82px }
.tbl-demanda tr:not(.tr-grupos) > :nth-child(3) { left: 146px }
.tbl-demanda tr:not(.tr-grupos) > :nth-child(4) { left: 336px }
.tbl-demanda tr:not(.tr-grupos) > :nth-child(5) { left: 390px }
.tbl-demanda tr:not(.tr-grupos) > :nth-child(6) { left: 478px }
.tbl-demanda tr:not(.tr-grupos) > :nth-child(7) { left: 556px }
/* v8.56.0 — colunas no tamanho dos dados. v8.72.2 — a largura do NOME agora é
   DEFINIDA no <col> do colgroup (190px): com table-layout:fixed a largura da
   coluna vem do <col>, não do <td>. Aqui fica só o wrapping (quebra dentro dos
   190px em vez de estourar a altura da linha). Ver comentário no views.js. */
.tbl-demanda .col-nome { white-space: normal; word-break: break-word; }

/* v8.57.0 — Prévia D1 × Almox: resta colorida + linha estourada destacada */
.resta-pos { color: var(--ok); }
.resta-zero { color: var(--warn); }
.resta-neg { color: var(--danger); }
.row-estouro > td { background: rgba(168, 50, 50, .09); }

/* v8.57.0 — tag "✎ edit": QTDE editada manualmente (Grade Completa) */
.tag.tag-edit {
  background: rgba(184, 115, 51, .16);
  color: var(--warn);
  border: 1px solid rgba(184, 115, 51, .35);
}
.tbl-demanda tbody .td-d1    { background: rgba(217, 119, 6, .06); }
.tbl-demanda tbody .td-d2    { background: rgba(37, 99, 235, .05); }
.tbl-demanda tbody .td-total { background: rgba(16, 122, 60, .06); }
.tbl-demanda tbody .td-d3    { background: rgba(124, 58, 237, .05); }
/* v8.184.0 — divisória forte no começo de cada grupo (EST.ALM de cada rodada e
   TOTAL), nas 3 linhas (grupos, sub-cabeçalho e corpo). A rodada selecionada
   segue com a borda --primary (col-rodada-ini, mais específica). */
.tbl-demanda .grp-ini { border-left: 2px solid rgba(40, 52, 84, .38); }
/* v8.184.0 — QTDE calculada sem fatura: número apagado + o que falta, em âmbar */
.qt-pend { color: var(--text-3); }   /* v8.185.0 — genérico (Demanda, Base Conferência) */
.env-pend {
  display: block; font-size: 10.5px; line-height: 1.25; margin-top: 1px;
  color: var(--warn); white-space: nowrap; font-weight: 500;
}
/* Situação é a única coluna onde o texto pode quebrar (frase mais longa). */
.tbl-demanda td:nth-last-child(2) .env-pend { white-space: normal; }
/* v8.51.0 (A2) — situação compacta: nowrap + fonte menor (evita "letras
   gigantes" / quebra em 2 linhas no tema soft). */
.tbl-demanda td .tag { white-space: nowrap; font-size: 10.5px; padding: 1px 7px; }

/* Banner de status (recalcule, sem rodada, etc.) */
.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  color: var(--text-3);
}
.empty-state-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.empty-state-action { margin-top: 14px; }

/* Pré-Distribuição — linhas marcadas como excluídas */
tr.row-excluida td {
  background: rgba(168,50,50,.06);
  color: var(--text-3);
}
tr.row-excluida td:first-child::before {
  content: "⊘";
  margin-right: 4px;
  color: var(--danger);
  font-weight: 700;
}
.predist-banner {
  background: rgba(184,115,51,.10);
  border: 1px solid rgba(184,115,51,.25);
  color: var(--warn);
  padding: 4px 12px;               /* v8.55.0 — faixa slim (era 10 14) */
  border-radius: var(--radius);
  font-size: 11.5px;
  margin-bottom: 8px;              /* v8.55.0 — era 12 */
  display: flex;
  align-items: center;
  gap: 8px;
}
.predist-banner b { color: var(--text); }
.predist-motivo-input {
  width: 100%;
  font-size: 11px;
  padding: 4px 6px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text);
  border-radius: 3px;
  font-family: inherit;
}
.predist-motivo-input:focus {
  outline: 0;
  border-color: var(--primary);
}
.predist-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.predist-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.predist-toolbar .btn-bulk {
  background: var(--warn);
  color: white;
  border: 0;
  padding: 6px 12px;
  font-size: 11px;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}
.predist-toolbar .btn-bulk:hover { filter: brightness(1.05); }
.predist-toolbar .btn-bulk:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* Excluídos — apresentação em lista */
.excluidos-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.excluidos-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 80px 90px 1fr auto;
  gap: 12px;
  align-items: center;
  font-size: 12px;
}
.excluidos-item .ex-escopo {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  padding: 2px 6px;
  border-radius: 3px;
  text-align: center;
}
.excluidos-item .ex-escopo.siaf { background: rgba(168,50,50,.12); color: var(--danger); }
.excluidos-item .ex-escopo.par  { background: rgba(184,115,51,.12); color: var(--warn); }
.excluidos-item .ex-id { font-family: 'Consolas', monospace; font-weight: 700; }
.excluidos-item .ex-motivo {
  color: var(--text-3);
  font-style: italic;
  font-size: 11px;
}
.excluidos-item .ex-meta {
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
}

/* Modal: lista de rodadas (trocar) */
.rodada-list {
  max-height: 360px;
  overflow-y: auto;
  margin: 8px -4px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rodada-list-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.rodada-list-item:hover { background: var(--surface-2); }
.rodada-list-item.active {
  border-color: var(--primary);
  background: var(--surface-2);
}
.rodada-list-item .rl-info { flex: 1; min-width: 0; }
.rodada-list-item .rl-nome {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}
.rodada-list-item .rl-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

/* Tabelas: quando preciso tirar o sticky (ex: imprimir, listas curtas) */
.table-wrap.short { max-height: 220px; }
.table-wrap.full  { max-height: none; }

/* Predist: cabeçalhos de filtro com chips */
.filter-chip {
  font-size: 11px;
  padding: 4px 10px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
}
.filter-chip:hover { background: var(--surface-2); }
.filter-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Atalhos do dashboard: chips clicáveis */
.btn-mini-link {
  padding: 6px 12px;
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
}
.btn-mini-link:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Coluna motivo: largura flexível, comporta input de motivo */
.col-motivo { min-width: 200px; }

/* Card de rodada ativa: destaque sutil */
.plan-card-ativa {
  border-color: var(--primary);   /* v8.115.1 — era verde (var --ok), fora da paleta índigo */
  box-shadow: 0 0 0 2px rgba(77,112,40,.12);
}
.plan-card-ativa:hover { background: var(--surface-2); }

/* Fix card-row reusable from mockup */
.cards-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

/* ============================================================
   ENTREGA 4F — Exportação XLSX
   - Lotes gerados (lista no topo)
   - 2 painéis lado-a-lado (Embalagem Única / Múltiplas Emb.)
   - Linhas com checkbox + chip de lote quando travado
   ============================================================ */

/* Lista de lotes gerados */
.lotes-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lote-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.lote-item .lote-info { flex: 1; min-width: 0; }
.lote-item .lote-nome {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.lote-item .lote-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}
.lote-item .lote-actions {
  display: flex;
  gap: 6px;
}

/* Grid de 2 colunas pros painéis */
.exp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 1100px) {
  .exp-grid { grid-template-columns: 1fr; }
}

.exp-painel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 300px;
}
.exp-painel-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.exp-painel-header h4 {
  font-size: 13px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}
.exp-painel-toolbar {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}
.exp-painel-toolbar .btn-mini {
  font-size: 10.5px;
  padding: 3px 8px;
}
.exp-painel-toolbar .counter {
  font-size: 11px;
  color: var(--text-3);
  margin-left: 4px;
}

/* Lista de itens do painel */
.exp-list {
  flex: 1;
  overflow-y: auto;
  max-height: calc(100vh - 460px);
  padding: 6px;
}
.exp-row {
  display: grid;
  grid-template-columns: auto 80px 1fr auto auto auto;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 3px;
  cursor: pointer;
  align-items: center;
  font-size: 12px;
  user-select: none;
}
.exp-row:hover { background: var(--surface-2); }
.exp-row.selecionado {
  background: rgba(101, 119, 56, .12);   /* tom suave do --ok */
}
.exp-row.travado {
  opacity: .55;
  cursor: not-allowed;
}
.exp-row.travado:hover { background: transparent; }
.exp-row input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--primary);
}
.exp-row.travado input[type="checkbox"] { cursor: not-allowed; }
.exp-row-siaf {
  font-family: 'Consolas', monospace;
  font-weight: 700;
  color: var(--text);
}
.exp-row-nome {
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.exp-row-qtde {
  font-family: 'Consolas', monospace;
  font-size: 11px;
  color: var(--text-2);
  text-align: right;
  min-width: 60px;
}

/* Chip de "Lote N" pra item travado */
.lote-chip {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
  padding: 2px 7px;
  border-radius: 8px;
  background: rgba(184,115,51,.15);
  color: var(--warn);
  border: 1px solid rgba(184,115,51,.3);
  white-space: nowrap;
}

/* Footer do painel com botão Gerar */
.exp-painel-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}
.exp-painel-footer .btn[disabled] {
  opacity: .4;
  cursor: not-allowed;
}

/* --- v8.92.0 — barra "o que falta" na tela Exportar --- */
.exp-pend-bar { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.exp-pend {
  flex: 1; min-width: 220px; padding: 10px 14px;
  border: 1px solid var(--border); border-left: 3px solid var(--border);
  border-radius: 8px; background: var(--surface);
}
.exp-pend.warn { border-left-color: var(--warn); }
.exp-pend.ok   { border-left-color: var(--ok); }
.exp-pend-lbl  { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .3px; }
.exp-pend-val  { font-size: 18px; font-weight: 700; color: var(--text); margin-top: 2px; }
.exp-pend-sub  { font-size: 12px; font-weight: 400; color: var(--text-2); }

/* --- v8.90.0 — Export por UNIDADE×SIAF: cabeçalho do SIAF + unidades --- */
/* A linha-cabeçalho do SIAF vira flex (itens variáveis: chevron, badge, chip). */
.exp-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.exp-row-head .exp-row-siaf { min-width: 72px; }
.exp-row-head .exp-row-nome { flex: 1; min-width: 0; }
.exp-row-head.travado { opacity: .6; }
.exp-chevron {
  background: none; border: none; cursor: pointer; padding: 0;
  width: 16px; line-height: 1; font-size: 11px; color: var(--text-3);
}
.exp-chevron:hover { color: var(--primary); }
.exp-chevron-spacer { display: inline-block; width: 16px; }
/* Badge "N/M un." */
.exp-uni-badge {
  font-size: 10px; font-weight: 700; white-space: nowrap;
  padding: 1px 7px; border-radius: 8px;
  background: var(--surface-2); color: var(--text-3);
  border: 1px solid var(--border);
}
.exp-uni-badge.on {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 40%, transparent);
  background: color-mix(in srgb, var(--ok) 10%, transparent);
}
.exp-uni-badge.trav { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
/* Lista de unidades (expandida sob o SIAF) */
.exp-uni-list {
  border-left: 2px solid var(--border);
  margin: 2px 6px 6px 22px;
}
.exp-uni {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 12px;
  font-size: 11.5px;
  border-radius: 3px;
  cursor: pointer;
  user-select: none;
}
.exp-uni:hover { background: var(--surface-2); }
.exp-uni.selecionado { background: rgba(101, 119, 56, .10); }
.exp-uni.travado { opacity: .5; cursor: not-allowed; }
.exp-uni.travado:hover { background: transparent; }
.exp-uni input[type="checkbox"] { cursor: pointer; accent-color: var(--primary); }
.exp-uni.travado input[type="checkbox"] { cursor: not-allowed; }
.exp-uni-cod {
  font-family: 'Consolas', monospace; color: var(--text-3); min-width: 46px;
}
.exp-uni-nome {
  flex: 1; min-width: 0; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.exp-uni-aut {
  font-family: 'Consolas', monospace; font-size: 10.5px;
  color: var(--text-3); white-space: nowrap;
}
.exp-uni-aut.exp-aut-critico { color: var(--danger); font-weight: 700; }
.exp-uni-aut.exp-aut-baixo { color: var(--warn); }
.exp-uni-qtde {
  font-family: 'Consolas', monospace; font-size: 10.5px;
  color: var(--text-2); text-align: right; min-width: 54px;
}

/* --- KPI boxes (aba Resumo da Exportação - 08/05) --- */
.kpi-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  text-align: center;
}
.kpi-box .kpi-label {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-bottom: 4px;
}
.kpi-box .kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* === Resumo de faturas refeito (v8.11.0) === */
.resumo-card {
  padding: 14px 16px;
  margin-bottom: 14px;
}
.resumo-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.resumo-card-title {
  font-size: 12px;
  color: var(--text-2);        /* v8.115.1 — era text-3 (muito claro) */
  text-transform: uppercase;
  letter-spacing: .3px;
  margin: 0;
  font-weight: 700;            /* v8.115.1 — negrito, destacava pouco */
}
.resumo-card-toolbar {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.resumo-filtro-label {
  font-size: 13px;
  color: var(--text-2);
}
.resumo-filtro-input {
  width: 86px;
  padding: 5px 8px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
}
.resumo-filtro-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--surface-2);
}
.resumo-filtro-input::placeholder {
  color: var(--text-3);
  font-style: italic;
}
.btn-sm {
  font-size: 12px;
  padding: 4px 10px;
}
.resumo-loading {
  text-align: center;
  padding: 18px;
  color: var(--text-3);
  font-size: 13px;
}
.resumo-vazio {
  text-align: center;
  padding: 16px;
  color: var(--text-3);
  font-size: 13px;
  margin-top: 8px;
}

/* v8.115.0 — seções recolhíveis (Faixas de autonomia / Lotes gerados) pra
   chegar antes na seleção de itens sem rolar a página inteira. */
.resumo-collapse { margin-top: 4px; }
.resumo-collapse > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .3px;
  padding: 6px 2px;
  user-select: none;
}
.resumo-collapse > summary::-webkit-details-marker { display: none; }
.resumo-collapse > summary::before {
  content: '▸';
  font-size: 11px;
  color: var(--text-3);
  transition: transform .15s ease;
}
.resumo-collapse[open] > summary::before { transform: rotate(90deg); }
.resumo-collapse-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-3);
  font-size: 11px;
}

/* KPI principal + secundários */
.resumo-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
@media (max-width: 760px) {
  .resumo-kpis { grid-template-columns: 1fr; }
}
.resumo-kpi-main {
  /* v8.115.1 — degradê índigo sutil (identidade SIDEC) sobre a superfície */
  background: linear-gradient(135deg, rgba(79,70,229,.13), rgba(79,70,229,.02)), var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 8px 13px;   /* v8.115.1 — ainda mais compacto */
}
.resumo-kpi-main-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-2);
  font-weight: 600;
}
.resumo-kpi-filtro {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--primary);
  font-size: 11px;
}
.resumo-kpi-main-value {
  font-size: 22px;   /* v8.115.1 — reduzido de novo (38 → 26 → 22) */
  font-weight: 700;
  color: var(--primary);
  line-height: 1.05;
  margin: 2px 0;
  font-variant-numeric: tabular-nums;
}
.resumo-kpi-main-hint {
  font-size: 11px;
  color: var(--text-3);
}
.resumo-kpis-side {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.resumo-kpi-side {
  /* v8.115.1 — degradê índigo bem leve (combina com o card principal) */
  background: linear-gradient(160deg, rgba(79,70,229,.07), rgba(79,70,229,0)), var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 8px;
  text-align: center;
}
.resumo-kpi-side-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--text-3);
  margin-bottom: 4px;
}
.resumo-kpi-side-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Tabela por faixa, com barra inline */
.resumo-tabela-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.resumo-tabela {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.resumo-tabela thead th {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--text-3);
  text-align: left;
}
.resumo-tabela thead .th-num,
.resumo-tabela tbody .td-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.resumo-tabela tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
}
.resumo-tabela tbody tr:last-child td { border-bottom: none; }
.resumo-tabela tbody tr:hover { background: var(--surface-2); }
.td-num-strong { font-weight: 700; color: var(--text); }

.td-faixa {
  white-space: nowrap;
  font-weight: 500;
}
.resumo-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

.td-bar { width: 30%; min-width: 140px; }
.resumo-bar-wrap {
  position: relative;
  background: var(--surface-2);
  border-radius: 4px;
  height: 18px;
  overflow: hidden;
}
.resumo-bar {
  height: 100%;
  border-radius: 4px;
  transition: width .25s ease;
}
.resumo-bar-pct {
  /* v8.156.0 — o % ficava branco centralizado sobre a barra INTEIRA; quando a
     barra é curta o texto caía na parte clara (branco no claro = sumia). Agora
     fica à DIREITA (quase sempre sobre a trilha clara), escuro, com halo claro
     pra ler também quando a barra chega perto do fim. */
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 3px var(--surface-1), 0 0 3px var(--surface-1), 0 0 4px var(--surface-1);
  letter-spacing: .2px;
}
/* v8.156.0 — linha de faixa clicável (aplica a faixa nas exportações) */
.resumo-row-click { cursor: pointer; }
.resumo-row-click:hover { background: var(--surface-2); }
.resumo-faixa-apply {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--primary);
  margin-left: 8px;
  opacity: 0;
  transition: opacity .12s ease;
  white-space: nowrap;
}
.resumo-row-click:hover .resumo-faixa-apply { opacity: 1; }

/* Gradientes de gravidade (críticos → plenos) */
.resumo-dot.lv-critico { background: #c2410c; }
.resumo-bar.lv-critico { background: linear-gradient(90deg, #ea580c, #c2410c); }
.resumo-dot.lv-baixo   { background: #d97706; }
.resumo-bar.lv-baixo   { background: linear-gradient(90deg, #f59e0b, #d97706); }
.resumo-dot.lv-medio   { background: #ca8a04; }
.resumo-bar.lv-medio   { background: linear-gradient(90deg, #eab308, #ca8a04); }
.resumo-dot.lv-alto    { background: #65a30d; }
.resumo-bar.lv-alto    { background: linear-gradient(90deg, #84cc16, #65a30d); }
.resumo-dot.lv-pleno   { background: #16a34a; }
.resumo-bar.lv-pleno   { background: linear-gradient(90deg, #22c55e, #16a34a); }
.resumo-dot.lv-neutro  { background: var(--text-3); }
.resumo-bar.lv-neutro  { background: var(--text-3); }


/* ============================================================
 * Usuários (v8.12.0) — Tela de gerenciamento
 * ============================================================ */
.view-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
  gap: 14px;
}
.view-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.view-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}
.filtros-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.filtros-row .input {
  flex: 1;
  min-width: 180px;
}
.filtros-row select.input {
  flex: 0 0 auto;
  width: auto;
  min-width: 160px;
}
.loading-msg {
  text-align: center;
  padding: 24px;
  color: var(--text-3);
  font-style: italic;
}
.row-inativo {
  opacity: .55;
}
.row-inativo code,
.row-inativo td:not(:last-child) {
  text-decoration: line-through;
  text-decoration-color: var(--text-3);
}
.senha-display {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 4px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 6px;
  justify-content: space-between;
}
.senha-display code {
  font-family: 'Courier New', monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--primary);
  user-select: all;
}
.form-group {
  margin-bottom: 12px;
}
.form-group label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--text-2);
  margin-bottom: 4px;
  font-weight: 600;
}
.form-group .input {
  width: 100%;
}
.input {
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
}
.input:focus {
  outline: none;
  border-color: var(--primary);
}
.input:disabled {
  opacity: .55;
  cursor: not-allowed;
  background: var(--surface-2);
}


/* ============================================================
 * Relatórios (F2 — v8.11.0)
 * ============================================================ */
.rel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 14px;
  margin-top: 4px;
}
.rel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
}
.rel-card-titulo {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  border-left: 3px solid var(--primary);
  padding-left: 10px;
  margin-left: -2px;
}
.rel-card-desc {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-2);
}
.rel-card-acoes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}
.rel-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  transition: transform .06s ease, background .1s ease, border-color .1s ease;
}
.rel-btn:hover {
  background: var(--surface);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.rel-btn:active { transform: translateY(0); }
.rel-btn-icone {
  font-size: 20px;
  line-height: 1;
}
.rel-btn-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.rel-btn-rotulo {
  font-size: 13px;
  font-weight: 600;
}
.rel-btn-hint {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.3;
}
.rel-btn-pdf  .rel-btn-rotulo { color: var(--danger); }
.rel-btn-xlsx .rel-btn-rotulo { color: var(--ok); }
.rel-btn-loading {
  pointer-events: none;
  opacity: .8;
}
.rel-btn-loading .rel-btn-icone {
  animation: rel-spin 1.4s linear infinite;
  display: inline-block;
}
@keyframes rel-spin {
  to { transform: rotate(360deg); }
}
.rel-rodape {
  margin-top: 18px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: 6px;
  border-left: 3px solid var(--primary);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-2);
}
.rel-rodape b { color: var(--text); }


/* ============================================================
 * Roteirização (v8.13.0)
 * ============================================================ */
.rot-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 14px;
}
@media (max-width: 1100px) {
  .rot-layout { grid-template-columns: 1fr; }
}
.rot-controle-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.rot-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--text-3);
}
.rot-label-check {
  flex-direction: row;
  align-items: center;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  color: var(--text-2);
  gap: 6px;
}
.rot-resumo, .rot-tabela {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.rot-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.rot-kpi {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 6px;
  text-align: center;
}
.rot-kpi-warn {
  background: #ffe4d6;
  border-color: #ea580c;
}
.rot-kpi-label {
  font-size: 9px;
  text-transform: uppercase;
  color: var(--text-3);
  letter-spacing: .3px;
}
.rot-kpi-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.rot-kpi-hint {
  font-size: 10px;
  color: #c2410c;
  margin-top: 2px;
}
.rot-section-title {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-3);
  letter-spacing: .3px;
  margin: 6px 0 8px 0;
  font-weight: 600;
}
.rot-resumo-tabela {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.rot-resumo-tabela th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  padding: 4px 6px;
}
.rot-resumo-tabela td {
  padding: 6px;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.rot-resumo-row { cursor: pointer; }
.rot-resumo-row:hover { background: var(--surface-2); }
.rot-row-ativa { background: rgba(139, 99, 50, 0.12); }
.rot-row-ativa td { font-weight: 600; }
.rot-row-todas { text-align: center; font-style: italic; }
.rot-dia-semana {
  font-size: 10px;
  color: var(--text-3);
  margin-left: 4px;
}
.td-num { text-align: right; font-variant-numeric: tabular-nums; }
.badge-urg {
  display: inline-block;
  background: #c2410c;
  color: #fff;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
}
.badge-manual {
  display: inline-block;
  background: #d97706;
  color: #fff;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
}
/* v8.15.0 — radio-row pro modal de limpar planejamento */
.radio-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}
.radio-row input[type="radio"]:disabled + span {
  color: var(--text-3);
  cursor: not-allowed;
}
.radio-row input[type="radio"] {
  margin-top: 3px;
}
.badge-sem-data {
  display: inline-block;
  background: var(--text-3);
  color: #fff;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
}
/* v8.14.1 — badge "+N" do estouro de capacidade */
.badge-estouro {
  display: inline-block;
  background: #d97706;
  color: #fff;
  padding: 1px 6px;
  margin-left: 4px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
}
.rot-resumo-row.rot-row-estouro {
  background: rgba(217, 119, 6, 0.06);
}
.rot-tabela-wrap {
  overflow-x: auto;
  max-height: 70vh;
}
.rot-faturas {
  font-size: 12px;
}
.rot-faturas th {
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.rot-row-urgente td {
  /* v8.115.1 — era rgba(234,88,12,.06) (laranja/salmão, destoava do índigo).
     Índigo claro (mesmo tom do fundo dos cards) — sinaliza sem brigar. */
  background: rgba(79, 70, 229, 0.06) !important;
}
.badge-dia {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  margin-right: 2px;
  color: var(--text-2);
}
.banner-success {
  background: rgba(77, 112, 40, 0.12);
  border-left: 3px solid var(--ok);
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 13px;
}


/* ============================================================
 * Dashboard (v8.10.0) — Saúde do planejamento + Alertas + Admin
 * ============================================================ */
.dash-section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.dash-section-title > span:last-child {
  font-weight: 400;
  font-size: 11px;
}
.dash-subtitle {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  margin: 0 0 8px 0;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.dash-kpi {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.dash-kpi-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 4px;
}
.dash-kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.dash-kpi-attn { border-left: 3px solid var(--warn); }
.dash-kpi-ok   { border-left: 3px solid var(--ok); }

/* ===== v8.83.1 — Reservas GSnet (compacto, pegada Estoque IBL) ===== */
.rg-wrap { font-size: 12.5px; }
.rg-wrap .view-header h2 { font-size: 17px; }
.rg-wrap .toolbar { padding: 8px 10px; gap: 8px; }
.rg-wrap .toolbar input, .rg-wrap .toolbar select {
  font-size: 12px; padding: 5px 9px; border-radius: 7px; }
.rg-wrap .counter { font-size: 11px; }
/* KPIs compactos com faixa colorida à esquerda (estilo IBL: valor 18px) */
.rg-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 9px; margin-bottom: 12px; }
.rg-kpi { background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--border-2); border-radius: var(--radius); padding: 8px 11px; }
.rg-kpi .v { font-size: 18px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums; line-height: 1.15; }
.rg-kpi .l { font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .3px; color: var(--text-3); margin-top: 2px; }
.rg-kpi-sub { font-size: 11px; color: var(--text-2); margin-top: 2px;
  font-variant-numeric: tabular-nums; }
.rg-kpi.ac { border-left-color: var(--primary); }
.rg-kpi.ok { border-left-color: var(--ok); }
.rg-kpi.pu { border-left-color: var(--accent); }
.rg-kpi.wn { border-left-color: var(--warn); }
/* tabela compacta (11.5px, cabeçalho suave, hover sutil) */
.tbl-rg { font-size: 11.5px; }
.tbl-rg th { padding: 6px 8px; background: var(--surface-2); color: var(--text-2);
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .2px;
  border-bottom: 2px solid var(--border); }
.tbl-rg td { padding: 5px 8px; border-bottom: 1px solid var(--border); }
.tbl-rg tbody tr:hover td { background: color-mix(in srgb, var(--primary) 7%, var(--surface)); }
/* linhas de item injetadas sob o documento (explosão doc → itens) */
.tbl-rg tr.rg-item-row td { background: var(--surface-2); border-top: none; padding: 3px 8px; }
.tbl-rg tr.rg-item-row:hover td { background: var(--surface-2); }
.tbl-rg tr.rg-item-row .rg-item-cell { padding-left: 22px; color: var(--text-2); }
.tbl-rg tr.rg-item-row .rg-item-cell b { color: var(--text); }
/* badge de dias (ergonomia visual — NÃO é métrica de atraso) */
.rg-dias { display: inline-block; min-width: 26px; text-align: center; padding: 1px 6px;
  border-radius: 10px; font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rg-dias-0 { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.rg-dias-1 { background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary); }
.rg-dias-2 { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.rg-dias-3 { background: color-mix(in srgb, var(--danger) 20%, transparent); color: var(--danger); }
/* gráficos: cards e barras horizontais */
.rg-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.rg-charts .card h3 { font-size: 13px; margin: 2px 0 12px; }
.rg-bars { display: flex; flex-direction: column; gap: 6px; }
.rg-bar-row { display: grid; grid-template-columns: minmax(110px, 170px) 1fr 60px;
  align-items: center; gap: 10px; font-size: 11.5px; border-radius: 5px; padding: 1px 3px; }
.rg-bar-label { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rg-bar-track { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; height: 15px; overflow: hidden; }
.rg-bar-fill { height: 100%; border-radius: 5px; background: var(--primary); min-width: 2px; }
.rg-bar-fill.rg-dias-0 { background: var(--ok); }
.rg-bar-fill.rg-dias-1 { background: var(--primary); }
.rg-bar-fill.rg-dias-2 { background: var(--warn); }
.rg-bar-fill.rg-dias-3 { background: var(--danger); }
.rg-bar-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
/* v8.84.0 — Conciliação de reservas (planilha × docs) */
.rg-cc-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.rg-cc-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.rg-cc-chip { cursor: pointer; font-size: 12px; padding: 5px 11px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); }
.rg-cc-chip b { color: var(--text); font-variant-numeric: tabular-nums; }
.rg-cc-chip.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; color: var(--text); }
.rg-cc-badge { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 9px; border-radius: 11px; }
.rg-cc-badge.rg-cc-aj { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.rg-cc-badge.rg-cc-cc { background: color-mix(in srgb, var(--danger) 20%, transparent); color: var(--danger); }
.rg-cc-badge.rg-cc-ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.rg-cc-badge.rg-cc-sa { background: color-mix(in srgb, var(--text-3) 22%, transparent); color: var(--text-2); }
.rg-cc-multi { display: inline-block; font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }

/* Ações (v8.85.0) — criar / ajustar / cancelar (individual + lote) */
.rg-ac-wrap { display: flex; flex-direction: column; gap: 14px; padding: 4px 0; }
.rg-ac-warn { font-size: 12px; padding: 9px 13px; border-radius: 9px;
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.rg-ac-card { border: 1px solid var(--border); border-radius: 11px; padding: 14px 16px;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.rg-ac-h { font-weight: 700; font-size: 13.5px; margin-bottom: 12px; color: var(--text); }
.rg-ac-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.rg-ac-field { display: flex; flex-direction: column; gap: 4px; }
.rg-ac-field > label { font-size: 10px; font-weight: 700; letter-spacing: .4px;
  text-transform: uppercase; color: var(--text-3); padding-left: 2px; }
.rg-ac-field > select, .rg-ac-field > input {
  height: 38px; padding: 0 11px; font-size: 13px; box-sizing: border-box; color: var(--text);
  border: 1px solid var(--border-2); border-radius: 8px; background: var(--surface);
  transition: border-color .15s, box-shadow .15s; }
.rg-ac-field > select:focus, .rg-ac-field > input:focus { outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.rg-ac-field.rg-ac-grow { flex: 0 1 300px; min-width: 180px; max-width: 320px; }
.rg-ac-field.rg-ac-qt { width: 96px; }
.rg-ac-sel-ok     { border-color: color-mix(in srgb, var(--ok) 60%, var(--border-2)) !important; }
.rg-ac-sel-danger { border-color: color-mix(in srgb, var(--danger) 55%, var(--border-2)) !important; }

/* botões de ação — cheios de cor, altura alinhada aos campos */
.rg-ac-go { height: 38px; padding: 0 20px; border: none; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 600; white-space: nowrap; color: #fff; background: var(--primary);
  transition: background .15s, opacity .15s; display: inline-flex; align-items: center; gap: 6px; }
.rg-ac-go:hover:not(:disabled) { background: var(--primary-2); }
.rg-ac-go:disabled { opacity: .45; cursor: not-allowed; }
.rg-ac-go-ok      { background: var(--ok); }
.rg-ac-go-ok:hover:not(:disabled)      { background: color-mix(in srgb, var(--ok) 82%, black); }
.rg-ac-go-danger  { background: var(--danger); }
.rg-ac-go-danger:hover:not(:disabled)  { background: color-mix(in srgb, var(--danger) 82%, black); }
.rg-ac-go.sec { background: transparent; color: var(--primary); text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--primary) 45%, var(--border-2)); }
.rg-ac-go.sec:hover { background: color-mix(in srgb, var(--primary) 12%, transparent); }

/* arquivo estilizado (esconde o input cru) */
.rg-ac-file { display: inline-flex; align-items: center; height: 38px; padding: 0 14px; max-width: 240px;
  border: 1px dashed var(--border-2); border-radius: 8px; cursor: pointer; font-size: 12.5px;
  color: var(--text-2); background: var(--surface); }
.rg-ac-file:hover { border-color: var(--primary); color: var(--text); }
.rg-ac-file input[type="file"] { display: none; }
.rg-ac-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rg-ac-lote { align-items: center; }

.rg-ac-avisos { font-size: 11.5px; color: var(--warn); margin: 4px 0 8px; max-height: 120px; overflow: auto; }
.rg-ac-bar { height: 8px; border-radius: 6px; overflow: hidden; margin-bottom: 4px;
  background: color-mix(in srgb, var(--border) 45%, transparent); }
.rg-ac-bar i { display: block; height: 100%; background: var(--primary); transition: width .3s; }
.rg-ac-done { font-weight: 600; color: var(--ok); margin: 8px 0; }

/* Ações INLINE na aba Itens (v8.86.0) — ajustar / excluir por linha.
   O nº do documento vem da própria linha, sem adivinhação. */
.rg-itacts { white-space: nowrap; }
.rg-itact { height: 26px; padding: 0 9px; margin-right: 5px; border-radius: 7px; cursor: pointer;
  font-size: 11.5px; font-weight: 600; line-height: 24px; display: inline-block;
  border: 1px solid transparent; transition: background .13s, border-color .13s, color .13s; }
.rg-itact:last-child { margin-right: 0; }
.rg-itact-aj { color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent);
  border-color: color-mix(in srgb, var(--primary) 32%, transparent); }
.rg-itact-aj:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.rg-itact-ex { color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, transparent);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.rg-itact-ex:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* Modais das ações inline (ajustar / excluir) */
.rg-mform { display: flex; flex-direction: column; gap: 9px; }
.rg-mline { display: flex; justify-content: space-between; gap: 14px; font-size: 13px;
  padding-bottom: 7px; border-bottom: 1px dashed var(--border); }
.rg-mline > span { color: var(--text-3); font-weight: 600; }
.rg-mline > b { text-align: right; color: var(--text); }
.rg-mfield { display: flex; flex-direction: column; gap: 5px; font-size: 11px; font-weight: 700;
  letter-spacing: .3px; text-transform: uppercase; color: var(--text-3); margin-top: 4px; }
.rg-mfield > input { height: 40px; padding: 0 12px; font-size: 15px; font-weight: 600; text-transform: none;
  letter-spacing: 0; color: var(--text); border: 1px solid var(--border-2); border-radius: 9px; background: var(--surface); }
.rg-mfield > input:focus { outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.rg-mnote { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.rg-mwarn { font-size: 12.5px; padding: 9px 12px; border-radius: 9px; color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 32%, transparent); }

/* resultado da ação (no modal de progresso) + rodapé "em breve" da aba Ações */
.rg-ac-warn2 { color: var(--warn) !important; }
.rg-ok { color: var(--ok); }
.rg-skip { color: var(--text-3); }
.rg-err { color: var(--danger); }
.rg-ac-soon { font-size: 12.5px; color: var(--text-3); padding: 2px 2px 4px; }

/* Entradas GSnet (v8.87.0 / layout v8.99.0) — nota de segurança + barra de filtro */
.eg-note { display: flex; align-items: flex-start; gap: 9px; font-size: 12px; color: var(--text-2);
  padding: 10px 13px; margin: 2px 0 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--warn); }
.eg-note .eg-note-ico { flex: 0 0 auto; color: var(--warn); font-size: 14px; line-height: 1.25; }
.eg-note b { color: var(--text); }
.eg-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 2px 0 12px; }
.eg-tb-label { font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase;
  color: var(--text-3); }
.eg-toolbar select { height: 38px; min-width: 240px; padding: 0 12px; font-size: 13px; box-sizing: border-box;
  color: var(--text); border: 1px solid var(--border-2); border-radius: 8px; background: var(--surface);
  transition: border-color .15s, box-shadow .15s; }
.eg-toolbar select:focus { outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.eg-toolbar .btn { height: 38px; box-sizing: border-box; display: inline-flex; align-items: center;
  gap: 6px; padding: 0 16px; font-size: 13px; }
.eg-captura { font-size: 12px; color: var(--text-2); margin-left: 4px; }

/* Entradas GSnet (v8.87.0) — barra de ações da seleção */
.eg-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; margin: 4px 0 10px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px; }
.eg-selall { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  font-weight: 600; color: var(--text-2); cursor: pointer; }
.eg-selall input, .eg-chk { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }
#eg-acao-job:not(:empty) { margin: 4px 0 12px; }
/* doc multi-item: link "▸ N itens" + linhas dos itens expandidas */
.eg-toggle { cursor: pointer; color: var(--primary); font-weight: 600; }
.eg-toggle:hover { text-decoration: underline; }
.eg-toggle .caret { display: inline-block; font-size: 10px; }
.eg-item-row > td { background: color-mix(in srgb, var(--surface-2) 60%, transparent);
  font-size: 12px; color: var(--text-2); padding-top: 4px; padding-bottom: 4px; }

.dash-progress-row {
  margin: 14px 0 6px 0;
}
.dash-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 4px;
}
.dash-progress-pct {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.dash-progress-bar {
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.dash-progress-fill {
  height: 100%;
  transition: width .4s ease;
}
.bar-ok   { background: var(--ok); }
.bar-warn { background: var(--warn); }
.bar-crit { background: var(--danger); }

.dash-fases {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.dash-fase-pill {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 12px;
}
.dash-fase-tag {
  font-weight: 700;
  color: var(--primary);
  font-size: 11px;
}
.dash-fase-num {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* Alertas */
.dash-alertas { /* card já cobre o padding */ }
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.alert-item.alert-warn {
  border-left: 3px solid var(--warn);
}
.alert-item.alert-info {
  border-left: 3px solid var(--text-3);
}
.alert-icon {
  font-size: 18px;
  line-height: 1;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.alert-warn .alert-icon { color: var(--warn); }
.alert-info .alert-icon { color: var(--text-2); }
.alert-body {
  flex: 1;
  min-width: 0;
}
.alert-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.alert-msg {
  font-size: 12px;
  color: var(--text-2);
}

/* Admin: top SIAFs / top unidades em 2 colunas */
.dash-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 14px;
}
@media (max-width: 800px) {
  .dash-grid-2col { grid-template-columns: 1fr; }
}
.dash-top-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dash-top-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid transparent;
}
.dash-top-item:hover { border-color: var(--border); }
.dash-top-rank {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--surface);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dash-top-body {
  flex: 1;
  min-width: 0;
}
.dash-top-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-top-num {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* Versão + ambiente no rodapé da sidebar (v8.10.1) */
.sidebar-version {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-3);
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: .3px;
}
.sidebar-version:empty {
  display: none;
}
.sidebar-version .ver-tag {
  font-weight: 600;
  color: var(--text-2);
}
.sidebar-version .ver-amb-homolog {
  display: inline-block;
  background: #ffd84d;
  color: #4a3500;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 700;
  font-size: 9px;
  letter-spacing: .5px;
}

/* v8.15.0 — Análise de Atendimento (matriz autonomia × coef) */
.aa-matriz-wrap {
  overflow-x: auto;
}
.aa-matriz-table {
  border-collapse: collapse;
  margin: 0 auto;
  font-size: 13px;
}
.aa-matriz-table th, .aa-matriz-table td {
  border: 1px solid var(--border);
  padding: 10px 14px;
  text-align: center;
  min-width: 80px;
}
.aa-matriz-table .aa-corner {
  background: var(--bg-2);
  font-size: 11px;
  color: var(--text-2);
  font-weight: 700;
  padding: 6px 10px;
}
.aa-matriz-table .aa-header-col,
.aa-matriz-table .aa-header-row {
  background: var(--bg-2);
  font-weight: 700;
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
}
.aa-matriz-table .aa-cell {
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  background: var(--bg-1);
}
.aa-matriz-table .aa-cell:hover {
  transform: scale(1.05);
  box-shadow: 0 0 0 2px var(--accent);
  z-index: 2;
  position: relative;
}
.aa-matriz-table .aa-cell-critico {
  background: #FCA5A5 !important;
  color: #7f1d1d;
}

/* ============================================================================ */
/* v8.16.0 — Medex (cards de import) e Mapa de Entregas                          */
/* ============================================================================ */

/* Banner "Medex não importado" */
.banner-medex-faltando {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  background: linear-gradient(to right, #fff3c4, #fff9e3);
  border: 1px solid #f0c25a;
  border-radius: 6px;
  color: #6a4d00;
}
.banner-medex-faltando > span:first-child {
  font-size: 22px;
  line-height: 1;
}

/* Card específico do Medex (diferenciado visualmente do base/estoque) */
.import-card-medex {
  border-left: 3px solid #7a5af8;
}
.import-card-medex .import-card-title::before {
  content: "💊 ";
}

/* Avisos clicáveis (cards expansíveis) */
.import-avisos {
  margin-top: 10px;
}
.import-avisos-header {
  margin-bottom: 8px;
  color: var(--warn);
}
.aviso-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: var(--bg-1);
  transition: background 0.15s;
}
.aviso-card:hover {
  background: var(--bg-2);
}
.aviso-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.aviso-icone {
  color: var(--warn);
  font-size: 14px;
}
.aviso-msg {
  flex: 1;
  font-size: 13px;
}
.aviso-toggle {
  border: 1px solid var(--border);
  background: transparent;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-2);
}
.aviso-toggle:hover {
  background: var(--bg-2);
}
.aviso-toggle .chev {
  display: inline-block;
  margin-left: 3px;
  font-size: 10px;
}
.aviso-detalhe {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.aviso-items-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}
.aviso-item-chip {
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-family: var(--mono, monospace);
  color: var(--text-2);
}
/* v8.20.1 — badge de fonte do nome no Catálogo (quando vem do fallback) */
.nome-fonte-badge {
  display: inline-block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 1px 5px;
  border-radius: 8px;
  margin-left: 4px;
  font-weight: 600;
}
.nome-fonte-base {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}
.nome-fonte-estoque {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* v8.20.0 — headers clicáveis pra ordenar na Grade Completa */
.th-sortable {
  cursor: pointer;
  user-select: none;
}
.th-sortable:hover {
  background: var(--bg-2);
}
.sort-ind {
  font-size: 9px;
  color: var(--text-3);
  margin-left: 2px;
}
.sort-ind.active {
  color: var(--primary, #2563eb);
  font-weight: 700;
}

/* v8.20.0 — avisos com nome do item (siafs_sem_mapeamento, estoque_sem_siaf) */
.aviso-item-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 2px 8px 2px 4px;
  border-radius: 12px;
  font-size: 11px;
}
.aviso-item-row .aviso-item-chip {
  background: transparent;
  border: none;
  padding: 0 4px 0 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
}
.aviso-item-nome {
  color: var(--text-2);
  font-size: 11px;
}

/* Modal de divergências do Medex */
.medex-div-modal {
  max-height: 70vh;
  overflow-y: auto;
}
.medex-div-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.div-sec {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.div-sec.ok {
  background: var(--bg-1);
  opacity: 0.7;
}
.div-sec-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.div-sec-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
}
.div-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  background: var(--bg-1);
  border-radius: 4px;
  font-size: 12px;
}
.div-item code {
  background: var(--bg-2);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--mono, monospace);
}

/* Tag info (azul/roxo claro) */
.tag-info {
  background: #e9e5fc;
  color: #5b3fcb;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

/* ============================================================================ */
/* Mapa de Entregas                                                              */
/* ============================================================================ */
.mapa-kpis {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
}
.mapa-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mapa-kpi-lbl {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-3);
  letter-spacing: 0.5px;
}
.mapa-kpi-val {
  font-size: 18px;
  font-weight: 600;
}
.mapa-exports {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.mapa-tabela-wrap {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: auto;
  max-height: 75vh;
}
.mapa-tabela {
  border-collapse: collapse;
  font-size: 12px;
  width: 100%;
}
.mapa-tabela thead th {
  background: #FFEB9C;
  color: #5a4400;
  font-weight: 700;
  font-size: 11px;
  padding: 6px 4px;
  text-align: center;
  border: 1px solid #d0c089;
  position: sticky;
  top: 0;
  z-index: 3;
}
.mapa-tabela thead th.mapa-fixo {
  position: sticky;
  z-index: 4;
}
.mapa-tabela thead th.mapa-fixo:nth-child(1) { left: 0; }
.mapa-tabela thead th.mapa-fixo:nth-child(2) { left: 110px; }
.mapa-tabela thead th.mapa-fixo:nth-child(3) { left: 280px; }
.mapa-tabela thead th.mapa-fixo:nth-child(4) { left: 320px; }
.mapa-tabela tbody td {
  border: 1px solid var(--border);
  padding: 4px 6px;
  white-space: nowrap;
}
.mapa-tabela tbody td.mapa-fixo {
  background: var(--bg-1);
  position: sticky;
  z-index: 2;
  font-weight: 500;
}
.mapa-tabela tbody td.mapa-fixo:nth-child(1) { left: 0; width: 110px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.mapa-tabela tbody td.mapa-fixo:nth-child(2) { left: 110px; width: 170px; max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.mapa-tabela tbody td.mapa-fixo:nth-child(3) { left: 280px; width: 40px; text-align: center; }
.mapa-tabela tbody td.mapa-fixo.mapa-total { left: 320px; width: 50px; text-align: center; background: var(--bg-2); }

.mapa-tabela tbody tr:nth-child(even) td.mapa-fixo {
  background: var(--bg-2);
}
.mapa-tabela td.mapa-drs {
  font-size: 11px;
  color: var(--text-2);
}
.mapa-tabela td.mapa-cel {
  text-align: center;
  font-weight: 600;
  font-size: 12px;
  cursor: default;
  transition: outline 0.1s;
}
.mapa-tabela td.mapa-cel-com {
  cursor: pointer;
}
.mapa-tabela td.mapa-cel-com:hover {
  outline: 2px solid var(--accent, #4a90e2);
  outline-offset: -2px;
  z-index: 1;
}

.mapa-cel-detalhe {
  min-width: 600px;
}
.mapa-cel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.mapa-cel-stats {
  margin-bottom: 14px;
}

/* ============================================================================ */
/* v8.16.0 — Popover de origem do consumo (Grade Completa)                       */
/* ============================================================================ */
.btn-link-consumo {
  background: transparent;
  border: none;
  border-bottom: 1px dashed var(--text-3);
  padding: 0 2px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-link-consumo:hover {
  background: var(--bg-2);
  border-bottom-color: var(--accent, #4a90e2);
}
.origem-flag-medex {
  color: #7a5af8;
  font-size: 10px;
}

.origem-consumo-modal {
  min-width: 500px;
}
.origem-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.origem-resultado {
  text-align: right;
}
.origem-resultado-val {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent, #4a90e2);
  font-variant-numeric: tabular-nums;
}
.origem-aviso-medex {
  background: linear-gradient(to right, #f3eefe, #faf9ff);
  border: 1px solid #d6c8fc;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 12px;
  color: #4a3a8f;
  margin-bottom: 14px;
}
.origem-candidatos {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.origem-candidato {
  display: grid;
  grid-template-columns: 1fr 110px 150px;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-1);
  transition: all 0.1s;
}
.origem-candidato.venceu {
  border-color: var(--ok, #4caf50);
  background: linear-gradient(to right, #f0fdf4, var(--bg-1));
  box-shadow: 0 0 0 1px var(--ok, #4caf50);
}
.origem-candidato-rotulo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.origem-candidato-valor {
  text-align: right;
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.origem-candidato-fonte {
  text-align: right;
  font-family: var(--mono, monospace);
  font-size: 10px;
}

/* Botão link (texto) — usado no Ver mapa → */
.btn-link {
  background: transparent;
  border: none;
  color: var(--accent, #4a90e2);
  cursor: pointer;
  padding: 4px 8px;
  font: inherit;
  text-decoration: none;
}
.btn-link:hover {
  text-decoration: underline;
}

/* ============================================================ */
/* v8.17.0 — Modal alargado (wide: true) — pra modais com tabela */
/* ============================================================ */
.modal-box.modal-wide {
  width: 720px;
}
@media (max-width: 800px) {
  .modal-box.modal-wide { width: 95vw; }
}

/* v8.17.0 — Hint explicativo da autonomia em Exportar D1 */
.resumo-card-hint {
  padding: 8px 14px 12px;
  font-size: 12px;
  color: var(--text-3);
  font-style: italic;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 10px;
}

/* ============================================================ */
/* v8.17.0 — REFINAMENTOS DO TEMA SOFT MODERN                   */
/* ============================================================ */
/* Estratégia: todos os seletores prefixados com [data-theme="soft"]
   pra zero impacto nos outros 3 temas (sepia/light/dark).         */

/* --- Tipografia: usa Inter no Soft --- */
[data-theme="soft"] body {
  font-family: var(--soft-font);
  font-size: 13.5px;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
[data-theme="soft"] code,
[data-theme="soft"] .mono {
  font-family: var(--soft-mono);
}

/* --- Sidebar: visual de produto moderno --- */
[data-theme="soft"] .sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
}
[data-theme="soft"] .sidebar-brand {
  border-bottom: 1px solid var(--border);
  padding: 16px 18px 14px;
}
[data-theme="soft"] .sidebar-brand-name {
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 14.5px;
}
[data-theme="soft"] .sidebar-brand-sub {
  color: var(--text-3);
  font-weight: 400;
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
}
[data-theme="soft"] .sidebar-section {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-3);
  padding: 14px 18px 6px;
}
[data-theme="soft"] .sidebar-item {
  margin: 1px 8px;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 450;
  color: var(--text-2);
  transition: background 0.12s, color 0.12s;
}
[data-theme="soft"] .sidebar-item:hover:not(.disabled) {
  background: var(--surface-2);
  color: var(--text);
}
[data-theme="soft"] .sidebar-item.active {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 550;
}
[data-theme="soft"] .sidebar-item.disabled {
  color: var(--text-3);
  opacity: 0.55;
}

/* --- Topbar --- */
[data-theme="soft"] .topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}

/* --- Cards genéricos: bordas arredondadas + sombra sutil --- */
[data-theme="soft"] .card {
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  background: var(--surface);
}
[data-theme="soft"] .card:hover { box-shadow: var(--shadow-lg); transition: box-shadow .15s; }

/* --- Botões: arredondados, primário em roxo, sem peso 700 --- */
[data-theme="soft"] .btn,
[data-theme="soft"] .btn-ok,
[data-theme="soft"] .btn-primary,
[data-theme="soft"] .btn-danger {
  border-radius: 7px;
  font-weight: 500;
  font-family: var(--soft-font);
  letter-spacing: -0.005em;
  transition: all 0.12s;
}
[data-theme="soft"] .btn {
  background: var(--surface);
  border: 1px solid var(--border-2);
  color: var(--text);
}
[data-theme="soft"] .btn:hover { background: var(--surface-2); }
[data-theme="soft"] .btn-primary {
  background: var(--primary);
  color: white;
  border: 1px solid var(--primary);
}
[data-theme="soft"] .btn-primary:hover { background: var(--primary-2); filter: none; }
[data-theme="soft"] .btn-ok {
  background: var(--ok);
  color: white;
  font-weight: 500;
}

/* --- Inputs e selects: bordas suaves, focus ring roxo --- */
[data-theme="soft"] input[type="text"],
[data-theme="soft"] input[type="number"],
[data-theme="soft"] input[type="date"],
[data-theme="soft"] input[type="email"],
[data-theme="soft"] input[type="password"],
[data-theme="soft"] textarea,
[data-theme="soft"] select {
  border: 1px solid var(--border-2);
  border-radius: 7px;
  background: var(--surface);
  font-family: var(--soft-font);
  transition: border-color 0.12s, box-shadow 0.12s;
}
[data-theme="soft"] input[type="text"]:focus,
[data-theme="soft"] input[type="number"]:focus,
[data-theme="soft"] input[type="date"]:focus,
[data-theme="soft"] textarea:focus,
[data-theme="soft"] select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

/* --- Tags / badges --- */
[data-theme="soft"] .tag {
  border-radius: 5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  padding: 2px 8px;
  font-size: 11.5px;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
[data-theme="soft"] .tag.tag-ok       { background: #DCFCE7; color: #15803D; border-color: transparent; }
[data-theme="soft"] .tag.tag-warn     { background: #FED7AA; color: #9A3412; border-color: transparent; }
[data-theme="soft"] .tag.tag-danger   { background: #FEE2E2; color: #B91C1C; border-color: transparent; }
[data-theme="soft"] .tag.tag-info,
[data-theme="soft"] .tag.tag-primary  { background: var(--primary-bg); color: var(--primary); border-color: transparent; }

/* --- Modais: bordas mais arredondadas --- */
[data-theme="soft"] .modal-box {
  border-radius: 12px;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
}
[data-theme="soft"] .modal-header {
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* --- Avisos e cards de importação --- */
[data-theme="soft"] .aviso-card {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
[data-theme="soft"] .aviso-card:hover {
  background: var(--surface);
  border-color: var(--border-2);
}
[data-theme="soft"] .aviso-toggle {
  border-radius: 5px;
  font-weight: 500;
}
[data-theme="soft"] .import-card-medex {
  border-left: 3px solid var(--primary);
}
[data-theme="soft"] .banner-medex-faltando {
  background: linear-gradient(to right, #FEF3C7, #FFF7E6);
  border: 1px solid #F0C25A;
  border-radius: 8px;
  color: #6A4D00;
}
[data-theme="soft"] .aviso-item-chip {
  background: var(--surface);
  border-color: var(--border);
  border-radius: 12px;
  font-family: var(--soft-mono);
}

/* --- Tabelas: zebra mais sutil, hover suave --- */
[data-theme="soft"] table thead th {
  background: var(--surface-2);
  color: var(--text-3);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
}
[data-theme="soft"] table tbody tr:hover td {
  background: var(--surface-2);
}

/* --- Dashboard: KPI cards --- */
[data-theme="soft"] .dash-kpi,
[data-theme="soft"] .kpi-card,
[data-theme="soft"] .kpi {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* --- Toasts --- */
[data-theme="soft"] .toast {
  border-radius: 8px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
}

/* --- Chips de filtro / pílulas de status --- */
[data-theme="soft"] .chip {
  border-radius: 999px;
  font-weight: 500;
  font-size: 12px;
}

/* --- Pagination buttons --- */
[data-theme="soft"] .pag-btn,
[data-theme="soft"] .btn-mini {
  border-radius: 6px;
  border: 1px solid var(--border-2);
}

/* --- Atalho: usar JetBrains Mono em todos os <code> e SIAFs --- */
[data-theme="soft"] code,
[data-theme="soft"] .siaf-cell,
[data-theme="soft"] .mono-cell {
  font-family: var(--soft-mono);
  font-size: 12px;
}

/* --- Empty state --- */
[data-theme="soft"] .empty-state {
  border-radius: 10px;
  border: 1px dashed var(--border-2);
  background: var(--surface);
}
[data-theme="soft"] .empty-state-title {
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* --- Origem do consumo modal (refinos) --- */
[data-theme="soft"] .origem-candidato {
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 10px 14px;
  background: var(--surface);
}
[data-theme="soft"] .origem-candidato.venceu {
  border-color: var(--ok);
  background: linear-gradient(to right, #F0FDF4, var(--surface));
  box-shadow: 0 0 0 1px var(--ok);
}

/* --- Cobertura barra: cores mais saturadas no soft --- */
[data-theme="soft"] .cov-pleno   { background: #16A34A; }
[data-theme="soft"] .cov-alto    { background: #84CC16; }
[data-theme="soft"] .cov-medio   { background: #EAB308; }
[data-theme="soft"] .cov-baixo   { background: #F97316; }
[data-theme="soft"] .cov-critico { background: #DC2626; }

/* --- Mapa de Entregas: cabeçalho amarelo mais suave --- */
[data-theme="soft"] .mapa-tabela thead th {
  background: #FEF3C7;
  color: #78350F;
}

/* --- Scrollbar (Chrome/Edge) sutil --- */
[data-theme="soft"] ::-webkit-scrollbar { width: 10px; height: 10px; }
[data-theme="soft"] ::-webkit-scrollbar-track { background: transparent; }
[data-theme="soft"] ::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 5px;
  border: 2px solid var(--bg);
}
[data-theme="soft"] ::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ================================================================
   Mapeamento de Faturas (v8.18.0)
   Sub-aba dentro de Faturas + modal de timeline + banner discreto.
   ================================================================ */

.banner-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  background: rgba(95,130,170,.10);
  border: 1px solid rgba(95,130,170,.30);
  color: var(--text-2);
}
.banner-info strong { color: var(--text-1); }
[data-theme="soft"] .banner-info {
  background: #EFF6FF;
  border-color: #BFDBFE;
  color: #1E3A8A;
}
[data-theme="soft"] .banner-info strong { color: #1E40AF; }

/* Timeline da fatura — lista vertical de eventos */
.timeline-list {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.timeline-list::before {
  /* linha vertical contínua */
  content: '';
  position: absolute;
  left: 9px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: var(--border-2);
}
.timeline-item {
  position: relative;
  padding: 10px 0 10px 32px;
  min-height: 24px;
}
.timeline-dot {
  position: absolute;
  left: 4px;
  top: 14px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg);
  z-index: 1;
}
.timeline-item:first-child .timeline-dot {
  background: var(--ok);
}
.timeline-content {
  line-height: 1.4;
}
.timeline-status {
  font-size: 14px;
  margin-bottom: 2px;
}
.timeline-meta {
  font-size: 12px;
}

/* ============================================================
   v8.90.1 — FIX hover: botão SÓLIDO colorido não pode "sumir" no hover.
   Os hovers genéricos (`.btn:hover` base e `[data-theme="soft"] .btn:hover`)
   trocam o fundo de QUALQUER `.btn` por uma cor CLARA (var(--border)/--surface-2).
   Em botão de texto branco isso vira texto branco sobre fundo claro = invisível
   (medido: "Gerar"/btn-ok no tema Soft dava contraste ~13). As variantes sólidas
   reafirmam fundo colorido + texto branco no hover, com specificity que vence o
   genérico (`.btn.btn-x:hover` = 0,3,0) e os temas (`[data-theme] .btn.btn-x:hover`
   = 0,4,0), no fim do arquivo pra ganhar empates de ordem. Botões de texto ESCURO
   (`.btn`, `.btn-sm`) não mudam. ============================================ */
.btn.btn-ok:hover,      [data-theme] .btn.btn-ok:hover      { background: var(--ok);        color: #fff; filter: brightness(1.08); }
.btn.btn-danger:hover,  [data-theme] .btn.btn-danger:hover  { background: var(--danger);    color: #fff; filter: brightness(1.08); }
.btn.btn-warn:hover,    [data-theme] .btn.btn-warn:hover    { background: var(--warn);      color: #fff; filter: brightness(1.08); }
.btn.btn-primary:hover, [data-theme] .btn.btn-primary:hover { background: var(--primary-2); color: #fff; }

/* Consistência do estado BASE no Soft: warn/danger caíam pro genérico
   `[data-theme="soft"] .btn` (fundo claro + texto escuro) por não terem override
   próprio no tema — perdiam a cor. Reafirma (e evita "pop" de cor no hover). */
[data-theme="soft"] .btn-warn   { background: var(--warn);   color: #fff; }
[data-theme="soft"] .btn-danger { background: var(--danger); color: #fff; }

/* ===== CESAF (v8.102.2) — aba Efetivar Faturas (2 colunas, aproveita a tela) ===== */
.cesaf-wrap { max-width: 1440px; margin: 0 auto; padding: 22px 24px 44px; }
.cesaf-badge { display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:700;
  color:var(--primary); background:var(--primary-bg);
  border:1px solid color-mix(in srgb,var(--primary) 30%,transparent); padding:4px 11px; border-radius:20px; }
.cesaf-wrap h2 { font-size:22px; margin:11px 0 4px; letter-spacing:-.01em; }
.cesaf-sub { color:var(--text-2); max-width:82ch; margin:4px 0 16px; font-size:12px; line-height:1.5;
  background:var(--surface); border:1px solid var(--line); border-left:3px solid var(--primary);
  border-radius:8px; padding:9px 13px; }
.cesaf-grid { display:grid; grid-template-columns:1.6fr 1fr; gap:20px; align-items:start; }
@media (max-width:980px){ .cesaf-grid { grid-template-columns:1fr; } }
.cesaf-col { display:flex; flex-direction:column; gap:18px; }
.cesaf-card { background:var(--surface); border:1px solid var(--line); border-radius:14px;
  box-shadow:0 1px 2px rgba(0,0,0,.03); overflow:hidden; }
.cesaf-ch { display:flex; align-items:center; gap:9px; padding:13px 18px; border-bottom:1px solid var(--line); background:var(--surface-2); }
.cesaf-ch .ic { width:22px; height:22px; display:grid; place-items:center; border-radius:7px; background:linear-gradient(180deg,#5b52ec,#4338ca); color:#fff; font-size:12px; font-weight:800; }
.cesaf-ch b { font-size:12.5px; font-weight:700; text-transform:uppercase; letter-spacing:.5px; color:var(--text-2); } .cesaf-ch .step, .cesaf-ch .cnt { margin-left:auto; font-size:11.5px; color:var(--text-3); }
.cesaf-ch .cnt { font-weight:600; }
.cesaf-ch .tmr { margin-left:auto; font-size:12.5px; font-weight:700; font-variant-numeric:tabular-nums;
  color:var(--primary); background:var(--primary-bg); padding:3px 9px; border-radius:14px; }
.cesaf-body { padding:14px; }
.cesaf-split { display:grid; grid-template-columns:1fr auto 1fr; gap:20px; align-items:stretch; }
@media (max-width:560px){ .cesaf-split { grid-template-columns:1fr; gap:14px; } }
.cesaf-zone label { display:block; font-size:11.5px; font-weight:700; text-transform:uppercase; letter-spacing:.03em; color:var(--text-3); margin-bottom:8px; }
.cesaf-drop { height:96px; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center;
  border:1.5px dashed color-mix(in srgb,var(--line) 45%,var(--text-3)); border-radius:10px; background:var(--surface-2); cursor:pointer; transition:.15s; padding:10px; }
.cesaf-drop:hover { border-color:var(--primary); background:var(--primary-bg); }
.cesaf-drop .up { font-size:22px; opacity:.65; line-height:1; }
.cesaf-drop .t { font-weight:600; margin-top:4px; font-size:13px; }
.cesaf-drop .h { font-size:12px; color:var(--text-3); margin-top:4px; }
.cesaf-drop.has { border-style:solid; border-color:var(--ok); background:color-mix(in srgb,var(--ok) 12%,transparent); }
.cesaf-drop.has .up { color:var(--ok); opacity:1; }
.cesaf-ta { width:100%; height:96px; font-family:ui-monospace,Consolas,monospace; font-size:13px;
  border:1px solid color-mix(in srgb,var(--line) 45%,var(--text-3)); border-radius:12px; padding:12px; background:var(--surface-2); color:var(--text); resize:none; }
.cesaf-ta:focus { outline:none; border-color:var(--primary); background:var(--surface); }
.cesaf-or { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; color:var(--text-3); font-size:12px; font-weight:700; }
.cesaf-or .l { width:1px; flex:1; background:var(--line); }
@media (max-width:560px){ .cesaf-or { flex-direction:row; } .cesaf-or .l { width:auto; height:1px; flex:1; } }
.cesaf-foot { display:flex; gap:12px; align-items:center; padding:14px 18px; border-top:1px solid var(--line); background:var(--surface-2); flex-wrap:wrap; }
.cesaf-ready { display:inline-flex; align-items:center; gap:8px; font-size:13px; font-weight:600; color:var(--ok); }
.cesaf-ready .dot { width:8px; height:8px; border-radius:50%; background:var(--ok); }
.cesaf-spacer { flex:1; }
.cesaf-stats { display:flex; gap:12px; flex-wrap:wrap; margin-bottom:14px; }
.cesaf-stat { flex:1; min-width:110px; border:1px solid var(--line); border-radius:11px; padding:12px 14px; background:var(--surface-2); }
.cesaf-stat .v { font-size:18px; font-weight:800; font-variant-numeric:tabular-nums; line-height:1.1; }
.cesaf-stat .l { font-size:11px; color:var(--text-3); text-transform:uppercase; letter-spacing:.03em; margin-top:2px; }
.cesaf-stat.ok .v { color:var(--ok); } .cesaf-stat.err .v { color:var(--warn); }
.cesaf-bar { height:10px; background:var(--line); border-radius:6px; overflow:hidden; margin-bottom:12px; }
.cesaf-bar > div { height:100%; background:var(--ok); transition:width .3s; }
/* histórico como lista de cards na coluna direita */
.cesaf-lote { display:block; padding:12px 14px 12px 17px; border-bottom:1px solid var(--line); cursor:pointer; position:relative; }
.cesaf-lote:last-child { border-bottom:none; } .cesaf-lote:hover { background:color-mix(in srgb,var(--primary) 5%,transparent); }
.cesaf-lote .rail { position:absolute; left:0; top:0; bottom:0; width:3px; background:var(--ok); }
.cesaf-lote .rail.err { background:var(--warn); } .cesaf-lote .rail.run { background:var(--primary); }
.cesaf-lote .top { display:flex; align-items:baseline; gap:8px; }
.cesaf-lote .lid { font-weight:700; font-family:ui-monospace,Consolas,monospace; }
.cesaf-lote .arq { color:var(--text); font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cesaf-lote .meta { font-size:12px; color:var(--text-3); margin-top:3px; display:flex; gap:10px; flex-wrap:wrap; }
.cesaf-lote .mok { color:var(--ok); font-weight:700; } .cesaf-lote .mer { color:var(--warn); font-weight:700; }
.cesaf-empty { padding:26px; text-align:center; color:var(--text-3); font-size:13px; }

/* ===== Fatura Avulsa (v8.102.3) — redesign aproveitando a tela ===== */
.avf-wrap { max-width: 1200px; margin: 0 auto; }
.avf-badge { display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:700; color:var(--primary);
  background:var(--primary-bg); border:1px solid color-mix(in srgb,var(--primary) 30%,transparent); padding:4px 11px; border-radius:20px; }
.avf-wrap > h3 { font-size:19px; margin:11px 0 4px; }
.avf-sub { color:var(--text-2); max-width:96ch; margin:0 0 16px; font-size:13px; line-height:1.5; }
.avf-card { background:var(--surface); border:1px solid var(--line); border-radius:14px; box-shadow:0 1px 2px rgba(0,0,0,.03); overflow:hidden; margin-bottom:16px; }
.avf-ch { display:flex; align-items:center; gap:9px; padding:12px 18px; border-bottom:1px solid var(--line); background:var(--surface-2); }
.avf-ch .ic { width:22px; height:22px; display:grid; place-items:center; border-radius:7px; background:linear-gradient(180deg,#5b52ec,#4338ca); font-size:12px; font-weight:800; color:#fff; }
.avf-ch b { font-size:12.5px; font-weight:700; text-transform:uppercase; letter-spacing:.5px; color:var(--text-2); }
.avf-ch .step { margin-left:auto; font-size:11.5px; color:var(--text-3); }
.avf-body { padding:18px; }
.avf-card input, .avf-card select { font-size:14px; border:1px solid color-mix(in srgb,var(--line) 45%,var(--text-3));
  border-radius:9px; padding:9px 11px; background:var(--surface-2); color:var(--text); }
.avf-card input:focus, .avf-card select:focus { outline:none; border-color:var(--primary); background:var(--surface); }
.avf-consulta { display:flex; gap:16px; align-items:flex-end; flex-wrap:wrap; }
.avf-fld { display:flex; flex-direction:column; gap:6px; }
.avf-fld .lbl { font-size:11.5px; font-weight:700; text-transform:uppercase; letter-spacing:.03em; color:var(--text-3); }
.avf-split { display:grid; grid-template-columns:1.1fr 1fr; gap:0; }
@media (max-width:820px){ .avf-split { grid-template-columns:1fr; } }
.avf-L { padding:18px; } .avf-R { padding:18px; border-left:1px solid var(--line); background:var(--surface-2); }
@media (max-width:820px){ .avf-R { border-left:none; border-top:1px solid var(--line); } }
.avf-itemname { font-size:16px; font-weight:800; line-height:1.2; } .avf-itemmeta { color:var(--text-3); font-size:12.5px; margin-top:3px; }
.avf-itemhead { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.avf-arm { flex:0 0 auto; font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.02em;
  padding:3px 9px; border-radius:6px; background:rgba(217,119,6,.14); color:#b45309; white-space:nowrap; }
.avf-tiles { display:flex; gap:10px; margin-top:13px; flex-wrap:wrap; }
.avf-tile { flex:1; min-width:130px; border:1px solid var(--line); border-radius:10px; padding:9px 12px;
  background:linear-gradient(135deg,rgba(79,70,229,.09),rgba(79,70,229,.01)),var(--surface); }
.avf-tile.win { border-color:#a9b0f5; box-shadow:inset 0 0 0 1px #c3c6ff; }
.avf-tile .v { font-size:18px; font-weight:800; font-family:ui-monospace,Consolas,monospace; font-variant-numeric:tabular-nums; line-height:1.15; }
.avf-tile .l { font-size:10.5px; color:var(--text-3); text-transform:uppercase; letter-spacing:.03em; margin-top:2px; display:flex; align-items:center; gap:5px; }
.avf-tile .d { font-size:10.5px; color:var(--text-3); margin-top:3px; }
.avf-menor { font-size:8.5px; font-weight:800; background:#e0e7ff; color:#4338ca; padding:1px 6px; border-radius:999px; text-transform:none; letter-spacing:0; }
.avf-rlbl { font-size:11.5px; font-weight:700; text-transform:uppercase; letter-spacing:.03em; color:var(--text-3); margin-bottom:6px; }
.avf-qbig { font-size:18px !important; font-weight:800; font-family:ui-monospace,Consolas,monospace; width:100%; text-align:left; padding:10px 12px !important; }
.avf-hint { font-size:12px; color:var(--text-3); margin-top:8px; }
.avf-err { font-size:12.5px; color:var(--danger); font-weight:600; margin-top:6px; min-height:16px; }

/* ===== v8.103.0 — shell compartilhado (Avulsa + CESAF): cabeçalho ANCORADO +
   grid de 2 colunas que enche a tela. Resolve o "texto solto" (barra com régua
   embaixo + chips de contexto à direita, encostando nas duas margens) e o
   "1/3 da tela" (2 colunas: ação | contexto). Escopado por .scr-*; usa as
   variáveis de tema (com fallback de --primary-bg pros temas que não o definem). */
.scr-wrap { padding:22px 28px 52px; }
.scr-head { display:flex; align-items:flex-end; justify-content:space-between; gap:24px;
  padding-bottom:15px; border-bottom:1px solid var(--line); margin-bottom:20px; flex-wrap:wrap; }
.scr-head .l { min-width:0; }
.scr-badge { display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:700; color:var(--primary);
  background:var(--primary-bg, color-mix(in srgb,var(--primary) 12%,transparent));
  border:1px solid color-mix(in srgb,var(--primary) 30%,transparent); padding:4px 11px; border-radius:20px; }
.scr-title { font-size:20px; font-weight:700; letter-spacing:-.01em; margin:10px 0 4px; }
.scr-sub { color:var(--text-2); max-width:82ch; margin:4px 0 0; font-size:12px; line-height:1.5;
  background:var(--surface); border:1px solid var(--line); border-left:3px solid var(--primary);
  border-radius:8px; padding:9px 13px; }
.scr-head .r { display:flex; gap:8px; align-items:center; flex:0 0 auto; flex-wrap:wrap; justify-content:flex-end; }
.scr-chip { display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:600; color:var(--text-2);
  background:var(--surface); border:1px solid var(--line); padding:5px 11px; border-radius:20px; white-space:nowrap; }
.scr-chip b { color:var(--text); }
.scr-chip.pri { color:var(--primary); background:var(--primary-bg, color-mix(in srgb,var(--primary) 12%,transparent));
  border-color:color-mix(in srgb,var(--primary) 30%,transparent); }
.scr-chip .dot { width:7px; height:7px; border-radius:50%; background:var(--ok); }
.scr-grid { display:grid; grid-template-columns:1.5fr 1fr; gap:20px; align-items:start; }
@media (max-width:1040px){ .scr-grid { grid-template-columns:1fr; } }
.scr-main { display:flex; flex-direction:column; gap:18px; min-width:0; }
.scr-side { display:flex; flex-direction:column; gap:18px; min-width:0; }
/* na barra de consulta da Avulsa os campos agora esticam pra encher a coluna */
.avf-consulta .avf-fld input, .avf-consulta .avf-fld select { width:100%; }

/* ============================================================
   v8.112.1 — OVERLAY DE RECONEXÃO (servidor reiniciando)
   Cobre a tela inteira enquanto o backend está fora (restart de deploy). Sem
   botão de fechar: não há o que fazer sem servidor, e some sozinho ao voltar.
   ============================================================ */
#reconexao-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(2px);
}
.reconexao-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 34px;
  max-width: 460px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .25);
}
.reconexao-spin {
  width: 30px;
  height: 30px;
  margin: 0 auto 14px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: reconexao-gira .9s linear infinite;
}
@keyframes reconexao-gira { to { transform: rotate(360deg); } }
.reconexao-titulo { font-size: 17px; font-weight: 600; color: var(--text); }
.reconexao-sub { margin-top: 8px; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.reconexao-tempo { margin-top: 12px; font-size: 12px; color: var(--text-3); }

/* ============================================================
 * v8.115.0 — Sidebar SEMPRE-ESCURA (identidade SIDEC)
 *
 * Padrão "sidebar escura + conteúdo claro" (como a SIONCO), agora
 * coeso porque o conteúdo é o tema Claro (cinza-frio). O accent é o
 * ÍNDIGO do SIDEC — não o bronze da SIONCO — pra não confundir as
 * duas plataformas.
 *
 * Técnica: redefino as variáveis de cor SÓ no escopo da sidebar; as
 * regras .sidebar-* já usam var(--surface|--text|...), então herdam
 * o escuro sem reescrever cada regra. Fundo, item ativo e avatar têm
 * regra própria.
 * ============================================================ */
.app-layout > .sidebar {
  --surface:   #20264a;
  --surface-2: #2c3363;
  --border:    rgba(255,255,255,.09);
  --border-2:  rgba(255,255,255,.15);
  --text:      #eef1fb;
  --text-2:    #c6cbe8;
  --text-3:    #8b92bf;
  --primary:   #a9adf8;
  background: linear-gradient(180deg, #232a54 0%, #161a33 100%);
  border-right: 1px solid rgba(255,255,255,.06);
}
.app-layout > .sidebar .sidebar-item.active {
  background: linear-gradient(90deg, rgba(99,102,241,.92), rgba(79,70,229,.20));
  color: #ffffff;
  border-left-color: #8b8ff5;
  font-weight: 600;
}
.app-layout > .sidebar .sidebar-item.active .sidebar-icon { color: #dfe0ff; opacity: 1; }
.app-layout > .sidebar .sidebar-item:hover:not(.disabled) { color: #ffffff; }
.app-layout > .sidebar .user-avatar {
  background: linear-gradient(145deg, #7c7bf5, #4f46e5);
  color: #fff;
}
.app-layout > .sidebar .sidebar-brand-name { color: #c3c6ff; }

/* --- RAIL recolhido: manter o NOME (SIDEC) e as SEÇÕES visíveis --- */
.app-layout.sidebar-rail .sidebar-brand-row { justify-content: center; }
.app-layout.sidebar-rail .sidebar-brand-name {
  opacity: 1;
  display: block;
  text-align: center;
  font-size: 11px;
  letter-spacing: .4px;
  pointer-events: auto;
}
.app-layout.sidebar-rail .sidebar-brand { padding-left: 4px; padding-right: 4px; }
.app-layout.sidebar-rail .sidebar-section {
  height: auto;
  opacity: .72;
  margin: 0;
  padding: 7px 2px 3px;
  font-size: 7.5px;
  letter-spacing: .01em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-top: 1px solid rgba(255,255,255,.06);
  pointer-events: none;
}
.app-layout.sidebar-rail .sidebar-nav .sidebar-section:first-child { border-top: none; }
.app-layout.sidebar-rail > .sidebar:hover .sidebar-section {
  font-size: 10px;
  text-align: left;
  letter-spacing: .5px;
  padding: 14px 20px 6px;
  border-top: none;
}
.app-layout.sidebar-rail > .sidebar:hover .sidebar-brand-name { font-size: 16px; text-align: left; }
.app-layout.sidebar-rail > .sidebar:hover .sidebar-brand-row { justify-content: space-between; }

/* ==========================================================================
   v8.142.0 — Identidade CAF na TELA DE LOGIN (marca SIDEC + amarelo/cinza).
   Tudo escopado em .login-wrap: só o login muda de cor; o tema do app
   (índigo SIDEC) fica intacto. A logo é o PNG oficial (frontend/img/).
   ========================================================================== */
.login-wrap {
  --caf-amarelo: #FFCC00;
  --caf-amarelo-press: #F0C000;
  --caf-cinza: #525252;
}
/* logo oficial (substitui o antigo título Playfair "SIDEC") */
.login-wrap .login-logo {
  display: block;
  width: 100%;
  max-width: 360px;
  height: auto;
  margin: 1.3rem 0 0.4rem;
}
/* mini-resumo institucional com barra amarela */
.login-wrap .login-resumo {
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-2);
  max-width: 42ch;
  margin: 1.1rem 0 auto;
  padding-left: 14px;
  border-left: 3px solid var(--caf-amarelo);
}
.login-wrap .login-resumo b { color: var(--text); font-weight: 700; }
/* painel esquerdo: faixa amarela + brilho quente (sobrepõe o tint índigo) */
.login-wrap .login-left {
  position: relative;
  padding-left: 1.7rem;
  background:
    radial-gradient(520px 380px at 0% 0%,
      rgba(255, 204, 0, 0.10), transparent 72%);
}
.login-wrap .login-left::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 5px;
  background: var(--caf-amarelo);
  border-radius: 3px;
}
/* linha institucional CAF · SES-SP · Área Técnica */
.login-wrap .login-org { color: var(--caf-cinza); }
.login-wrap .login-org .sep { color: var(--caf-amarelo); font-weight: 800; margin: 0 7px; }
/* coluna direita — realces em amarelo (label, foco do campo, botão) */
.login-wrap .login-section-label { color: var(--caf-amarelo); }
.login-wrap .login-section-label::before { background: var(--caf-amarelo); }
.login-wrap .input-group input:focus,
.login-wrap .input-group textarea:focus {
  border-color: var(--caf-amarelo);
  box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.25);
}
.login-wrap .btn-primary {
  background: var(--caf-amarelo);
  color: #2a2a2a;
  font-weight: 800;
}
.login-wrap .btn-primary:hover { background: var(--caf-amarelo-press); }

/* === v8.163.0 — Justificativa da unidade (📝) na Grade e nos Manuais ===
   Ícone discreto só nas linhas cuja base tem MOTIVO/OBSERVACAO_JUSTIFICATIVA;
   clique abre modal read-only. Emoji sobre superfície clara some sem contraste
   (emoji é bitmap, não herda `color`) → drop-shadow, nunca text-shadow. */
.jst-btn {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0 2px;
  font-size: 13px;
  line-height: 1;
  vertical-align: -1px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .35));
}
.jst-btn:hover { filter: drop-shadow(0 1px 2px rgba(79, 70, 229, .6)); }
.jst-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 4px;
}

/* ============================================================
   v8.175.0 — Padrão NATIVO de "tela BI" (.bi-*). Nasceu no Estoque RV
   (bloco CBAF); é o molde pra migrar o Estoque IBL pra fora do iframe.
   Visual = o dos tiles/sub-abas/barras do painel IBL, mas com os tokens
   da plataforma (mesma tipografia, chrome e tema das outras telas).
   ============================================================ */
.bi { display: flex; flex-direction: column; gap: 12px; }
.bi-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.bi-head .l { flex: 1; min-width: 260px; }
.bi-head .l h2 { margin: 0; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.bi-head .l .sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.bi-head .l .sub b { color: var(--text-2); }
.bi-head .r { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.bi-filtros {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
}
.bi-fld { display: flex; flex-direction: column; gap: 3px; }
.bi-fld label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .3px;
  color: var(--text-2); font-weight: 600;
}
.bi-fld .ctrl {
  font-size: 12.5px; padding: 6px 10px; border: 1px solid var(--border-2);
  border-radius: 7px; background: var(--surface); color: var(--text); min-width: 140px;
}
.bi-fld .ctrl:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.bi-fld.grow { flex: 1; min-width: 220px; max-width: 520px; }  /* pedido do Rodrigo: busca pela metade */
.bi-fld.grow .ctrl { width: 100%; }
.bi-filtros .acts { display: flex; gap: 6px; align-items: center; margin-left: auto; }

/* multi-select de locais (chips) */
.bi-ms { position: relative; }
.bi-ms-ctrl {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap; min-width: 260px; min-height: 34px;
  border: 1px solid var(--border-2); border-radius: 7px; background: var(--surface);
  padding: 4px 6px; cursor: pointer;
}
.bi-ms-ctrl.has { border-color: var(--primary); }
.bi-ms-chip {
  display: inline-flex; align-items: center; gap: 5px; background: var(--primary-bg);
  color: var(--primary); font-weight: 700; font-size: 11px; border-radius: 12px; padding: 2px 8px;
}
.bi-ms-chip i { font-style: normal; cursor: pointer; opacity: .6; }
.bi-ms-chip i:hover { opacity: 1; }
.bi-ms-ph { font-size: 11.5px; color: var(--text-3); }
.bi-ms-cnt { margin-left: auto; font-size: 10px; color: var(--text-3); padding-left: 6px; }
.bi-ms-panel {
  display: none; position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 260px;
  max-height: 260px; overflow: auto; background: var(--surface); border: 1px solid var(--border-2);
  border-radius: 8px; box-shadow: var(--shadow-lg); padding: 6px;
}
.bi-ms-panel.open { display: block; }
.bi-ms-opt {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 6px 8px;
  border-radius: 6px; cursor: pointer; color: var(--text);
}
.bi-ms-opt:hover { background: var(--surface-2); }
.bi-ms-foot { border-top: 1px solid var(--border); margin-top: 4px; padding: 7px 8px 2px; font-size: 11px; }
.bi-ms-foot a { cursor: pointer; color: var(--primary); font-weight: 600; margin-right: 10px; }

.bi-fbanner {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px;
  background: #fff4d9; border: 1px solid #e0b400; color: #8a6d1b; border-radius: 8px; padding: 8px 12px;
}
.bi-fbanner .fchip { background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px; padding: 2px 9px; font-weight: 600; color: var(--text); }
.bi-fbanner a { margin-left: auto; color: var(--primary); font-weight: 700; cursor: pointer; white-space: nowrap; }

.bi-subtabs { display: flex; gap: 6px; flex-wrap: wrap; }
.bi-subtab {
  font-size: 13px; padding: 8px 13px; color: var(--text-2); cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  display: flex; align-items: center; gap: 7px; transition: background .12s, border-color .12s, color .12s;
}
.bi-subtab:not(.on):hover { border-color: var(--primary); color: var(--text); }
.bi-subtab.on { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.bi-subtab .ct { font-size: 10px; background: var(--surface); border-radius: 10px; padding: 1px 7px; color: var(--text-2); }
.bi-subtab.on .ct { background: rgba(255,255,255,.26); color: #fff; }

.bi-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.bi-kpis.k4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .bi-kpis, .bi-kpis.k4 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px)  { .bi-kpis, .bi-kpis.k4 { grid-template-columns: repeat(2, 1fr); } }
.bi-kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; border-left: 3px solid var(--border-2); position: relative;
}
.bi-kpi .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.bi-kpi .l { font-size: 10px; text-transform: uppercase; letter-spacing: .3px; color: var(--text-2); margin-top: 2px; }
.bi-kpi .sub { font-size: 11px; font-weight: 700; margin-top: 3px; color: var(--text-2); }
.bi-kpi.ok { border-left-color: var(--ok); } .bi-kpi.ok .sub { color: var(--ok); }
.bi-kpi.dn { border-left-color: var(--danger); } .bi-kpi.dn .sub { color: var(--danger); }
.bi-kpi.wn { border-left-color: var(--warn); } .bi-kpi.wn .sub { color: var(--warn); }
.bi-kpi.ac { border-left-color: var(--primary); } .bi-kpi.ac .sub { color: var(--primary); }
.bi-kpi.pu { border-left-color: var(--accent); } .bi-kpi.pu .sub { color: var(--accent); }
.bi-kpi.clk { cursor: pointer; transition: .12s; }
.bi-kpi.clk:hover { box-shadow: 0 3px 10px rgba(79,70,229,.18); transform: translateY(-1px); }
.bi-kpi .go { position: absolute; top: 8px; right: 9px; font-size: 10px; color: var(--text-3); opacity: 0; }
.bi-kpi.clk:hover .go { opacity: 1; }
.bi-kpi.sel { box-shadow: 0 0 0 2px var(--primary) inset; background: var(--primary-bg); }

.bi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 1000px) { .bi-grid { grid-template-columns: 1fr; } }
.bi-card { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 12px; }
.bi-card h3 { margin: 0 0 10px; font-size: 13px; color: var(--text); display: flex; align-items: center; gap: 7px; }
.bi-card h3 .tagq { font-size: 10px; font-weight: 600; color: var(--text-3); margin-left: auto; }
.bi-bars { display: flex; flex-direction: column; gap: 8px; }
.bi-barrow { display: grid; grid-template-columns: 200px 1fr 90px; align-items: center; gap: 8px; font-size: 11.5px; border-radius: 5px; padding: 1px 3px; }
.bi-barrow.clk { cursor: pointer; }
.bi-barrow.clk:hover { background: var(--surface-2); }
.bi-barrow .lab { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bi-track { height: 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; overflow: hidden; }
.bi-track > i { display: block; height: 100%; border-radius: 5px; background: var(--primary); }
.bi-track > i.ok { background: #2e7d32; } .bi-track > i.wn { background: #e8a33d; }
.bi-track > i.dn { background: #c0392b; } .bi-track > i.pu { background: #7b5ea7; }
.bi-barrow .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.bi-bars.wide .bi-barrow { grid-template-columns: 360px 1fr 110px; }

.bi-table-wrap { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow: auto; max-height: 68vh; }
.bi-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.bi-table th {
  position: sticky; top: 0; z-index: 2; text-align: left; font-weight: 600; color: var(--text-2);
  padding: 8px 10px; border-bottom: 2px solid var(--border); white-space: nowrap;
  background-image: linear-gradient(var(--surface-2), var(--surface-2));
}
.bi-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.bi-table td.nome { white-space: normal; }
.bi-table td.n, .bi-table th.n { text-align: right; font-variant-numeric: tabular-nums; }
.bi-table th[data-srt] { cursor: pointer; user-select: none; }
.bi-table th[data-srt]:hover { color: var(--primary); }
.bi-table th .srt { font-size: 9px; color: var(--primary); margin-left: 3px; }
.bi-table tbody tr:hover td { background: var(--primary-bg); }
.bi-table .zero { color: var(--text-3); }
.bi-tag { display: inline-block; font-size: 10px; padding: 2px 7px; border-radius: 11px; font-weight: 600; }
.bi-tag.ok { background: #e9f5ec; color: #1e7e34; } .bi-tag.dn { background: #fdecea; color: #b3261e; }
.bi-tag.wn { background: #fff4d9; color: #8a6d1b; } .bi-tag.pr { background: var(--primary-bg); color: var(--primary); }
.bi-tfoot { display: flex; align-items: center; gap: 12px; font-size: 11.5px; color: var(--text-3); padding: 6px 2px; }

.bi-vazio {
  padding: 40px; text-align: center; color: var(--text-2); background: var(--surface);
  border: 1px dashed var(--border-2); border-radius: 8px; line-height: 1.7;
}
.bi-vazio b { color: var(--text); }

.bi-rels { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .bi-rels { grid-template-columns: 1fr; } }
.bi-rel { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.bi-rel .ic { font-size: 20px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.18)); }
.bi-rel .tx { flex: 1; } .bi-rel .tx b { font-size: 13px; } .bi-rel .tx div { font-size: 11.5px; color: var(--text-2); }
.bi-rel .dl { display: flex; gap: 6px; }

.bi-note { font-size: 11.5px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }

/* ============================================================
   v8.176.0 — Acompanhamento Logístico NATIVO (.al-*) sobre o bloco .bi-*.
   Saiu do iframe (acomp_painel.html); o que era CSS próprio do template
   vira estes poucos complementos com os tokens da plataforma.
   ============================================================ */
.bi-kpis.k5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .bi-kpis.k5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px)  { .bi-kpis.k5 { grid-template-columns: repeat(2, 1fr); } }
.bi-tag.mt { background: #e9ecf1; color: #4a5568; }                 /* neutro (sem de-para / estágio inicial) */
.bi-subtab .ct.dn { background: var(--danger); color: #fff; }        /* badge vermelho da aba Situações */
.bi-subtab.on .ct.dn { background: #fff; color: var(--danger); }
.bi-seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: 7px; overflow: hidden; }
.bi-seg button {
  border: 0; background: var(--surface); padding: 6px 12px; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--text-2); font-family: inherit;
}
.bi-seg button + button { border-left: 1px solid var(--border-2); }
.bi-seg button:hover { color: var(--text); background: var(--surface-2); }
.bi-seg button.on { background: var(--primary); color: #fff; }

.al-top { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.al-top .al-plan { min-width: 260px; font-weight: 600; }
.al-top .sub { font-size: 12px; color: var(--text-3); padding-bottom: 8px; }
.al-top .sub b { color: var(--text-2); }
.al-top .acts { display: flex; gap: 6px; align-items: center; margin-left: auto; }

.al-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.al-chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2);
  border: 1px solid var(--border); background: var(--surface); border-radius: 20px;
  padding: 5px 12px; cursor: pointer; user-select: none; transition: border-color .12s, background .12s;
}
.al-chip:hover { border-color: var(--primary); color: var(--text); }
.al-chip.on { border-color: var(--primary); background: var(--primary-bg); color: var(--text); font-weight: 600; }
.al-chip .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.al-chip b { color: var(--text); font-variant-numeric: tabular-nums; }

/* larguras pra caber em 1 linha a partir de ~1600px (abaixo disso quebra em 2) */
.al-w-uni .ctrl { min-width: 200px; }
.al-w-item .ctrl { min-width: 200px; }
.al-w-doc { min-width: 110px !important; width: 110px; }
.al-w-sel { min-width: 150px !important; max-width: 200px; }
.al-w-date { min-width: 128px !important; }
.al-w-num { min-width: 78px !important; width: 84px; }

.al-table-wrap.bi-table-wrap { max-height: calc(100vh - 372px); min-height: 300px; }   /* ajustado em runtime (_alFitTable) */
.al-table td, .al-table th { padding: 5px 8px; }
.al-table td code { font-size: 11.5px; }
.bi-table tfoot td {
  position: sticky; bottom: 0; z-index: 2; font-weight: 700; color: var(--text-2);
  border-top: 2px solid var(--border); border-bottom: 0;
  background-image: linear-gradient(var(--surface-2), var(--surface-2));   /* nunca rgba em sticky (v8.106.1) */
}
.al-pager { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-3); padding: 6px 2px; }
.al-pager .pg { display: flex; gap: 4px; align-items: center; }
.al-pager .pg .btn-mini { margin: 0; }
.al-aut-crit { color: var(--danger); font-weight: 700; }
tr.al-clk { cursor: pointer; }
#al-pane.al-busy { opacity: .55; transition: opacity .15s; pointer-events: none; }

/* dashboard (aba Situações) */
.al-dash-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.al-dash-tools .lim { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--text-2); }
.al-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 12px; margin-bottom: 14px; }   /* 5 + 4 em tela larga */
.al-card {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border-2);
  border-radius: 8px; padding: 12px 14px; cursor: pointer; position: relative; transition: .12s;
}
.al-card:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(79,70,229,.12); transform: translateY(-1px); }
.al-card .t {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--text-2);
  min-height: 30px; display: flex; align-items: center; gap: 6px; line-height: 1.25;
}
.al-card .t .ic { font-size: 15px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.18)); }
.al-card .v { font-size: 28px; font-weight: 800; letter-spacing: -.5px; margin-top: 6px; font-variant-numeric: tabular-nums; color: var(--text); }
.al-card .m { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.al-card .go { position: absolute; right: 12px; bottom: 9px; font-size: 11px; color: var(--primary); font-weight: 700; opacity: 0; transition: .12s; }
.al-card:hover .go { opacity: 1; }
.al-card.sev-red { border-left-color: var(--danger); }   .al-card.sev-red .v { color: var(--danger); }
.al-card.sev-amber { border-left-color: var(--warn); }   .al-card.sev-amber .v { color: var(--warn); }
.al-card.sev-blue { border-left-color: var(--primary); } .al-card.sev-blue .v { color: var(--primary); }
.al-card.sev-mut { opacity: .7; }                        .al-card.sev-mut .v { color: var(--text-3); }
/* (v8.177.0: o margin-bottom do .bi-grid no Acomp vem do bloco .bi-dense abaixo) */
.al-table-res th.wide { width: 42%; }        /* resumos: a coluna do nome absorve a folga, números ficam perto dos rótulos */

/* ── v8.176.0 — DENSIDADE: "mais da metade da tela é filtro, nomes, bla bla;
   em prod aparecem 15 docs, aqui 8" (Rodrigo). O dado é o protagonista: cabeçalho
   em 1 linha, tiles/chips/filtros/abas encolhem, paginação sobe pra linha das
   abas e a tabela fica com o resto da tela, fonte menor.
   v8.177.0 — promovido de `#al` pra `.bi-dense` (classe no root do Acomp E do
   Estoque IBL nativo); o Estoque RV segue com o tamanho aprovado. ──────────── */
.al-head, .bi-head-dense { margin-bottom: 4px; align-items: center; flex-wrap: wrap; gap: 2px 10px; }
.al-head h2, .bi-head-dense h2 { margin: 0; font-size: 17px; flex: 0 0 auto; }
.al-head .al-head-r, .bi-head-dense .bi-head-r { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.al-head .al-head-sub { flex-basis: 100%; font-size: 11px; }     /* 2ª linha: contagens, largura toda */
.bi-head-dense .bi-head-info { font-size: 11.5px; }                /* v8.177.0 — IBL: contagens na MESMA linha do título */
.bi-head-dense .bi-head-info b { color: var(--text-2); }
.al-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .3px; color: var(--text-2); font-weight: 600; }
.al-ctrl { font-size: 12px; padding: 4px 7px; border: 1px solid var(--border-2); border-radius: 6px; background: var(--surface); color: var(--text); }
.al-btn { padding: 5px 10px; font-size: 12px; }
.al-sep { width: 1px; height: 22px; background: var(--border-2); margin: 0 4px; }

.bi-dense { gap: 6px; }
.bi-dense .al-top { gap: 10px; }
.bi-dense .al-plan-fld { flex-direction: row; align-items: center; gap: 8px; }
.bi-dense .al-plan-fld label { font-size: 10px; }
.bi-dense .al-top .ctrl { padding: 4px 8px; font-size: 12.5px; min-width: 230px; }
.bi-dense .al-top .sub { padding-bottom: 0; font-size: 11.5px; }
.bi-dense .al-top .acts .btn { padding: 5px 10px; font-size: 12px; }
.bi-dense .bi-seg button { padding: 4px 10px; font-size: 11.5px; }

.bi-dense .bi-kpis { gap: 6px; }
.bi-dense .bi-kpi { padding: 5px 10px 6px; border-left-width: 3px; }
.bi-dense .bi-kpi .v { font-size: 15px; line-height: 1.25; }
.bi-dense .bi-kpi .l { display: inline; font-size: 9.5px; margin: 0; }
.bi-dense .bi-kpi .sub { display: inline; font-size: 10px; margin: 0 0 0 7px; }
.bi-dense .bi-kpi .sub::before { content: '· '; color: var(--text-3); font-weight: 400; }

.bi-dense .al-chips { gap: 6px; }
.bi-dense .al-chip { padding: 2px 9px; font-size: 11px; }

.bi-dense .bi-filtros { padding: 5px 8px 6px; gap: 5px 8px; }
.bi-dense .bi-fld { gap: 1px; }
.bi-dense .bi-fld label { font-size: 9.5px; }
.bi-dense .bi-fld .ctrl { padding: 3px 7px; font-size: 12px; }
.bi-dense .bi-filtros .acts .btn { padding: 4px 9px; font-size: 12px; }

.bi-dense .bi-subtabs { gap: 5px; align-items: center; }
.bi-dense .bi-subtab { padding: 4px 10px; font-size: 12px; }
.bi-dense .bi-subtab .ct { font-size: 9.5px; padding: 0 6px; }
.bi-dense .bi-pgbar { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-3); white-space: nowrap; }
.bi-dense .bi-pgbar label { display: flex; align-items: center; gap: 4px; }
.bi-dense .bi-pgbar .ctrl { padding: 2px 4px; font-size: 11px; min-width: 0; }
.bi-dense .bi-pgbar .pg { display: inline-flex; align-items: center; gap: 3px; }
.bi-dense .bi-pgbar .pg .btn-mini { margin: 0; padding: 2px 7px; font-size: 11px; }

.bi-dense .bi-table { font-size: 11.5px; }
.bi-dense .al-table td, .bi-dense .al-table th,
.bi-dense .ib-table td, .bi-dense .ib-table th { padding: 3px 6px; }
.bi-dense .al-table-res td, .bi-dense .al-table-res th { padding: 3px 8px; }
.bi-dense .bi-table th { padding-top: 5px; padding-bottom: 5px; }
.bi-dense .bi-table tfoot td { padding-top: 4px; padding-bottom: 4px; }
.bi-dense .bi-tag { font-size: 9.5px; padding: 1px 6px; }
.bi-dense .al-table td code { font-size: 11px; }
.bi-dense .bi-fbanner { padding: 5px 10px; font-size: 11.5px; }

/* dashboard também encolhe um pouco (mantém os 9 cards legíveis) */
.bi-dense .al-dash-tools { margin-bottom: 8px; }
.bi-dense .al-cards { gap: 8px; margin-bottom: 8px; }
.bi-dense .al-card { padding: 8px 12px; }
.bi-dense .al-card .t { font-size: 10.5px; min-height: 26px; }
.bi-dense .al-card .v { font-size: 24px; margin-top: 3px; }
.bi-dense .al-card .m { font-size: 11px; }
.bi-dense .bi-grid { gap: 8px; margin-bottom: 8px; }
.bi-dense .bi-card { padding: 9px 12px; }
.bi-dense .bi-bars { gap: 5px; }

/* ============================================================
   v8.177.0 — Estoque IBL NATIVO (.ib-*) sobre o bloco .bi-* + .bi-dense.
   Saiu do iframe (estoque_ibl_painel._PAGINA); o que era CSS próprio do
   template vira estes complementos com os tokens da plataforma.
   ============================================================ */
.bi-dense .bi-ms-ctrl { min-height: 24px; padding: 1px 6px; min-width: 230px; }   /* alinha com os inputs de 24 px */
.bi-dense .bi-ms-chip { font-size: 10.5px; padding: 1px 7px; }
.bi-tag.q { background: #efe7f7; color: #6a1b9a; }                        /* quarentena / só GSnet / só cálculo */
.bi-tag.arm-r { background: #dbeafe; color: #1e40af; }                    /* ❄ Refrig. */
.bi-tag.arm-c { background: #fef9c3; color: #854d0e; }                    /* ☀ Clima. */
.bi-track > i.or { background: #e2663c; }                                 /* ≤ 30 dias */
.bi-track > i.mt { background: var(--border-2); }                         /* sem classe */
.bi-track > i.ac { background: var(--primary); }
.bi-abc { display: inline-block; width: 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 4px; font-weight: 700; font-size: 10px; color: #fff; }
.bi-abc.abc-A { background: #c0392b; } .bi-abc.abc-B { background: #e8a33d; } .bi-abc.abc-C { background: #2e7d32; }
.ib-mult-warn { color: #b45309; font-weight: 600; }
.ib-subinfo { padding: 0 2px; }
.bi-pgbar { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-3); white-space: nowrap; }

/* menu ⬇ Exportar (dropdown do filtro) */
.bi-menu { position: relative; display: inline-block; }
.bi-menu-pop {
  display: none; position: absolute; right: 0; top: calc(100% + 4px); z-index: 25; min-width: 250px;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 8px; box-shadow: var(--shadow-lg); padding: 6px;
}
.bi-menu-pop.open { display: block; }
.bi-menu-pop a { display: block; padding: 7px 9px; font-size: 12px; border-radius: 6px; color: var(--text); text-decoration: none; cursor: pointer; }
.bi-menu-pop a:hover { background: var(--surface-2); }

/* explode item → lote → posição (LINHAS alinhadas às 14 colunas) */
tr.ib-item { cursor: pointer; }
tr.ib-item .exp { display: inline-block; width: 14px; color: var(--primary); font-weight: 700; transition: .12s; }
tr.ib-item.open .exp { transform: rotate(90deg); }
tr.ib-lote td { background: var(--surface-2); }
tr.ib-lote .exp2 { display: inline-block; width: 12px; color: var(--accent); cursor: pointer; font-weight: 700; }
tr.ib-pos td { background: #fbfaff; color: var(--text-2); font-size: 11px; }
.bi-table tbody tr.ib-lote:hover td, .bi-table tbody tr.ib-pos:hover td { background: var(--primary-bg); }
.ib-det { color: var(--primary); cursor: pointer; font-weight: 600; font-size: 11px; white-space: nowrap; }
#ib-pane.ib-busy { opacity: .55; transition: opacity .15s; pointer-events: none; }
/* nome do item QUEBRA quando não cabe (pedido do Rodrigo, 16/09: nomes longos empurravam
   Diferença/Aderência pra fora da tela); `anywhere` entra no cálculo de largura da tabela,
   então nunca há rolagem horizontal — nomes curtos seguem em 1 linha */
#ib .bi-table td.nome { white-space: normal; overflow-wrap: anywhere; }

/* ficha do item (modal) */
.ib-attrs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px 18px; margin-bottom: 12px; }
.ib-attrs .attr .k { font-size: 10px; text-transform: uppercase; color: var(--text-3); letter-spacing: .3px; }
.ib-attrs .attr .v { font-size: 13px; font-weight: 600; }
.ib-totais { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.ib-totais .bi-tag { font-size: 11px; padding: 3px 9px; }

/* histórico: legenda do SVG */
.ib-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--text-2); margin-top: 8px; }
.ib-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }

/* Retrato do Estoque: moldura + carimbo âmbar fixos (v8.126.0 — "NÃO é o estoque atual") */
.ib-moldura { border: 2px solid #B45309; border-radius: 8px; padding: 6px; background: var(--surface); }
.ib-carimbo {
  background: #B45309; color: #fff; padding: 6px 14px; font-weight: 700; font-size: 13px; text-align: center;
  border-radius: 6px; position: sticky; top: 0; z-index: 5;
}
.ib-carimbo b { color: #fff; }

/* Medex diário — farmácias dentro do item (consolidado) + FALTAM (v8.179.0) */
.cmx-item-exp { cursor: pointer; }
#cmx-tabela th:first-child, #cmx-tabela td:first-child { padding-left: 18px; position: relative; }
.cmx-seta { position: absolute; left: 4px; color: var(--text-3); }
.cmx-fme td { font-size: 12.5px; color: var(--text-2); }
.cmx-fme td.cmx-fme-nome { padding-left: 22px; box-shadow: inset 3px 0 0 var(--border); }
.cmx-faltam { color: var(--danger); font-weight: 700; }
.cmx-fme td.cmx-faltam { color: var(--danger); }
/* v8.182.0 — Saldo FMEs: autonomia < 1 mês em destaque (só a cor do texto) */
.fme-aut-baixa { color: var(--danger); font-weight: 700; }

/* Auditoria GSnet — agrupada por documento (v8.180.0) */
.ag-doc-exp { cursor: pointer; }
/* a setinha fica na margem da célula (absolute) pra não empurrar o nº do doc —
   os números seguem alinhados com os docs de 1 item */
.tbl-rg th.ag-doc, .tbl-rg td.ag-doc { padding-left: 18px; position: relative; }
.ag-seta { position: absolute; left: 4px; color: var(--text-3); }
.ag-item td { font-size: 12.5px; color: var(--text-2); }
.ag-item td.ag-item-nome { padding-left: 18px; box-shadow: inset 3px 0 0 var(--border); }

/* v8.189.0 — rodapé de total da sub-aba Pacientes por município: fixo no fim da área
   rolável, fundo OPACO (lição v8.106.1: rgba deixa as linhas "voarem" por baixo). */
.cpm-total td { position: sticky; bottom: 0; z-index: 2; background: #eceefb; border-top: 2px solid var(--primary); }

/* v8.191.0 — itens selecionados (com nome) na sub-aba Pacientes por município */
.cpm-chips { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 2px 0 10px; }
.cpm-chip { border: 1px solid var(--border); border-radius: 999px; padding: 3px 6px 3px 12px; font-size: 12.5px; background: var(--surface); }
.cpm-chip a { margin-left: 4px; padding: 0 6px; color: var(--text-2); text-decoration: none; font-weight: 700; }
.cpm-chip a:hover { color: var(--danger, #c0392b); }
.cpm-sep { font-size: 12.5px; display: inline-flex; gap: 6px; align-items: center; margin-left: 6px; }
.cpm-chips:empty { display: none; }
