/* ══════════════════════════════════════════════════════════════
   SHELL v3 · layout global + primitivos UI · relift 12/10/2026
   ══════════════════════════════════════════════════════════════
   Lê tokens.css. Marca em três lugares: barra superior, botão
   primário e tarja da placa. O resto é neutro, claro e quieto.
   Sidebar branca com seções retráteis; login dividido (painel de
   marca + formulário neutro); sem fundo animado, sem vidro, sem
   degradê em texto. Primitivos (.btn, .card, .badge, .modal,
   .field, .toast) mantidos com os mesmos nomes.
   ══════════════════════════════════════════════════════════════ */
/* ══ Camada de marca · Perito (padrão) e dono custom (ex.: FB) ══
   :root  = ramp Perito EXATO (roxo/teal/ouro) · nada muda pro Perito.
   html[data-brand="custom"] = dono com cor própria (main.js injeta
   --brand-primary/accent/aux); aqui derivamos o ramp e sobrepomos os
   tokens do design system, então a marca toda (botões, KPIs, sidebar,
   login, sinapses) acompanha a cor do dono, mantendo o mesmo visual. */
:root {
  --bx-deep1:#221645; --bx-deep2:#1a1133; --bx-deep3:#130b23;
  --bx-ovl1:#2e1849;  --bx-ovl2:#1b0f30;  --bx-ovl3:#0e0820;
  --bx-violet:#7a4fd0; --bx-violet2:#9a6cf0;
  --bx-violet-deep:#5a35a8; --bx-violet-deep2:#3a1f6e;
  --bx-teal:#58c8dc; --bx-teal2:#34b6cf; --bx-teal-green:#28a296;
  --bx-teal-l:#5fd6ea; --bx-teal-l2:#9fe9f6;
  --bx-glow-violet:#8a54e6; --bx-line-mid:#9a7bff; --bx-gold:#d1a950;
  --bx-card1:#3a265c; --bx-card2:#1a0f2e;
  --bx-breathe1:#5fd6ea; --bx-breathe2:#8a54e6; --bx-breathe3:#7a4ad0;
  --syn-line:#8f78cf; --syn-dot:#c3b2f5;
  --syn-t0:#9fe9f6; --syn-t1:#5fd6ea; --syn-v0:#d7c4ff; --syn-v1:#9a6cf0;
}
html[data-brand="custom"] {
  /* tokens do design system seguem o dono */
  --primary: var(--brand-primary);
  --primary-dark: color-mix(in srgb, var(--brand-primary) 80%, #000);
  --accent: var(--brand-accent);
  --accent-dark: color-mix(in srgb, var(--brand-accent) 78%, #000);
  --accent-soft: color-mix(in srgb, var(--brand-accent) 8%, transparent);
  --gold: var(--brand-aux);
  --sidebar: var(--brand-primary);
  --info: var(--brand-primary);
  /* ramp visual derivado das 3 cores do dono */
  --bx-deep1: color-mix(in srgb, var(--brand-primary) 80%, #02040a);
  --bx-deep2: color-mix(in srgb, var(--brand-primary) 55%, #02040a);
  --bx-deep3: color-mix(in srgb, var(--brand-primary) 34%, #010309);
  --bx-ovl1:  color-mix(in srgb, var(--brand-primary) 84%, #02050c);
  --bx-ovl2:  color-mix(in srgb, var(--brand-primary) 52%, #02050c);
  --bx-ovl3:  color-mix(in srgb, var(--brand-primary) 30%, #010207);
  --bx-violet:  color-mix(in srgb, var(--brand-primary) 52%, white 30%);
  --bx-violet2: color-mix(in srgb, var(--brand-accent) 52%, white 34%);
  --bx-violet-deep:  color-mix(in srgb, var(--brand-primary) 80%, #000);
  --bx-violet-deep2: var(--brand-primary);
  --bx-teal: var(--brand-accent);
  --bx-teal2: color-mix(in srgb, var(--brand-accent) 86%, var(--brand-primary));
  --bx-teal-green: color-mix(in srgb, var(--brand-accent) 70%, #000 18%);
  --bx-teal-l:  color-mix(in srgb, var(--brand-accent) 66%, white 30%);
  --bx-teal-l2: color-mix(in srgb, var(--brand-accent) 44%, white 46%);
  --bx-glow-violet: color-mix(in srgb, var(--brand-primary) 54%, white 24%);
  --bx-line-mid:    color-mix(in srgb, var(--brand-accent) 60%, white 18%);
  --bx-card1: color-mix(in srgb, var(--brand-primary) 66%, #0a0a16);
  --bx-card2: color-mix(in srgb, var(--brand-primary) 34%, #07060f);
  --bx-breathe1: color-mix(in srgb, var(--brand-accent) 60%, white 26%);
  --bx-breathe2: color-mix(in srgb, var(--brand-primary) 54%, white 22%);
  --bx-breathe3: color-mix(in srgb, var(--brand-primary) 62%, white 12%);
  --syn-line: color-mix(in srgb, var(--brand-primary) 50%, white 24%);
  --syn-dot:  color-mix(in srgb, var(--brand-accent) 46%, white 40%);
  --syn-t0: color-mix(in srgb, var(--brand-accent) 40%, white 50%);
  --syn-t1: color-mix(in srgb, var(--brand-accent) 70%, white 24%);
  --syn-v0: color-mix(in srgb, var(--brand-primary) 38%, white 50%);
  --syn-v1: color-mix(in srgb, var(--brand-primary) 56%, white 26%);
}

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

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--txt);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
}

button { font-family: inherit; cursor: pointer; border: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }
a { color: inherit; }

/* ──────────────────────────────────────────────────────────────
   APP LAYOUT · barra de marca no topo, sidebar + conteúdo abaixo
   ────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
}
#app .app-corpo { flex: 1; display: flex; min-height: 0; }

#app.with-sidebar .sidebar { display: flex; }
#app.no-sidebar .sidebar { display: none; }
/* enquanto o shell ainda não decidiu (antes de `with-sidebar`), a sidebar não aparece: sem isso
   ela nascia com 240px vazia e encolhia animando até o trilho a cada entrada em módulo */
#app:not(.with-sidebar) .sidebar { display: none; }

/* ──────────────────────────────────────────────────────────────
   BARRA DE MARCA (topbar) · 56 px, cor primária do dono
   ────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 16px 0 12px;
  gap: 10px;
  flex-shrink: 0;
}
html[data-brand="custom"] .topbar { background: var(--brand-primary); }

.topbar__menu {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  color: rgba(255,255,255,.85);
  padding: 0;
}
.topbar__menu:hover { background: rgba(255,255,255,.12); color: #fff; }

.topbar__brand {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 6px;
  border-radius: var(--radius);
  text-decoration: none;
  color: #fff;
  flex-shrink: 0;
}
.topbar__brand:hover { background: rgba(255,255,255,.1); }
.topbar__brand img { height: 26px; width: auto; max-width: 150px; display: block; }
.topbar__brand .fallback { font-weight: 700; font-size: 14px; letter-spacing: .04em; }

.topbar__ctx {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px 0 12px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.14);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  max-width: 300px;
  min-width: 0;
}
.topbar__ctx:hover { background: rgba(255,255,255,.16); }
.topbar__ctx > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__ctx .ico { flex-shrink: 0; opacity: .8; }

.topbar__crumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255,255,255,.72);
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.topbar__crumb b { color: #fff; font-weight: 600; }
.topbar__crumb .sep { color: rgba(255,255,255,.4); }

.topbar__spacer { flex: 1; }

.topbar__busca {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px 0 10px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.14);
  color: rgba(255,255,255,.85);
  font-size: 13px;
  min-width: 200px;
}
.topbar__busca:hover { background: rgba(255,255,255,.16); color: #fff; }
.topbar__busca kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0,0,0,.22);
  color: rgba(255,255,255,.8);
}

.topbar__chip {
  font-size: 11px;
  color: rgba(255,255,255,.85);
  background: rgba(255,255,255,.12);
  padding: 4px 10px;
  border-radius: 99px;
  font-variant-numeric: tabular-nums;
}

.topbar__user {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 8px 0 4px;
  border-radius: var(--radius);
  background: transparent;
  border: 0;
  color: #fff;
  flex-shrink: 0;
}
.topbar__user:hover { background: rgba(255,255,255,.12); }
.topbar__user-ava {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 600; font-size: 12.5px;
  background: var(--accent);
  color: #1C1F26;
}
.topbar__user-txt { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.topbar__user-nome { font-size: 13px; font-weight: 600; }
.topbar__user-papel { font-size: 11px; color: rgba(255,255,255,.62); }

/* menu do usuário */
.topbar__menu-user {
  position: absolute;
  right: 12px; top: 58px;
  width: 240px;
  background: var(--card);
  border: 1px solid var(--borda);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: var(--z-dropdown);
  color: var(--txt);
}
.topbar__menu-user a, .topbar__menu-user button {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--txt);
  font-size: 13.5px;
  text-decoration: none;
  text-align: left;
}
.topbar__menu-user a:hover, .topbar__menu-user button:hover { background: var(--bg); }
.topbar__menu-user .ico { color: var(--sub); }
.topbar__menu-user hr { border: 0; border-top: 1px solid var(--borda-soft); margin: 4px 0; }
.topbar__menu-user .is-sair { color: var(--crit); }
.topbar__menu-user .is-sair .ico { color: var(--crit); }

/* ──────────────────────────────────────────────────────────────
   SIDEBAR · clara, seções retráteis, ícones em traço
   ────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--card);
  color: var(--txt);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto; overflow-x: hidden;   /* a sidebar inteira rola (13/10): rodapé não fica congelado roubando espaço do menu */
  scrollbar-width: thin; scrollbar-color: var(--borda) transparent;
  border-right: 1px solid var(--borda);
}
.sidebar > * { flex-shrink: 0; }   /* nada encolhe: o que não cabe rola */

.sb-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--borda-soft);
  min-height: 56px;
}
.sb-logo img { height: 28px; width: auto; max-width: 140px; object-fit: contain; display: block; }
.sb-logo__mini { display: none; width: 34px; height: 34px; border-radius: var(--radius); place-items: center; background: var(--bg); border: 1px solid var(--borda); font: 600 12.5px var(--font-display); color: var(--primary); letter-spacing: .04em; }
.sb-pin {
  display: none; margin-left: auto; width: 28px; height: 28px; align-items: center; justify-content: center; flex-shrink: 0;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer;
}
.sb-pin:hover { color: var(--txt); background: var(--bg); border-color: var(--borda); }
.sb-pin[aria-pressed="true"] { color: var(--primary); background: var(--primary-soft); }
html[data-brand="custom"] .sb-pin[aria-pressed="true"] { color: var(--brand-primary); background: color-mix(in srgb, var(--brand-primary) 10%, transparent); }
.sb-logo .fallback { display: none; font-weight: 700; font-size: 13px; letter-spacing: .04em; color: var(--txt); }

.sb-slogan {
  padding: 14px 16px 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--txt);
  line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.sb-cli { padding: 6px 16px 4px; }
.sb-cli-label { font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sb-cli-display {
  font-size: 13px; font-weight: 600; color: var(--txt);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
}
.sb-cli-display--selo::before {
  content: ''; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--selo-a) 0 40%, var(--selo-b, var(--selo-a)) 60% 100%);
}

.sidebar__nav { padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 2px; flex: 0 0 auto; min-height: 0; overflow: visible; scrollbar-width: thin; scrollbar-color: var(--borda) transparent; }
.sidebar__divider { height: 1px; background: var(--borda-soft); margin: 6px 8px; }

.sidebar__grupo { display: flex; flex-direction: column; gap: 2px; }
.sidebar__caption {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: 14px 8px 4px;
  background: transparent;
  border: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.sidebar__caption:hover { color: var(--txt); }
.sidebar__caption .ico { transition: transform .15s; }
.sidebar__grupo.is-fechada .sidebar__caption .ico { transform: rotate(-90deg); }
.sidebar__grupo.is-fechada .sidebar__grupo-corpo { display: none; }
.sidebar__grupo-corpo { display: flex; flex-direction: column; gap: 2px; }

.sidebar__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 13px;          /* 13/10/2026: sidebar mais leve (era 14 e #374151) */
  font-weight: 450;
  color: #4B5563;
  text-decoration: none;
  line-height: 1.25;
  transition: background .12s, color .12s;
}
.sidebar__item:hover { background: var(--bg); color: var(--txt); }
.sidebar__item.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
html[data-brand="custom"] .sidebar__item.is-active {
  background: color-mix(in srgb, var(--brand-primary) 10%, transparent);
  color: var(--brand-primary);
}
.sidebar__item__ico {
  width: 17px; height: 17px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--sub);
  flex-shrink: 0;
}
.sidebar__item__ico svg { width: 17px; height: 17px; }
.sidebar__item.is-active .sidebar__item__ico { color: inherit; }
.sidebar__item > span:last-child { min-width: 0; }

.sidebar__personalizar { padding: 4px 8px 6px; }
.sidebar__personalizar-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 7px;
  background: transparent;
  border: 0;
  color: var(--sub);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}
.sidebar__personalizar-btn:hover { background: var(--bg); color: var(--txt); }
.sidebar__personalizar-ico { width: 18px; height: 18px; display: inline-flex; flex-shrink: 0; }
.sidebar__personalizar-lbl em { font-style: normal; color: var(--muted); }

.sidebar__foot {
  margin-top: auto;
  padding: 8px 12px;
  border-top: 1px solid var(--borda-soft);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar__foot-ava {
  width: 30px; height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid; place-items: center;
  font-weight: 600; font-size: 12.5px;
  color: #fff;
  background: var(--primary);
}
.sidebar__foot-user { font-size: 11px; color: var(--sub); display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.sidebar__foot-user__nome { color: var(--txt); font-weight: 600; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__foot-user__voltar { color: var(--sub); text-decoration: none; font-size: 11.5px; }
.sidebar__foot-user__voltar:hover { color: var(--primary); }
.sidebar__foot-logout {
  background: transparent;
  border: 1px solid var(--borda);
  color: var(--sub);
  width: 30px; height: 30px;
  border-radius: var(--radius);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar__foot-logout:hover { background: var(--crit-bg); color: var(--crit); border-color: var(--crit-bg); }

/* ──────────────────────────────────────────────────────────────
   MAIN / CONTENT
   ────────────────────────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.content { flex: 1; overflow-y: auto; padding: 20px 24px 32px; min-width: 0; }
.content > * { animation: fadeUp .18s var(--ease-out); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }


/* Modal de Personalizar menu */
.fb-mp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  animation: fb-mp-fade .15s ease;
}
@keyframes fb-mp-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.fb-mp-modal {
  background: #fff;
  width: 560px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  border-radius: var(--radius, 10px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fb-mp-pop .18s ease;
}
@keyframes fb-mp-pop {
  from { transform: translateY(10px) scale(.98); opacity: 0; }
  to   { transform: translateY(0)    scale(1);   opacity: 1; }
}
.fb-mp-head {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--borda, #e5e7eb);
}
.fb-mp-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--txt, #0f172a);
}
.fb-mp-head p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--sub, #64748b);
  line-height: 1.45;
}
.fb-mp-body {
  padding: 16px 22px;
  overflow-y: auto;
  flex: 1;
}
.fb-mp-grupo {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--borda, #e5e7eb);
}
.fb-mp-grupo:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}
.fb-mp-grupo-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--sub, #64748b);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 6px;
}
.fb-mp-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--txt, #0f172a);
  user-select: none;
  transition: background .12s;
}
.fb-mp-item:hover {
  background: #f8fafc;
}
.fb-mp-item input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary, #1d7a4f);
  cursor: pointer;
  flex-shrink: 0;
}
.fb-mp-ico {
  width: 18px; height: 18px; display: inline-flex; color: var(--sub);
  flex-shrink: 0;
}
.fb-mp-ico svg { width: 18px; height: 18px; }
.fb-mp-lbl {
  flex: 1;
}
.fb-mp-foot {
  padding: 12px 22px;
  border-top: 1px solid var(--borda, #e5e7eb);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.fb-mp-btn {
  padding: 8px 14px;
  background: #fff;
  border: 1px solid var(--borda, #e5e7eb);
  border-radius: var(--radius-sm, 6px);
  color: var(--txt, #0f172a);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.fb-mp-btn:hover {
  background: #f8fafc;
}
.fb-mp-btn--primary {
  background: var(--primary, #1d7a4f);
  border-color: var(--primary, #1d7a4f);
  color: #fff;
}
.fb-mp-btn--primary:hover {
  filter: brightness(1.08);
}
.fb-mp-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}
/* ──────────────────────────────────────────────────────────────
   BOTÕES / CARDS / BADGES (primitivos)
   ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--card);
  color: var(--txt);
  border: 1px solid var(--borda);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  min-height: 34px;
  /* transitions vão em fb-ds.css */
}
.btn:hover { background: var(--bg); }
.btn--primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn--primary:hover { filter: brightness(.94); }
.btn--ghost { background: transparent; }
.btn--danger { color: var(--err); border-color: var(--err); }
.btn--danger:hover { background: var(--err-bg); }
.btn--sm { padding: 5px 11px; font-size: 12px; border-radius: 6px; }

.card {
  background: var(--card);
  border: 1px solid var(--borda);
  border-radius: var(--radius);
  box-shadow: none;
  padding: 18px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg);
  color: var(--sub);
}
.badge--ok   { background: var(--ok-bg);   color: var(--ok); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--err  { background: var(--err-bg);  color: var(--err); }
.badge--info { background: var(--info-bg); color: var(--info); }

/* ──────────────────────────────────────────────────────────────
   LOADING / VAZIO
   ────────────────────────────────────────────────────────────── */
.ui-loader {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 40px;
  color: var(--sub);
  font-size: 13px;
}
.ui-loader__spin {
  width: 18px; height: 18px;
  border: 2px solid var(--borda);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ui-vazio {
  text-align: center;
  padding: 48px 20px;
  color: var(--sub);
}
.ui-vazio__ico { font-size: 16px; margin-bottom: 6px; color: var(--muted); }
.ui-vazio { padding: 20px; }
.ui-vazio h3   { font-size: 16px; color: var(--txt); margin-bottom: 4px; }
.ui-vazio p    { font-size: 13px; }
.ui-vazio--erro { color: var(--err); }
.ui-vazio--erro h3 { color: var(--err); }

/* ──────────────────────────────────────────────────────────────
   TOAST
   ────────────────────────────────────────────────────────────── */
.toast-stack {
  position: fixed;
  right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: var(--z-toast);
  pointer-events: none;
}
.toast {
  background: var(--card);
  border: 1px solid var(--borda);
  border-left: 3px solid var(--info);
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  min-width: 240px;
  max-width: 360px;
  opacity: 0;
  transform: translateX(12px);
  transition: opacity .2s, transform .2s;
  pointer-events: auto;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast--ok   { border-left-color: var(--ok); }
.toast--warn { border-left-color: var(--warn); }
.toast--erro { border-left-color: var(--err); }
.toast--info { border-left-color: var(--info); }

/* ──────────────────────────────────────────────────────────────
   MODAL · convenção .show
   ────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: none;
  align-items: center; justify-content: center;
  z-index: var(--z-modal);
  padding: 20px;
}
.modal-overlay.show { display: flex; }

.modal {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal--wide { max-width: 720px; }
.modal__head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--borda);
  display: flex; align-items: center; justify-content: space-between;
}
.modal__head h3 { font-size: 16px; }
.modal__close {
  background: transparent; border: none;
  width: 28px; height: 28px;
  font-size: 20px; color: var(--sub);
  border-radius: var(--radius-sm);
}
.modal__close:hover { background: var(--bg); color: var(--txt); }
.modal__body { padding: 20px; overflow: auto; }
.modal__foot {
  padding: 14px 20px;
  border-top: 1px solid var(--borda);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ──────────────────────────────────────────────────────────────
   FORM FIELDS
   ────────────────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--sub);
  margin-bottom: 4px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  background: var(--card);
  font-size: 14px;
  color: var(--txt);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.field textarea { min-height: 88px; resize: vertical; }
.field__hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

.field--check label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--txt);
  text-transform: none;
  letter-spacing: 0;
  margin: 0;
  cursor: pointer;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--borda);
  border-radius: var(--radius-sm);
  transition: border-color .12s, background .12s;
}
.field--check label:hover { border-color: var(--accent); }
.field--check input[type="checkbox"],
.field--check input[type="radio"] {
  width: 18px; height: 18px;
  margin: 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.field--check label:has(input:checked) {
  border-color: var(--accent);
  background: var(--ok-bg);
}


/* ──────────────────────────────────────────────────────────────
   LOGIN v3 · painel de marca à esquerda + formulário neutro
   ────────────────────────────────────────────────────────────── */
.login-overlay {
  position: fixed; inset: 0;
  display: none;
  z-index: var(--z-overlay);
  background: var(--bg);
  overflow: auto;
}
.login-overlay.show { display: block; }

.login-split { min-height: 100%; display: flex; flex-wrap: wrap; }

.login-panel {
  flex: 1 1 480px;
  min-width: 0;
  position: relative;
  overflow: hidden;
  background: var(--primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px 52px;
}
html[data-brand="custom"] .login-panel { background: var(--brand-primary); }
.login-panel::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(900px 600px at 20% 10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%),
    radial-gradient(700px 500px at 90% 100%, color-mix(in srgb, var(--gold) 14%, transparent), transparent 55%),
    linear-gradient(180deg, rgba(0,0,0,.06), rgba(0,0,0,.22));
}
.login-panel::after {
  content: '';
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 1px, transparent 1px 48px);
}
.login-panel > * { position: relative; z-index: 1; }
.login-panel__logo { display: flex; align-items: center; min-height: 56px; }
.login-panel__logo img { height: 44px; width: auto; max-width: 260px; object-fit: contain; }
.login-panel__logo.is-cli img { height: auto; max-height: 72px; }
.login-panel__logo .fallback { display: none; font-weight: 700; font-size: 22px; letter-spacing: .06em; }
.login-panel__logo.is-fallback img { display: none; }
.login-panel__logo.is-fallback .fallback { display: block; }

.login-panel__txt { display: flex; flex-direction: column; gap: 14px; max-width: 460px; }
.login-panel__kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--accent) 70%, #fff);
}
.login-panel__titulo {
  font-family: var(--font-condensed);
  font-weight: 600;
  font-size: clamp(30px, 3.4vw, 44px);
  line-height: 1.08;
}
.login-panel__sub { font-size: 16px; line-height: 1.5; color: rgba(255,255,255,.72); }
.login-panel__foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font-size: 12px; color: rgba(255,255,255,.55);
}
.login-panel__foot img { height: 16px; width: auto; opacity: .85; vertical-align: middle; }
.login-panel__foot .versao { font-family: var(--font-mono); font-size: 11px; }

.login-form-wrap {
  flex: 1 1 480px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 44px 28px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.login-card__titulo { display: flex; flex-direction: column; gap: 6px; }
.login-card__titulo h1 { font-size: 28px; font-weight: 600; line-height: 1.15; color: var(--txt); }
.login-card__titulo p { font-size: 14px; color: var(--sub); }

.login-card .field { margin: 0; }
.login-card .field label {
  font-size: 13px; font-weight: 500; color: #374151;
  text-transform: none; letter-spacing: 0; margin-bottom: 6px;
}
.login-card .field--pwd label { display: flex; justify-content: space-between; align-items: baseline; }
.login-card__ajuda { font-size: 12px; font-weight: 500; color: var(--primary); text-decoration: none; }
.login-card__ajuda:hover { text-decoration: underline; }
.login-card__campos { display: flex; flex-direction: column; gap: 14px; }

.login-inp { position: relative; }
.login-ico { position: absolute; left: 12px; top: 12px; width: 20px; height: 20px; color: var(--sub); pointer-events: none; }
.login-inp input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 40px;
  border: 1px solid #D4D7DD;
  border-radius: var(--radius);
  background: #fff;
  font-size: 15px;
  font-weight: 500;
  color: var(--txt);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.login-inp input::placeholder { color: var(--muted); }
.login-inp input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);
}
.login-pwd-toggle {
  position: absolute; right: 8px; top: 8px;
  width: 28px; height: 28px;
  border: 0; background: transparent; color: var(--sub);
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; border-radius: 6px;
}
.login-pwd-toggle:hover { background: var(--bg); color: var(--txt); }
.login-pwd-toggle svg { width: 20px; height: 20px; }
.login-pwd-toggle .icon-off { display: none; }
.login-pwd-toggle.is-on .icon-on { display: none; }
.login-pwd-toggle.is-on .icon-off { display: block; }

.login-caps {
  display: none;
  margin-top: 6px;
  font-size: 12px;
  color: var(--warn);
}
.login-caps.show { display: block; }

.login__err {
  display: none;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--crit-bg);
  color: var(--crit);
  font-size: 13px;
  font-weight: 500;
}
.login__err.show { display: block; animation: loginErrSlide .18s var(--ease-out); }
@keyframes loginErrSlide { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

#loginBtn {
  height: 44px;
  border: 0;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: background .12s, transform .08s;
}
html[data-brand="custom"] #loginBtn { background: var(--brand-primary); }
#loginBtn:hover { filter: brightness(.94); }
#loginBtn:active { transform: translateY(1px); }
#loginBtn:disabled { opacity: .7; cursor: default; }
.login-spin {
  display: none;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
#loginBtn.is-loading .login-spin { display: inline-block; }

.login-card__nota { font-size: 13px; line-height: 1.5; color: var(--sub); }
.login-card__foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--borda);
  font-size: 12px;
  color: var(--muted);
}
.login-card__foot a, .login-card__foot button {
  color: var(--sub); text-decoration: none; background: transparent; border: 0; font: inherit; padding: 0;
}
.login-card__foot a:hover, .login-card__foot button:hover { color: var(--txt); text-decoration: underline; }

