/* ═══════════════════════════════════════════
   GESTOR RN CONSULTORIA — Estilos Principais
═══════════════════════════════════════════ */

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

:root {
  --primary: #ea580c;
  --primary-dark: #c2410c;
  --primary-light: #f97316;
  --primary-glow: rgba(234,88,12,0.15);

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;

  --bg: #f5f5f5;
  --bg-card: #ffffff;
  --sidebar-bg: #111111;
  --sidebar-text: rgba(255,255,255,0.65);
  --sidebar-active: rgba(249,115,22,0.18);

  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;

  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;

  --sidebar-w: 240px;
  --topbar-h: 60px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Temas de cor */
[data-theme="green"] { --primary: #059669; --primary-dark: #047857; --primary-light: #10b981; --primary-glow: rgba(5,150,105,0.15); }
[data-theme="purple"] { --primary: #7c3aed; --primary-dark: #6d28d9; --primary-light: #8b5cf6; --primary-glow: rgba(124,58,237,0.15); }
[data-theme="orange"] { --primary: #ea580c; --primary-dark: #c2410c; --primary-light: #f97316; --primary-glow: rgba(234,88,12,0.15); }

html { font-size: 14px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-logo {
  width: 130px;
  height: auto;
  object-fit: contain;
}

.brand-name { display: block; font-weight: 700; font-size: 15px; color: #fff; }
.brand-tagline { display: block; font-size: 10px; color: var(--sidebar-text); margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,0.35);
  padding: 8px 10px 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
  cursor: pointer;
  margin-bottom: 2px;
}

.nav-item:hover { background: var(--sidebar-active); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; color: rgba(255,255,255,0.55); }
.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { color: #fff; }

/* ── FLUXOGRAMA PAISAGEM ── */
.fluxo-wrap { padding: 4px 0 32px; width: 100%; }
.fluxo-viewport {
  overflow-x: auto; overflow-y: hidden;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); padding: 16px 8px;
  cursor: grab; user-select: none;
}
.fluxo-viewport:active { cursor: grabbing; }
.fluxo-svg-scaler {
  display: block;
  transform-origin: top left;
  transition: transform .2s ease;
}
.fluxo-zoom-bar {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 10px; justify-content: flex-end;
}
.fluxo-zoom-btn {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 6px;
  border: 1.5px solid var(--border); background: var(--card-bg);
  color: var(--text-muted); cursor: pointer; font-size: 16px;
  transition: border-color .15s, color .15s;
}
.fluxo-zoom-btn:hover { border-color: var(--primary); color: var(--primary); }
.fluxo-zoom-label {
  font-size: 11.5px; color: var(--text-muted); min-width: 38px; text-align: center;
}
.fluxo-titulo {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--text-muted); margin-bottom: 10px;
}
.fluxo-titulo i { font-size: 18px; }
.fluxo-titulo strong { color: var(--text); }
.fluxo-legenda {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-bottom: 20px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.fluxo-leg-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text-muted);
}
.fluxo-leg-shape {
  display: inline-block; width: 20px; height: 14px;
  border: 2px solid #9ca3af; background: transparent;
}
.fluxo-leg-shape.oval    { border-radius: 50px; }
.fluxo-leg-shape.processo{ border-radius: 4px; }
.fluxo-leg-shape.decisao {
  transform: rotate(45deg) scale(0.75);
  border-radius: 2px; margin: 0 4px;
}

/* Trilhas horizontais */
.fluxo-trilhas { display: flex; flex-direction: column; gap: 0; min-width: max-content; }
.fluxo-trilha  { display: flex; align-items: center; padding: 10px 0; }

/* Nós */
.fluxo-node {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; min-width: 110px; max-width: 130px;
  min-height: 60px; padding: 10px 12px;
  border: 2px solid var(--node-cor);
  cursor: default; transition: box-shadow .15s;
  flex-shrink: 0;
}
.fluxo-node:hover { box-shadow: 0 0 0 3px color-mix(in srgb, var(--node-cor) 20%, transparent); }
.fluxo-oval    { border-radius: 60px; min-width: 80px; max-width: 100px; min-height: 44px; background: color-mix(in srgb, var(--node-cor) 12%, var(--card-bg)); }
.fluxo-processo{ border-radius: 8px; background: color-mix(in srgb, var(--node-cor) 8%, var(--card-bg)); }
.fluxo-decisao {
  border-radius: 0;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  padding: 14px 20px; min-width: 120px; max-width: 140px; min-height: 80px;
  background: color-mix(in srgb, var(--node-cor) 14%, var(--card-bg));
}
.fluxo-node-label {
  font-size: 11px; font-weight: 600;
  color: var(--node-cor); line-height: 1.3;
}
.fluxo-node-desc {
  font-size: 10px; color: var(--text-muted);
  margin-top: 3px; line-height: 1.3; display: block;
}
.fluxo-decisao .fluxo-node-desc { display: none; }

/* Seta horizontal */
.fluxo-seta {
  display: flex; flex-direction: row;
  align-items: center; flex-shrink: 0;
}
.fluxo-linha { height: 2px; width: 22px; background: var(--border); }
.fluxo-ponta {
  width: 0; height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 8px solid var(--border);
}

/* Label condicional (Sim/Não) acima/abaixo da seta */
.fluxo-seta-wrap {
  display: flex; flex-direction: column;
  align-items: center; flex-shrink: 0;
}
.fluxo-condicional-label {
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 2px;
}
/* cabeçalho do fluxo com botão editar */
.fluxo-cabecalho {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 10px;
}
.fluxo-btn-editar {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; font-size: 12.5px; font-weight: 600;
  border: 1.5px solid var(--primary); border-radius: var(--radius);
  background: transparent; color: var(--primary); cursor: pointer;
  transition: background .15s;
}
.fluxo-btn-editar:hover { background: var(--primary-glow); }

/* ── PAINEL EDITOR FLUXO (slide-in direito) ── */
.fe-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 420px; max-width: 96vw;
  z-index: 1100;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  box-shadow: -6px 0 40px rgba(0,0,0,.25);
}
.fe-panel-open { transform: translateX(0); }
.fe-panel-inner {
  height: 100%; display: flex; flex-direction: column;
  background: var(--card-bg);
  border-left: 1px solid var(--border);
}
.fe-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--border);
  background: var(--card-bg);
}
.fe-panel-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; color: var(--text);
}
.fe-close-btn {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1.5px solid var(--border); background: none;
  color: var(--text-muted); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.fe-close-btn:hover { background: var(--bg); color: var(--text); }
.fe-panel-section {
  padding: 14px 20px 10px; border-bottom: 1px solid var(--border);
}
.fe-panel-steps-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text-muted);
}
.fe-steps-count {
  font-size: 11px; font-weight: 500; color: var(--text-muted);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; padding: 2px 10px;
}
.fe-label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 8px;
}

