/* =========================================================================
   THEME PRO — camada de acabamento profissional (carregada por ultimo)
   Objetivo: visual de produto SaaS vendavel (marca Consultoria Oswaldo Lima).
   Nao altera estrutura/JS; apenas refina tokens, tipografia, sombras,
   sidebar, topbar, cards, tabelas, botoes, dialogs e login.
   ========================================================================= */

:root {
  /* CLEAN CLARO — sidebar branca com texto forte + acento esmeralda.
     Alto contraste (nada de cinza apagado). Nomes --green* por compat. */
  /* Verde escurecido p/ WCAG AA: texto branco no botao passa 4,5:1 (era 3,46).
     Contraste e simetrico, entao link/texto verde no branco tambem passa. */
  --green: #0a8055;
  --green-light: #17b57e;
  --green-dark: #086f47;
  --green-strong: #0a6a49;
  --green-soft: #e6f7f0;
  --mint: #e6f7f0;

  /* Estados semanticos: vermelho = fora da meta/NC,
     ambar = riscos/documentos a vencer, verde = ok/sem pendencias */
  --amber: #e6a020;
  --red: #d64545;
  --success: #1f9d57;
  --blue: #0e7c86;

  /* Neutros — texto escuro forte e legivel.
     Nada de cinza lavado: o secundario e um slate escuro de alto contraste. */
  --ink: #14201b;
  --text: #14201b;
  --muted: #37424c;
  --muted-2: #55606a;

  /* Superficies e fundo — conteudo claro p/ cards brancos se destacarem */
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface-soft: #eef1f4;

  /* Bordas visiveis */
  --line: #e3e8ec;
  --border-ui: #e6e9ee;
  --border-control: #d9e0e4;

  /* Raios: 11px controles, 18px cards (referencia) */
  --r-sm: 11px;
  --r-md: 18px;
  --r-lg: 18px;

  /* Sombras suaves de duas camadas (v2 — mais definicao) */
  --shadow-sm: 0 2px 6px rgba(20, 40, 30, 0.06), 0 1px 2px rgba(20, 40, 30, 0.04);
  --shadow-md: 0 6px 16px rgba(20, 40, 30, 0.08), 0 1px 2px rgba(20, 40, 30, 0.05);
  --shadow-lg: 0 18px 40px rgba(20, 40, 30, 0.14);

  --focus-ring: 0 0 0 3px rgba(15, 169, 104, 0.22);

  /* Tipografia — Manrope (UI) + IBM Plex Mono (numeros KPI) */
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Manrope", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* (Tema escuro grafite/petroleo aposentado — UI agora clean clara.) */
}

/* ----------------------------------------------------------------- Base */
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.006em;
  color: var(--text);
  background:
    radial-gradient(1200px 480px at 88% -8%, rgba(37, 99, 235, 0.05), transparent 60%),
    linear-gradient(180deg, #f9fbfd 0%, var(--bg) 340px);
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}
h1 { font-size: 24px; }
h2 { font-size: 18px; }

/* Legendas e metadados */
.eyebrow, .card span, .dashboard-group h2, .menu-group-title span, th { font-family: var(--font-body); }

/* --------------------------------------------------------------- Sidebar
   Slate escuro neutro (estilo dashboard SaaS): sobrio, moderno, deixa o azul
   de marca como unico acento e nao compete com os sinais semanticos. */
.sidebar {
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-right: none;
  box-shadow: none;
  padding: 18px 14px;
}

.brand {
  padding: 6px 8px 16px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

.sidebar .brand strong { color: #ffffff; }
.sidebar .brand span { color: rgba(255, 255, 255, 0.55); }

.brand-mark,
.login-brand .brand-mark {
  background: linear-gradient(145deg, var(--green-light) 0%, var(--green-dark) 100%);
  border-radius: 12px;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  width: 44px;
  height: 44px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand strong { font-weight: 800; letter-spacing: -0.01em; }

/* Titulos de grupo do menu */
.menu-group-title span {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.45);
}

.menu-group-title { color: rgba(255, 255, 255, 0.45); }
.menu-group-title:hover { background: rgba(255, 255, 255, 0.05); }

/* Itens do menu — pilula + barra de acento no ativo (sobre fundo escuro) */
nav button {
  position: relative;
  border-radius: 10px;
  border-left: none;
  padding: 10px 12px 10px 14px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

nav button:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  transform: none;
  box-shadow: none;
}

nav button.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.10);
}

nav button.active::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 999px;
  background: #3b82f6;
}

/* Badge de atencao sobre o fundo escuro: ambar cheio, numero branco */
.sidebar .menu-badge { background: var(--amber); color: #ffffff; }

/* Divisor e acoes administrativas do menu */
.sidebar .menu-divider { border-color: rgba(255, 255, 255, 0.12); }
.sidebar .menu-admin-btn { color: rgba(255, 255, 255, 0.65); }
.sidebar .menu-admin-btn:hover { color: #ffffff; background: rgba(255, 255, 255, 0.07); }
.sidebar .menu-admin-btn.warn { color: #f3b0a6; }
.sidebar .menu-admin-btn.warn:hover { color: #ffd2cb; }

/* ---------------------------------------------------------------- Topbar */
.app-shell { padding: 22px 28px 40px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  margin: -22px -28px 0;
  padding: 16px 28px;
  background: rgba(248, 250, 252, 0.85);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar .eyebrow { color: var(--muted); font-weight: 600; }
.topbar h1, #pageTitle {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  color: var(--ink);
}

.user-badge {
  background: var(--mint);
  color: var(--green-dark);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.14);
  font-weight: 700;
  letter-spacing: 0;
}

/* O titulo da tela vive apenas no topbar (h1); a barra de acoes das secoes
   alinha a direita mesmo sem h2 ao lado. */
.section-actions {
  margin-left: auto;
}

/* Caixa de resposta da Pesquisa inteligente so aparece quando ha conteudo. */
#assistantAnswer:empty {
  display: none;
}

/* --------------------------------------------------------------- Filtros */
.filters {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 12px;
  margin: 18px 0;
}

/* --------------------------------------------------------------- Botoes */
button {
  border-radius: var(--r-sm);
  font-weight: 600;
  background: var(--green);
  box-shadow: none;
  transition: background 0.12s ease, box-shadow 0.12s ease;
}

button:hover {
  background: var(--green-dark);
  box-shadow: var(--shadow-sm);
}

button:active { transform: translateY(0); }

button:focus-visible { outline: none; box-shadow: var(--focus-ring); }

button.secondary,
.button-link {
  background: var(--surface);
  color: var(--green-dark);
  border: 1px solid var(--border-control);
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.04);
  font-weight: 650;
}

button.secondary:hover,
.button-link:hover {
  background: var(--surface-soft);
  border-color: #cbd5e1;
}

button.danger {
  background: #f9e9e7;
  color: var(--red);
  border: 1px solid #ecc8c3;
  box-shadow: none;
}

/* --------------------------------------------------------------- Inputs */
input, select, textarea {
  border: 1px solid var(--border-control);
  border-radius: var(--r-sm);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  box-shadow: var(--focus-ring);
}

/* ---------------------------------------------------------------- Cards */
.card,
.split section,
.answer {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}

.card {
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

/* fio de acento no topo do card */
.card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--green), var(--success));
  opacity: 0;
  transition: opacity 0.16s ease;
}

.card.clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.card.clickable:hover::after { opacity: 1; }

.card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Valores de indicadores: fonte mono para leitura de dado tecnico */
.card strong {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-top: 6px;
}

.attention-item strong,
.daily-progress strong { font-family: var(--font-mono); font-weight: 500; }