@media (max-width: 900px) {
  .login-panel { flex-basis: 100%; min-height: 0; padding: 28px 24px; gap: 20px; }
  .login-panel__titulo { font-size: 28px; }
  .login-panel__sub { display: none; }
  .login-form-wrap { flex-basis: 100%; padding: 28px 20px 40px; }
}

/* ══════════════════════════════════════════════════════════════
   v26.3 · MODO EMBED
   ══════════════════════════════════════════════════════════════ */
#app.embed-mode .topbar,
#app.embed-mode .sidebar { display: none !important; }
#app.embed-mode .main { margin-left: 0 !important; width: 100% !important; }
#app.embed-mode .content { padding: 12px 18px !important; max-width: 100% !important; }
#app.embed-mode .fontes,
#app.embed-mode .hub { max-width: 100% !important; padding: 0 !important; }

/* ──────────────────────────────────────────────────────────────
   SIDEBAR · colapso desktop e gaveta no celular
   ────────────────────────────────────────────────────────────── */
.topbar__menu svg { transition: transform .2s var(--ease-soft); }
@media (min-width: 769px) {
  #app.with-sidebar .sidebar { transition: width .18s var(--ease-soft), box-shadow .18s; }
  #app.with-sidebar.sidebar-collapsed .sidebar { width: 0; min-width: 0; overflow: hidden; pointer-events: none; border-right: 0; }
  #app.no-sidebar .topbar__menu { display: none; }

  /* ── TRILHO: só ícones; abre por cima do conteúdo ao passar o mouse (ou foco) ── */
  #app.with-sidebar.sidebar-rail .app-corpo { position: relative; padding-left: var(--rail-w, 60px); }
  #app.with-sidebar.sidebar-rail .sidebar {
    position: absolute; left: 0; top: 0; bottom: 0; z-index: 80;
    width: var(--rail-w, 60px);
  }
  #app.with-sidebar.sidebar-rail .sidebar:hover,
  #app.with-sidebar.sidebar-rail .sidebar:focus-within {
    width: var(--sidebar-w);
    box-shadow: 8px 0 28px rgba(16, 24, 40, .12);
  }
  /* estado recolhido = trilho sem mouse e sem foco */
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sb-logo { padding: 12px 0; justify-content: center; }
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sb-logo img,
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sb-logo .fallback,
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sb-pin,
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sb-slogan,
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sb-cli,
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sidebar__caption > span,
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sidebar__caption .ico,
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sidebar__item > span:last-child,
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sidebar__personalizar-lbl,
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sidebar__foot-user,
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sidebar__foot-logout,
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .selo--sidebar,
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .selo--parceiro { display: none !important; }
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sb-logo__mini { display: grid; }
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sidebar__caption { padding: 10px 0 2px; justify-content: center; }
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sidebar__caption::after { content: ''; width: 18px; height: 1px; background: var(--borda); }
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sidebar__grupo.is-fechada .sidebar__grupo-corpo { display: flex; }   /* no trilho todo ícone aparece */
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sidebar__nav { padding: 6px 10px 8px; overflow-x: hidden; }
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sidebar__item { justify-content: center; padding: 9px 0; gap: 0; }
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sidebar__personalizar { padding: 4px 10px 6px; }
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sidebar__personalizar-btn { justify-content: center; padding: 9px 0; gap: 0; }
  #app.sidebar-rail .sidebar:not(:hover):not(:focus-within) .sidebar__foot { justify-content: center; padding: 10px 0; }
  /* aberto (mouse em cima ou fixa): alfinete visível */
  #app.with-sidebar .sb-pin { display: inline-flex; }
}
@media (max-width: 768px) {
  #app.with-sidebar .sidebar {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0;
    width: min(280px, 85vw);
    z-index: 90;
    transform: translateX(-100%);
    transition: transform .22s var(--ease-soft);
    box-shadow: 4px 0 24px rgba(0,0,0,.18);
  }
  #app.with-sidebar.sidebar-open .sidebar { transform: translateX(0); }
  #app.with-sidebar.sidebar-open::before {
    content: ''; position: fixed; inset: var(--topbar-h) 0 0 0;
    background: rgba(0,0,0,.4); z-index: 85;
  }
  #app.no-sidebar .topbar__menu { display: none; }
  .topbar { padding: 0 8px; gap: 6px; }
  .topbar__crumb, .topbar__busca, .topbar__user-txt { display: none; }
  .topbar__ctx { max-width: 46vw; }
  .content { padding: 14px 12px 28px; }
  .sidebar__item { padding: 11px 10px; }
}
@media (max-width: 420px) { .content { padding: 12px 10px 24px; } }