/* Lista de cards */
.fec-list {
  flex: 1; overflow-y: auto; padding: 10px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.fec-card {
  border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--bg); transition: border-color .15s;
}
.fec-card:hover { border-color: var(--primary); }
.fec-card-top {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px;
}
.fec-order {
  display: flex; flex-direction: column; gap: 2px; flex-shrink: 0;
}
.fec-order button {
  width: 24px; height: 22px; display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--border); border-radius: 5px;
  color: var(--text-muted); cursor: pointer; font-size: 12px;
  transition: background .12s;
}
.fec-order button:hover:not(:disabled) { background: var(--card-bg); color: var(--text); }
.fec-order button:disabled { opacity: .3; cursor: default; }
.fec-color-dot {
  width: 28px; height: 28px; border-radius: 50%;
  flex-shrink: 0; cursor: pointer; position: relative;
  border: 2px solid rgba(255,255,255,.3);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  transition: transform .15s;
}
.fec-color-dot:hover { transform: scale(1.15); }
.fec-main { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fec-label-input {
  width: 100%; box-sizing: border-box;
  font-size: 13px; font-weight: 600; color: var(--text);
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 7px; padding: 7px 10px 7px 12px;
  border-left-width: 3px; outline: none;
  transition: border-color .15s;
}
.fec-label-input:focus { border-color: var(--primary); border-left-width: 3px; }
.fec-meta { display: flex; gap: 6px; }
.fec-select {
  flex: 1; font-size: 11.5px; color: var(--text-muted);
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 6px; outline: none; cursor: pointer;
}
.fec-select:focus { border-color: var(--primary); }
.fec-delete {
  flex-shrink: 0; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid transparent;
  border-radius: 7px; color: #d1d5db; cursor: pointer; font-size: 14px;
  transition: all .15s;
}
.fec-delete:hover { border-color: #fca5a5; color: #dc2626; background: #fef2f2; }
.fec-desc-wrap { padding: 0 12px 10px 12px; }
.fec-desc-input {
  width: 100%; box-sizing: border-box;
  font-size: 11.5px; color: var(--text-muted);
  background: transparent; border: none; border-top: 1px solid var(--border);
  padding: 7px 4px 0; outline: none;
}
.fec-desc-input::placeholder { color: #c4c9d4; }
.fec-desc-input:focus { border-top-color: var(--primary); }

/* Botão adicionar */
.fe-add-wrap { padding: 10px 16px 4px; }
.fe-btn-add {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px; font-size: 13px; font-weight: 600;
  border: 1.5px dashed var(--border); border-radius: 10px;
  background: transparent; color: var(--text-muted); cursor: pointer;
  transition: all .15s;
}
.fe-btn-add:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-glow); }

/* Rodapé do painel */
.fe-panel-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-top: 1px solid var(--border);
  background: var(--card-bg);
}
.fe-btn-cancel {
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  border: 1.5px solid var(--border); border-radius: 8px;
  background: transparent; color: var(--text-muted); cursor: pointer;
}
.fe-btn-cancel:hover { background: var(--bg); }
.fe-btn-reset {
  display: flex; align-items: center; gap: 5px;
  padding: 8px 12px; font-size: 12px; font-weight: 600;
  border: 1.5px solid transparent; border-radius: 8px;
  background: transparent; color: var(--text-muted); cursor: pointer;
}
.fe-btn-reset:hover { color: #dc2626; border-color: #fca5a5; background: #fef2f2; }
.fe-btn-save {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 18px; font-size: 13px; font-weight: 700;
  border: none; border-radius: 8px;
  background: var(--primary); color: #fff; cursor: pointer;
}
.fe-btn-save:hover { opacity: .9; }
.fluxo-seta-wrap .fluxo-seta { margin-top: 0; }

/* ── DEPT TABS (Mapeamento / Manuais / Pessoas) ── */
.dept-tabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 16px 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.dept-tab {
  padding: 7px 18px; font-size: 13px; font-weight: 500;
  border: 1.5px solid var(--border); border-radius: 20px;
  background: transparent; color: var(--text-muted);
  cursor: pointer; transition: all .18s;
}
.dept-tab:hover { border-color: var(--primary); color: var(--primary); }
.dept-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.dept-content { min-height: 200px; }
.dept-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 20px; text-align: center;
  color: var(--text-muted); font-size: 14px; gap: 10px;
}
.dept-empty i { font-size: 40px; opacity: .3; }

