/* MARCA DE VIDA — não remova.
   O index.html lê esta variável depois de carregar. Se ela não estiver aqui,
   é porque esta folha não chegou (ou chegou como HTML, vindo de um cache
   envenenado) e o app se recupera sozinho pedindo os CSS de novo com uma URL
   nova. Ver "AUTO-RECUPERAÇÃO" no index.html. */
:root { --checkup-css: ok; }

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Inter', sans-serif; background: #f1f5f9; color: #1e293b; font-size: var(--fs-base); line-height: var(--lh-normal); overflow-wrap: break-word; }
button { cursor: pointer; font-family: inherit; }
input, select { font-family: inherit; }

/* ===== VARIÁVEIS ===== */
:root {
  --purple: #4a1d96;
  --purple-light: #7c3aed;
  --purple-pale: #ede9fe;
  --orange: #ea580c;
  --orange-light: #f97316;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-400: #94a3b8;
  --border: #e2e8f0;
  --white: #ffffff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --sidebar-w: 260px;
  --sidebar-collapsed-w: 72px;
  --topbar-h: 64px;

  /* ===== Tipografia — escala modular (base 13px / leading 1,5; tracking ~0) ===== */
  --fs-2xs: 11px;      /* micro-rótulos, eyebrows */
  --fs-xs: 12px;       /* legendas, metadados, cabeçalho de tabela */
  --fs-sm: 13px;       /* corpo secundário */
  --fs-base: 14px;     /* corpo padrão, botões, inputs */
  --fs-md: 15px;       /* corpo enfático, título de item */
  --fs-lg: 17px;       /* subtítulo de seção */
  --fs-xl: 20px;       /* título de card / h3 */
  --fs-2xl: 24px;      /* título de página / h2 */
  --fs-3xl: 30px;      /* h1 */
  --fs-4xl: 34px;      /* números/estatísticas grandes */
  --fs-display: 42px;  /* hero */
  --fs-hero: 58px;     /* hero landing/certificado */
  --lh-tight: 1.1;     /* títulos grandes */
  --lh-snug: 1.25;     /* títulos médios */
  --lh-normal: 1.5;    /* corpo */
  --lh-relaxed: 1.65;  /* texto longo */
  --fw-normal: 500;
  --fw-medium: 600;
  --fw-semibold: 700;
  --fw-bold: 800;
}

/* ===== LAYOUT ===== */
#app { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--slate-900) 0%, var(--slate-800) 100%);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width 0.3s ease, min-width 0.3s ease;
  overflow: hidden;
}
#sidebar.collapsed {
  width: var(--sidebar-collapsed-w);
  min-width: var(--sidebar-collapsed-w);
}

/* Toggle btn */
#toggleBtn {
  position: fixed;
  top: 48px;
  left: calc(var(--sidebar-w) - 14px);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  border: 2.5px solid white;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(124,58,237,0.45);
  z-index: 200;
  transition: left 0.3s ease, background 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
#toggleBtn:hover {
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  box-shadow: 0 4px 16px rgba(124,58,237,0.6);
}
#toggleBtn i {
  transition: transform 0.3s ease;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
body.collapsed #toggleBtn {
  left: calc(var(--sidebar-collapsed-w) - 14px);
}
body.collapsed #toggleBtn i {
  transform: rotate(180deg);
}

/* Brand block (top of sidebar) */
.sb-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sb-brand-mark {
  height: 30px; width: auto;
  filter: brightness(0) invert(1);
  display: block;
  flex-shrink: 0;
}
.sb-brand-text { display: flex; flex-direction: column; line-height: 1; white-space: nowrap; overflow: hidden; transition: opacity .2s; }
.sb-brand-wordmark { font-size: var(--fs-lg); font-weight: 900; letter-spacing: .04em; color: white; }
.sb-brand-wordmark i { font-style: normal; font-weight: 300; opacity: .8; }
.sb-brand-sub { font-size: var(--fs-2xs); color: rgba(255,255,255,.45); text-transform: uppercase; letter-spacing: .22em; margin-top: 4px; font-weight: var(--fw-medium); }
#sidebar.collapsed .sb-brand-text { opacity: 0; pointer-events: none; }

/* User block */
.sb-user {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.sb-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--fs-md); flex-shrink: 0;
}
.sb-user-text { white-space: nowrap; overflow: hidden; transition: opacity 0.2s; }
.sb-user-text .sb-user-label { font-size: var(--fs-2xs); color: var(--slate-400); text-transform: uppercase; letter-spacing: 0.5px; }
.sb-user-text .sb-user-name { font-size: var(--fs-base); font-weight: var(--fw-medium); margin-top: 1px; }
#sidebar.collapsed .sb-user-text { opacity: 0; pointer-events: none; }
#sidebar.collapsed .sb-user button[aria-label="Sair do contexto"] { display: none; }