/* Grade de indicadores: colunas flexiveis min 190px */
.cards,
.dashboard-group .cards {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.dashboard-group h2 {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* -------------------------------------------------- Prioridade / atencao */
.attention-panel {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
}

.attention-item {
  border-radius: 10px;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}
.attention-item:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

/* --------------------------------------------------------------- Tabelas */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  overflow: auto;
}

th {
  background: var(--surface-soft);
  color: #26303a;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--line);
}

/* Texto das celulas em ink forte (nada de cinza) */
tbody td { color: var(--ink); }

tbody tr { transition: background 0.12s ease; }
tbody tr:hover td { background: #f1f5f9; }

/* --------------------------------------------------------------- Status */
.status {
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Cor por significado: ambar = pendente, vermelho = desvio, verde = ok,
   azul = contagem neutra. A primaria da marca fica fora dos alertas. */
.status.muted { background: #eef1f4; color: #64748b; }
.status.warn { background: #f7eedd; color: var(--amber); }
.status.danger { background: #f9e7e4; color: var(--red); }
.status.success { background: #e4f1ec; color: var(--success); }
.status.info { background: #e7f1fb; color: #2a6cb0; }

/* Barras do dashboard: contagem neutra (azul) x pendencia real (ambar) */
.bars.neutral .bar-fill { background: var(--blue); }
.bars.neutral .bar-track { background: #e7f1fb; }
.bars.pending .bar-fill { background: var(--amber); }
.bars.pending .bar-track { background: #f7eedd; }

/* ------------------------------------------- Estados vazios com identidade */
.table-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 36px 20px;
  text-align: center;
}

.table-empty .empty-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 20px;
  background: #e4f1ec;
  color: var(--success);
  margin-bottom: 4px;
}

.table-empty.empty-search .empty-icon {
  background: var(--surface-soft);
  color: var(--muted);
}

/* ------------------------------------------------------- Badges do menu */
.menu-badge {
  margin-left: auto;
  min-width: 19px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #f7eedd;
  color: #8a4708;  /* WCAG AA sobre o creme #f7eedd (era var(--amber) #e6a020 = baixo contraste) */
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-align: center;
}

nav button { display: flex; align-items: center; gap: 8px; }

/* ------------------------------------------------------ Skeleton loading */
@keyframes skeleton-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.skeleton {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  min-height: 92px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-soft) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
}

.skeleton-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  flex: none;
}

/* --------------------------------------------------------------- Dialogs */
dialog {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 22px;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
}

dialog h2 { font-size: 20px; }

/* ----------------------------------------------------------------- Login */
.login-screen {
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(37, 99, 235, 0.12), transparent 55%),
    radial-gradient(800px 500px at 100% 100%, rgba(37, 99, 235, 0.08), transparent 55%),
    linear-gradient(160deg, #f8fafc 0%, #eef2f7 100%);
}

.login-card {
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 34px 32px;
  backdrop-filter: blur(2px);
}

.login-card h1 { font-size: 24px; line-height: 1.2; }
.login-heading .eyebrow {
  color: var(--green-strong);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.login-card #loginButton {
  min-height: 46px;
  font-size: 15px;
  border-radius: 10px;
}

/* ------------------------------------------------------------ Scrollbars */
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: padding-box; }

/* ------------------------------------------------- Numeros do painel QI */
.qi-value, .qi-goal, .bar-label strong { font-family: var(--font-mono); font-weight: 500; }

/* ==================================================================
   Polimento do dashboard (feedback "nota 10"): hierarquia dos cards,
   chips de prioridade com peso, seções expansiveis como cards.
   ================================================================== */

/* Cards KPI: compactos, numero protagonista, cor pelo significado */
.card {
  min-height: 88px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card strong { font-size: 26px; margin-top: 8px; }
.card.muted-card strong { font-size: 26px; }
/* styles.css usa align-self:end para o grid antigo; no flex-column isso
   jogava o numero para a direita — normaliza a esquerda */
.dashboard-card strong { align-self: flex-start; }

.card.warn {
  background: #fdf9f0;
  border-color: #e8d5ae;
  border-left: 4px solid var(--amber);
}
.card.warn strong { color: var(--amber); }

.card.danger {
  background: #fcf1ef;
  border-color: #ecc8c3;
  border-left: 4px solid var(--red);
}
.card.danger strong { color: var(--red); }

.card.muted-card { background: var(--surface-soft); border-color: var(--line); }

/* Chips de prioridade: pilulas preenchidas, numero em destaque */
.attention-item {
  align-items: center;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
  background: #fcf1ef;
  border: 1px solid #ecc8c3;
}
.attention-item span { color: #7c3f38; font-size: 13px; }
.attention-item strong { font-size: 15px; }

.attention-item.danger { background: #fcf1ef; border-color: #ecc8c3; }
.attention-item.danger strong { color: var(--red); }
.attention-item.warn { background: #fdf9f0; border-color: #e8d5ae; }
.attention-item.warn span { color: #7c5a1f; }
.attention-item.warn strong { color: var(--amber); }

.attention-ok {
  background: #e4f1ec;
  color: var(--success);
  border-radius: 999px;
  font-weight: 600;
  padding: 8px 14px;
}
.attention-ok::before { content: "✓ "; }

/* Painel "Prioridade agora": acento vermelho quando ha itens, verde quando ok */
.dashboard-priority {
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
}
.dashboard-priority.ok { border-left-color: var(--success); }
.dashboard-priority .eyebrow { color: var(--red); font-weight: 700; letter-spacing: 0.05em; }
.dashboard-priority.ok .eyebrow { color: var(--success); }
.dashboard-priority p { color: var(--muted); }

.attention-panel { border-radius: var(--r-md); padding: 16px 18px; }
.attention-panel .eyebrow { color: var(--muted); font-weight: 700; letter-spacing: 0.05em; }

/* Seções expansiveis como cards de verdade, com chevron animado */
.dashboard-details {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  padding: 0;
  overflow: hidden;
}

.dashboard-details summary {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  list-style: none;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s ease;
}
.dashboard-details summary::-webkit-details-marker { display: none; }
.dashboard-details summary::before {
  content: "▸";
  color: var(--green);
  font-size: 13px;
  transition: transform 0.18s ease;
}
.dashboard-details[open] summary::before { transform: rotate(90deg); }
.dashboard-details summary:hover { background: var(--surface-soft); }
.dashboard-details[open] summary {
  margin-bottom: 0;
  border-bottom: 1px solid var(--line);
}
.dashboard-details > *:not(summary) { padding: 0 16px; }
.dashboard-details .dashboard-groups,
.dashboard-details .split { padding: 14px 16px 16px; }

/* ==================================================================
   REDESIGN DE REFERENCIA (Dashboard SGQ - referencia.html)
   Sidebar clara, acento esmeralda, cards 18px, prioridade em lista.
   Este bloco carrega por ultimo e sobrescreve os estilos acima.
   ================================================================== */

/* Fundo plano (sem gradiente/tinta) */
body {
  background: var(--bg);
  font-family: var(--font-body);
}

/* ------------------------------------- Sidebar CLARA (clean / moderna)
   Fundo branco, texto escuro forte (sem cinza lavado), acento esmeralda
   suave no item ativo com filete lateral. */
.sidebar {
  background: #ffffff;
  border-right: 1px solid var(--line);
  box-shadow: 1px 0 0 rgba(15, 40, 30, 0.02);
  padding: 14px 12px;
}

.brand { border-bottom: 1px solid var(--line); padding: 12px 12px 16px; }
.sidebar .brand strong { color: var(--ink); font-weight: 800; }
.sidebar .brand span { color: var(--muted); }

.brand-mark,
.login-brand .brand-mark {
  background: var(--green);
  box-shadow: 0 6px 14px rgba(15, 169, 104, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* Titulos de grupo do menu — quase-preto, nitido (nada de cinza apagado) */
.menu-group-title,
.menu-group-title span {
  color: #1b2620;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  font-size: 11px;
}
.menu-group-title:hover { background: var(--surface-soft); }

/* Itens do menu — texto escuro forte, hover cinza-claro */
nav button {
  color: var(--ink);
  font-weight: 600;
  border-radius: 10px;
}
nav button:hover {
  background: var(--surface-soft);
  color: var(--ink);
}
nav button.active {
  background: var(--mint);
  color: var(--green-strong);
  font-weight: 700;
  box-shadow: none;
}
nav button.active:hover { background: var(--mint); color: var(--green-strong); }
/* Filete de acento esmeralda no item ativo */
nav button.active::before {
  display: block;
  content: "";
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 999px;
  background: var(--green);
}

/* Nao exibir contadores numericos na barra lateral */
.sidebar .menu-badge { display: none; }

.sidebar .menu-divider { border-color: var(--line); }
.sidebar .menu-admin-btn { color: #46525c; font-weight: 600; }
.sidebar .menu-admin-btn:hover { color: var(--ink); background: var(--surface-soft); }
.sidebar .menu-admin-btn.warn { color: var(--red); }
.sidebar .menu-admin-btn.warn:hover { color: #a3271b; background: #fbecea; }

/* ---------------------------------------------------------------- Topbar */
.topbar {
  background: rgba(245, 247, 246, 0.85);
  border-bottom: 1px solid var(--line);
}
.topbar .eyebrow { color: var(--green); font-weight: 700; letter-spacing: 0.06em; }
.topbar h1, #pageTitle { color: #12201a; font-weight: 800; }

.user-badge {
  background: var(--mint);
  color: var(--green-dark);
  box-shadow: inset 0 0 0 1px rgba(15, 138, 95, 0.14);
}

/* ----------------------------------------------------------- Cards 18px */
.card, .split section, .answer, .attention-panel, .dashboard-priority,
.table-wrap, .filters { border-radius: 18px; }

.card::after { background: linear-gradient(90deg, var(--green), var(--success)); }

.dashboard-group h2 { color: #4a564f; font-weight: 800; letter-spacing: 0.08em; }

/* ----------------------------------------------- Prioridade agora (lista) */
.dashboard-priority {
  border: 1px solid var(--line);
  border-left: 1px solid var(--line);
  padding: 22px 24px;
}
.dashboard-priority.ok { border-left: 1px solid var(--line); }
.dashboard-priority .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--red);
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.dashboard-priority .eyebrow::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(214, 69, 69, 0.14);
}
.dashboard-priority.ok .eyebrow { color: var(--success); }
.dashboard-priority.ok .eyebrow::before { background: var(--success); box-shadow: 0 0 0 4px rgba(31, 157, 87, 0.14); }
.dashboard-priority h2 { font-size: 19px; font-weight: 800; color: #12201a; margin-top: 10px; }
.dashboard-priority p { color: var(--muted); margin-top: 3px; }

.dashboard-priority-list, .attention-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

/* Item de prioridade como linha: [bolinha + rotulo] .... [ver aba ->] [contador] */
.attention-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 12px;
  padding: 13px 16px;
  font-weight: 600;
  transition: filter 0.14s ease;
}
.attention-item:hover { transform: none; box-shadow: none; filter: brightness(0.985); }
.attention-item > span {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 14px;
}
.attention-item > span::before {
  content: "";
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
  flex: none;
}
.attention-item strong {
  position: relative;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 11px;
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 12px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}
.attention-item strong::before {
  content: "ver aba →";
  position: absolute;
  right: calc(100% + 10px);
  white-space: nowrap;
  font-size: 12px; font-weight: 500;
}

.attention-item.danger { background: #fdf2f2; border: 1px solid #f4d7d7; }
.attention-item.danger > span { color: #7d2626; }
.attention-item.danger strong { background: var(--red); color: #ffffff; }
.attention-item.danger strong::before { color: #a86464; }

.attention-item.warn { background: #fdf7ec; border: 1px solid #f2e4c0; }
.attention-item.warn > span { color: #7d5410; }
.attention-item.warn strong { background: var(--amber); color: #3a2500; }
.attention-item.warn strong::before { color: #a58436; }

/* Estado "tudo ok" — check verde */
.attention-ok {
  background: var(--mint);
  color: var(--success);
  border: 1px solid #c9e6d5;
}

/* Botao "Ver detalhes do painel" no estilo card */
.dashboard-details {
  border-radius: 14px;
}
.dashboard-details summary::before { color: var(--green); }
.dashboard-details summary:hover { background: #fafcfb; }

/* v2 — legibilidade: estados vazios e textos secundarios sem cinza apagado */
.empty-state,
.table-empty,
.table-empty p,
.table-empty small,
.answer .empty-state {
  color: var(--muted);
}
.table-empty strong,
.table-empty .empty-title { color: var(--ink); }
.card span { color: var(--muted); }

/* ===================== LOGIN CLARO (clean / moderno) ===================== */
.login-screen {
  background:
    radial-gradient(900px 520px at 12% 6%, rgba(15, 169, 104, 0.10), transparent 55%),
    radial-gradient(820px 520px at 100% 100%, rgba(15, 169, 104, 0.06), transparent 55%),
    linear-gradient(165deg, #ffffff 0%, #eef3f1 100%);
}

.login-card {
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(15, 40, 30, 0.10), 0 2px 6px rgba(15, 40, 30, 0.05);
  color: var(--ink);
}

.login-brand .brand-mark { color: #ffffff; }
.login-card .brand strong,
.login-brand strong { color: var(--ink); }
.login-card .brand span,
.login-brand span { color: var(--muted); }

.login-heading h1 { color: var(--ink); }
.login-heading .eyebrow { color: var(--green-strong); }
.login-heading span { color: var(--muted); }

.login-card label { color: var(--ink); font-weight: 700; }
.login-card input {
  background: #ffffff;
  border: 1px solid var(--border-control);
  color: var(--ink);
}
.login-card input::placeholder { color: var(--muted-2); }
.login-card input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15, 169, 104, 0.20);
}

.login-card #loginButton {
  background: var(--green);
  color: #ffffff;
}
.login-card #loginButton:hover { background: var(--green-dark); }
.login-card small { color: var(--muted); }
.login-card .empty-state { color: var(--red); }

/* ==================================================================
   POLIMENTO FINAL — login mais respirado, tabs (sidebar) nitidas e
   layout CLEAN em mobile e desktop. Carrega por ultimo (vence tudo).
   ================================================================== */

/* ------------------------------------------------------------ Login */
.login-card {
  gap: 16px;
  max-width: 420px;
  padding: 32px 30px;
}
.login-brand { border-bottom-color: var(--line); }
.login-card label {
  display: grid;
  gap: 7px;
  font-size: 13px;
}
.login-card input {
  min-height: 46px;
  padding: 0 14px;
  border-radius: 11px;
  font-size: 15px;
}
.login-card #loginButton {
  margin-top: 4px;
  font-weight: 700;
  box-shadow: 0 10px 22px -10px rgba(15, 169, 104, 0.75);
}
.login-heading h1 { letter-spacing: -0.015em; }

/* -------------------------------------------------- Tabs / sidebar
   Garante contraste do texto sobre o grafite e alvos de toque comodos. */
.sidebar nav button { min-height: 40px; }
.sidebar .brand strong { font-size: 15px; }
.sidebar .brand span { font-size: 11.5px; }

/* styles.css desenha a marca como cartao com fundo/borda proprios; aqui
   simplificamos para so um filete inferior claro, alinhado a sidebar branca. */
.sidebar .brand {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 6px 8px 14px;
  margin-bottom: 6px;
}

/* =================================================================
   RESPONSIVO — mobile limpo (a sidebar vira faixa superior compacta)
   ================================================================= */
@media (max-width: 980px) {
  .sidebar {
    height: auto;
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 18px -14px rgba(15, 40, 30, 0.25);
  }
  .sidebar .brand { padding: 4px 6px 12px; margin-bottom: 4px; }
  .brand-mark { width: 38px; height: 38px; font-size: 15px; }

  /* Menu em duas colunas de pilulas, confortavel para o toque */
  #menu nav,
  nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .menu-group-title { grid-column: 1 / -1; }

  .app-shell { padding: 16px 16px 32px; }

  /* Topbar mobile: titulo em cima, acoes numa linha que quebra */
  .topbar {
    position: static;
    margin: -16px -16px 0;
    padding: 14px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .top-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  .top-actions .user-badge { margin-right: auto; }

  .topbar h1, #pageTitle { font-size: 21px; }
}

@media (max-width: 640px) {
  #menu nav,
  nav { grid-template-columns: 1fr; }

  .login-card { padding: 26px 20px; border-radius: 16px; }
  .login-heading h1 { font-size: 21px; }

  /* Alvos de toque maiores nos formularios */
  input, select, textarea, button { min-height: 42px; }

  .app-shell { padding: 14px 14px 28px; }
  dialog { padding: 18px 16px; border-radius: 16px; }
  .top-actions button { flex: 1 1 auto; }
}

/* =================================================================
   Formularios e Termos (documentos controlados)
   ================================================================= */
.cf-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 4px 0 18px;
}
.cf-toolbar #cfSearch { flex: 1 1 260px; }
.cf-toolbar #cfNew { margin-left: auto; }

.cf-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

/* Agrupamento por categoria (acordeao) — usado em Formularios e Termos. */
.cf-list > .cf-group { grid-column: 1 / -1; }
.cf-group {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.cf-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  cursor: pointer;
  font-weight: 700;
  color: var(--ink, #1f2937);
  list-style: none;
  user-select: none;
}
.cf-group-head::-webkit-details-marker { display: none; }
.cf-group-head::before {
  content: "▸";
  color: var(--green-strong);
  font-size: 12px;
  transition: transform 0.15s ease;
}
.cf-group[open] > .cf-group-head::before { transform: rotate(90deg); }
.cf-group-head:hover { background: var(--mint); }
.cf-archived-banner {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  border-radius: 12px;
  padding: 12px 16px;
  margin: 0 0 14px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
}
#cfArchivedToggle.active {
  background: var(--green-strong);
  color: #fff;
  border-color: var(--green-strong);
}
.cf-group-name { flex: 1; }
.cf-group-count {
  background: var(--mint);
  color: var(--green-strong);
  font-size: 12px;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 999px;
}
.cf-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  padding: 4px 16px 18px;
}
/* Card de consulta (biblioteca): compacto, foco em baixar/imprimir. */
.cf-card.cf-library { border-left: 4px solid #6366f1; gap: 10px; }
.cf-card.cf-library .cf-title { font-size: 15px; }

/* Painel (dashboard) da Análise de Impacto — KPIs clicáveis. */
.ia-dash {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.ia-kpi {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--kpi, var(--line));
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.ia-kpi:hover { transform: translateY(-1px); box-shadow: var(--shadow-md, 0 6px 16px rgba(0,0,0,.08)); }
.ia-kpi-on { background: color-mix(in srgb, var(--kpi) 10%, var(--surface)); border-color: var(--kpi); }
.ia-kpi-val { font-size: 30px; font-weight: 800; line-height: 1; color: var(--kpi); }
.ia-kpi-lbl { font-size: 13px; font-weight: 600; color: var(--ink, #1f2937); }
.ia-kpi-sub { font-size: 11.5px; color: #64748b; }

/* Barra de filtros das abas de registro (chips de status + periodo). */
.rec-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 4px 0 14px;
}
.rec-chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.rec-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px 6px 10px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.rec-chip:hover { border-color: var(--c); }
.rec-chip-on { background: color-mix(in srgb, var(--c) 12%, var(--surface)); border-color: var(--c); }
.rec-chip-n {
  min-width: 22px;
  text-align: center;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  background: var(--c);
  border-radius: 999px;
  padding: 1px 7px;
}
.rec-chip-l { font-size: 13px; font-weight: 600; color: var(--ink, #1f2937); }
.rec-period {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
}
.inv-code {
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--green-strong, #0f7a4d);
  background: var(--mint, #ecfdf5);
  border-radius: 6px;
  padding: 1px 7px;
}

/* ===== Dashboard estilo portal: pílulas com gradiente + onda + atalhos ===== */
.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 900px) { .hero-stats { grid-template-columns: repeat(2, 1fr); } }
.hero-pill {
  position: relative; overflow: hidden; border: none; text-align: left; cursor: pointer;
  border-radius: 20px; padding: 16px 18px 18px; color: #fff; min-height: 120px;
  display: flex; flex-direction: column; box-shadow: var(--shadow-md);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.hero-pill:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.hero-pill.green  { background: linear-gradient(130deg, #1fc088, #0b7250); }
.hero-pill.coral  { background: linear-gradient(130deg, #ff9a76, #e0514c); }
.hero-pill.amber  { background: linear-gradient(130deg, #f7c765, #e39a16); }
.hero-pill.purple { background: linear-gradient(130deg, #9a90ef, #5a4fbf); }
.hero-pill::after  { content: ""; position: absolute; right: -34px; bottom: -64px; width: 170px; height: 170px; background: rgba(255,255,255,0.15); border-radius: 44%; }
.hero-pill::before { content: ""; position: absolute; right: -64px; top: -46px; width: 130px; height: 130px; background: rgba(255,255,255,0.10); border-radius: 44%; }
.hero-pill .hp-ic { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 10px; background: rgba(255,255,255,0.22); display: grid; place-items: center; }
.hero-pill .hp-ic svg { width: 18px; height: 18px; stroke: #fff; fill: none; stroke-width: 2; }
.hero-pill .hp-lbl { position: relative; font-size: 13px; font-weight: 600; opacity: 0.96; }
.hero-pill .hp-num { position: relative; font-size: 36px; font-weight: 800; line-height: 1.05; margin-top: 6px; font-variant-numeric: tabular-nums; }
.hero-pill .hp-sub { position: relative; font-size: 12px; opacity: 0.9; margin-top: 2px; }

.quick-actions { margin-bottom: 18px; }
.quick-actions .eyebrow { display: block; margin: 0 0 10px; }
.quick-tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
@media (max-width: 900px) { .quick-tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .quick-tiles { grid-template-columns: repeat(2, 1fr); } }
.quick-tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
  cursor: pointer; box-shadow: var(--shadow-sm); transition: transform 0.14s ease, border-color 0.14s ease;
}
.quick-tile:hover { transform: translateY(-2px); border-color: #bfe6d6; }
.quick-tile .qt-ic { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; }
.quick-tile .qt-ic svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.9; }
.quick-tile .qt-t { font-size: 13px; font-weight: 600; color: var(--ink); }
.qt-ic.t1 { background: var(--mint); color: var(--green-strong); }
.qt-ic.t2 { background: #fdeee6; color: #c9502f; }
.qt-ic.t3 { background: #fdf3dc; color: #a9760d; }
.qt-ic.t4 { background: #eeecfb; color: #5a4fbf; }
.qt-ic.t5 { background: #e6f2fb; color: #2b6cb0; }
.qt-ic.t6 { background: #e8f6ee; color: #2a8a4e; }

/* Radar de Segurança: score como pílula gradiente + onda (cor pela banda). */
.readiness-score {
  position: relative; overflow: hidden; min-width: 158px; align-self: stretch;
  border-radius: 18px; padding: 20px 22px; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
}
.readiness-score::after  { content: ""; position: absolute; right: -30px; bottom: -56px; width: 150px; height: 150px; background: rgba(255,255,255,0.15); border-radius: 44%; }
.readiness-score::before { content: ""; position: absolute; left: -46px; top: -40px; width: 120px; height: 120px; background: rgba(255,255,255,0.10); border-radius: 44%; }
.readiness-score .rs-num { position: relative; font-size: 52px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.readiness-score .rs-lbl { position: relative; font-weight: 700; margin-top: 6px; letter-spacing: .02em; }

/* Score de cada pilar do Radar: chip gradiente (cor pela banda). */
.pillar-score {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 42px; padding: 5px 12px; border-radius: 11px;
  color: #fff; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-sm);
}

/* Ícones do dashboard/radar: traço arredondado e consistente. */
.hero-pill .hp-ic svg, .quick-tile .qt-ic svg {
  stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8;
}

.cf-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
}
.cf-card.cf-pending { border-left: 4px solid var(--amber); }

.cf-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.cf-cat {
  background: var(--mint);
  color: var(--green-strong);
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.cf-ver {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.cf-card-head .status { margin-left: auto; }

.cf-title { font-size: 16px; font-weight: 800; color: var(--ink); margin: 0 0 4px; }
.cf-meta { color: var(--muted); font-size: 12.5px; margin: 0 0 6px; }
.cf-desc { color: var(--muted); font-size: 13px; margin: 0 0 8px; }

.cf-ack-track {
  height: 7px;
  background: var(--surface-soft);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}
.cf-ack-fill { height: 100%; background: var(--green); border-radius: 999px; transition: width 0.3s ease; }
.cf-ack-label { color: var(--muted); font-size: 12px; margin: 6px 0 0; }

.cf-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.cf-ack-done { color: var(--success); font-weight: 700; font-size: 13px; }
.cf-nofile { color: var(--muted-2); font-size: 12.5px; }

/* Painel de ciencia (dialog) */
.cf-ack-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cf-ack-h { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 8px; }
.cf-ack-h.ok { color: var(--success); }
.cf-ack-h.pend { color: var(--amber); }
.cf-ack-ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cf-ack-ul li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 8px 10px; background: var(--surface-soft); border-radius: 8px;
}
.cf-ack-ul li span { color: var(--ink); font-weight: 600; font-size: 13px; }
.cf-ack-ul li small { color: var(--muted); font-size: 11.5px; }
.cf-ack-ul li.cf-empty { color: var(--muted); justify-content: center; }

.cf-version-note {
  background: #fdf7ec; border: 1px solid #f2e4c0; color: #7d5410;
  padding: 10px 12px; border-radius: 10px; font-size: 13px; margin: 0 0 14px;
}

@media (max-width: 640px) {
  .cf-list { grid-template-columns: 1fr; }
  .cf-ack-cols { grid-template-columns: 1fr; }
}

/* =================================================================
   Validação de Método (calculadora)
   ================================================================= */
.mv-dialog { width: min(680px, 96vw); }
.mv-mode {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin: 14px 0 10px; font-size: 13px; color: var(--muted);
}
.mv-mode label { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 600; }
.mv-mode input { min-height: auto; }

.mv-limits {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px 14px;
  margin: 6px 0 14px;
}
.mv-limits legend { font-size: 12px; font-weight: 700; color: var(--muted); padding: 0 6px; }

.mv-preview {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin: 4px 0 12px;
}
.mv-preview:empty { display: none; }
.mv-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 10px;
}
.mv-preview-grid div { display: flex; flex-direction: column; gap: 2px; }
.mv-preview-grid small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; }
.mv-preview-grid strong { font-family: var(--font-mono); font-size: 17px; font-weight: 500; color: var(--ink); }

.mv-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.mv-chip {
  font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-soft); color: var(--muted);
}
.mv-chip.ok { background: #e4f1ec; color: var(--success); }
.mv-chip.bad { background: #fbecea; color: var(--red); }

.mv-verdict {
  margin-top: 12px; text-align: center; font-weight: 800; letter-spacing: 0.04em;
  padding: 10px; border-radius: 10px; font-size: 15px;
}
.mv-verdict.ap { background: #e4f1ec; color: var(--success); }
.mv-verdict.rep { background: #fbecea; color: var(--red); }
.mv-verdict.none { background: var(--surface-soft); color: var(--muted); font-weight: 600; font-size: 13px; letter-spacing: 0; }

/* Cards do histórico */
.mv-card.mv-ap { border-left: 4px solid var(--success); }
.mv-card.mv-rep { border-left: 4px solid var(--red); }
.mv-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.mv-stats div { display: flex; flex-direction: column; gap: 1px; }
.mv-stats small { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.03em; }
.mv-stats strong { font-family: var(--font-mono); font-size: 15px; font-weight: 500; color: var(--ink); }

/* =================================================================
   Navegacao mais clara para todas as abas
   ================================================================= */
:root {
  --sidebar-width: 292px;
  --nav-accent: #0f8f61;
  --nav-accent-soft: rgba(15, 143, 97, 0.10);
  --nav-section-bg: #f6f9f8;
}

body {
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.sidebar {
  padding: 18px 12px 18px 16px;
  background:
    linear-gradient(180deg, rgba(15, 143, 97, 0.045), rgba(255, 255, 255, 0) 185px),
    #ffffff;
}

.sidebar .brand {
  position: sticky;
  top: -18px;
  z-index: 2;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

#menu {
  gap: 10px;
}

.menu-group {
  margin: 0;
  border: 1px solid transparent;
  border-radius: 16px;
}

.menu-group:has(.menu-group-items:not([hidden]) button.active) {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfc 100%);
  border-color: #dfe9e5;
  box-shadow: 0 10px 22px -18px rgba(15, 40, 30, 0.35);
  padding: 5px;
}

.menu-group-title {
  min-height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  letter-spacing: 0.04em;
}

.menu-group-title span {
  color: #2e3a35;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.menu-group-title:hover,
.menu-group-title[aria-expanded="true"] {
  background: var(--nav-section-bg);
}

.menu-group-title::after {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #edf5f2;
  color: #315047;
}

.menu-group-items {
  gap: 4px;
  padding: 2px 0 4px;
}

.menu-group-items button[data-module] {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px 10px 14px;
  border-radius: 12px;
  color: #27332f;
  font-size: 14px;
  line-height: 1.15;
}

.menu-group-items button[data-module] > span {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.menu-group-items button[data-module] > span::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 999px;
  background: #b8c8c2;
  box-shadow: 0 0 0 4px rgba(184, 200, 194, 0.16);
}

.menu-group-items button[data-module]:hover {
  background: #f1f6f4;
  color: #0d5f43;
  transform: none;
}

.menu-group-items button[data-module].active {
  background: linear-gradient(135deg, #e5f4ed 0%, #f5fbf8 100%);
  color: #075c3f;
  box-shadow: inset 3px 0 0 var(--nav-accent), 0 8px 16px -14px rgba(15, 40, 30, 0.50);
}

.menu-group-items button[data-module].active > span::before {
  background: var(--nav-accent);
  box-shadow: 0 0 0 5px var(--nav-accent-soft);
}

.menu-group-items button[data-module] .menu-badge,
.menu-group-title .menu-badge {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #fff3d6;
  color: #734900;
  font-size: 11px;
  font-weight: 800;
}

.topbar {
  margin: -26px -28px 18px;
  padding: 18px 28px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #dfe7e4;
  box-shadow: 0 10px 24px -22px rgba(15, 40, 30, 0.55);
}

.topbar h1 {
  letter-spacing: -0.035em;
}

.filters {
  border: 1px solid #dfe7e4;
  box-shadow: 0 14px 30px -24px rgba(15, 40, 30, 0.45);
}

.view > .section-head:first-child,
#records .section-head:first-child {
  align-items: flex-start;
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 12px;
  }

  .sidebar .brand {
    position: static;
    backdrop-filter: none;
  }

  .menu-group:has(.menu-group-items:not([hidden]) button.active) {
    padding: 4px;
  }

  .menu-group-items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .menu-group-items button[data-module] {
    min-height: 46px;
  }

  .topbar {
    margin: -16px -16px 16px;
    padding: 16px;
  }
}

@media (max-width: 640px) {
  .menu-group-items {
    grid-template-columns: 1fr;
  }

  .menu-group-title {
    min-height: 46px;
  }

  .menu-group-items button[data-module] {
    min-height: 48px;
    font-size: 15px;
  }
}

/* =================================================================
   Menu hambúrguer (mobile): a sidebar vira gaveta deslizante
   ================================================================= */
.menu-toggle { display: none; }
.sidebar-overlay { display: none; }

@media (max-width: 980px) {
  /* Botão hambúrguer no topbar */
  .menu-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    padding: 0 10px;
    background: var(--surface);
    border: 1px solid var(--border-control);
    border-radius: 11px;
    cursor: pointer;
  }
  .menu-toggle span {
    display: block;
    height: 2px;
    width: 20px;
    border-radius: 2px;
    background: var(--ink);
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
  body.sidebar-open .menu-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  body.sidebar-open .menu-toggle span:nth-child(2) { opacity: 0; }
  body.sidebar-open .menu-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  /* Topbar: hambúrguer + título na mesma linha, ações quebram embaixo */
  .topbar {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
  }
  .topbar-titles { flex: 1 1 auto; min-width: 0; }
  .top-actions { flex: 1 1 100%; }

  /* Sidebar vira gaveta fora da tela */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    width: min(290px, 86vw);
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
    box-shadow: none;
    border-right: 1px solid var(--line);
  }
  body.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 0 24px 60px rgba(15, 40, 30, 0.35);
  }
  .sidebar .brand { position: static; backdrop-filter: none; }

  /* Fundo escurecido atrás da gaveta */
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(10, 20, 15, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  body.sidebar-open .sidebar-overlay { opacity: 1; pointer-events: auto; }

  /* Conteúdo ocupa a largura toda (gaveta está fora do fluxo) */
  body { grid-template-columns: 1fr; }
  .app-shell { padding: 16px 16px 32px; }
}

/* =================================================================
   POLISH v3 — 5 ajustes de acabamento (bordas + controles + cards)
   ================================================================= */

/* (1) Raios unificados: controles 10px, cards/painéis 16px — escala coesa */
button, input, select, textarea, .button-link { border-radius: 10px; }
.card, .split section, .answer, .attention-panel, .dashboard-priority,
.table-wrap, .filters, .cf-card, .mv-preview, .mv-limits, dialog { border-radius: 16px; }

/* (2) Bordas mais refinadas: hairline suave e uniforme + profundidade por
   sombra leve (menos dependência de borda "dura") */
:root { --line: #e7ecef; --border-control: #d5dde3; }
.card, .filters, .table-wrap, .split section, .answer,
.attention-panel, .cf-card {
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(15, 40, 30, 0.04), 0 8px 22px -16px rgba(15, 40, 30, 0.16);
}

/* (3) Inputs/selects: altura consistente, foco elegante, hover perceptível,
   seta customizada no select */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),
select, textarea {
  min-height: 40px;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border-control);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { min-height: 76px; padding: 10px 12px; }
input:hover, select:hover, textarea:hover { border-color: #c2ccd4; }
input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15, 169, 104, 0.16);
  outline: none;
}
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23566169' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
/* Checkboxes/radios no tamanho nativo (não esticam com largura de input) */
input[type="checkbox"], input[type="radio"] {
  width: auto;
  height: auto;
  min-height: auto;
  padding: 0;
  accent-color: var(--green);
}

/* (4) Botões: alinham altura com inputs, feedback ao pressionar, secundário
   com borda/hover mais definidos (mas .small continua compacto) */
button:not(.small):not(.menu-group-title) { min-height: 40px; padding: 9px 16px; }
button.small { min-height: 32px; padding: 6px 11px; border-radius: 9px; }
button.secondary { border: 1px solid var(--border-control); }
button.secondary:hover { border-color: #b7c2ca; background: var(--surface-soft); }
button:active { transform: translateY(1px); }

/* (5) Tabelas e cards: respiro nas células, hover mais vivo.
   overflow:auto (não hidden) — o raio continua recortando E a tabela rola na
   horizontal no celular, então a coluna "Ações" (última) fica alcançável. */
.table-wrap { overflow: auto; -webkit-overflow-scrolling: touch; }
th, td { padding: 12px 14px; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover td { background: #f4f8f6; }
.card.clickable {
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.card.clickable:hover {
  transform: translateY(-2px);
  border-color: #cdd8d2;
  box-shadow: 0 14px 28px -16px rgba(15, 40, 30, 0.28);
}

/* =================================================================
   Menu com ícones — navegação com cara de app moderno
   ================================================================= */
.nav-ico { width: 18px; height: 18px; flex: 0 0 18px; }

/* Ícone de cada aba: cinza-esverdeado neutro, ganha acento no hover/ativo */
.menu-group-items button[data-module] { gap: 11px; }
.menu-group-items button[data-module] .nav-ico { color: #8a978f; transition: color 0.15s ease; }
.menu-group-items button[data-module]:hover .nav-ico { color: var(--nav-accent, #0f8f61); }
.menu-group-items button[data-module].active .nav-ico { color: var(--nav-accent, #0f8f61); }
/* Substituímos o antigo ponto marcador pelo ícone */
.menu-group-items button[data-module] > span::before { display: none; }

/* Cabeçalho da seção: ícone em pílula suave + rótulo mais definido */
.menu-group-title { display: flex; align-items: center; gap: 10px; }
.nav-group-ico {
  width: 26px; height: 26px;
  flex: 0 0 26px;
  padding: 5px;
  border-radius: 8px;
  background: #eef5f1;
  color: #0f8f61;
  box-sizing: border-box;
}
.menu-group-title span { color: #263a32; }
.menu-group:has(.menu-group-items:not([hidden]) button.active) .nav-group-ico {
  background: var(--nav-accent, #0f8f61);
  color: #ffffff;
}

/* =================================================================
   REVISÃO DE TIPOGRAFIA — texto profissional, sem cinza lavado
   (login + todas as abas). Carrega por último: vence os cinzas antigos.
   ================================================================= */

/* Títulos com mais presença (peso 600 em vez de 500) */
h1, h2, h3, .topbar h1, #pageTitle, .login-heading h1, .cf-title, dialog h2 {
  font-weight: 600;
  letter-spacing: -0.018em;
}

/* Eyebrows/rótulos neutros: slate escuro forte, não cinza claro */
.eyebrow { color: var(--muted); font-weight: 700; letter-spacing: 0.05em; }
.topbar .eyebrow { color: var(--green-strong); }          /* acento de marca */
.dashboard-priority .eyebrow { color: var(--red); }        /* semântico */
.dashboard-priority.ok .eyebrow { color: var(--success); }

/* Cabeçalhos de grupo do dashboard (INDICADORES DE QUALIDADE...) */
.dashboard-group h2 { color: #2b3832; font-weight: 800; letter-spacing: 0.07em; }

/* KPI cards "muted": legíveis (só levemente suaves, não apagados) */
.dashboard-card.muted-card span,
.dashboard-card.muted-card strong { color: #55606a; }

/* Rótulos de seção da sidebar (GERAL, DOCUMENTOS E NORMAS...): quase-preto */
.menu-group-title span,
.sidebar .menu-group-title span {
  color: #1e2b25;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.05em;
}

/* Ícone da aba um tom mais definido (não pálido) */
.menu-group-items button[data-module] .nav-ico { color: #6f7e76; }

/* Texto secundário geral: garante piso de contraste (slate escuro) */
.card span, small, .cf-meta, .cf-ack-label, .backup-info,
.table-empty small, .empty-state { color: var(--muted); }
.card strong, .cf-title, td { color: var(--ink); }

/* Corpo em ink cheio */
body { color: var(--ink); }

/* =================================================================
   PASSE DE UX (olhar de designer) — hierarquia, profundidade, leitura
   ================================================================= */

/* (1) Hierarquia de ação: "Anexar Evidência" é utilitário global — vira
   botão TONAL (verde suave) para não competir com a ação primária da tela */
#attachEvidence {
  background: var(--mint);
  color: var(--green-dark);
  border: 1px solid #c7e5d4;
  box-shadow: none;
  font-weight: 700;
}
#attachEvidence:hover { background: #d6efe3; border-color: #b6ddca; }

/* (2) CTA primário com profundidade sutil (premium, mas limpo).
   :where() zera a especificidade: o verde de CTA vira PADRÃO de botão puro,
   e qualquer componente com classe própria (item de atenção, chips, respostas
   de auditoria...) vence naturalmente — sem o verde vazar. */
button:where(:not(.secondary):not(.danger):not(.button-link):not(.menu-admin-btn):not(.menu-group-title):not(.menu-toggle):not([data-module]):not([data-menu-group]):not([data-admin-action]):not(#attachEvidence):not(.small)) {
  box-shadow: 0 6px 15px -9px rgba(15, 157, 107, 0.55);
}
button:where(:not(.secondary):not(.danger):not(.button-link):not(.menu-admin-btn):not(.menu-group-title):not(.menu-toggle):not([data-module]):not([data-menu-group]):not([data-admin-action]):not(#attachEvidence):not(.small)):hover {
  box-shadow: 0 9px 20px -9px rgba(15, 157, 107, 0.6);
  transform: translateY(-1px);
}

/* (3) Tabelas: zebra sutil para leitura em telas largas (hover vence) */
tbody tr:nth-child(even) td { background: #fafcfb; }
tbody tr:hover td { background: #eef5f1; }

/* (4) Foco visível e acessível (teclado) em tudo que é interativo */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 169, 104, 0.30);
  border-radius: 8px;
}

/* (5) Feedback interativo mais suave e consistente */
button, .attention-item, .cf-card, .card, tbody tr td { transition: all 0.15s ease; }
.attention-item:hover { transform: translateX(2px); }
.cf-card { transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease; }
.cf-card:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -16px rgba(15, 40, 30, 0.3); }

/* =================================================================
   Barra de registros consolidada: busca + ações numa linha só
   (antes eram 3 faixas: filtros, ações, busca → agora 2)
   ================================================================= */
.records-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.records-head .records-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 300px;
  min-width: 240px;
  max-width: 620px;
  margin: 0;
}
.records-head .records-toolbar #recordSearch { flex: 1 1 auto; min-width: 0; }
.records-head .section-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 760px) {
  .records-head { flex-direction: column; align-items: stretch; }
  .records-head .records-toolbar { max-width: none; }
  .records-head .section-actions { margin-left: 0; }
}

/* =================================================================
   Textos "apagados" reforçados — marca, badge e subtítulos do login
   (o problema era peso 400 fino; agora peso 500 + cor mais escura)
   ================================================================= */
.sidebar .brand span,
.login-brand span,
.login-card .brand span {
  color: #2c3832;
  font-weight: 500;
}
.login-heading span {
  color: #2e3a34;
  font-weight: 500;
}
.login-card small {
  color: #46525c;
  font-weight: 500;
}
/* Badge do usuário no topo: verde mais escuro p/ contraste sobre o mint */
.user-badge { color: #0a5a3e; }
/* Eyebrows verdes com mais presença */
.topbar .eyebrow,
.login-heading .eyebrow { color: #0a6a49; font-weight: 800; }

/* =================================================================
   Abas da sidebar: ícones em chip (sem aspecto apagado) + cada aba
   como bloco clicável definido (fundo sutil + hover/ativo claros)
   ================================================================= */

/* Ícone de cada aba num chip arredondado, cor forte */
.menu-group-items button[data-module] .nav-ico {
  width: 28px; height: 28px;
  flex: 0 0 28px;
  padding: 5.5px;
  border-radius: 8px;
  background: #ebf3ef;
  color: #3d6a58;
  box-sizing: border-box;
  transition: background 0.15s ease, color 0.15s ease;
}

/* Cada aba = bloco clicável com fundo sutil em repouso */
.menu-group-items button[data-module] {
  background: #f6faf8;
  color: #223330;
  border: 1px solid transparent;
}
.menu-group-items button[data-module]:hover {
  background: #e8f4ee;
  color: #0b6a49;
  border-color: #d5e8e0;
}
.menu-group-items button[data-module]:hover .nav-ico {
  background: #d4ede1;
  color: #0c8259;
}

/* Aba ativa: fundo esmeralda claro + chip esmeralda cheio (ícone branco) */
.menu-group-items button[data-module].active {
  background: linear-gradient(135deg, #dff2e9 0%, #f0f9f5 100%);
  color: #06543a;
  border-color: #bfe4d3;
}
.menu-group-items button[data-module].active .nav-ico {
  background: var(--nav-accent, #0f9d6b);
  color: #ffffff;
}

/* Ensaio de Proficiência — veredito "Alerta" (âmbar) + escala do z-score */
.mv-verdict.alert { background: #fdf7ec; color: #8a5a12; }
.pt-scale { text-align: center; font-size: 11.5px; color: var(--muted); margin: 8px 0 0; }

/* Investigação do Ensaio de Proficiência (obrigatória se insatisfatório) */
.pt-investigation {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px 14px;
  margin: 6px 0 14px;
}
.pt-investigation.pt-mandatory {
  border-color: #efc5bf;
  background: #fdf5f4;
}
.pt-investigation legend { font-size: 12px; font-weight: 800; color: var(--ink); padding: 0 6px; }
.pt-investigation.pt-mandatory legend { color: var(--red); }
.pt-inv-banner {
  font-size: 12.5px;
  color: #7d2626;
  background: #fbe9e7;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
}
.pt-investigation:not(.pt-mandatory) .pt-inv-banner { color: #7d5410; background: #fdf7ec; }
.req { color: var(--red); font-weight: 800; }
.pt-inv-chip {
  display: inline-block;
  font-size: 11.5px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px;
  margin: 6px 0 2px;
}
.pt-inv-chip.open { background: #fdf2f2; color: #a3271b; }
.pt-inv-chip.done { background: #e4f1ec; color: var(--success); }

/* Gerenciar abas (admin) — habilitar/desabilitar módulos */
#moduleSettingsDialog { width: min(560px, 96vw); }
.ms-body { display: grid; gap: 14px; margin: 6px 0 4px; max-height: 60vh; overflow-y: auto; }
.ms-group h4 {
  margin: 0 0 6px; font-size: 11px; font-weight: 800; letter-spacing: 0.06em;
  text-transform: uppercase; color: #2b3832;
}
.ms-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 6px; cursor: pointer; transition: background 0.12s ease, border-color 0.12s ease;
}
.ms-item:hover { background: var(--surface-soft); }
.ms-item span { flex: 1; color: var(--ink); font-weight: 600; font-size: 14px; }
.ms-item small { color: var(--muted); font-size: 11px; }
.ms-item.ms-locked { opacity: 0.75; cursor: default; background: #f7faf9; }
.ms-item input[type="checkbox"] { width: 18px; height: 18px; }

/* Gerenciar abas — seletor de unidade */
.ms-unit-select { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink); margin: 4px 0 12px; }
.ms-unit-select select { font-weight: 600; }

/* Atas de Reunião — seleção de participantes + folha de assinaturas */
.mt-participants { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 14px; margin: 6px 0 14px; }
.mt-part-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mt-part-head strong { font-size: 13px; color: var(--ink); }
.mt-part-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px; max-height: 220px; overflow-y: auto; margin-top: 8px; }
.mt-part-item { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 8px; cursor: pointer; }
.mt-part-item:hover { background: var(--surface-soft); }
.mt-part-item span { font-size: 13.5px; color: var(--ink); }
.mt-sign-meta { color: var(--muted); font-size: 12.5px; margin-bottom: 12px; font-weight: 600; }

/* Execução de auditoria no celular: botões de resposta empilham (não somem) */
@media (max-width: 680px) {
  .audit-answer-grid { grid-template-columns: 1fr; gap: 8px; }
  .audit-answer-btn { min-height: 46px; width: 100%; }
  .audit-execution-dialog { width: calc(100vw - 12px); max-width: none; }
  .audit-execution-dialog form { padding: 14px; }
  .audit-execution-body { max-height: 78vh; }
  .audit-exec-kpis { width: 100%; }
  .audit-exec-kpis span { flex: 1 1 auto; text-align: center; }
  .audit-exec-nav, .audit-exec-actions, .audit-exec-footer { width: 100%; }
  .audit-exec-nav button, .audit-exec-actions button, .audit-exec-footer button { flex: 1 1 auto; }
}

/* Campo de senha do usuário com botão Gerar */
.password-row { display: flex; gap: 8px; align-items: center; }
.password-row input { flex: 1 1 auto; min-width: 0; font-family: var(--font-mono); letter-spacing: 0.02em; }
.password-row button { flex: 0 0 auto; white-space: nowrap; }
.password-hint { display: block; color: var(--muted); font-size: 11.5px; margin-top: 5px; }

/* Link discreto na tela de login (esqueci minha senha / voltar) */
.login-link {
  background: none;
  border: none;
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  align-self: center;
  box-shadow: none;
}
.login-link:hover { text-decoration: underline; color: var(--green-dark); }

/* =================================================================
   Design comercial v1 — polimento global sem alterar funcionalidades
   ================================================================= */
:root {
  --brand-primary: #0a8055;
  --brand-primary-strong: #086f47;
  --brand-primary-soft: #e6f5ee;
  --brand-ink: #10251f;
  --brand-muted: #53615c;
  --brand-line: #dce8e3;
  --brand-panel: rgba(255, 255, 255, 0.88);
  --brand-shadow: 0 18px 45px -32px rgba(11, 42, 31, 0.55);
}

body {
  background:
    radial-gradient(900px 520px at 88% -10%, rgba(15, 157, 107, 0.10), transparent 58%),
    radial-gradient(720px 460px at 12% 18%, rgba(37, 99, 235, 0.055), transparent 60%),
    linear-gradient(180deg, #f7faf9 0%, #eef4f1 100%);
  color: var(--brand-ink);
  font-family: "Manrope", Arial, Helvetica, sans-serif;
}

.login-screen {
  overflow: hidden;
  background:
    radial-gradient(760px 520px at 12% 14%, rgba(15, 157, 107, 0.20), transparent 58%),
    radial-gradient(680px 520px at 92% 86%, rgba(7, 120, 79, 0.13), transparent 62%),
    linear-gradient(145deg, #f8fbfa 0%, #e7f1ec 52%, #f6faf8 100%);
}

.login-screen::before,
.login-screen::after {
  content: "";
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(2px);
}

.login-screen::before {
  width: 310px;
  height: 310px;
  left: -90px;
  bottom: -120px;
  background: rgba(15, 157, 107, 0.13);
}

.login-screen::after {
  width: 420px;
  height: 420px;
  right: -160px;
  top: -140px;
  background: rgba(37, 99, 235, 0.075);
}

.login-card {
  position: relative;
  z-index: 1;
  max-width: 438px;
  border: 1px solid rgba(220, 232, 227, 0.92);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.90);
  box-shadow: 0 30px 80px -44px rgba(11, 42, 31, 0.78), 0 2px 8px rgba(11, 42, 31, 0.06);
  backdrop-filter: blur(16px);
}

.login-brand {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(220, 232, 227, 0.90);
}

.brand-mark {
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18), transparent 35%),
    linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-strong) 100%);
  box-shadow: 0 14px 24px -16px rgba(15, 157, 107, 0.95);
}

.login-heading h1,
.topbar h1,
#pageTitle {
  color: var(--brand-ink);
  letter-spacing: -0.045em;
}

.login-heading h1 {
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.04;
}

.login-card label {
  color: #20312b;
}

input,
select,
textarea {
  border-radius: 13px;
  border-color: #cfded8;
  background: rgba(255, 255, 255, 0.94);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 4px rgba(15, 157, 107, 0.14);
}

button,
.button-link {
  border-radius: 13px;
}

/* Gradiente de CTA com :where(): especificidade zero — vale só para botões
   "puros"; componentes com classe própria não herdam o verde. */
button:where(:not(.secondary):not(.danger):not(.login-link)) {
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-strong) 100%);
  box-shadow: 0 14px 26px -18px rgba(15, 157, 107, 0.85);
}

button.secondary {
  background: rgba(255, 255, 255, 0.92);
  border-color: #cfded8;
  color: #08784f;
}

.sidebar {
  border-right: 1px solid rgba(220, 232, 227, 0.95);
  background:
    linear-gradient(180deg, rgba(15, 157, 107, 0.065), rgba(255, 255, 255, 0) 210px),
    rgba(255, 255, 255, 0.96);
  box-shadow: 14px 0 44px -38px rgba(11, 42, 31, 0.60);
}

.sidebar .brand {
  margin-bottom: 12px;
}

.sidebar .brand strong,
.login-brand strong {
  color: var(--brand-ink);
  font-weight: 850;
}

.sidebar .brand span,
.login-brand span,
.login-card .brand span {
  color: var(--brand-muted);
}

.menu-group:has(.menu-group-items:not([hidden]) button.active) {
  border-color: rgba(15, 157, 107, 0.18);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 32px -28px rgba(11, 42, 31, 0.42);
}

.menu-group-title {
  color: #33433d;
}

.menu-group-title span {
  font-weight: 850;
}

.menu-group-items button[data-module] {
  border-radius: 14px;
}

.menu-group-items button[data-module].active {
  background: linear-gradient(135deg, #dbf2e8 0%, #f6fbf8 100%);
  border-color: rgba(15, 157, 107, 0.24);
  color: #075c3f;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  border: 1px solid rgba(220, 232, 227, 0.90);
  border-top: 0;
  border-radius: 0 0 20px 20px;
  background: rgba(255, 255, 255, 0.90);
  box-shadow: var(--brand-shadow);
}

.topbar .eyebrow,
.login-heading .eyebrow {
  color: var(--brand-primary-strong);
  letter-spacing: 0.08em;
}

.filters,
.records-toolbar,
.table-wrap,
.dashboard-priority,
.attention-panel,
.card,
.cf-card,
dialog {
  border-color: var(--brand-line);
  box-shadow: var(--brand-shadow);
}

.filters {
  background: var(--brand-panel);
  backdrop-filter: blur(10px);
}

.card,
.dashboard-priority,
.attention-panel,
.table-wrap,
.cf-card {
  background: rgba(255, 255, 255, 0.92);
}

.section-head h2,
.dashboard-priority h2,
.attention-panel h2 {
  color: var(--brand-ink);
  letter-spacing: -0.03em;
}

th {
  color: #52635d;
  background: #f4f8f6;
}

tbody tr:hover {
  background: #f7fbf9;
}

.status.success,
.attention-ok {
  background: var(--brand-primary-soft);
  color: var(--brand-primary-strong);
}

.toast {
  border-radius: 16px;
  box-shadow: 0 20px 45px -28px rgba(11, 42, 31, 0.70);
}

.empty-state:last-child,
main > footer.empty-state {
  margin: 18px 0 4px;
  color: #65736e;
  font-size: 12px;
}

@media (max-width: 980px) {
  .topbar {
    border-radius: 0 0 18px 18px;
  }

  .login-screen {
    padding: 18px;
  }
}

@media (max-width: 640px) {
  .login-card {
    border-radius: 20px;
    padding: 24px 20px;
  }

  .top-actions .user-badge {
    width: 100%;
    text-align: center;
  }
}

/* =================================================================
   Interface desktop/mobile v2 — legibilidade e toque
   ================================================================= */
@media (min-width: 1180px) {
  .app-shell {
    padding: 30px 36px 34px;
  }

  .topbar {
    margin: -30px -36px 22px;
    padding: 20px 36px;
  }

  .filters {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(240px, 1fr) auto;
    gap: 10px;
    align-items: center;
  }

  .records-head {
    margin-top: 8px;
  }

  .records-head .records-toolbar {
    max-width: 720px;
  }

  .table-wrap {
    border-radius: 18px;
  }
}

@media (max-width: 980px) {
  body {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: auto;
    max-height: 48vh;
    overflow-y: auto;
    border-right: 0;
    border-bottom: 1px solid var(--brand-line);
    box-shadow: 0 18px 34px -30px rgba(11, 42, 31, 0.70);
  }

  .sidebar .brand {
    display: flex;
    margin-bottom: 8px;
    padding-bottom: 10px;
  }

  #menu {
    gap: 8px;
  }

  .menu-group {
    border-radius: 14px;
  }

  .menu-group-items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .menu-group-items button[data-module] {
    min-height: 48px;
    padding: 10px 12px;
  }

  .app-shell {
    padding: 18px 18px 30px;
  }

  .topbar {
    margin: -18px -18px 18px;
    padding: 16px 18px;
  }

  .filters {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
  }

  .section-head,
  .records-head {
    gap: 10px;
  }

  .section-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: stretch;
  }

  .topbar,
  .top-actions,
  .section-head,
  .records-head,
  .records-head .section-actions {
    flex-direction: column;
  }

  .top-actions,
  .section-head,
  .records-head,
  .records-head .records-toolbar,
  .records-head .section-actions {
    width: 100%;
  }

  .top-actions {
    align-items: stretch;
  }

  .top-actions button,
  .section-actions button,
  .records-head .section-actions button,
  .records-toolbar button {
    width: 100%;
    min-height: 46px;
  }

  .filters {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .filters select,
  .filters input,
  .filters button,
  .records-toolbar input,
  .records-toolbar button {
    width: 100%;
    min-height: 46px;
  }

  .records-head .records-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    max-width: none;
  }

  .dashboard-priority,
  .attention-panel,
  .split,
  .cards,
  .compact-cards,
  .dashboard-groups {
    grid-template-columns: 1fr !important;
  }

  .table-wrap {
    margin-inline: -4px;
    border-radius: 16px;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 720px;
  }

  th,
  td {
    padding: 12px 10px;
  }

  dialog {
    width: calc(100vw - 14px);
    max-width: none;
    max-height: calc(100dvh - 14px);
    border-radius: 20px;
  }

  #recordDialog {
    max-height: calc(100dvh - 14px);
  }

  #recordDialog .form-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .sidebar {
    max-height: 42vh;
    padding: 10px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .sidebar .brand strong {
    font-size: 14px;
  }

  .sidebar .brand span {
    font-size: 11px;
  }

  .menu-group-title {
    min-height: 44px;
  }

  .menu-group-items {
    grid-template-columns: 1fr;
  }

  .menu-group-items button[data-module] {
    min-height: 50px;
    font-size: 15px;
  }

  .app-shell {
    padding: 14px 12px 28px;
  }

  .topbar {
    margin: -14px -12px 14px;
    padding: 14px 12px;
  }

  .topbar h1,
  #pageTitle {
    font-size: 24px;
  }

  .eyebrow {
    font-size: 11px;
  }

  .login-screen {
    padding: 12px;
  }

  .login-card {
    width: 100%;
    max-width: none;
    padding: 22px 18px;
  }

  .login-heading h1 {
    font-size: 25px;
  }
}

/* =================================================================
   Correção mobile v3 — restaurar gaveta e não cortar abas
   ================================================================= */
@media (max-width: 980px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(312px, 88vw);
    height: 100vh;
    height: 100dvh;
    max-height: none;
    z-index: 60;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.24s ease;
    border-right: 1px solid var(--brand-line);
    border-bottom: 0;
    box-shadow: none;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 0 24px 60px rgba(15, 40, 30, 0.35);
  }

  .sidebar .brand {
    position: static;
    top: auto;
    background: transparent;
    backdrop-filter: none;
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(10, 20, 15, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease;
  }

  body.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .menu-group-items {
    grid-template-columns: 1fr;
  }

  .menu-group-items button[data-module] {
    min-height: 48px;
  }

  .topbar {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .topbar-titles {
    flex: 1 1 180px;
    min-width: 0;
  }

  .top-actions {
    flex: 1 1 100%;
  }
}

@media (max-width: 520px) {
  .sidebar {
    width: min(326px, 92vw);
    max-height: none;
  }
}

@media (max-width: 980px) {
  body:not(.sidebar-open) .sidebar {
    transform: translateX(-100%) !important;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0) !important;
  }
}

/* =================================================================
   Design executivo v5 — acabamento de produto profissional
   ================================================================= */
:root {
  --pro-shadow-soft: 0 10px 26px -22px rgba(11, 42, 31, 0.55);
  --pro-shadow-hover: 0 22px 44px -30px rgba(11, 42, 31, 0.62);
  --pro-ring: rgba(15, 157, 107, 0.16);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar::after {
  content: "";
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(15, 157, 107, 0.28), transparent);
}

.user-badge {
  border: 1px solid rgba(15, 157, 107, 0.20);
  background: linear-gradient(135deg, #e9f7f1 0%, #f7fcfa 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.filters,
.records-toolbar,
.daily-progress,
.table-wrap,
.answer,
.split section,
.dashboard-priority,
.attention-panel,
.card,
.cf-card,
.search-result-card,
.qi-summary-card,
.qi-card {
  border-radius: 18px;
  box-shadow: var(--pro-shadow-soft);
}

.filters,
.records-toolbar {
  padding: 13px;
}

.filters select,
.filters input,
.records-toolbar input,
.records-toolbar select {
  min-height: 44px;
}

.card,
.dashboard-card,
.cf-card,
.qi-summary-card,
.qi-card,
.search-result-card {
  position: relative;
  overflow: hidden;
}

.card::before,
.dashboard-card::before,
.cf-card::before,
.qi-summary-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, rgba(15, 157, 107, 0.65), rgba(15, 157, 107, 0));
  opacity: 0;
  transition: opacity 0.16s ease;
}

.card:hover,
.dashboard-card:hover,
.cf-card:hover,
.qi-summary-card:hover,
.qi-card:hover,
.search-result-card:hover {
  border-color: rgba(15, 157, 107, 0.24);
  box-shadow: var(--pro-shadow-hover);
}

.card:hover::before,
.dashboard-card:hover::before,
.cf-card:hover::before,
.qi-summary-card:hover::before {
  opacity: 1;
}

.dashboard-card strong,
.card strong,
.qi-summary-card strong {
  letter-spacing: -0.04em;
}

.dashboard-card span,
.card span,
.qi-summary-card span,
.cf-meta,
.cf-desc {
  line-height: 1.35;
}

.dashboard-group h2,
.section-head h2 {
  font-weight: 850;
}

.dashboard-priority {
  border-left: 0;
  background:
    radial-gradient(520px 180px at 0% 0%, rgba(15, 157, 107, 0.08), transparent 60%),
    rgba(255, 255, 255, 0.93);
}

.dashboard-priority .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.dashboard-priority .eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 5px rgba(15, 157, 107, 0.10);
}

.attention-item {
  border-radius: 15px;
  min-height: 52px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.60);
}

.attention-item strong {
  min-width: 26px;
  height: 26px;
  font-size: 12px;
}

.table-wrap {
  border: 1px solid rgba(220, 232, 227, 0.95);
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 1px solid #dce8e3;
  background: linear-gradient(180deg, #f8fbfa 0%, #f0f6f3 100%);
  font-size: 11px;
  letter-spacing: 0.055em;
}

td {
  border-bottom-color: #edf3f0;
}

tbody tr {
  transition: background 0.12s ease, box-shadow 0.12s ease;
}

tbody tr:hover {
  background: #f8fcfa;
  box-shadow: inset 3px 0 0 rgba(15, 157, 107, 0.45);
}

.status {
  border: 1px solid transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.status.success {
  border-color: #bfe4d3;
}

.status.warn {
  border-color: #f4ddb0;
}

.status.danger {
  border-color: #f0c2bd;
}

.action-menu summary {
  border-radius: 999px;
  border-color: #d7e5df;
  background: #ffffff;
}

.action-menu[open] summary,
.action-menu summary:hover {
  background: var(--brand-primary-soft);
  color: var(--brand-primary-strong);
}

.action-menu-list {
  border-color: rgba(220, 232, 227, 0.96);
  border-radius: 15px;
  box-shadow: 0 22px 44px -26px rgba(11, 42, 31, 0.48);
  padding: 6px;
}

.action-menu-list button {
  border-radius: 10px;
}

.table-empty {
  border-radius: 18px;
  background:
    radial-gradient(220px 120px at 50% 0%, rgba(15, 157, 107, 0.10), transparent 70%),
    #ffffff;
}

.empty-icon {
  box-shadow: 0 12px 24px -18px rgba(15, 157, 107, 0.90);
}

dialog {
  border-radius: 22px;
  box-shadow: 0 28px 74px -36px rgba(4, 24, 17, 0.72);
}

dialog::backdrop {
  background: rgba(9, 24, 18, 0.42);
  backdrop-filter: blur(3px);
}

#recordDialog h2 {
  letter-spacing: -0.03em;
}

#recordDialog menu,
dialog menu {
  gap: 10px;
}

@media (max-width: 720px) {
  .topbar {
    position: static;
  }

  .topbar::after {
    left: 12px;
    right: 12px;
  }

  .filters,
  .records-toolbar {
    padding: 10px;
  }

  .card,
  .dashboard-card,
  .cf-card,
  .qi-summary-card,
  .qi-card,
  .search-result-card {
    border-radius: 16px;
  }

  th {
    position: static;
  }
}

/* =================================================================
   10 melhorias enterprise v6 — inspirado em grandes plataformas SaaS
   ================================================================= */
:root {
  --enterprise-blue: #1f6feb;
  --enterprise-slate: #17212b;
  --enterprise-surface: rgba(255, 255, 255, 0.94);
  --enterprise-line: rgba(196, 211, 204, 0.78);
}

/* 1. Fundo com camada institucional mais sofisticada */
body {
  background:
    radial-gradient(820px 520px at 78% -12%, rgba(31, 111, 235, 0.075), transparent 60%),
    radial-gradient(760px 460px at 5% 10%, rgba(15, 157, 107, 0.13), transparent 58%),
    linear-gradient(180deg, #f8fbfa 0%, #eef5f1 48%, #f7faf9 100%);
}

/* 2. Topbar com aparencia de cockpit corporativo */
.topbar {
  min-height: 86px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(248, 252, 250, 0.88)),
    radial-gradient(520px 160px at 90% 0%, rgba(15, 157, 107, 0.10), transparent 65%);
}

.topbar h1,
#pageTitle {
  font-size: clamp(25px, 2vw, 32px);
}

/* 3. Sidebar com trilho visual mais premium */
.sidebar {
  background:
    linear-gradient(180deg, rgba(15, 157, 107, 0.085), rgba(255, 255, 255, 0) 240px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.98), rgba(248, 252, 250, 0.96));
}

.sidebar .brand {
  border-bottom-color: rgba(196, 211, 204, 0.82);
}

.menu-group-title {
  letter-spacing: 0.08em;
}

/* 4. Itens do menu com efeito de selecao de app enterprise */
.menu-group-items button[data-module] {
  border: 1px solid transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.menu-group-items button[data-module].active {
  border-color: rgba(15, 157, 107, 0.30);
  box-shadow:
    inset 4px 0 0 var(--brand-primary),
    0 12px 22px -18px rgba(11, 42, 31, 0.65);
}

/* 5. Botoes principais com acabamento menos "flat" */
button:not(.secondary):not(.danger):not(.login-link) {
  border: 1px solid rgba(6, 95, 70, 0.15);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 16px 28px -20px rgba(6, 95, 70, 0.95);
}

button:not(.secondary):not(.danger):not(.login-link):hover {
  filter: saturate(1.04) brightness(1.01);
}

button.secondary:hover {
  border-color: rgba(15, 157, 107, 0.34);
  background: #f8fcfa;
}

/* 6. Inputs/filtros com sensacao de formulario premium */
input,
select,
textarea {
  box-shadow: inset 0 1px 2px rgba(16, 37, 31, 0.035);
}

.filters:focus-within,
.records-toolbar:focus-within {
  border-color: rgba(15, 157, 107, 0.34);
  box-shadow: 0 0 0 4px var(--pro-ring), var(--pro-shadow-soft);
}

/* 7. Cards de indicador com leitura executiva */
.dashboard-card,
.card,
.qi-summary-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 253, 251, 0.94));
}

.dashboard-card strong,
.card strong {
  color: var(--enterprise-slate);
  font-weight: 850;
}

.dashboard-card span,
.card span {
  color: #52625c;
  font-weight: 700;
}

/* 8. Tabelas com primeira coluna mais legivel em telas grandes */
@media (min-width: 981px) {
  tbody td:first-child,
  thead th:first-child {
    padding-left: 16px;
  }

  tbody td:last-child,
  thead th:last-child {
    padding-right: 16px;
  }
}

/* 9. Alertas e prioridades com linguagem visual menos agressiva */
.attention-item.danger {
  background:
    linear-gradient(135deg, #fff6f6, #fffafa);
  border-color: #efc7c3;
}

.attention-item.warn {
  background:
    linear-gradient(135deg, #fff8ea, #fffdf7);
  border-color: #efd7a4;
}

.attention-item > span {
  font-weight: 650;
}

/* 10. Mobile com acabamento de aplicativo: acoes e dialogs mais confortaveis */
@media (max-width: 720px) {
  .top-actions {
    gap: 8px;
  }

  .top-actions button,
  .section-actions button,
  .records-toolbar button {
    border-radius: 14px;
  }

  .table-wrap {
    border-radius: 18px;
    box-shadow: 0 12px 28px -24px rgba(11, 42, 31, 0.55);
  }

  dialog {
    border-radius: 22px;
  }

  .status {
    font-size: 11px;
    padding: 4px 8px;
  }
}

/* =================================================================
   Ajuste fino v7 — menu mais sobrio + Pesquisa inteligente premium
   ================================================================= */
.menu-group-title {
  background: linear-gradient(135deg, #f4faf7, #ffffff);
  border: 1px solid rgba(196, 211, 204, 0.82);
  color: #263832;
}

.menu-group-title .nav-ico {
  background: #e5f3ed;
  color: var(--brand-primary-strong);
}

.menu-group-items button[data-module] {
  background: rgba(255, 255, 255, 0.76);
  border-color: rgba(220, 232, 227, 0.80);
  color: #243630;
}

.menu-group-items button[data-module] .nav-ico {
  background: #eef6f2;
  color: #477061;
}

.menu-group-items button[data-module]:hover {
  background: #f3faf6;
  border-color: rgba(15, 157, 107, 0.22);
}

.menu-group-items button[data-module].active {
  background: linear-gradient(135deg, #e7f6ef 0%, #ffffff 100%);
  color: #075c3f;
}

#assistant {
  max-width: 1120px;
}

#assistant::before {
  content: "Busque rapidamente evidencias, documentos, riscos, treinamentos e pendencias do SGQ.";
  display: block;
  margin: 0 0 12px;
  color: #53615c;
  font-size: 14px;
  font-weight: 650;
}

.assistant-box {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(220, 232, 227, 0.94);
  border-radius: 22px;
  background:
    radial-gradient(420px 160px at 0% 0%, rgba(15, 157, 107, 0.085), transparent 70%),
    rgba(255, 255, 255, 0.92);
  box-shadow: var(--pro-shadow-soft);
}

.assistant-box textarea {
  min-height: 112px;
  border: 0;
  background: transparent;
  box-shadow: none;
  resize: vertical;
  font-size: 15px;
  line-height: 1.5;
}

.assistant-box textarea:focus {
  box-shadow: none;
}

#askAssistant {
  min-height: 92px;
  align-self: stretch;
  border-radius: 16px;
  font-size: 15px;
}

.search-examples {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 16px;
}

.search-examples span {
  color: #53615c;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.search-examples button.secondary.small {
  min-height: 34px;
  border-radius: 999px;
  background: #ffffff;
  border-color: rgba(196, 211, 204, 0.92);
  color: #08784f;
  box-shadow: 0 8px 18px -16px rgba(11, 42, 31, 0.45);
}

#assistantAnswer.answer:not(:empty) {
  margin-top: 14px;
  border-radius: 22px;
}

@media (max-width: 720px) {
  #assistant::before {
    font-size: 13px;
  }

  .assistant-box {
    grid-template-columns: 1fr;
    border-radius: 18px;
  }

  .assistant-box textarea {
    min-height: 126px;
  }

  #askAssistant {
    min-height: 48px;
  }

  .search-examples button.secondary.small {
    flex: 1 1 auto;
  }
}

/* =================================================================
   Pesquisa inteligente v8 — modulo central do SGQ
   ================================================================= */
#assistant {
  display: grid;
  gap: 14px;
}

#assistant::before {
  display: none;
}

.assistant-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 20px 22px;
  border: 1px solid rgba(220, 232, 227, 0.94);
  border-radius: 24px;
  background:
    radial-gradient(520px 190px at 0% 0%, rgba(15, 157, 107, 0.12), transparent 70%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(248, 252, 250, 0.92));
  box-shadow: var(--pro-shadow-soft);
}

.assistant-hero h2 {
  margin: 3px 0 5px;
  color: var(--brand-ink);
  font-size: clamp(22px, 2vw, 30px);
  letter-spacing: -0.045em;
}

.assistant-hero span {
  color: #53615c;
  font-size: 14px;
  line-height: 1.5;
}

.assistant-kpis {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 240px;
}

.assistant-kpis span {
  padding: 7px 10px;
  border: 1px solid rgba(196, 211, 204, 0.84);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #08784f;
  font-size: 12px;
  font-weight: 800;
}

.assistant-box {
  margin: 0;
  border-color: rgba(15, 157, 107, 0.20);
}

.assistant-box:focus-within {
  border-color: rgba(15, 157, 107, 0.42);
  box-shadow: 0 0 0 4px var(--pro-ring), var(--pro-shadow-soft);
}

.assistant-box textarea::placeholder {
  color: #6a7772;
}

.assistant-recent {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: -6px;
}

.assistant-recent span {
  color: #53615c;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.assistant-recent button.secondary.small {
  min-height: 32px;
  border-radius: 999px;
  color: #315047;
  background: #f8fcfa;
}

.search-loading {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 18px;
}

.search-loading > span {
  width: 34px;
  height: 34px;
  border: 3px solid #dce8e3;
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: assistantSpin 0.8s linear infinite;
}

.search-loading strong {
  color: var(--brand-ink);
}

.search-loading p {
  margin: 4px 0 0;
  color: #53615c;
}

@keyframes assistantSpin {
  to { transform: rotate(360deg); }
}

.search-summary {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid rgba(220, 232, 227, 0.92);
  border-radius: 18px;
  background: linear-gradient(135deg, #ffffff, #f7fbf9);
}

.search-summary > span {
  color: #08784f;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-summary > strong {
  color: var(--brand-ink);
  font-size: 18px;
}

.search-group {
  margin-top: 18px;
}

.search-group-title {
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(220, 232, 227, 0.90);
}

.search-result-card {
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 253, 251, 0.94));
}

.search-result-card h3 {
  letter-spacing: -0.02em;
}

.search-best-match {
  border-radius: 999px;
  background: #e6f5ee;
  color: #08784f;
  font-weight: 850;
}

.search-empty {
  padding: 22px;
  border: 1px dashed rgba(15, 157, 107, 0.35);
  border-radius: 18px;
  background:
    radial-gradient(260px 140px at 50% 0%, rgba(15, 157, 107, 0.10), transparent 70%),
    #ffffff;
}

@media (max-width: 760px) {
  .assistant-hero {
    flex-direction: column;
    padding: 16px;
    border-radius: 20px;
  }

  .assistant-kpis {
    justify-content: flex-start;
    min-width: 0;
  }

  .assistant-box {
    padding: 12px;
  }

  .assistant-recent button.secondary.small,
  .search-examples button.secondary.small {
    flex: 1 1 calc(50% - 8px);
  }
}

@media (max-width: 480px) {
  .assistant-kpis span,
  .assistant-recent button.secondary.small,
  .search-examples button.secondary.small {
    width: 100%;
  }
}

/* =================================================================
   Pesquisa inteligente v9 — mais compacta e orientada a resultados
   ================================================================= */
#assistant {
  gap: 10px;
}

.assistant-hero {
  padding: 16px 20px;
  border-radius: 20px;
}

.assistant-hero h2 {
  max-width: 720px;
  font-size: clamp(21px, 1.75vw, 27px);
  line-height: 1.12;
}

.assistant-hero span {
  font-size: 13px;
}

.assistant-kpis {
  gap: 6px;
  min-width: 220px;
}

.assistant-kpis span {
  padding: 6px 9px;
  font-size: 11.5px;
}

.assistant-box {
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 10px;
  padding: 12px;
  border-radius: 20px;
}

.assistant-box::before {
  content: "";
  align-self: start;
  justify-self: start;
  width: 22px;
  height: 22px;
  margin: 4px 0 -26px 4px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 42% 42%, transparent 0 35%, #08784f 36% 48%, transparent 49%),
    linear-gradient(45deg, transparent 0 58%, #08784f 59% 68%, transparent 69%);
  opacity: 0.72;
  pointer-events: none;
}

.assistant-box textarea {
  min-height: 82px;
  padding-left: 34px;
  font-size: 14px;
}

#askAssistant {
  min-height: 76px;
  border-radius: 14px;
}

.search-examples,
.assistant-recent {
  margin: 0;
}

.search-examples span,
.assistant-recent span {
  font-size: 11px;
}

.search-examples button.secondary.small,
.assistant-recent button.secondary.small {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
}

#assistantAnswer.answer:not(:empty) {
  margin-top: 8px;
}

.search-result-cards {
  gap: 10px;
}

.search-result-card {
  padding: 14px;
}

.search-result-card h3 {
  margin-top: 6px;
}

.search-result-actions {
  gap: 7px;
}

@media (max-width: 760px) {
  .assistant-hero {
    padding: 14px;
  }

  .assistant-box {
    grid-template-columns: 1fr;
  }

  .assistant-box textarea {
    min-height: 96px;
  }

  #askAssistant {
    min-height: 46px;
  }
}

/* =================================================================
   Pesquisa inteligente v10 — barra compacta final
   ================================================================= */
.assistant-hero {
  padding: 14px 18px;
}

.assistant-hero h2 {
  font-size: clamp(20px, 1.55vw, 25px);
}

.assistant-box {
  grid-template-columns: minmax(0, 1fr) 116px !important;
  align-items: stretch;
  min-height: 70px;
  padding: 10px;
}

.assistant-box::before {
  margin-top: 3px;
}

.assistant-box textarea#question {
  min-height: 54px !important;
  height: 54px !important;
  max-height: 90px;
  overflow-y: auto;
  padding-top: 8px;
  padding-bottom: 8px;
  line-height: 1.35;
}

#askAssistant {
  min-height: 54px !important;
  height: 54px;
  align-self: center;
  border-radius: 13px;
}

.search-examples,
.assistant-recent {
  gap: 6px;
}

.search-examples button.secondary.small,
.assistant-recent button.secondary.small {
  min-height: 28px;
  padding: 5px 9px;
}

@media (max-width: 760px) {
  .assistant-box {
    grid-template-columns: 1fr !important;
  }

  .assistant-box textarea#question {
    min-height: 72px !important;
    height: 72px !important;
  }

  #askAssistant {
    width: 100%;
    height: 46px;
    min-height: 46px !important;
  }
}

/* Correção v11: placeholder da Pesquisa inteligente legível */
.assistant-box::before {
  display: none;
}

.assistant-box textarea#question {
  width: 100%;
  min-width: 0;
  padding-left: 14px;
  color: var(--brand-ink);
  text-align: left;
  white-space: normal;
}

.assistant-box textarea#question::placeholder {
  color: #6a7772;
  opacity: 1;
}

/* =================================================================
   Limpeza visual v12 — menos poluicao, mais foco na busca
   ================================================================= */
#assistant {
  max-width: 1040px;
  gap: 8px;
}

.assistant-hero {
  display: none;
}

.assistant-box {
  background: #ffffff;
  border-color: rgba(196, 211, 204, 0.88);
  box-shadow: 0 14px 28px -26px rgba(11, 42, 31, 0.45);
}

.assistant-box:focus-within {
  box-shadow: 0 0 0 3px rgba(15, 157, 107, 0.12), 0 14px 28px -26px rgba(11, 42, 31, 0.45);
}

.search-examples,
.assistant-recent {
  padding: 0 2px;
}

.search-examples span,
.assistant-recent span {
  color: #6a7772;
  font-size: 10.5px;
  letter-spacing: 0.08em;
}

.search-examples button.secondary.small,
.assistant-recent button.secondary.small {
  background: transparent;
  border-color: rgba(196, 211, 204, 0.78);
  box-shadow: none;
}

.search-examples button.secondary.small:hover,
.assistant-recent button.secondary.small:hover {
  background: #f7fbf9;
}

.menu-group-title {
  background: #ffffff;
  border-color: rgba(220, 232, 227, 0.92);
  box-shadow: none;
}

.menu-group-title .nav-ico {
  background: #f1f7f4;
}

.menu-group:has(.menu-group-items:not([hidden]) button.active) {
  background: rgba(255, 255, 255, 0.62);
}

.menu-group-items button[data-module] {
  background: #ffffff;
}

.menu-group-items button[data-module].active {
  background: linear-gradient(135deg, #eaf7f1 0%, #ffffff 100%);
}

/* Correção v13: cada aba deve aparecer isoladamente */
.view:not(.active) {
  display: none !important;
}

#assistant.view:not(.active) {
  display: none !important;
}

#assistant.view.active {
  display: grid;
}

/* =================================================================
   v14 — CONTRASTE DO MENU + verde como ACENTO (nao como fundo)
   Diagnostico: o gradiente verde global das acoes primarias
   (button:not(.secondary):not(.danger):not(.login-link), specificity
   0,3,1) vazava sobre os titulos de grupo e itens de navegacao, que
   sao <button>. As tentativas limpas das camadas v7/v12 (fundo branco)
   tinham specificity menor (0,1,0 / 0,2,1) e nunca venciam — por isso a
   barra lateral virava uma "parede verde" com texto escuro de baixo
   contraste. Aqui restauramos a navegacao sobria com specificity
   suficiente (prefixo #menu) e reservamos o verde para o item ATIVO,
   os icones e as acoes primarias — verde vira acento, nao fundo.
   ================================================================= */

/* Titulos de secao — rotulo sobrio, sem fundo verde */
#menu .menu-group-title {
  background: #ffffff;
  border: 1px solid rgba(220, 232, 227, 0.92);
  color: #26302b;
  box-shadow: none;
}
#menu .menu-group-title:hover,
#menu .menu-group-title[aria-expanded="true"] {
  background: #f4faf7;
  border-color: rgba(15, 157, 107, 0.20);
}
#menu .menu-group-title .nav-ico {
  background: #eaf4ef;
  color: var(--brand-primary-strong);
}

/* Itens de navegacao (nao ativos) — cartao branco, tinta forte legivel */
#menu .menu-group-items button[data-module]:not(.active) {
  background: #ffffff;
  border: 1px solid rgba(220, 232, 227, 0.85);
  color: #223531;
  box-shadow: none;
  font-weight: 600;
}
#menu .menu-group-items button[data-module]:not(.active):hover {
  background: #f2faf6;
  border-color: rgba(15, 157, 107, 0.30);
  color: #0d3a2b;
}
#menu .menu-group-items button[data-module]:not(.active) .nav-ico {
  background: #eef6f2;
  color: #3f6a5b;
}

/* Item ATIVO — verde como acento: tinta verde + filete lateral de marca */
#menu .menu-group-items button[data-module].active {
  position: relative;
  background: linear-gradient(135deg, #e6f6ef 0%, #ffffff 100%);
  border: 1px solid rgba(15, 157, 107, 0.28);
  color: #075c3f;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  font-weight: 750;
}
#menu .menu-group-items button[data-module].active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 58%;
  border-radius: 999px;
  background: var(--brand-primary);
}
#menu .menu-group-items button[data-module].active .nav-ico {
  background: rgba(15, 157, 107, 0.16);
  color: var(--brand-primary-strong);
}

/* Pesquisa inteligente — recurso de destaque: leve tom menta, diferenciado
   sem virar um botao verde gritante */
#menu .menu-group-items button[data-module="assistant"]:not(.active) {
  background: rgba(15, 157, 107, 0.07);
  border-color: rgba(15, 157, 107, 0.22);
  color: #08654a;
}
#menu .menu-group-items button[data-module="assistant"]:not(.active):hover {
  background: rgba(15, 157, 107, 0.12);
  color: #075c3f;
}

/* =================================================================
   Bloco recolhivel "Mais opcoes" — campos opcionais/tecnicos do
   formulario de registro, para deixar o form principal mais curto.
   ================================================================= */
#recordDialog .form-advanced {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafcfb;
  margin-top: 6px;
}
#recordDialog .form-advanced > summary {
  cursor: pointer;
  list-style: none;
  padding: 11px 14px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--green-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
#recordDialog .form-advanced > summary::-webkit-details-marker { display: none; }
#recordDialog .form-advanced > summary::before {
  content: "\25B8";
  color: var(--green);
  transition: transform 0.18s ease;
}
#recordDialog .form-advanced[open] > summary::before { transform: rotate(90deg); }
#recordDialog .form-advanced-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 4px 14px 14px;
}
@media (max-width: 640px) {
  #recordDialog .form-advanced-grid { grid-template-columns: 1fr; }
}

/* =================================================================
   Historico de Passagens de Plantao — cartoes (mais legivel que a
   tabela; preserva quebras de linha do resumo estruturado).
   ================================================================= */
.shift-history-list { display: flex; flex-direction: column; gap: 12px; }
.shift-card {
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
}
.shift-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.shift-sector {
  background: var(--mint);
  color: var(--green-strong);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 999px;
}
.shift-when { color: var(--muted); font-size: 12.5px; font-family: var(--font-mono); white-space: nowrap; }
.shift-flow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.shift-person { display: inline-flex; align-items: center; gap: 9px; }
.shift-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; flex: none;
  background: #e6f7f0; color: var(--green-strong);
  font-size: 11px; font-weight: 800;
}
.shift-avatar-to { background: #e7f1fb; color: #2a6cb0; }
.shift-person-info { display: flex; flex-direction: column; line-height: 1.2; }
.shift-person-info small { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.shift-person-info strong { color: var(--ink); font-size: 13.5px; font-weight: 700; }
.shift-arrow { color: var(--muted-2); font-size: 18px; font-weight: 700; }
.shift-summary {
  white-space: pre-wrap;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.55;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
}
@media (max-width: 640px) {
  .shift-card-head { flex-wrap: wrap; }
  .shift-flow { gap: 10px; }
}

/* =================================================================
   Painel resumo de Planos de Acao (contadores por status).
   ================================================================= */
#dailyProgress.ap-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  margin: 0 0 16px;
}
.ap-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--muted-2);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 12px 14px;
}
.ap-stat-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.ap-stat-num { font-family: var(--font-mono); font-size: 24px; font-weight: 500; color: var(--ink); line-height: 1.1; }
.ap-stat-pct { font-size: 12px; font-weight: 700; color: var(--muted-2); }
.ap-done { border-left-color: var(--success); }
.ap-done .ap-stat-num { color: var(--success); }
.ap-progress { border-left-color: var(--blue); }
.ap-progress .ap-stat-num { color: var(--blue); }
.ap-late { border-left-color: var(--red); }
.ap-late .ap-stat-num { color: var(--red); }
.ap-reprog { border-left-color: var(--amber); }
.ap-reprog .ap-stat-num { color: var(--amber); }
.ap-total { border-left-color: var(--ink); }
@media (max-width: 720px) {
  #dailyProgress.ap-summary { grid-template-columns: repeat(2, 1fr); }
}

/* =================================================================
   Comprovante de assinatura — visual de certificado (treinamento/ata).
   ================================================================= */
#certificateBody .certificate-sheet { padding: 30px 34px; }
.cert-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding-bottom: 16px; margin-bottom: 18px;
  border-bottom: 2px solid var(--green);
}
.cert-brand { display: flex; align-items: center; gap: 11px; }
.cert-brand-mark {
  width: 42px; height: 42px; border-radius: 11px;
  background: var(--green); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.cert-brand-txt { display: flex; flex-direction: column; }
.cert-brand-txt strong { color: var(--ink); font-size: 15px; font-weight: 800; }
.cert-brand-txt span { color: var(--muted); font-size: 11.5px; }
.cert-seal {
  display: flex; align-items: center; gap: 8px;
  border: 1.5px solid var(--green); border-radius: 999px;
  padding: 6px 14px 6px 8px; color: var(--green-strong);
  transform: rotate(-3deg); flex: none;
}
.cert-seal-check {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--green); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 800;
}
.cert-seal-text { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; line-height: 1.1; }
#certificateBody .certificate-sheet h1 { font-size: 1.25rem; margin: 0 0 4px; color: var(--green-dark); }
#certificateBody .cert-sub { color: var(--muted); font-size: 13px; margin: 0 0 4px; }
.cert-signer {
  display: flex; align-items: center; gap: 13px;
  background: var(--mint); border: 1px solid #c9e6d5; border-radius: 12px;
  padding: 13px 15px; margin: 18px 0;
}
.cert-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--green); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 15px; flex: none;
}
.cert-signer-info { display: flex; flex-direction: column; gap: 1px; }
.cert-signer-label { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--green-strong); }
.cert-signer-name { font-size: 17px; font-weight: 800; color: var(--ink); }
.cert-signer-meta { font-size: 12.5px; color: var(--muted); }
.cert-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.cert-field {
  display: flex; flex-direction: column; gap: 2px;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
}
.cert-field span { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.cert-field strong { font-size: 13px; color: var(--ink); word-break: break-word; }
.cert-hash-box {
  background: var(--surface-soft); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; margin: 14px 0;
}
.cert-hash-label { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); margin-bottom: 4px; }
#certificateBody .cert-hash {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink);
  word-break: break-all; display: block;
}
#certificateBody .cert-foot {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--muted); line-height: 1.5;
}
@media (max-width: 560px) {
  .cert-grid { grid-template-columns: 1fr; }
  .cert-head { flex-wrap: wrap; }
}

/* Assinatura no comprovante */
.cert-signature { margin: 16px 0 6px; text-align: center; }
.cert-signature img { max-width: 320px; max-height: 90px; display: inline-block; }
.cert-signature-line {
  border-top: 1.5px solid var(--ink);
  max-width: 340px; margin: 2px auto 0; padding-top: 5px;
  font-size: 12.5px; color: var(--muted);
}

/* Quadro de assinatura (desenhar/gerar) no dialogo de assinatura */
.sign-pad-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 4px 0 0;
  background: var(--surface);
}
.sign-pad-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.sign-pad-label > span { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--green-strong); }
.sign-pad-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sign-pad {
  width: 100%; height: 150px;
  border: 1px dashed var(--border-control);
  border-radius: 10px;
  background: #fbfdfc;
  touch-action: none; cursor: crosshair;
  display: block;
}
.sign-pad-hint { display: block; margin-top: 6px; font-size: 11.5px; color: var(--muted); }

/* Em telas menores (tablet/celular) reduzimos o quadro de assinatura para
   garantir que documento + assinatura + botoes caibam sem rolagem excessiva. */
@media (max-width: 640px) {
  .sign-pad { height: 110px; }
  .sign-pad-wrap { padding: 10px 12px; }
  .sign-pad-label { flex-wrap: wrap; }
  .sign-foot { flex-wrap: wrap; }
  .sign-foot #signConfirm { flex: 1 1 100%; }
}
@media (max-height: 560px) {
  .sign-pad { height: 84px; }
}

/* =================================================================
   v15 — RESPOSTAS DE AUDITORIA: opções neutras, preenchem só quando ATIVAS
   O gradiente de CTA fazia o botão "Conforme" (tom success, sem fundo
   próprio) parecer pré-selecionado. Aqui o trio fica plano e igual;
   a cor forte é reservada ao estado .active — o verde volta a ser acento.
   ================================================================= */
.audit-answer-btn,
.audit-answer-btn.success,
.audit-answer-btn.danger,
.audit-answer-btn.secondary {
  background: #ffffff;
  background-image: none;
  border: 1.5px solid var(--border-control, #cbd5cf);
  color: var(--ink, #1b2a24);
  box-shadow: none;
  font-weight: 700;
}
.audit-answer-btn.success { color: #0b7a52; border-color: #bfe3d2; }
.audit-answer-btn.danger { color: var(--red, #d64545); border-color: #eccfcb; }
.audit-answer-btn.secondary { color: #475569; }
.audit-answer-btn:hover { filter: none; background: #f6faf8; box-shadow: none; transform: none; }
.audit-answer-btn.success.active { background: var(--green, #0f9d6b); border-color: var(--green, #0f9d6b); color: #ffffff; }
.audit-answer-btn.danger.active { background: var(--red, #d64545); border-color: var(--red, #d64545); color: #ffffff; }
.audit-answer-btn.secondary.active { background: #475569; border-color: #475569; color: #ffffff; }
.audit-answer-btn.active { outline: none; box-shadow: 0 8px 18px -12px rgba(11, 42, 31, 0.55); }

/* ===== Barra lateral recolhível (rail de ícones estilo portal) — desktop ===== */
.sidebar-collapse { display: none; }
@media (min-width: 981px) {
  .sidebar-collapse {
    display: flex; align-items: center; justify-content: flex-end; width: 100%;
    margin: 6px 0 2px; padding: 6px 8px; background: transparent; border: none;
    border-radius: 8px; color: var(--muted); cursor: pointer;
  }
  .sidebar-collapse:hover { background: var(--surface-soft); color: var(--ink); }

  body.nav-collapsed { grid-template-columns: 76px 1fr; }
  body.nav-collapsed .sidebar { padding: 14px 8px; overflow-y: auto; }
  body.nav-collapsed .brand { justify-content: center; padding: 8px 0 12px; }
  body.nav-collapsed .brand > div:last-child { display: none; }
  body.nav-collapsed .sidebar-collapse { justify-content: center; }
  body.nav-collapsed .sidebar-collapse svg { transform: rotate(180deg); }
  body.nav-collapsed .menu-group-title { display: none; }
  body.nav-collapsed .menu-group-items { display: flex !important; flex-direction: column; gap: 4px; }
  body.nav-collapsed nav button { justify-content: center; padding: 11px 0; }
  body.nav-collapsed nav button span:not(.menu-badge) { display: none; }
  body.nav-collapsed nav button.active::before { display: none; }
  body.nav-collapsed .menu-divider { margin: 8px 6px; }
}

/* ===== Login no estilo portal (gradiente + onda) — camada final ===== */
.login-screen {
  overflow: hidden;
  background:
    radial-gradient(760px 520px at 14% 12%, rgba(31,192,136,0.30), transparent 60%),
    radial-gradient(720px 520px at 88% 92%, rgba(90,79,191,0.16), transparent 62%),
    linear-gradient(140deg, #0f9d6b 0%, #0a6a49 55%, #0b7250 100%);
}
.login-screen::before {
  width: 360px; height: 360px; left: -110px; bottom: -140px;
  background: rgba(255,255,255,0.10); filter: none;
}
.login-screen::after {
  width: 440px; height: 440px; right: -160px; top: -150px;
  background: rgba(255,255,255,0.08); filter: none;
}
.login-card {
  background: #ffffff;
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: 24px;
  box-shadow: 0 40px 90px -40px rgba(4,32,22,0.55), 0 2px 8px rgba(4,32,22,0.10);
}

/* ===== Toque de identidade no cabeçalho de cada aba ===== */
.topbar-titles { position: relative; padding-left: 16px; }
.topbar-titles::before {
  content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 4px;
  border-radius: 999px; background: linear-gradient(180deg, #1fc088, #0a6a49);
}

/* ===== Acabamento: acento nos titulos de secao + botoes primarios ===== */
.dashboard-group h2 { position: relative; padding-left: 13px; }
.dashboard-group h2::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 4px; height: 15px; border-radius: 999px;
  background: linear-gradient(180deg, #1fc088, #0a6a49);
}
/* Gradiente sutil só nos botoes primarios claros (por ID/classe — sem vazar) */
#loginButton, #newRecord, button.primary {
  /* WCAG AA: ambas as pontas escuras o bastante p/ texto branco (era #17b57e = 2,9:1) */
  background-image: linear-gradient(135deg, #0a8055, #08653f);
  border: none;
}
#loginButton:hover, #newRecord:hover, button.primary:hover {
  background-image: linear-gradient(135deg, #14a06f, #085a3e);
}

/* ===== Business Analytics Financeiro ===== */
.fin-grid2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
@media (max-width: 860px) { .fin-grid2 { grid-template-columns: 1fr; } }
.fin-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow-sm); }
.fin-insights { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