/* ── NAV GRUPOS COM SUBMENU ── */
.nav-group { }
.nav-group-toggle { cursor: pointer; justify-content: space-between; }
.nav-arrow {
  font-size: 16px;
  margin-left: auto;
  transition: transform .22s;
  color: var(--sidebar-text);
  line-height: 1;
}
.nav-group.open .nav-arrow { transform: rotate(90deg); }
.nav-submenu {
  display: none;
  flex-direction: column;
  background: rgba(0,0,0,0.18);
  border-left: 2px solid var(--primary);
  margin: 2px 8px 4px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  overflow: hidden;
}
.nav-group.open .nav-submenu { display: flex; }
.nav-sub-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--primary);
  padding: 8px 12px 3px;
  opacity: .85;
}
.nav-subitem {
  display: block;
  padding: 7px 12px 7px 16px;
  font-size: 12.5px;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: background .15s, color .15s;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.nav-subitem:last-child { border-bottom: none; }
.nav-subitem:hover, .nav-subitem.active {
  background: var(--primary-glow);
  color: #fff;
}

/* Bloco de usuário no canto superior direito */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 12px;
  margin-left: 4px;
  border-left: 1px solid var(--border);
}
.user-avatar {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: #fff;
  flex-shrink: 0;
}
.user-details { line-height: 1.25; }
.user-name { display: block; font-size: 13px; font-weight: 600; color: var(--text); }
.user-role { display: block; font-size: 11px; color: var(--text-muted); }