/* ── Marca-chrome: realces de marca em superfícies CLARAS (carteira/cards)
   e ramp do hero do hub. Default = Perito exato; custom = derivado da cor. */
:root {
  --bxc-brand:#381d54; --bxc-brand-2:#5a3686;
  --bxc-accent:#5fd6ea; --bxc-violet:#9a6cf0; --bxc-gold:#d1a950;
  --bx-hero1:#2c1746; --bx-hero2:#221238; --bx-hero3:#170c28;
}
html[data-brand="custom"] {
  --bxc-brand: var(--brand-primary);
  --bxc-brand-2: color-mix(in srgb, var(--brand-primary) 74%, white 14%);
  --bxc-accent: var(--brand-accent);
  --bxc-violet: color-mix(in srgb, var(--brand-primary) 54%, white 24%);
  --bxc-gold: var(--brand-aux);
  --bx-hero1: color-mix(in srgb, var(--brand-primary) 86%, #02050c);
  --bx-hero2: color-mix(in srgb, var(--brand-primary) 62%, #02050c);
  --bx-hero3: color-mix(in srgb, var(--brand-primary) 40%, #010207);
}

/* ── Login · carteira da FB (13/10/2026) ─────────────────────
   A FB assina o painel (logo dela no lugar do logo do cliente) e o
   logo do cliente vai para o canto superior direito, no fundo claro,
   onde as cores do cliente aparecem sem perder contraste. Os dois
   logos são dimensionados pela área (main.js, _pesoLogo) para terem o
   mesmo peso. O topo do canto alinha com o topo do logo da FB. GAT e
   Print não passam por aqui. */
.login-panel__logo.is-dono { min-height: 64px; }
.login-panel__logo.is-dono img { height: 48px; max-width: 230px; object-fit: contain; object-position: left center; }
.login-form-wrap.tem-canto { position: relative; }
/* tela baixa: o cartão desce o bastante para nunca encostar no logo do canto */
@media (min-width: 901px) and (max-height: 760px) { .login-form-wrap.tem-canto { padding-top: 132px; } }
.login-canto {
  position: absolute; top: 44px; right: 52px;
  min-height: 64px; display: flex; align-items: center; justify-content: flex-end;
}
.login-canto img { height: 44px; width: auto; max-width: 210px; object-fit: contain; object-position: right center; display: block; }
@media (max-width: 900px) {
  .login-form-wrap.tem-canto { flex-direction: column; align-items: stretch; padding-top: 24px; }
  .login-form-wrap.tem-canto .login-card { margin: 0 auto; }
  .login-canto { position: static; min-height: 0; margin: 0 auto 22px; width: 100%; max-width: 380px; justify-content: flex-end; }
}

/* ══════════════════════════════════════════════════════════════
   14/10/2026 · Mapas (Leaflet) presos no próprio quadro
   O Leaflet põe as camadas em z-index 400 e os controles (zoom, legenda,
   créditos) em 1000. Sem um contexto de empilhamento no mapa, esses números
   competem com a página inteira: o mapa passava por cima do menu lateral
   do módulo (z 80/90) e os créditos "Leaflet | OpenStreetMap" por cima do
   botão Abrir chamado (z 900). Com isolation o mapa empilha só dentro de si
   e fica no nível normal do conteúdo. Vale para todos os mapas da
   plataforma; tela cheia (Fullscreen API ou classe com position: fixed no
   quadro do mapa) continua igual.
   ══════════════════════════════════════════════════════════════ */
.leaflet-container { isolation: isolate; }