/* Busca de cliente DENTRO da sidebar (tema escuro) */
.sb-search { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 8px; padding: 8px 12px; flex: 1; position: relative; transition: border-color .15s, background .15s; }
.sb-search:focus-within { border-color: var(--purple-light); background: rgba(255,255,255,.1); }
.sb-search input { background: none; border: none; outline: none; font-size: var(--fs-base); color: #fff; width: 100%; font-family: inherit; }
.sb-search input::placeholder { color: rgba(255,255,255,.4); }
.sb-search-icon { color: rgba(255,255,255,.5); flex-shrink: 0; }
.sb-search #clientSearchDropdown { position: absolute; top: calc(100% + 8px); left: -8px; right: -8px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.4), 0 2px 6px rgba(0,0,0,.2); display: none; max-height: 420px; overflow-y: auto; z-index: 200; }
.sb-search.open #clientSearchDropdown { display: block; }
#sidebar.collapsed .sb-search { display: none; }

/* Linha do cliente selecionado na sidebar (estilo da carteira) */
.sb-client-row { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.sb-client-row .sb-client-avatar { width: 38px; height: 38px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: var(--fs-sm); flex-shrink: 0; }
.sb-client-row .sb-client-info { min-width: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.sb-client-row .sb-client-name { font-weight: var(--fw-semibold); font-size: var(--fs-lg); line-height: 1.1; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-client-row .sb-client-since { font-size: var(--fs-xs); color: rgba(255,255,255,.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#sidebar.collapsed .sb-client-info, #sidebar.collapsed .sb-user button[aria-label="Sair do contexto"] { display: none; }

/* Nav */
.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 8px; }
.sb-nav::-webkit-scrollbar { width: 4px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
.sb-category {
  font-size: var(--fs-2xs); font-weight: var(--fw-semibold); color: var(--slate-400);
  text-transform: uppercase; letter-spacing: 0.8px;
  padding: 12px 8px 4px;
  white-space: nowrap; overflow: hidden;
  transition: opacity 0.2s, height 0.2s, padding 0.2s;
}
#sidebar.collapsed .sb-category {
  opacity: 0;
  height: 0;
  padding: 0;
  margin: 0;
  pointer-events: none;
}
.sb-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px; border-radius: 8px;
  color: var(--slate-400); font-size: var(--fs-base); font-weight: var(--fw-normal);
  transition: all 0.15s; background: none; border: none; width: 100%;
  text-align: left; white-space: nowrap;
  position: relative;
}
.sb-link:hover { background: rgba(124,58,237,0.12); color: #e2e8f0; }
.sb-link.sb-link-locked { opacity: .45; cursor: not-allowed; }
.sb-link.sb-link-locked:hover { background: transparent; color: var(--slate-400); }
.sb-link.active {
  background: rgba(124,58,237,0.18);
  color: white;
  border-left: 2px solid var(--purple-light);
  padding-left: 6px;
}
.sb-link i { font-size: 19px; flex-shrink: 0; }
.sb-link-text {
  transition: opacity 0.2s, max-width 0.3s;
  max-width: 200px;
  overflow: hidden;
  white-space: nowrap;
}
#sidebar.collapsed .sb-link-text {
  opacity: 0;
  max-width: 0;
  pointer-events: none;
}
#sidebar.collapsed .sb-link {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
#sidebar.collapsed .sb-link.active {
  border-left: none;
  border-radius: 8px;
}
#sidebar.collapsed .sb-link i {
  font-size: 21px;
  margin: 0 auto;
}

/* Tooltip collapsed — elemento único em <body> (ver setupSidebarTooltip),
   não um ::after: a .sb-nav tem overflow-x:hidden (pro scroll vertical dos
   links) e isso corta qualquer conteúdo gerado por pseudo-elemento que
   tente escapar da largura da sidebar, incluindo o tooltip embaixo do ícone. */
.sb-tooltip {
  position: fixed;
  background: var(--slate-800);
  color: white;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: var(--fs-sm);
  white-space: nowrap;
  border: 1px solid var(--slate-700);
  pointer-events: none;
  z-index: 9999;
  display: none;
}

/* ===== MAIN ===== */
#main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  transition: margin-left 0.3s ease;
  min-width: 0;
}
body.collapsed #main { margin-left: var(--sidebar-collapsed-w); }

/* ===== TOPBAR ===== */
#topbar {
  height: var(--topbar-h);
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
}
.tb-search {
  display: flex; align-items: center; gap: 8px;
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px; width: 360px;
  position: relative;
}
.tb-search input { background: none; border: none; outline: none; font-size: var(--fs-base); color: var(--slate-800); width: 100%; }
.tb-search input::placeholder { color: #94a3b8; }
.tb-search.has-context { background: #faf5ff; border-color: #c4b5fd; }
.tb-search-clear {
  display: none;
  background: none; border: none; cursor: pointer;
  color: #94a3b8; padding: 0;
  width: 22px; height: 22px;
  align-items: center; justify-content: center;
  border-radius: 6px;
}
.tb-search-clear:hover { background: #e2e8f0; color: var(--slate-800); }
.tb-search.open .tb-search-clear,
.tb-search.has-context .tb-search-clear { display: inline-flex; }

#clientSearchDropdown {
  position: absolute;
  top: calc(100% + 6px); left: 0; right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(15,23,42,.14), 0 2px 6px rgba(15,23,42,.06);
  display: none;
  max-height: 380px;
  overflow-y: auto;
  z-index: 100;
}
.tb-search.open #clientSearchDropdown { display: block; }
.csd-header {
  padding: 8px 14px;
  font-size: var(--fs-2xs); font-weight: var(--fw-semibold);
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .08em;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.csd-header kbd {
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: var(--fs-2xs);
  font-family: 'Inter', sans-serif;
  color: var(--slate-800);
}
.client-result {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background .12s;
}
.client-result:last-child { border-bottom: none; }
.client-result:hover { background: #f8fafc; }
.client-result-avatar {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: var(--fs-sm);
  flex-shrink: 0;
}
.client-result-info { flex: 1; min-width: 0; }
.client-result-name { font-weight: var(--fw-medium); font-size: var(--fs-base); color: var(--slate-800); }
.client-result-meta { font-size: var(--fs-xs); color: #94a3b8; margin-top: 2px; }
.client-result-score {
  font-family: 'Inter', sans-serif;
  font-size: var(--fs-base); font-weight: var(--fw-semibold);
  color: var(--purple-light);
}

/* Client context banner */
.ctx-banner {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, #faf5ff, #ede9fe);
  border: 1px solid #c4b5fd;
  border-left: 4px solid var(--purple-light);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
  animation: ctxIn .3s cubic-bezier(.2,.7,.3,1);
}
@keyframes ctxIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.ctx-banner-avatar {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 800; font-size: var(--fs-md);
  flex-shrink: 0;
}
.ctx-banner-info { flex: 1; min-width: 0; }
.ctx-banner-label {
  font-size: var(--fs-2xs); font-weight: var(--fw-semibold);
  color: var(--purple);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.ctx-banner-name {
  font-size: var(--fs-lg); font-weight: var(--fw-semibold);
  color: var(--slate-800);
  margin-top: 2px;
}
.ctx-banner-stats {
  display: flex; gap: 22px;
  border-left: 1px solid rgba(124,58,237,.25);
  padding-left: 18px;
  flex-wrap: wrap;
}
.ctx-banner-stats > div { display: flex; flex-direction: column; gap: 2px; }
.ctx-banner-stats .ctx-num {
  font-family: 'Inter', sans-serif;
  font-size: var(--fs-lg); font-weight: 800;
  color: var(--purple);
  line-height: 1;
}
.ctx-banner-stats .ctx-lbl {
  font-size: var(--fs-2xs);
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: 4px;
}
.ctx-banner-clear {
  background: white;
  border: 1px solid #c4b5fd;
  color: var(--purple);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit;
  transition: all .15s;
  flex-shrink: 0;
}
.ctx-banner-clear:hover {
  background: var(--purple);
  color: white;
}

@media (max-width: 920px) {
  .tb-search { width: 240px; }
  .ctx-banner-stats { display: none; }
}

/* ============================================
   MOBILE (< 900px) — sidebar off-canvas
   ============================================ */
#mobileMenuBtn {
  display: none;
  width: 38px; height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff; color: #475569;
  cursor: pointer;
  align-items: center; justify-content: center;
  margin-right: 8px;
  flex-shrink: 0;
}
#mobileMenuBtn:hover { background: #f1f5f9; }
@media (max-width: 900px) {
  #mobileMenuBtn { display: inline-flex; }
  #toggleBtn { display: none !important; } /* recolher é do desktop; no mobile o menu abre/fecha pelo hamburguer */
  #sidebar {
    position: fixed;
    top: 0; left: -300px;
    width: 280px; height: 100vh;
    z-index: 80;
    transition: left .25s ease;
    box-shadow: 4px 0 24px rgba(15,23,42,.18);
    background: #0f172a;
  }
  body.sidebar-open #sidebar { left: 0; }
  body.sidebar-open #sidebarBackdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(15,23,42,.55);
    z-index: 75;
    animation: fadeIn .2s ease;
  }
  #sidebarBackdrop { display: none; }
  #main { margin-left: 0; width: 100%; }
  #content { padding: 16px 12px 80px; }
  .tb-search { width: 100% !important; min-width: 0; }
  .tb-user-info { display: none; }
  .topbar { padding: 8px 12px !important; gap: 6px; }
  .page-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-title { font-size: var(--fs-2xl) !important; }
  .grid-3, .grid-4 { grid-template-columns: 1fr !important; gap: 12px; }
  /* Resumo da auditoria: progresso em cima, rosca embaixo */
  .aud-summary { grid-template-columns: 1fr !important; gap: 12px; }
  .card { padding: 16px; }
  table { font-size: var(--fs-sm); }
  .filter-pills { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; flex-wrap: nowrap; }
  .filter-pills .pill { flex-shrink: 0; }
  /* Jornada BIM: stepper de 8 etapas rola na horizontal (rótulos legíveis) */
  .journey-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; }
  .journey-track { min-width: 680px; }
  .journey-hint-scroll::before { content: "\\2190 deslize \\2192  ·  "; opacity: .8; }

  /* Colaboradores: master-detail empilha (lista em cima, detalhe embaixo) */
  .pipeline-md { grid-template-columns: 1fr !important; }
  .pipeline-md > * { min-width: 0 !important; } /* deixa colunas encolherem (sem estourar a largura) */
  .pipeline-master { max-height: 46vh !important; }
  /* Cards de colaborador mais compactos no celular */
  .pipeline-master .kanban-mini-avatar { width: 30px; height: 30px; font-size: var(--fs-xs); }
  /* Linhas de "Testes atribuídos": quebram para não rolar na horizontal */
  .colab-test-row { flex-wrap: wrap; }
  .colab-test-name { flex: 1 1 100% !important; }
  /* Trava de seguranca: nada empurra a pagina na horizontal (tabelas/jornada rolam dentro de si) */
  #content { overflow-x: hidden; }

  /* Barra de filtros: selects/busca em largura cheia; botões dividem a linha */
  .kanban-filters > select,
  .kanban-filters > input { flex: 1 1 100% !important; width: 100% !important; min-width: 0 !important; }
  .kanban-filters .btn { flex: 1 1 auto; justify-content: center; }

  /* Tabelas largas: cada uma rola na horizontal (sem quebrar o layout da página) */
  #content table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
}
.tb-right { display: flex; align-items: center; gap: 8px; }
.tb-icon-btn {
  width: 36px; height: 36px; border-radius: 8px;
  border: none; background: none; color: #64748b;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xl); position: relative;
}
.tb-icon-btn:hover { background: #f1f5f9; }
.tb-notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; background: var(--orange);
  border-radius: 50%; border: 1px solid white;
}
.tb-divider { width: 1px; height: 28px; background: var(--border); margin: 0 4px; }
.tb-user { display: flex; align-items: center; gap: 10px; position: relative; cursor: pointer; padding: 4px 6px; border-radius: 8px; transition: background .15s; }
.tb-user:hover { background: #f1f5f9; }
.tb-user-info { text-align: right; }
.tb-user-info .name { font-size: var(--fs-base); font-weight: var(--fw-medium); }
.tb-user-info .role { font-size: var(--fs-xs); color: #64748b; }
.tb-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--purple-light), var(--orange));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: var(--fs-base); color: white;
}
.tb-user-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(15,23,42,.18), 0 2px 6px rgba(15,23,42,.06);
  min-width: 220px;
  padding: 6px;
  z-index: 200;
}
.tb-user-menu.open { display: block; }
.tb-user-menu button {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  border: none;
  background: none;
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--slate-800);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.tb-user-menu button:hover { background: #f8fafc; }
.tb-user-menu .menu-divider { height: 1px; background: var(--border); margin: 4px 6px; }

/* ===== Footer da sidebar (ações + usuário, movidos da topbar) ===== */
.sb-footer {
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.sb-footer-icons { display: flex; align-items: center; justify-content: space-around; gap: 2px; }
.sb-footer .tb-icon-btn { color: rgba(255,255,255,.6); }
.sb-footer .tb-icon-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.sb-footer .tb-notif-dot { border-color: var(--slate-900); }
.sb-footer .tb-user { padding: 8px; border-radius: 8px; }
.sb-footer .tb-user:hover { background: rgba(255,255,255,.08); }
.sb-footer .tb-user-info { display: block; text-align: left; flex: 1; min-width: 0; overflow: hidden; }
.sb-footer .tb-user-info .name { color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-footer .tb-user-info .role { color: rgba(255,255,255,.5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* dropdown abre PARA CIMA (footer fica colado na base da tela) */
.sb-footer .tb-user-menu { top: auto; bottom: calc(100% + 8px); right: auto; left: 0; }
/* estado colapsado: empilha ícones e esconde o texto do usuário */
#sidebar.collapsed .sb-footer { padding: 10px 6px; }
#sidebar.collapsed .sb-footer-icons { flex-direction: column; gap: 4px; }
#sidebar.collapsed .sb-footer .tb-user { justify-content: center; }
#sidebar.collapsed .sb-footer .tb-user-info { display: none; }

/* Painel de notificações (abre a partir do sino no footer) */
.notif-panel { position: fixed; left: 12px; bottom: 80px; width: 300px; max-height: 360px; overflow-y: auto; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 14px 36px rgba(15,23,42,.24); z-index: 9998; }

/* Topbar agora vazia no desktop (conteúdo foi para o footer da sidebar) */
@media (min-width: 901px) { #topbar { display: none; } }

/* ===== CONTENT ===== */
#content { flex: 1; padding: 24px 24px 90px; overflow-y: auto; }

/* ===== PAGES ===== */
.page-section { display: none; }
.page-section.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity:0; transform: translateY(6px); } to { opacity:1; transform: translateY(0); } }

/* ===== COMPONENTS ===== */
/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 8px; border: none;
  font-size: var(--fs-base); font-weight: var(--fw-medium); line-height: var(--lh-snug); transition: all 0.15s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: white; box-shadow: 0 2px 8px rgba(74,29,150,0.25);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(74,29,150,0.35); }
.btn-secondary {
  background: white; color: #374151;
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: #f8fafc; border-color: var(--purple-light); }
.btn-danger {
  background: white; color: #dc2626;
  border: 1px solid #fecaca;
}
.btn-danger:hover { background: #fef2f2; border-color: #ef4444; color: #b91c1c; }
.btn-danger-solid {
  background: linear-gradient(135deg,#b91c1c,#ef4444); color: white;
  border: none;
}
.btn-danger-solid:hover { background: linear-gradient(135deg,#991b1b,#dc2626); }
.btn-orange {
  background: linear-gradient(135deg, var(--orange), var(--orange-light));
  color: white;
}
.btn-orange:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(234,88,12,0.3); }

/* Cards */
.card {
  background: white; border: 1px solid var(--border);
  border-radius: 12px; padding: 20px;
}
.kpi-card {
  background: white; border: 1px solid var(--border);
  border-radius: 12px; padding: 20px;
  transition: all 0.2s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.07); border-color: #c4b5fd; }
.kpi-icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xl); margin-bottom: 12px;
}


/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 9px; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: var(--fw-medium);
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-orange { background: #ffedd5; color: #9a3412; }

/* Progress */
.progress-track { background: #e2e8f0; border-radius: 999px; overflow: hidden; height: 7px; }
.progress-fill { height: 100%; border-radius: 999px; transition: width 0.5s; }

/* Test cards */
.test-card {
  background: white; border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; cursor: pointer;
  transition: all 0.2s; position: relative;
  display: flex; flex-direction: column; height: 100%;
}
.test-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(74,29,150,0.1);
  border-color: #c4b5fd;
}
.test-card.done { background: linear-gradient(135deg, #f0fdf4, #dcfce7); border-color: #86efac; }
.test-icon-wrap {
  width: 54px; height: 54px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-3xl); margin-bottom: 12px;
  background: linear-gradient(135deg, #f3e8ff, #fef3c7);
}

/* Option cards (test) */
.option-card {
  background: white; border: 2px solid var(--border);
  border-radius: 10px; padding: 14px 16px; cursor: pointer;
  transition: all 0.15s; display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}
.option-card:last-child { margin-bottom: 0; }
.option-card:hover { border-color: var(--purple-light); background: #faf5ff; }
.option-card.selected { border-color: var(--purple); background: #f5f0ff; }
.option-radio {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid #cbd5e1; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.option-card.selected .option-radio { border-color: var(--purple); }
.option-card.selected .option-radio::after {
  content: ''; width: 10px; height: 10px;
  background: var(--purple); border-radius: 50%;
}

/* Checkpoint */
.cp-dot {
  width: 13px; height: 13px; border-radius: 50%; flex-shrink: 0;
  background: #e2e8f0; border: 2px solid white;
  box-shadow: 0 0 0 2px #e2e8f0; margin-top: 3px;
}
.cp-dot.done { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.cp-dot.active {
  background: var(--purple);
  box-shadow: 0 0 0 2px var(--purple);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 2px var(--purple); }
  50% { box-shadow: 0 0 0 5px rgba(74,29,150,0.25); }
}

/* Gradient text */
.g-text {
  background: linear-gradient(135deg, var(--purple), var(--orange));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-base); }
th { padding: 12px 16px; text-align: left; font-size: var(--fs-xs); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: 0.5px; color: #64748b; background: #f8fafc; border-bottom: 1px solid var(--border); }
td { padding: 13px 16px; border-bottom: 1px solid #f1f5f9; }
tr:hover td { background: #fafbfc; }
/* Lista plana de núcleos/departamentos: colunas com mais respiro entre si */
.nuc-table th, .nuc-table td { padding-left: 24px; padding-right: 32px; vertical-align: middle; }
.nuc-table th:first-child, .nuc-table td:first-child { padding-left: 20px; }
.nuc-table th:last-child, .nuc-table td:last-child { padding-right: 20px; }
.nuc-test-count { display: inline-block; font-size: var(--fs-2xs); font-weight: 800; padding: 2px 9px; border-radius: 999px; white-space: nowrap; background: #f1f5f9; color: #94a3b8; cursor: pointer; transition: filter .12s; }
.nuc-test-count:hover { filter: brightness(.96); }

/* Scrollbar (global — fino e discreto) */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* Scrollbar da JANELA/documento (a barra da lateral direita) — trilho branco, thumb cinza, setas topo/base */
html::-webkit-scrollbar { width: 15px; height: 15px; }
html::-webkit-scrollbar-track { background: #e2e8f0; }
html::-webkit-scrollbar-thumb { background: #475569; border-radius: 999px; border: 3px solid #e2e8f0; background-clip: padding-box; min-height: 40px; }
html::-webkit-scrollbar-thumb:hover { background: #334155; background-clip: padding-box; }
/* setas (botoes) no topo e na base */
html::-webkit-scrollbar-button { background: #e2e8f0; height: 15px; background-repeat: no-repeat; background-position: center; }
html::-webkit-scrollbar-button:vertical:decrement { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='9' height='9' viewBox='0 0 10 10'><path d='M5 3 L8.5 7 L1.5 7 Z' fill='%23475569'/></svg>"); }
html::-webkit-scrollbar-button:vertical:increment { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='9' height='9' viewBox='0 0 10 10'><path d='M1.5 3 L8.5 3 L5 7 Z' fill='%23475569'/></svg>"); }
/* esconde o segundo par de botoes que o webkit cria por padrao */
html::-webkit-scrollbar-button:vertical:start:increment,
html::-webkit-scrollbar-button:vertical:end:decrement { display: none; }
/* NAO usar scrollbar-color/width no html: essa propriedade e herdada e
   quebraria o scrollbar proprio da sidebar (.sb-nav). Mantem so os pseudo webkit. */

/* Page headers — title block (title + subtitle) aligned with action button at first line */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header > div:first-child { padding-top: 4px; } /* nudge title block to align baseline with button */
.page-title { font-size: var(--fs-2xl); font-weight: var(--fw-semibold); line-height: var(--lh-tight); color: #0f172a; }
.page-subtitle { font-size: var(--fs-base); line-height: var(--lh-normal); color: #64748b; margin-top: 4px; }
.meta-text { font-size: var(--fs-sm); font-weight: var(--fw-normal); color: #64748b; }

/* Grid helpers */
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px,1fr)); gap: 16px; }
.grid-tests { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px,250px)); gap: 16px; }
/* Resumo da auditoria: 1/3 para o progresso, 2/3 para a rosca + legenda */
.aud-summary { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }
/* 3 colunas fixas do dashboard (Pilares / Auditoria / Avaliações). Em CLASSE
   porque applyNoClientEmptyState faz ch.style.display='' (limparia display:grid inline). */
.dash-3col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; margin-bottom: 16px; }
@media (max-width: 980px) { .dash-3col { grid-template-columns: 1fr; } }
/* Detalhe do colaborador: Testes atribuídos | Resultados lado a lado (estilo pipeline). */
.colab-report-cols { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 16px; align-items: stretch; }
@media (max-width: 1100px) { .colab-report-cols { grid-template-columns: 1fr; } }
/* Chamada de atenção do cadeado da Auditoria quando se tenta editar travado. */
@keyframes audit-lock-shake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-3px)} 40%,80%{transform:translateX(3px)} }
.audit-lock-shake { animation: audit-lock-shake .35s ease; }

/* Filters */
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.pill {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: white; color: #64748b; font-size: var(--fs-sm); font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
.pill:hover { border-color: var(--purple-light); color: var(--purple); }
.pill.active { background: #ede9fe; border-color: var(--purple-light); color: var(--purple); font-weight: 600; }

/* Select styled */
select.styled {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px;
  background: white; font-size: var(--fs-base); color: #374151; outline: none;
  cursor: pointer;
}
select.styled:focus { border-color: var(--purple-light); }

/* Alert box */
.alert {
  padding: 12px 16px; border-radius: 8px;
  border-left: 4px solid var(--purple);
  background: #f5f0ff; color: var(--purple);
  font-size: var(--fs-base); margin-bottom: 20px;
}

/* Mb helpers */
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }

/* Hover underline */
.hover-link { color: var(--purple); font-size: var(--fs-sm); font-weight: 600; background: none; border: none; cursor: pointer; }
.hover-link:hover { text-decoration: underline; }

/* ===== POLISH: refined numbers, sub-icons, transitions ===== */
.mono { font-family: 'Inter', sans-serif; font-variant-numeric: tabular-nums; }
.num { font-feature-settings: 'tnum' on, 'lnum' on; }
.kpi-card { box-shadow: 0 1px 2px rgba(15,23,42,.04); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
/* Big number in KPI cards → tabular monospace for AEC feel */
.kpi-card > div:nth-child(3) {
  font-family: 'Inter', sans-serif;
  font-feature-settings: 'tnum' 1, 'lnum' 1;
  letter-spacing: -0.02em;
}
.kpi-card > div:nth-child(3) span { font-family: inherit; }
.card { box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.btn { letter-spacing: 0.01em; }
.btn-primary:active, .btn-orange:active { transform: translateY(0); }
.icon-chip {
  width: 42px; height: 42px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-2xl);
  background: #f5f0ff;
  color: var(--purple);
}
.icon-chip.sm { width: 32px; height: 32px; font-size: 17px; border-radius: 8px; }
.icon-chip.lg { width: 54px; height: 54px; font-size: 26px; border-radius: 12px; }

/* Page transitions: a bit more refined */
.page-section.active { animation: fadeInUp .28s cubic-bezier(.2,.7,.3,1); }
@keyframes fadeInUp { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform:none; } }

/* Test card icon (replaces emoji) */
.test-icon {
  width: 54px; height: 54px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  margin-bottom: 12px;
  background: #f5f0ff;
  color: var(--purple);
  transition: transform 0.2s;
}
.test-card:hover .test-icon { transform: scale(1.08); }
.test-card:hover .test-icon { transform: scale(1.06) rotate(-2deg); }
.test-card.done .test-icon { background: rgba(16,185,129,.15); color: #047857; }

/* ============================================
   ORGANOGRAMA (árvore hierárquica — estilo Apple)
   ============================================ */
.org-scroll { overflow: auto; padding: 28px 18px; background: #f8fafc; border-radius: 12px; max-height: 80vh; }

/* Organograma — port fiel do organograma_arquitetura_AW (árvore + pilha, cores por cargo) */
.awo-wrap { display: flex; flex-direction: column; gap: 24px; }
.awo-nucleo { background: #fff; border-radius: 16px; padding: 22px 18px; box-shadow: 0 2px 18px rgba(0,0,0,.08); overflow-x: auto; }
.awo-nh { display: flex; align-items: center; gap: 14px; border-bottom: 2px solid #3FBFB0; padding-bottom: 12px; margin-bottom: 22px; }
.awo-nh h2 { font-size: 20px; color: #111213; margin: 0; }
.awo-badge { background: #e6f7f4; color: #1f8a7c; font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 20px; }

/* Nó (card) */
.awo-node { display: inline-flex; align-items: center; gap: 9px; background: #fff; border: 1px solid #e3e6e8; border-radius: 10px; padding: 8px 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); width: 230px; cursor: pointer; }
.awo-node:hover { box-shadow: 0 4px 12px rgba(0,0,0,.16); }
.awo-av { width: 30px; height: 30px; border-radius: 50%; background: #3FBFB0; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11px; flex-shrink: 0; }
.awo-nm { font-weight: 600; font-size: 13.5px; line-height: 1.15; color: #1a1a1a; }
.awo-cg { font-size: 11px; color: #778; }
.awo-node.den { background: #111213; border: none; }
.awo-node.den .awo-nm { color: #fff; } .awo-node.den .awo-cg { color: #7fded0; } .awo-node.den .awo-av { background: #3FBFB0; color: #111213; }
.awo-node.dir { background: #3FBFB0; border: none; }
.awo-node.dir .awo-nm { color: #fff; } .awo-node.dir .awo-cg { color: #eafffc; } .awo-node.dir .awo-av { background: #fff; color: #1f8a7c; }
.awo-node.ger-p { border-color: #e8915b; border-width: 2px; } .awo-node.ger-p .awo-av { background: #e8915b; }
.awo-node.ger-d { border-color: #5b8de8; border-width: 2px; } .awo-node.ger-d .awo-av { background: #5b8de8; }
.awo-node.arq-p { background: #fdf2e9; border-color: #f0c9a3; } .awo-node.arq-p .awo-av { background: #f0b07a; color: #7a4d22; }
.awo-node.arq-d { background: #eef3fc; border-color: #cdddf5; } .awo-node.arq-d .awo-av { background: #a9c4f0; color: #2c4a7a; }
.awo-node.gray { background: #f0f1f2; border-color: #d4d7da; } .awo-node.gray .awo-av { background: #9aa0a6; color: #fff; } .awo-node.gray .awo-nm { color: #5f6368; } .awo-node.gray .awo-cg { color: #9aa0a6; }
.awo-node.grp { background: #fafbfc; border: 1px dashed #b9bec3; cursor: default; } .awo-node.grp .awo-nm { color: #444; } .awo-node.grp .awo-cg { color: #8a9097; }
.awo-node.grp.arq { background: #eef3fc; border-color: #a9c4f0; } .awo-node.grp.arq .awo-nm { color: #2c4a7a; } .awo-node.grp.arq .awo-cg { color: #5b7cbf; }
.awo-node.grp.sup { background: #f0f1f2; border-color: #9aa0a6; } .awo-node.grp.sup .awo-nm { color: #5f6368; } .awo-node.grp.sup .awo-cg { color: #7d8388; }

/* Pilha vertical de subordinados (sob um gestor) */
.awo-stack { display: flex; flex-direction: column; gap: 8px; align-items: center; margin-top: 18px; position: relative; }
.awo-stack::before { content: ''; position: absolute; top: -18px; left: 50%; width: 2px; height: 18px; background: #cdd3d6; }

/* Árvore (níveis de gestão, na horizontal) */
.awo-tree { display: inline-block; min-width: 100%; }
.awo-tree ul { padding-top: 20px; position: relative; display: flex; justify-content: flex-start; gap: 18px; list-style: none; margin: 0; }
.awo-tree li { list-style: none; position: relative; padding: 20px 10px 0 10px; display: flex; flex-direction: column; align-items: center; }
.awo-tree li::before, .awo-tree li::after { content: ''; position: absolute; top: 0; right: 50%; border-top: 2px solid #cdd3d6; width: 50%; height: 20px; }
.awo-tree li::after { right: auto; left: 50%; border-left: 2px solid #cdd3d6; }
.awo-tree li:only-child::after, .awo-tree li:only-child::before { display: none; }
.awo-tree li:first-child::before, .awo-tree li:last-child::after { border: 0; }
.awo-tree li:last-child::before { border-right: 2px solid #cdd3d6; border-radius: 0 6px 0 0; }
.awo-tree li:first-child::after { border-radius: 6px 0 0 0; }
.awo-tree ul ul::before { content: ''; position: absolute; top: 0; left: 50%; border-left: 2px solid #cdd3d6; width: 0; height: 20px; }
.awo-tree > ul { justify-content: center; padding-top: 0; }
.awo-tree > ul > li { padding-top: 0; }
.awo-tree > ul > li::before, .awo-tree > ul > li::after { display: none; }
@media print { .awo-node, .awo-badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
.org-tree, .org-tree ul {
  list-style: none; padding: 0; margin: 0; position: relative;
}
.org-tree { display: inline-block; min-width: 100%; text-align: center; }
.org-tree ul {
  padding-top: 32px;
  display: flex; justify-content: center;
}
.org-tree li {
  display: inline-block; padding: 32px 14px 0;
  position: relative; vertical-align: top;
}
.org-tree li::before, .org-tree li::after {
  content: ''; position: absolute; top: 0;
  width: 50%; height: 32px;
  border-top: 2px solid #38bdf8;
}
.org-tree li::before { right: 50%; }
.org-tree li::after  { left: 50%; }
.org-tree li:only-child::before, .org-tree li:only-child::after { display: none; }
.org-tree li:only-child { padding-top: 0; }
.org-tree li:first-child::before, .org-tree li:last-child::after { border: 0 none; }
.org-tree li:last-child::before { border-right: 2px solid #38bdf8; border-radius: 0 6px 0 0; }
.org-tree li:first-child::after { border-left: 2px solid #38bdf8; border-radius: 6px 0 0 0; }
.org-tree ul > li > ul::before {
  content: ''; position: absolute; top: 0; left: 50%;
  border-left: 2px solid #38bdf8; width: 0; height: 32px;
}
.org-node {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 10px 16px 10px 10px;
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(29,78,216,.32);
  min-width: 220px;
  text-align: left;
  cursor: pointer;
  color: #fff;
  transition: transform .15s, box-shadow .15s;
}
.org-node:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(29,78,216,.45);
}
.org-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  color: #fff; font-size: var(--fs-sm); font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.35);
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.org-name { font-weight: 700; font-size: var(--fs-base); color: #fff; line-height: 1.2; }
.org-role { font-size: var(--fs-xs); color: rgba(255,255,255,.78); margin-top: 2px; }
.org-dept { font-size: var(--fs-2xs); color: #fff; background: rgba(255,255,255,.18); padding: 1px 7px; border-radius: 4px; margin-top: 4px; display: inline-block; letter-spacing: .3px; text-transform: uppercase; font-weight: 700; }
.org-empty { text-align: center; padding: 40px 20px; color: #64748b; font-size: var(--fs-base); }
.org-title { text-align: center; font-weight: 800; font-size: var(--fs-xl); color: #0f172a; margin-bottom: 20px; }

/* ============================================
   KANBAN PIPELINE
   ============================================ */
.kanban-wrap { overflow-x: auto; padding: 4px 0 16px; }
.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(260px, 1fr));
  gap: 12px;
  min-width: 100%;
}
.kanban-col {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  min-height: 200px;
  position: relative;
}
.kanban-col::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 12px 12px 0 0;
  background: var(--col-color, #94a3b8);
}
.kanban-col-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; padding-top: 4px;
}
.kanban-col-title {
  font-size: var(--fs-xs); font-weight: 800; color: #475569;
  text-transform: uppercase; letter-spacing: .8px;
}
.kanban-col-count {
  font-size: var(--fs-xs); font-weight: 700; background: #fff;
  padding: 2px 9px; border-radius: 999px;
  border: 1px solid #e2e8f0; color: #64748b;
}
.kanban-card {
  position: relative;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 12px; margin-bottom: 8px;
  transition: transform .1s, box-shadow .1s, border-color .1s;
}
.kanban-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15,23,42,.08); border-color: #c4b5fd; }
.kanban-empty {
  text-align: center; padding: 20px 8px; color: #cbd5e1; font-size: var(--fs-xs);
}
.kanban-mini-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  color: #fff; font-size: var(--fs-xs); font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.kanban-progress-bar {
  height: 4px; background: #f1f5f9; border-radius: 999px; overflow: hidden;
  margin-top: 6px;
}
.kanban-progress-bar > div { height: 100%; background: #7c3aed; transition: width .2s; }
.kanban-filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 16px;
}

/* ============================================
   MODO PÚBLICO (cadastro via link) — "Ficha de Inscrição"
   ============================================ */
#publicCadastro { min-height: 100vh; background: #f1f5f9; font-family: inherit; }
.public-shell { max-width: 760px; margin: 0 auto; padding: 0 16px 60px; }
.public-hero {
  background: linear-gradient(135deg, #4c1d95 0%, #6d28d9 60%, #7c3aed 100%);
  color: #fff;
  border-radius: 0 0 18px 18px;
  padding: 28px 28px 32px;
  margin-bottom: 20px;
  box-shadow: 0 6px 20px rgba(76,29,149,.18);
}
.public-hero .empresa-tag {
  font-size: var(--fs-xs); letter-spacing: 1.2px; text-transform: uppercase;
  font-weight: 700; color: #c4b5fd;
  display: flex; align-items: center; gap: 8px;
}
.public-hero .ficha-title {
  font-size: var(--fs-3xl); font-weight: 800; margin: 8px 0 6px;
  letter-spacing: -.5px;
}
.public-hero .ficha-sub {
  font-size: var(--fs-base); color: #ddd6fe; line-height: 1.5;
}
.public-hero .ficha-person {
  font-size: var(--fs-lg); font-weight: 700; color: #fff; margin: 4px 0 2px;
}
.public-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 28px 28px;
  box-shadow: 0 4px 16px rgba(15,23,42,.04);
}
.public-section-title {
  font-size: var(--fs-sm); font-weight: 800; color: #7c3aed;
  letter-spacing: 1.2px; text-transform: uppercase;
  padding-bottom: 8px; margin-bottom: 18px;
  border-bottom: 1px solid #ede9fe;
}
.public-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.public-grid > .full { grid-column: 1 / -1; }
@media (max-width: 600px) {
  .public-grid { grid-template-columns: 1fr; }
  .public-shell { padding: 0 12px 48px; }
  .public-hero { padding: 22px 18px 24px; border-radius: 0 0 14px 14px; margin-bottom: 16px; }
  .public-hero .ficha-title { font-size: var(--fs-2xl); }
  .public-card { padding: 20px 16px; border-radius: 14px; }
}
.public-form-field { margin-bottom: 0; }
.public-form-field label {
  display: block; font-size: var(--fs-sm); font-weight: 700; color: #0f172a;
  margin-bottom: 5px;
}
.public-form-field label .req { color: #dc2626; }
.public-form-field input, .public-form-field select {
  width: 100%; padding: 11px 13px;
  border: 1px solid #e2e8f0; border-radius: 8px;
  font-size: var(--fs-md); font-family: inherit;
  outline: none; transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
  background: #fff;
}
.public-form-field input:focus, .public-form-field select:focus {
  border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124,58,237,.12);
}
.public-card-footer {
  margin-top: 22px; padding-top: 18px; border-top: 1px solid #f1f5f9;
}
.public-submit {
  width: 100%; padding: 14px;
  background: #7c3aed; color: #fff;
  border: none; border-radius: 10px;
  font-size: var(--fs-md); font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, transform .1s;
  font-family: inherit;
}
.public-submit:hover { background: #6d28d9; }
.public-submit:active { transform: translateY(1px); }
.public-submit:disabled { opacity: .6; cursor: not-allowed; }

/* ============================================
   LOGIN SCREEN
   ============================================ */
#loginScreen {
  position: fixed; inset: 0; z-index: 1000;
  background: radial-gradient(140% 100% at 80% -10%, var(--purple-light) 0%, var(--purple) 40%, color-mix(in srgb, var(--purple) 70%, black) 80%, color-mix(in srgb, var(--purple) 45%, black) 100%);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  opacity: 1; transition: opacity .55s ease, visibility .55s;
}
body.logged-in #loginScreen { opacity: 0; visibility: hidden; pointer-events: none; }

/* Telas de autenticação (esqueci a senha, redefinir, código do 2FA).
   Mesmo fundo e mesmo enquadramento do login — para quem usa, é a mesma casa.
   `display` é controlado pelo JS; por isso não há transição de opacidade aqui:
   estas telas trocam entre si, e um fade entre elas piscaria o fundo. */
#authScreen {
  display: none;                 /* padrão; o JS liga com data-visivel */
  position: fixed; inset: 0; z-index: 1001;
  background: radial-gradient(140% 100% at 80% -10%, var(--purple-light) 0%, var(--purple) 40%, color-mix(in srgb, var(--purple) 70%, black) 80%, color-mix(in srgb, var(--purple) 45%, black) 100%);
  align-items: center; justify-content: center;
  overflow-y: auto;
}
#authScreen[data-visivel="1"] { display: flex; }

/* Bloco de texto explicativo acima do formulário. */
.auth-intro {
  color: rgba(255,255,255,.72);
  font-size: var(--fs-sm);
  line-height: 1.6;
  text-align: center;
  margin: -4px 0 18px;
}
.auth-intro b { color: #fff; }

/* Mensagem de retorno (erro ou sucesso) dentro das telas de auth. */
.auth-msg {
  display: none;
  font-size: var(--fs-sm);
  line-height: 1.5;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.auth-msg[data-tipo="erro"] { background: rgba(220,38,38,.16); color: #fecaca; border: 1px solid rgba(248,113,113,.4); }
.auth-msg[data-tipo="ok"]   { background: rgba(16,185,129,.16); color: #a7f3d0; border: 1px solid rgba(52,211,153,.4); }

/* Campo do código de 6 dígitos: monoespaçado e espaçado, para conferir dígito
   a dígito sem contar com o dedo. */
.auth-codigo {
  font-size: 30px !important;
  letter-spacing: 12px !important;
  text-align: center;
  font-weight: 800;
  padding-left: 12px !important;
}

/* Link discreto de voltar, no rodapé das telas. */
.auth-voltar {
  display: block; text-align: center; margin-top: 16px;
  color: rgba(255,255,255,.6); font-size: var(--fs-sm);
  background: none; border: none; cursor: pointer; width: 100%;
}
.auth-voltar:hover { color: #fff; text-decoration: underline; }
body:not(.logged-in):not(.public-mode) { overflow: hidden; }
html.public-mode, body.public-mode {
  overflow: auto !important;
  height: auto !important;
  min-height: 100vh;
}
body.public-mode #loginScreen { display: none !important; }

/* ============================================
   MODO CLIENTE (acesso read-only, travado na própria empresa)
   Enforcement de leitura é feito pela guarda de clique (JS); aqui escondemos
   as afordâncias visuais de admin/edição.
   ============================================ */
body.client-view .sb-admin-only { display: none !important; }
/* oposto de .sb-admin-only: só aparece no modo cliente (ex.: "Meus dados") */
.sb-client-only { display: none; }
body.client-view .sb-client-only { display: flex; }
/* trava no cliente: sem trocar de cliente nem voltar para "sem contexto" */
body.client-view .sb-user button[aria-label="Sair do contexto"] { display: none !important; }
body.client-view .sb-search { display: none !important; }
/* esconde botões/afordâncias de edição dentro do conteúdo */
body.client-view #content .btn-primary,
body.client-view #content .btn-danger,
body.client-view #content .hover-link,
body.client-view .client-hide { display: none !important; }
/* jornada não é clicável no modo cliente */
body.client-view #dash-timeline > div,
body.client-view #dashboard-timeline > div { pointer-events: none !important; cursor: default !important; }
/* aviso "somente leitura" */
#readOnlyToast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px); background: #0f172a; color: #fff; font-size: var(--fs-sm); font-weight: 600; padding: 10px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(15,23,42,.35); z-index: 10000; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; display: flex; align-items: center; gap: 8px; }
#readOnlyToast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Blueprint grid overlay */
#loginScreen::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 56px 56px;
  background-position: center;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
  pointer-events: none;
}
/* Subtle glow accents */
#loginScreen::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(40% 40% at 10% 90%, rgba(234,88,12,.28), transparent 70%),
    radial-gradient(35% 35% at 95% 10%, rgba(167,139,250,.25), transparent 70%);
  pointer-events: none;
}

.login-content {
  position: relative; z-index: 2;
  width: 100%; max-width: 460px;
  padding: 32px 28px;
  text-align: center;
  animation: loginIn .6s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes loginIn { from { opacity:0; transform: translateY(14px); } to { opacity:1; transform:none; } }

/* MOBILE: login enxuto e rolável (sem cortar o topo; sem animação decorativa) */
@media (max-width: 600px) {
  #loginScreen { display: block; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .login-content { max-width: 100%; margin: 0 auto; padding: 36px 22px 40px; }
  .spbim-full { width: auto; height: 64px; }
  .spbim-mark { height: 48px; }
  .lod-strip { display: none !important; }      /* animação 3D decorativa: ocupa muita altura no celular */
  .spbim-corp-mark { margin-top: 16px; padding-top: 14px; }
  .spbim-corp-mark img { height: 42px; }
}

/* SPBIM logo (combined lamp + wordmark) */
.spbim-logo {
  display: flex; justify-content: center;
  margin-bottom: 22px;
}
.spbim-full {
  width: 100%;
  height: auto;
  filter: brightness(0) invert(1) drop-shadow(0 2px 12px rgba(0,0,0,.25));
  display: block;
}
.spbim-mark {
  height: 64px; width: auto;
  filter: brightness(0) invert(1) drop-shadow(0 2px 8px rgba(0,0,0,.25));
  display: block;
}
.spbim-wordmark {
  font-family: 'Inter', sans-serif;
  font-weight: 900;
  font-size: 38px;
  letter-spacing: .04em;
  line-height: 1;
}
.spbim-wordmark span { font-weight: 300; opacity: .85; }
.spbim-wordmark-img {
  height: 72px;
  width: auto;
  filter: brightness(0) invert(1) drop-shadow(0 2px 10px rgba(0,0,0,.25));
  display: block;
}

/* SPBIM corporate wordmark (bottom of form, below LOD card) */
.spbim-corp-mark {
  display: flex; justify-content: center;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.spbim-corp-mark img {
  height: 54px;
  width: auto;
  max-width: 100%;
  opacity: .75;
  filter: brightness(0) invert(1);
  transition: opacity .2s;
}
.spbim-corp-mark img:hover { opacity: 1; }
.login-tagline {
  color: rgba(255,255,255,.65);
  font-size: var(--fs-sm);
  letter-spacing: .25em;
  text-transform: uppercase;
  margin-top: 28px;
  margin-bottom: 28px;
  font-weight: 500;
}
.login-form .login-tagline {
  text-align: center;
  margin-top: 0;
  margin-bottom: 22px;
}

/* Form card */
.login-form {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 24px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  text-align: left;
}
.login-field {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 14px;
}
.login-field label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: rgba(255,255,255,.75);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.login-field-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: rgba(0,0,0,.18);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px;
  transition: border-color .15s, background .15s;
}
.login-field-wrap:focus-within {
  border-color: #c4b5fd;
  background: rgba(0,0,0,.28);
  box-shadow: 0 0 0 3px rgba(167,139,250,.18);
}
.login-field-wrap i { color: rgba(255,255,255,.55); font-size: var(--fs-xl); }
.login-field-wrap input {
  flex: 1; background: transparent; border: none; outline: none;
  color: white; font-size: var(--fs-md); font-family: inherit;
}
.login-field-wrap input::placeholder { color: rgba(255,255,255,.4); }
.login-field-wrap input:-webkit-autofill,
.login-field-wrap input:-webkit-autofill:hover,
.login-field-wrap input:-webkit-autofill:focus,
.login-field-wrap input:-webkit-autofill:active {
  -webkit-text-fill-color: #fff;
  -webkit-box-shadow: 0 0 0 1000px transparent inset;
  transition: background-color 9999s ease-in-out 0s;
  caret-color: #fff;
}
.login-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 6px; margin-bottom: 18px;
  font-size: var(--fs-sm);
}
.login-check {
  display: inline-flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,.7);
  cursor: pointer;
}
.login-check input { accent-color: #a78bfa; }
.login-link { color: #c4b5fd; font-weight: 500; }
.login-link:hover { color: white; text-decoration: underline; }
.login-submit {
  width: 100%;
  padding: 13px 18px;
  border-radius: 10px;
  border: none;
  font-family: inherit;
  font-weight: 700;
  font-size: var(--fs-md);
  letter-spacing: .03em;
  color: white;
  background: linear-gradient(135deg, #f97316, #ea580c 60%, #c2410c);
  box-shadow: 0 6px 20px rgba(234,88,12,.35), inset 0 1px 0 rgba(255,255,255,.18);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .15s, box-shadow .15s;
}
.login-submit:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(234,88,12,.45), inset 0 1px 0 rgba(255,255,255,.2); }
.login-submit:active { transform: translateY(0); }
.login-footer {
  margin-top: 22px;
  font-size: var(--fs-xs);
  color: rgba(255,255,255,.5);
  letter-spacing: .04em;
  text-align: center;
}
.login-footer a { color: rgba(255,255,255,.85); font-weight: 600; }

/* LOD animation strip */
.lod-strip {
  margin-top: 28px;
  padding: 16px;
  background: rgba(0,0,0,.18);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 12px;
  display: flex; align-items: center; gap: 18px;
}
.lod-svg-wrap {
  width: 130px; height: 110px;
  flex-shrink: 0;
  position: relative;
}
.lod-svg-wrap svg { width: 100%; height: 100%; overflow: visible; }
.lod-caption {
  flex: 1; min-width: 0;
  text-align: left;
  display: flex; flex-direction: column;
  gap: 10px;
  min-height: 104px;
}
.lod-caption-line {
  font-size: var(--fs-2xs);
  font-weight: 600;
  color: rgba(255,255,255,.55);
  letter-spacing: .25em;
  text-transform: uppercase;
  line-height: 1;
  flex-shrink: 0;
}
.lod-steps-wrap {
  position: relative;
  flex: 1;
  min-height: 64px; /* comporta descrição em até 2 linhas sem cortar */
}
.lod-step {
  position: absolute; top: 0; left: 0; right: 0; /* altura automática (não corta a 2ª linha) */
  opacity: 0;
  transition: opacity .4s ease;
  display: flex; flex-direction: column; gap: 4px;
}
.lod-step.active { opacity: 1; }
.lod-step .lod-tag {
  display: inline-flex; align-items: baseline; gap: 8px;
  font-family: 'Inter', sans-serif;
  color: white;
  font-weight: 700;
  font-size: var(--fs-lg);
  letter-spacing: .04em;
  white-space: nowrap;
}
.lod-step .lod-tag b { color: #fdba74; font-weight: 700; }
.lod-step .lod-tag span { opacity: .4; font-weight: 400; }
.lod-step .lod-desc {
  display: block;
  font-size: var(--fs-xs);
  color: rgba(255,255,255,.65);
  letter-spacing: .02em;
  line-height: 1.3;
}
.lod-progress {
  display: flex; gap: 4px;
  flex-shrink: 0;
}
.lod-progress span {
  flex: 1; height: 2px; border-radius: 1px;
  background: rgba(255,255,255,.12);
  transition: background .3s;
}
.lod-progress span.on { background: #fb923c; }

/* SVG building layers */
.lod-svg-wrap svg .lod-layer { opacity: 0; transition: opacity .4s ease; }
.lod-svg-wrap svg .lod-layer.show { opacity: 1; }
.lod-svg-wrap svg .lod-layer line,
.lod-svg-wrap svg .lod-layer path,
.lod-svg-wrap svg .lod-layer polygon,
.lod-svg-wrap svg .lod-layer polyline {
  stroke: rgba(255,255,255,.92);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.lod-svg-wrap svg .lod-layer.fill-roof polygon { fill: rgba(251,146,60,.28); stroke: #fb923c; }
.lod-svg-wrap svg .lod-layer.hatch line { stroke: rgba(255,255,255,.35); stroke-width: 0.9; }

/* Mobile login adjustments */
@media (max-width: 520px) {
  .login-content { padding: 24px 18px; max-width: 100%; }
  .spbim-wordmark { font-size: 30px; }
  .spbim-wordmark-img { height: 60px; }
  .spbim-mark { height: 50px; }
  .lod-strip { flex-direction: column; align-items: stretch; }
  .lod-svg-wrap { width: 100%; height: 130px; }
}

/* ============================================
   ABSTRACT AVATARS (inclusivos, geométricos)
   ============================================ */
.abstract-avatar {
  position: relative;
  overflow: hidden;
  background: #1e1b3a !important;
  border-radius: 50%;
  color: transparent !important;
  text-indent: -9999px;
  padding: 0 !important;
  flex-shrink: 0;
}
.abstract-avatar > svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}
/* Square variant (clientes use rounded squares) */
.abstract-avatar.square { border-radius: 9px; }

/* ============================================
   TWEAKS — expressive variants (3 controls)
   ============================================ */

/* ----- PALETA — Azul AEC (engenharia/técnico) ----- */
body.palette-azul {
  --purple: #1e3a8a;
  --purple-light: #3b82f6;
  --purple-pale: #dbeafe;
  --orange: #0e7490;
  --orange-light: #06b6d4;
}
body.palette-azul .g-text { background: linear-gradient(135deg, #1e3a8a, #06b6d4); -webkit-background-clip: text; background-clip: text; color: transparent; }
body.palette-azul .login-submit { background: linear-gradient(135deg, #06b6d4, #0891b2 60%, #155e75); box-shadow: 0 6px 20px rgba(6,182,212,.35), inset 0 1px 0 rgba(255,255,255,.18); }
body.palette-azul .login-submit:hover { box-shadow: 0 10px 28px rgba(6,182,212,.45), inset 0 1px 0 rgba(255,255,255,.2); }
body.palette-azul #loginScreen { background: radial-gradient(140% 100% at 80% -10%, #1e40af 0%, #1e3a8a 40%, #172554 80%, #0c1d4f 100%); }
body.palette-azul #sidebar { background: linear-gradient(180deg, #0c1d4f 0%, #1e3a8a 100%); }

/* ----- PALETA — Grafite (monocromático sério, AEC corporativo) ----- */
body.palette-grafite {
  --purple: #111827;
  --purple-light: #4b5563;
  --purple-pale: #f3f4f6;
  --orange: #b45309;
  --orange-light: #d97706;
}
body.palette-grafite .g-text { background: linear-gradient(135deg, #111827, #b45309); -webkit-background-clip: text; background-clip: text; color: transparent; }
body.palette-grafite .login-submit { background: linear-gradient(135deg, #d97706, #b45309 60%, #92400e); box-shadow: 0 6px 20px rgba(180,83,9,.32), inset 0 1px 0 rgba(255,255,255,.18); }
body.palette-grafite #loginScreen { background: radial-gradient(140% 100% at 80% -10%, #374151 0%, #1f2937 40%, #111827 80%, #030712 100%); }
body.palette-grafite #sidebar { background: linear-gradient(180deg, #030712 0%, #111827 100%); }

/* ----- PALETA — Solar (terracota + âmbar quente) ----- */
body.palette-solar {
  --purple: #9a3412;
  --purple-light: #ea580c;
  --purple-pale: #ffedd5;
  --orange: #ca8a04;
  --orange-light: #eab308;
}
body.palette-solar .g-text { background: linear-gradient(135deg, #9a3412, #eab308); -webkit-background-clip: text; background-clip: text; color: transparent; }
body.palette-solar .login-submit { background: linear-gradient(135deg, #eab308, #ca8a04 60%, #854d0e); box-shadow: 0 6px 20px rgba(202,138,4,.35), inset 0 1px 0 rgba(255,255,255,.18); }
body.palette-solar #loginScreen { background: radial-gradient(140% 100% at 80% -10%, #c2410c 0%, #9a3412 40%, #7c2d12 80%, #431407 100%); }
body.palette-solar #sidebar { background: linear-gradient(180deg, #431407 0%, #7c2d12 100%); }

/* ----- DENSIDADE — Compacta (dashboard de BI denso) ----- */
body.density-compacta #content { padding: 16px 16px 80px; }
body.density-compacta .card,
body.density-compacta .kpi-card { padding: 14px; border-radius: 8px; }
body.density-compacta .kpi-card > div:nth-child(3) { font-size: 24px; margin: 4px 0; }
body.density-compacta .kpi-icon { width: 32px; height: 32px; border-radius: 7px; font-size: var(--fs-lg); margin-bottom: 8px; }
body.density-compacta .page-header { margin-bottom: 14px; }
body.density-compacta .page-title { font-size: var(--fs-xl); }
body.density-compacta .page-subtitle { font-size: var(--fs-sm); }
body.density-compacta .grid-4, body.density-compacta .aud-summary { gap: 10px; }
body.density-compacta .grid-3, body.density-compacta .grid-2 { gap: 12px; }
body.density-compacta .mb-4 { margin-bottom: 12px; }
body.density-compacta .mb-6 { margin-bottom: 14px; }
body.density-compacta th { padding: 8px 12px; font-size: var(--fs-2xs); }
body.density-compacta td { padding: 8px 12px; }
body.density-compacta .btn { padding: 7px 12px; font-size: var(--fs-sm); }
body.density-compacta .test-card { padding: 12px; }
body.density-compacta .test-icon { width: 38px; height: 38px; font-size: 20px; margin-bottom: 8px; }

/* ----- DENSIDADE — Espaçosa (editorial/premium) ----- */
body.density-espacosa #content { padding: 40px 40px 100px; }
body.density-espacosa .card,
body.density-espacosa .kpi-card { padding: 30px; border-radius: 18px; }
body.density-espacosa .kpi-card > div:nth-child(3) { font-size: 42px; margin: 10px 0; }
body.density-espacosa .kpi-icon { width: 52px; height: 52px; border-radius: 14px; font-size: 25px; margin-bottom: 18px; }
body.density-espacosa .page-header { margin-bottom: 36px; }
body.density-espacosa .page-title { font-size: 30px; }
body.density-espacosa .page-subtitle { font-size: var(--fs-md); margin-top: 6px; }
body.density-espacosa .grid-4, body.density-espacosa .aud-summary { gap: 22px; }
body.density-espacosa .grid-3, body.density-espacosa .grid-2 { gap: 22px; }
body.density-espacosa .mb-4 { margin-bottom: 22px; }
body.density-espacosa .mb-6 { margin-bottom: 32px; }
body.density-espacosa th { padding: 16px 22px; }
body.density-espacosa td { padding: 18px 22px; }
body.density-espacosa .btn { padding: 12px 22px; }
body.density-espacosa .test-card { padding: 26px; }

/* ----- MODO — Blueprint (técnico, grid, monospace, line-art) ----- */
body.mode-blueprint { background: #eef4fb; }
body.mode-blueprint #content {
  background-image:
    linear-gradient(rgba(30,64,175,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30,64,175,.06) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: center top;
}
body.mode-blueprint .card,
body.mode-blueprint .kpi-card,
body.mode-blueprint .test-card {
  border-radius: 3px;
  box-shadow: none;
  border: 1px solid #c7d2e5;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(2px);
}
body.mode-blueprint .page-title {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}
body.mode-blueprint .page-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: var(--fs-xs);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #475569;
}
body.mode-blueprint .kpi-icon,
body.mode-blueprint .test-icon { border-radius: 3px; }
body.mode-blueprint .badge {
  border-radius: 2px;
  font-family: 'Inter', sans-serif;
  font-size: var(--fs-2xs);
  letter-spacing: .05em;
  text-transform: uppercase;
}
body.mode-blueprint .btn-primary,
body.mode-blueprint .btn-secondary,
body.mode-blueprint .btn-orange { border-radius: 3px; letter-spacing: .02em; }
body.mode-blueprint .sb-link { border-radius: 3px; }
body.mode-blueprint .pill { border-radius: 3px; }
body.mode-blueprint .progress-track,
body.mode-blueprint .progress-fill { border-radius: 0; }
body.mode-blueprint h1, body.mode-blueprint h2, body.mode-blueprint h3 { font-weight: 600; }
body.mode-blueprint .icon-chip { border-radius: 3px; }

/* ----- MODO — Editorial (serif, contraste, espaçamento generoso) ----- */
body.mode-editorial { background: #faf7f2; }
body.mode-editorial .page-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700;
  letter-spacing: -0.025em;
  font-size: 30px;
}
body.mode-editorial .kpi-card > div:nth-child(3) {
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700;
  letter-spacing: -0.04em;
}
body.mode-editorial .card,
body.mode-editorial .kpi-card,
body.mode-editorial .test-card {
  border-radius: 4px;
  border: 1px solid #e8e1d2;
  box-shadow: 0 1px 3px rgba(120,80,30,.05);
  background: #fffdf8;
}
body.mode-editorial #content { background: #faf7f2; }
body.mode-editorial #topbar { background: #fffdf8; border-bottom-color: #e8e1d2; }
body.mode-editorial .badge { border-radius: 3px; font-family: Georgia, serif; font-weight: 600; font-size: var(--fs-xs); }
body.mode-editorial .btn { font-family: 'Inter', sans-serif; letter-spacing: .02em; }
body.mode-editorial h1, body.mode-editorial h2 { font-family: Georgia, serif; }
body.mode-editorial .kpi-icon { background: #f5efe1 !important; color: #78532b !important; }

/* ============================================
   NIGHTSHADE — modo noturno (dark mode)
   ============================================ */
body.mode-night { background: #0b1220; color: #cbd5e1; }
body.mode-night #content { background: #0b1220; }
body.mode-night #topbar { background: #111a2b; border-bottom-color: #25324a; }

/* Botão NightShade (lua/sol) */
body.mode-night #nightShadeBtn { color: #fbbf24; }
#nightShadeBtn.active { color: #fbbf24; }

/* Topbar interno */
body.mode-night .tb-icon-btn { color: #94a3b8; }
body.mode-night .tb-icon-btn:hover { background: #1c2741; }
body.mode-night .tb-divider { background: #25324a; }
body.mode-night .tb-user:hover { background: #1c2741; }
body.mode-night .tb-user-info .name { color: #e2e8f0; }
body.mode-night .tb-user-info .role { color: #94a3b8; }
body.mode-night .tb-search { background: #131c2e; border-color: #25324a; }
body.mode-night .tb-search input { color: #e2e8f0; }
body.mode-night .tb-search.has-context { background: #1e1736; border-color: #6d28d9; }

/* Superfícies (cards, kpis, testes) */
body.mode-night .card,
body.mode-night .kpi-card,
body.mode-night .test-card { background: #131c2e; border-color: #25324a; color: #cbd5e1; }
body.mode-night .kpi-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.45); border-color: #6d28d9; }

/* Títulos e textos */
body.mode-night .page-title { color: #f1f5f9; }
body.mode-night .page-subtitle { color: #94a3b8; }
body.mode-night h1, body.mode-night h2, body.mode-night h3 { color: #e2e8f0; }

/* Tabelas */
body.mode-night table { color: #cbd5e1; }
body.mode-night th { color: #94a3b8; border-bottom-color: #25324a; }
body.mode-night td { border-bottom-color: #1c2741; }
body.mode-night tbody tr:hover { background: #1c2741; }

/* Inputs e selects */
body.mode-night input,
body.mode-night select,
body.mode-night textarea { background: #0f172a; color: #e2e8f0; border-color: #25324a; }
body.mode-night input::placeholder { color: #64748b; }

/* Pills e badges */
body.mode-night .pill { background: #131c2e; color: #94a3b8; border-color: #25324a; }
body.mode-night .pill.active { background: var(--purple); color: #fff; }

/* Barras de progresso */
body.mode-night .progress-track { background: #1c2741; }

/* Modais */
body.mode-night .app-modal-dialog { background: #131c2e; color: #cbd5e1; }
body.mode-night .app-modal-close { background: #1c2741; color: #cbd5e1; }
body.mode-night .app-modal-close:hover { background: #25324a; }

/* Painel de ajustes (tweaks) no escuro */
body.mode-night #tweaksPanel { background: #131c2e; border-color: #25324a; color: #cbd5e1; }

/* ============================================
   TWEAKS PANEL UI
   ============================================ */

#tweaksPanel {
  position: fixed;
  left: 12px; bottom: 80px;
  z-index: 901;
  width: 304px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15,23,42,.20), 0 4px 12px rgba(15,23,42,.08);
  display: none;
  overflow: hidden;
  font-family: inherit;
  animation: tweaksIn .25s cubic-bezier(.2,.7,.3,1);
}
@keyframes tweaksIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
body.tweaks-open #tweaksPanel { display: block; }
body:not(.logged-in) #tweaksPanel { display: none !important; }

.tweaks-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.tweaks-title {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--fs-base); font-weight: 700;
  color: var(--slate-800);
}
.tweaks-title i { color: var(--purple-light); font-size: 17px; }
.tweaks-close {
  width: 26px; height: 26px;
  border: none; background: none;
  border-radius: 7px;
  color: #94a3b8;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.tweaks-close:hover { background: #f1f5f9; color: var(--slate-800); }
.tweaks-body { padding: 14px 16px 18px; }
.tweaks-section + .tweaks-section { margin-top: 18px; }
.tweaks-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: var(--fs-2xs); font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
}
.tweaks-label small {
  font-size: var(--fs-xs); font-weight: 600;
  color: var(--slate-800);
  text-transform: none;
  letter-spacing: 0;
  font-family: 'Inter', sans-serif;
}

/* Segmented control (Density/Mode) */
.tweaks-seg {
  display: grid;
  gap: 4px;
  background: #f1f5f9;
  border-radius: 9px;
  padding: 3px;
}
.tweaks-seg.cols-3 { grid-template-columns: repeat(3, 1fr); }
.tweaks-seg button {
  border: none;
  background: transparent;
  padding: 8px 6px;
  border-radius: 7px;
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.tweaks-seg button:hover { color: var(--slate-800); }
.tweaks-seg button.on {
  background: white;
  color: var(--slate-800);
  box-shadow: 0 1px 3px rgba(15,23,42,.10), 0 0 0 1px rgba(15,23,42,.05);
}
.tweaks-seg button i { font-size: var(--fs-lg); color: var(--purple-light); }

/* Palette chips (color cards) */
.tweaks-palette {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.tweaks-palette button {
  border: 2px solid transparent;
  background: none;
  padding: 0;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform .15s, border-color .15s;
}
.tweaks-palette button:hover { transform: translateY(-1px); }
.tweaks-palette button.on { border-color: var(--slate-800); }
.tweaks-palette .swatch {
  display: block;
  height: 48px;
  border-radius: 7px;
  position: relative;
}
.tweaks-palette .swatch::after {
  content: '';
  position: absolute; right: 5px; bottom: 5px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent, currentColor);
  border: 2px solid white;
}
.tweaks-palette .label {
  display: block;
  margin-top: 6px;
  font-size: var(--fs-2xs);
  font-weight: 600;
  color: var(--slate-800);
  text-align: center;
}

/* Identidade visual do cliente (iniciais + cor do avatar) */
.cl-ident { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.cl-ident-preview {
  width: 56px; height: 56px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: var(--fs-lg);
  flex-shrink: 0; letter-spacing: .5px;
}
/* Seletor mais específico que .form-input, que define width:100% e é
   declarado depois — sem isto o campo estica e empurra os swatches. */
.cl-ident input.cl-ident-initials {
  width: 96px; flex: 0 0 96px;
  text-align: center; text-transform: uppercase; letter-spacing: 2px; font-weight: 700;
}
.cl-swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cl-swatch {
  display: inline-block;
  width: 32px; height: 32px; border-radius: 9px;
  border: 2px solid transparent; padding: 0; cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.cl-swatch:hover { transform: translateY(-1px); }
.cl-swatch.on { border-color: var(--slate-800); box-shadow: 0 0 0 2px #fff inset; }
.cl-swatch-custom { position: relative; overflow: hidden; }
.cl-swatch-custom input[type="color"] {
  position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px);
  border: none; padding: 0; background: none; cursor: pointer; opacity: 0;
}

/* Tweaks footer hint */
.tweaks-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
  font-size: var(--fs-2xs);
  color: #94a3b8;
}
.tweaks-foot button {
  background: none;
  border: none;
  color: var(--purple-light);
  font-weight: 600;
  font-size: var(--fs-xs);
  cursor: pointer;
  font-family: inherit;
}
.tweaks-foot button:hover { text-decoration: underline; }

@media (max-width: 520px) {
  #tweaksPanel { width: calc(100vw - 24px); left: 12px; bottom: 80px; }
}

/* ===== Modal: Adicionar cliente ===== */
.app-modal { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 24px; }
.app-modal-overlay { position: absolute; inset: 0; background: rgba(15, 23, 42, .55); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.app-modal-dialog { position: relative; background: #fff; border-radius: 16px; box-shadow: 0 25px 60px rgba(0,0,0,.25); width: min(640px, 100%); max-height: calc(100vh - 48px); overflow: auto; display: flex; flex-direction: column; }
.app-modal-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 22px 24px 16px; gap: 12px; }
.app-modal-icon { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg,#4a1d96,#7c3aed); color: #fff; display: flex; align-items: center; justify-content: center; font-size: var(--fs-2xl); flex-shrink: 0; }
.app-modal-icon.danger { background: linear-gradient(135deg,#b91c1c,#ef4444); }
.app-modal-subtitle { white-space: pre-line; }
.app-modal-title { font-size: var(--fs-xl); font-weight: 800; color: #0f172a; line-height: 1.2; }
.app-modal-subtitle { font-size: var(--fs-sm); color: #64748b; margin-top: 3px; }
.app-modal-close { background: #f1f5f9; border: none; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; color: #475569; display: flex; align-items: center; justify-content: center; font-size: var(--fs-lg); flex-shrink: 0; }
.app-modal-close:hover { background: #e2e8f0; }
.app-modal-body { padding: 6px 24px 18px; border-top: 1px solid var(--border); padding-top: 18px; }
.app-modal-section-label { font-size: var(--fs-xs); font-weight: 700; color: #64748b; letter-spacing: .5px; margin-bottom: 14px; }
.app-modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 20px; border-top: 1px solid var(--border); }
.app-modal .form-helper { font-size: var(--fs-xs); color: #64748b; margin-top: 4px; }
.app-modal .form-required { color: #dc2626; margin-left: 2px; }
@media (max-width: 520px) {
  .app-modal-dialog { border-radius: 14px; }
  .app-modal-grid-2 { grid-template-columns: 1fr !important; }
}