.btn-sair {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  display: flex; align-items: center;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-sair:hover {
  background: #fee2e2;
  border-color: #fecaca;
  color: var(--danger);
}

/* ── MAIN ── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}

.menu-toggle {
  display: none;
  background: none; border: none;
  font-size: 20px; cursor: pointer; color: var(--text);
}

/* nowrap + ellipsis: sem isso o título quebra em 3 linhas e estoura a barra
   assim que o seletor de empresa disputa espaço, abaixo de ~1024px */
.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Seletor da empresa em que se está trabalhando */
.seletor-empresa {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 14px;
  border-right: 1px solid var(--border);
}
.seletor-empresa-rotulo {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
}
.seletor-empresa select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  max-width: 230px;
  cursor: pointer;
}
.seletor-empresa select:hover  { border-color: var(--primary); }
.seletor-empresa select:focus  { outline: none; border-color: var(--primary); }

/* Em telas menores a barra fica disputada: o rótulo "Empresa" sai primeiro,
   depois o nome encurta. O botão de gerenciar nunca sai. */
@media (max-width: 1150px) {
  .seletor-empresa-rotulo { display: none; }
  .seletor-empresa select,
  .empresa-unica { max-width: 160px; }
  .seletor-empresa { padding-right: 10px; }
}

/* Com uma empresa só não há o que escolher: mostra o nome como texto.
   O botão de gerenciar continua visível — sem ele não haveria como
   cadastrar a segunda empresa. */
.empresa-unica {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seletor-empresa select.oculto,
.empresa-unica.oculto { display: none; }

.btn-empresas {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 9px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  display: flex; align-items: center;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-empresas:hover {
  background: var(--primary-glow);
  border-color: var(--primary);
  color: var(--primary);
}

.empresa-linha {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--bg-card);
}
.empresa-linha.ativa { border-color: var(--primary); background: var(--primary-glow); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.btn-notif, .btn-icon {
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px; cursor: pointer;
  color: var(--text-muted); font-size: 14px;
  transition: background .15s, color .15s;
  position: relative;
}
.btn-notif:hover, .btn-icon:hover { background: var(--bg); color: var(--text); }

.badge {
  background: var(--danger);
  color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 99px; padding: 1px 5px;
  margin-left: 4px;
}

/* ── CONTENT ── */
.content { padding: 24px; padding-bottom: 52px; flex: 1; }

.module { display: none; }
.module.active { display: block; }

/* ── MODULE HEADER ── */
.module-header {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 12px; margin-bottom: 24px;
}
.module-header h1 { font-size: 22px; font-weight: 800; color: var(--text); }
.module-sub { color: var(--text-muted); font-size: 13px; flex: 1; min-width: 200px; }

/* ── BUTTONS ── */
.btn-primary {
  background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius-sm);
  padding: 9px 18px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .15s, transform .1s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(.98); }

.btn-secondary {
  background: #fff; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 18px; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background .15s;
}
.btn-secondary:hover { background: var(--bg); }

.btn-icon-sm {
  background: none; border: 1px solid var(--border);
  border-radius: 5px; padding: 4px 8px;
  font-size: 12px; cursor: pointer;
  color: var(--text-muted); transition: all .15s;
}
.btn-icon-sm:hover { background: var(--bg); color: var(--text); }
.btn-danger-sm {
  background: none; border: 1px solid #fecaca;
  border-radius: 5px; padding: 4px 8px;
  font-size: 12px; cursor: pointer;
  color: var(--danger); transition: all .15s;
}
.btn-danger-sm:hover { background: #fef2f2; }

/* ── KPI CARDS ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow);
  border-left: 4px solid transparent;
  transition: transform .15s, box-shadow .15s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-blue { border-left-color: var(--primary); }
.kpi-orange { border-left-color: var(--warning); }
.kpi-red { border-left-color: var(--danger); }
.kpi-green { border-left-color: var(--success); }

.kpi-icon { font-size: 26px; }
.kpi-value { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.kpi-label { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ── DASHBOARD GRID ── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

/* ── CARD ── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 14px; font-weight: 700; color: var(--text); }
.card-body { padding: 16px 20px; }

.chart-wrap { min-height: 200px; display: flex; align-items: center; justify-content: center; }
.chart-wrap canvas { max-height: 220px; }

/* ── FILTER BAR ── */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-bottom: 16px;
}
.filter-bar select, .filter-bar input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text);
  background: var(--bg-card);
  outline: none;
  transition: border-color .15s;
}
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--primary); }
.filter-bar input { min-width: 200px; flex: 1; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); }

.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.data-table thead tr { border-bottom: 2px solid var(--border); }
.data-table th {
  padding: 12px 16px;
  text-align: left; font-weight: 600;
  color: var(--text-muted); font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap; background: #f8fafc;
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #f8fafc; }

/* ── BADGES / STATUS ── */
.badge-status {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 600;
}
.s-green { background: #d1fae5; color: #065f46; }
.s-blue { background: #dbeafe; color: #1e40af; }
.s-yellow { background: #fef3c7; color: #92400e; }
.s-red { background: #fee2e2; color: #991b1b; }
.s-gray { background: #f1f5f9; color: #475569; }

/* ── PROCESS GRID ── */
.process-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.process-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border-top: 3px solid var(--primary);
  transition: transform .15s, box-shadow .15s;
}
.process-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.process-card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 10px;
}
.process-card-title { font-weight: 700; font-size: 15px; color: var(--text); }
.process-card-setor {
  font-size: 11px; font-weight: 600;
  background: var(--primary-glow); color: var(--primary);
  padding: 2px 8px; border-radius: 99px;
}
.process-card-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.process-steps { margin: 10px 0; }
.process-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-muted); padding: 3px 0;
}
.step-num {
  width: 18px; height: 18px;
  background: var(--primary); color: #fff;
  border-radius: 50%; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.process-card-actions { display: flex; gap: 8px; margin-top: 14px; }

/* ── REUNIÕES ── */
.reunioes-list { display: flex; flex-direction: column; gap: 14px; }

.reuniao-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.reuniao-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer; user-select: none;
}
.reuniao-head:hover { background: #f8fafc; }
.reuniao-titulo { font-weight: 700; font-size: 15px; color: var(--text); }
.reuniao-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.reuniao-chevron { font-size: 12px; color: var(--text-muted); transition: transform .2s; }
.reuniao-card.open .reuniao-chevron { transform: rotate(180deg); }
.reuniao-body { display: none; padding: 0 20px 20px; }
.reuniao-card.open .reuniao-body { display: block; }

.reuniao-section { margin-top: 14px; }
.reuniao-section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: .06em; margin-bottom: 5px; }
.reuniao-section-content { font-size: 13px; color: var(--text); line-height: 1.6; white-space: pre-wrap; background: var(--bg); border-radius: var(--radius-sm); padding: 10px 12px; }

/* ── INDICADORES ── */
.ind-tabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 20px;
}
.ind-tab {
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--bg-card); color: var(--text-muted);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all .15s;
}
.ind-tab:hover { background: var(--bg); color: var(--text); }
.ind-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.ind-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.ind-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  transition: transform .15s, box-shadow .15s;
}
.ind-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.ind-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.ind-card-name { font-weight: 700; font-size: 14px; color: var(--text); }
.ind-card-area { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }

.ind-values { display: flex; gap: 20px; margin: 14px 0; }
.ind-val-box { flex: 1; }
.ind-val-label { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.ind-val-num { font-size: 22px; font-weight: 800; color: var(--text); }
.ind-val-unit { font-size: 12px; color: var(--text-muted); }

.ind-progress { margin: 10px 0; }
.progress-bar-wrap { background: var(--border); border-radius: 99px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 99px; transition: width .4s ease; }

.ind-chart-wrap { margin-top: 12px; height: 70px; }
.ind-card-actions { display: flex; gap: 8px; margin-top: 14px; }

/* ── CLIMA GRID ── */
.clima-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.clima-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  transition: transform .15s, box-shadow .15s;
}
.clima-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.clima-card-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.clima-card-period { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }

.clima-stat-row { display: flex; gap: 12px; margin-bottom: 14px; }
.clima-stat { flex: 1; background: var(--bg); border-radius: var(--radius-sm); padding: 10px; text-align: center; }
.clima-stat-val { font-size: 18px; font-weight: 800; color: var(--primary); }
.clima-stat-label { font-size: 11px; color: var(--text-muted); }

.clima-dimensoes { margin: 12px 0; }
.clima-dim { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.clima-dim-name { font-size: 12px; color: var(--text); width: 120px; flex-shrink: 0; }
.clima-dim-bar-wrap { flex: 1; background: var(--border); border-radius: 99px; height: 7px; overflow: hidden; }
.clima-dim-bar { height: 100%; background: var(--primary); border-radius: 99px; }
.clima-dim-val { font-size: 12px; font-weight: 600; color: var(--text); width: 32px; text-align: right; }

.clima-card-actions { display: flex; gap: 8px; margin-top: 14px; }

/* ── ALERTAS ── */
.alerta-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.alerta-item:last-child { border-bottom: none; }
.alerta-dot {
  width: 8px; height: 8px; border-radius: 50%;
  margin-top: 5px; flex-shrink: 0;
}
.alerta-texto { font-size: 13px; color: var(--text); }
.alerta-sub { font-size: 11px; color: var(--text-muted); }

.atividade-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.atividade-item:last-child { border-bottom: none; }
.atividade-icon { font-size: 18px; }
.atividade-nome { font-size: 13px; font-weight: 500; color: var(--text); }
.atividade-meta { font-size: 11px; color: var(--text-muted); }

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  align-items: center; justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  animation: modalIn .2s ease;
}
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 900px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(.96) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg-card); z-index: 1;
}
.modal-header h2 { font-size: 17px; font-weight: 700; }
.modal-close {
  background: none; border: none;
  font-size: 16px; cursor: pointer; color: var(--text-muted);
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; transition: background .15s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  position: sticky; bottom: 0; background: var(--bg-card);
}

/* ── FORMS ── */
.form-group { margin-bottom: 14px; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; }
.form-row .form-group { flex: 1; min-width: 150px; margin-bottom: 0; }
.form-row { margin-bottom: 14px; }
.flex2 { flex: 2 !important; }

label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }

input[type="text"], input[type="date"], input[type="time"],
input[type="number"], input[type="search"], input[type="email"],
select, textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: var(--font);
  color: var(--text); background: #fff;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
textarea { resize: vertical; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: #1e293b; color: #fff;
  padding: 12px 20px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(8px);
  transition: opacity .25s, transform .25s;
  pointer-events: none; z-index: 999;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ── FOOTER ── */
.app-footer {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  z-index: 200;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 10px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
@media (max-width: 768px) {
  .app-footer { left: 0; }
}

/* ── THEME BUTTONS ── */
.theme-options { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-btn {
  padding: 7px 18px; border-radius: 99px;
  border: 2px solid var(--border);
  font-size: 13px; font-weight: 500; cursor: pointer;
  background: #fff; color: var(--text); transition: all .15s;
}
.theme-btn.active { border-color: var(--primary); color: var(--primary); }

/* ── EMPTY STATE ── */
.empty-state {
  padding: 40px 20px; text-align: center;
  color: var(--text-muted); font-size: 13px;
}
.full-width { grid-column: 1 / -1; }

/* ── CLIENTES ── */
.clientes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.cliente-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  border-left: 4px solid var(--primary);
}
.cliente-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.cliente-card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.cliente-card-nome { font-weight: 700; font-size: 15px; color: var(--text); }
.cliente-card-seg { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--primary-glow); color: var(--primary); }
.cliente-card-meta { font-size: 12px; color: var(--text-muted); line-height: 1.8; }
.cliente-card-actions { display: flex; gap: 8px; margin-top: 14px; }

.cli-tabs {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.cli-tab {
  padding: 10px 20px;
  background: none; border: none;
  font-size: 13.5px; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.cli-tab:hover { color: var(--text); }
.cli-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.cli-tab-content { display: none; }
.cli-tab-content.active { display: block; }

.cli-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.cli-info-item {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.cli-info-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 4px; }
.cli-info-value { font-size: 14px; font-weight: 500; color: var(--text); }

/* ── DIAGNÓSTICO ── */
.diag-empty {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}

.diag-resultado {
  display: flex; flex-direction: column; gap: 20px;
}

.diag-header-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  color: #fff;
  display: flex; align-items: center; gap: 24px;
  flex-wrap: wrap;
}
.diag-score-circle {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  border: 3px solid rgba(255,255,255,.4);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  flex-shrink: 0;
}
.diag-score-num { font-size: 28px; font-weight: 800; line-height: 1; }
.diag-score-label { font-size: 10px; opacity: .8; margin-top: 2px; }
.diag-header-text { flex: 1; }
.diag-header-text h2 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.diag-header-text p { font-size: 13px; opacity: .85; line-height: 1.6; }

.diag-areas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.diag-area-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.diag-area-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.diag-area-nome { font-size: 13px; font-weight: 700; }
.diag-area-score { font-size: 20px; font-weight: 800; }
.diag-area-bar-wrap { background: var(--border); border-radius: 99px; height: 7px; overflow: hidden; margin-bottom: 8px; }
.diag-area-bar { height: 100%; border-radius: 99px; transition: width .5s ease; }
.diag-area-nivel { font-size: 11px; font-weight: 600; }

.diag-section { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 24px; }
.diag-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }

.diag-texto { font-size: 13.5px; line-height: 1.8; color: var(--text); white-space: pre-wrap; }

.diag-prioridade-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.diag-prioridade-item:last-child { border-bottom: none; }
.prio-num {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: #fff; flex-shrink: 0;
}
.prio-1 { background: var(--danger); }
.prio-2 { background: var(--warning); }
.prio-3 { background: var(--info); }
.prio-other { background: var(--text-muted); }
.prio-titulo { font-size: 13.5px; font-weight: 600; color: var(--text); }
.prio-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.5; }

/* ── DIAGNÓSTICO FORM ── */
.diag-form-wrap {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.diag-form-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap; gap: 12px;
  background: var(--bg);
}

.diag-form-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 0; }

.diag-form-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.diag-form-section:last-child { border-bottom: none; }

.diag-form-section-title {
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--primary); margin-bottom: 14px;
}

.diag-areas-check {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.diag-area-item {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s;
}
.diag-area-item.selected { border-color: var(--primary); }

.diag-area-check-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; cursor: pointer;
  user-select: none;
  background: #fff;
}
.diag-area-item.selected .diag-area-check-head { background: var(--primary-glow); }

.diag-area-checkbox {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; transition: all .15s;
}
.diag-area-item.selected .diag-area-checkbox {
  background: var(--primary); border-color: var(--primary); color: #fff;
}

.diag-area-check-label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.diag-area-check-body { display: none; padding: 0 14px 12px; }
.diag-area-item.selected .diag-area-check-body { display: block; }

/* ── QUESTIONÁRIO RN ── */
.quest-secao {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
}
.quest-secao-titulo {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--primary); margin-bottom: 14px;
}
.quest-item { margin-bottom: 12px; }
.quest-label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text); margin-bottom: 6px;
  text-transform: none; letter-spacing: 0;
}
.quest-textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; font-family: var(--font);
  color: var(--text); background: #fff;
  resize: vertical; outline: none;
  transition: border-color .15s;
}
.quest-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.quest-escala {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.quest-escala input[type="radio"] { display: none; }
.quest-escala-btn {
  min-width: 44px; height: 36px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; font-size: 12px; font-weight: 600;
  color: var(--text-muted); transition: all .15s;
  padding: 0 6px; line-height: 1.2;
  text-align: center;
}
.quest-escala-btn small { font-size: 9px; font-weight: 400; }
.quest-escala-btn:hover { border-color: var(--primary); color: var(--primary); }
.quest-escala-btn.sel { background: var(--primary); color: #fff; border-color: var(--primary); }
.quest-escala-hint {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--text-muted);
  width: 100%; margin-top: 2px;
}
.quest-opcoes { display: flex; flex-wrap: wrap; gap: 8px; }
.quest-opcoes input[type="radio"] { display: none; }
.quest-opcao-btn {
  padding: 7px 14px;
  border: 1.5px solid var(--border); border-radius: 99px;
  cursor: pointer; font-size: 12px; font-weight: 500;
  color: var(--text-muted); transition: all .15s;
}
.quest-opcao-btn:hover { border-color: var(--primary); color: var(--primary); }
.quest-opcao-btn.sel { background: var(--primary); color: #fff; border-color: var(--primary); }
.quest-maturidade {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px dashed var(--border);
}

/* ── DIAGNÓSTICO RESUMO ── */
.diag-secao-resumo { margin-bottom: 16px; }
.diag-secao-titulo {
  font-size: 13px; font-weight: 700;
  color: var(--primary); margin-bottom: 8px;
  text-transform: uppercase; letter-spacing: .04em;
}
.diag-secao-item { margin-bottom: 8px; }
.diag-secao-pergunta { font-size: 12px; color: var(--text-muted); margin-bottom: 2px; }
.diag-secao-resp { font-size: 13px; color: var(--text); background: var(--bg); padding: 8px 12px; border-radius: var(--radius-sm); }

/* ── QUESTIONÁRIO ── */
.quest-area {
  margin-bottom: 20px;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.quest-area-title {
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--primary); margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.quest-item { margin-bottom: 12px; }
.quest-item label { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 5px; display: block; text-transform: none; letter-spacing: 0; }
.quest-scale {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.quest-scale input[type="radio"] { display: none; }
.quest-scale label {
  width: 36px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border);
  border-radius: 6px; cursor: pointer;
  font-size: 13px; font-weight: 600;
  color: var(--text-muted); transition: all .15s;
  text-transform: none; letter-spacing: 0; margin: 0;
}
.quest-scale input[type="radio"]:checked + label {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.quest-scale label:hover { border-color: var(--primary); color: var(--primary); }
.quest-scale-hint { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-muted); margin-top: 3px; }

/* ── PLANO CLIENTE ── */
.plano-cli-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.plano-cli-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.plano-cli-area-badge {
  font-size: 11px; font-weight: 700;
  padding: 3px 10px; border-radius: 99px;
  text-transform: uppercase; letter-spacing: .04em;
}
.plano-cli-title { font-size: 14px; font-weight: 700; flex: 1; }
.plano-cli-score { font-size: 13px; font-weight: 600; }
.plano-cli-body { padding: 16px 20px; }
.plano-cli-acao {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.plano-cli-acao:last-child { border-bottom: none; }
.plano-cli-check {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary-glow);
  border: 2px solid var(--primary);
  flex-shrink: 0; margin-top: 2px;
}
.plano-cli-acao-txt { font-size: 13px; color: var(--text); line-height: 1.5; }
.plano-cli-acao-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── AUTOCOMPLETE CIDADES ── */
.autocomplete-wrap { position: relative; }
.autocidade-dropdown {
  display: none;
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: #fff;
  border: 1.5px solid var(--primary);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 220px;
  overflow-y: auto;
  z-index: 300;
  box-shadow: 0 8px 20px rgba(0,0,0,.12);
}
.autocidade-dropdown.open { display: block; }
.autocidade-item {
  padding: 9px 14px;
  font-size: 13.5px; color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.autocidade-item:last-child { border-bottom: none; }
.autocidade-item:hover,
.autocidade-item.ativo { background: var(--primary-glow); color: var(--primary); font-weight: 600; }
.autocidade-uf { font-size: 11px; font-weight: 700; color: var(--primary); margin-left: 6px; opacity: .8; }

/* ── CNPJ ── */
.cnpj-wrap { display: flex; gap: 6px; align-items: center; }
.cnpj-wrap input { flex: 1; }
.cnpj-btn {
  flex-shrink: 0;
  width: 36px; height: 36px;
  background: var(--primary);
  border: none; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: background .18s;
}
.cnpj-btn:hover { background: var(--primary-dark); }
.cnpj-status { font-size: 11.5px; margin-top: 4px; min-height: 16px; }
.cnpj-status.ok    { color: #16a34a; }
.cnpj-status.erro  { color: #dc2626; }
.cnpj-status.info  { color: var(--text-muted); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .menu-toggle { display: block; }
  /* o rodapé é fixo: manter a reserva embaixo, senão ele cobre o último
     bloco da tela (o botão "Ativar plataforma" na ficha do cliente, por ex.) */
  .content { padding: 16px; padding-bottom: 60px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  /* sem espaço para nome e cargo: fica só o avatar e o botão sair */
  .topbar-user .user-details { display: none; }
  .topbar-user { padding-left: 8px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .form-row .form-group { min-width: unset; }
}

/* ── CARDS DE DOCUMENTO (Manuais, Mapeamento, Pessoas) ── */
.manual-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  overflow: hidden;
  transition: box-shadow .15s, transform .1s;
}
.manual-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.manual-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px 10px;
}
.manual-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}
.manual-card-body { padding: 0 18px 12px; }
.manual-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.s-gray { background: #e2e8f0; color: #475569; }

.btn-icon-danger:hover {
  background: #fee2e2;
  color: var(--danger);
}

.manual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
@media (max-width: 640px) {
  .manual-grid { grid-template-columns: 1fr; }
}
