/* =========================================================
   CGcom Gestão — design system
   Cores extraídas do logo: azul #4475B8, verde #86A73F, céu #C6E4F7
   ========================================================= */

:root {
  /* Marca */
  --brand-blue: #4475b8;
  --brand-blue-600: #355f9c;
  --brand-blue-800: #1d3a66;
  --brand-green: #86a73f;
  --brand-green-600: #6c8a2c;
  --brand-sky: #c6e4f7;

  /* Superfícies */
  --bg-0: #eef3fa;
  --bg-1: #f7f9fd;
  --rail-0: #0f2547;
  --rail-1: #17345f;
  --rail-2: #1f4377;

  /* Status (cards) */
  --ok: #22a447;
  --danger: #e5413a;
  --info: #2f7de1;

  /* Texto */
  --ink: #1f2a3d;
  --ink-2: #4a5872;
  --ink-3: #7a879d;
  --ink-inv: #e9f0fb;
  --ink-inv-2: #a9bbd6;

  /* Forma */
  --rail-w: 224px;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-1: 0 1px 2px rgba(20, 40, 80, 0.06), 0 4px 16px rgba(20, 40, 80, 0.06);
  --shadow-2: 0 2px 6px rgba(20, 40, 80, 0.08), 0 16px 40px rgba(20, 40, 80, 0.12);

  /* Movimento */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-blob: 28s;
}

/* ---------- Reset curto ---------- */
*,
*::before,
*::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--bg-1) 0%, var(--bg-0) 55%, #e8eff8 100%);
  color: var(--ink);
  font-family: system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }

/* =========================================================
   FUNDO DA TELA — blobs desfocados em movimento lento
   ========================================================= */
.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}
.bg__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  will-change: transform;
}
.bg__blob--blue {
  width: 46vw; height: 46vw;
  top: -18vw; right: -8vw;
  background: radial-gradient(circle at 40% 40%, #7aa6e0 0%, var(--brand-blue) 45%, transparent 70%);
  animation: drift-a var(--dur-blob) var(--ease) infinite alternate;
}
.bg__blob--green {
  width: 34vw; height: 34vw;
  bottom: -14vw; left: 22vw;
  background: radial-gradient(circle at 50% 50%, #b9d47a 0%, var(--brand-green) 40%, transparent 70%);
  opacity: 0.38;
  animation: drift-b calc(var(--dur-blob) * 1.15) var(--ease) infinite alternate;
}
.bg__blob--sky {
  width: 40vw; height: 40vw;
  top: 30vh; right: 18vw;
  background: radial-gradient(circle, #e2f2fd 0%, var(--brand-sky) 45%, transparent 72%);
  opacity: 0.8;
  animation: drift-c calc(var(--dur-blob) * 0.9) var(--ease) infinite alternate;
}
.bg__blob--indigo {
  width: 26vw; height: 26vw;
  top: 8vh; left: 30vw;
  background: radial-gradient(circle, #a9b8f0 0%, #6f86d6 40%, transparent 70%);
  opacity: 0.25;
  animation: drift-b calc(var(--dur-blob) * 1.3) var(--ease) infinite alternate-reverse;
}
/* Granulado leve para evitar banding do gradiente */
.bg__grain {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes drift-a {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(-6vw, 8vh) scale(1.08); }
  100% { transform: translate(-12vw, 2vh) scale(0.96); }
}
@keyframes drift-b {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(8vw, -6vh) scale(1.12); }
  100% { transform: translate(14vw, -2vh) scale(1); }
}
@keyframes drift-c {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-10vw, -10vh) scale(1.15); }
}

/* =========================================================
   FAIXA DA SIDEBAR — gradiente marinho com brilho deslizante
   ========================================================= */
.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail-w);
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(68, 117, 184, 0.45) 0%, transparent 60%),
    radial-gradient(90% 40% at 100% 100%, rgba(134, 167, 63, 0.22) 0%, transparent 70%),
    linear-gradient(180deg, var(--rail-2) 0%, var(--rail-1) 35%, var(--rail-0) 100%);
  box-shadow: 4px 0 24px rgba(15, 37, 71, 0.18);
}
/* Brilho diagonal que atravessa a faixa devagar */
.rail__sheen {
  position: absolute;
  inset: -50% -150%;
  background: linear-gradient(115deg, transparent 42%, rgba(198, 228, 247, 0.10) 50%, transparent 58%);
  animation: sheen 14s linear infinite;
}
/* Halo verde que respira no topo, atrás do logo */
.rail__glow {
  position: absolute;
  top: -60px; left: -40px;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(134, 167, 63, 0.35) 0%, transparent 65%);
  filter: blur(10px);
  animation: breathe 9s ease-in-out infinite;
}
/* Filete de luz na borda direita */
.rail::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, rgba(198, 228, 247, 0.35), rgba(198, 228, 247, 0.05));
}

@keyframes sheen {
  0%   { transform: translateY(-30%); }
  100% { transform: translateY(30%); }
}
@keyframes breathe {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.15); }
}

/* ---------- Acessibilidade: menos movimento ---------- */
@media (prefers-reduced-motion: reduce) {
  .bg__blob, .rail__sheen, .rail__glow { animation: none; }
}

/* =========================================================
   TIPOGRAFIA — Plus Jakarta Sans
   ========================================================= */
body { font-family: "Plus Jakarta Sans", system-ui, sans-serif; font-size: 14px; line-height: 1.45; }
.h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; color: var(--brand-blue-800); }
.h2 { font-size: 16px; font-weight: 700; color: var(--ink); }
.t1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); font-variant-numeric: tabular-nums; }
.t2 { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.t3 { font-size: 12px; font-weight: 500; color: var(--ink-3); }

/* ---------- Ícones (sprite SVG na etapa 4) ---------- */
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico--sm { width: 16px; height: 16px; }
.ico--xs { width: 12px; height: 12px; }
/* Espaço reservado para logo/avatar até a etapa 4 */
.ph { background: rgba(198, 228, 247, 0.25); border: 1px dashed rgba(198, 228, 247, 0.55); }

/* =========================================================
   LAYOUT
   ========================================================= */
.app { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100vh; }

/* =========================================================
   SIDEBAR
   ========================================================= */
.nav {
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  padding: 18px 12px 12px;
  color: var(--ink-inv);
  overflow: hidden;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 0 4px 16px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(198, 228, 247, 0.12);
  color: inherit; text-decoration: none;
}
/* Símbolo sobre um selo de vidro claro (o azul do logo some sobre o marinho) */
.nav-brand__mark {
  flex: none;
  display: grid; place-items: center;
  width: 50px; height: 50px;
  border-radius: 15px;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #e9f2fb 60%, #cfe3f6 100%);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25), inset 0 0 0 1px rgba(255, 255, 255, 0.9), 0 0 0 3px rgba(198, 228, 247, 0.12);
}
.nav-brand__img { width: 42px; height: 42px; transition: transform 1.2s var(--ease); }
/* As setas do logo giram uma volta ao passar o mouse */
.nav-brand:hover .nav-brand__img { transform: rotate(-360deg); }
/* Logo da empresa: selo claro na largura da sidebar (ver logoDaEmpresa no app.js) */
.nav-brand__selo { flex: 1; min-width: 0; display: grid; place-items: center; height: 62px; padding: 6px 10px; border-radius: 15px; background: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25); }
.nav-brand__logo { max-width: 100%; max-height: 50px; object-fit: contain; }
.nav-brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.nav-brand__name { font-size: 22px; font-weight: 800; letter-spacing: 0.04em; color: #fff; }
.nav-brand__tag { font-size: 9.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; color: var(--ink-inv-2); margin-top: 3px; }

.nav-user {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px;
  margin-bottom: 12px;
  border: 0; border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.3s var(--ease);
}
.nav-user:hover { background: rgba(255, 255, 255, 0.09); }
.nav-user__av { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.nav-user__hello { flex: 1; text-align: left; font-size: 13px; font-weight: 500; color: var(--ink-inv); }
.nav-user__hello strong { font-weight: 700; color: #fff; }
.nav-user__chev { color: var(--ink-inv-2); transform: rotate(0deg); }

.nav-search {
  display: flex; align-items: center; gap: 8px;
  padding: 0 10px;
  height: 36px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: rgba(8, 22, 45, 0.45);
  border: 1px solid rgba(198, 228, 247, 0.14);
  color: var(--ink-inv-2);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.nav-search:focus-within { border-color: rgba(134, 167, 63, 0.8); box-shadow: 0 0 0 3px rgba(134, 167, 63, 0.18); }
.nav-search__in { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 12.5px; color: #fff; }
.nav-search__in::placeholder { color: var(--ink-inv-2); }

.nav-groups {
  flex: 1;
  overflow-y: auto;
  margin: 0 -6px;
  padding: 0 6px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(198, 228, 247, 0.25) transparent;
}
.nav-group + .nav-group { margin-top: 10px; }
.nav-group__head {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: 6px 6px 6px;
  border: 0; background: none; cursor: pointer;
  border-bottom: 1px solid rgba(198, 228, 247, 0.12);
  margin-bottom: 4px;
}
.nav-group__head .t3 { font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: #fff; }
.nav-group__chev { color: var(--ink-inv-2); transition: transform 0.35s var(--ease); }
.nav-group__head[aria-expanded="false"] .nav-group__chev { transform: rotate(-90deg); }
.nav-group__list {
  list-style: none; margin: 0; padding: 0;
  overflow: hidden;
  max-height: 600px;
  transition: max-height 0.45s var(--ease), opacity 0.3s var(--ease);
}
.nav-group.is-collapsed .nav-group__list { max-height: 0; opacity: 0; }

.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 5px 10px;
  border-radius: 9px;
  font-size: 13px; font-weight: 500;
  color: var(--ink-inv-2);
  text-decoration: none;
  transition: color 0.25s var(--ease), background 0.25s var(--ease), transform 0.25s var(--ease);
}
.nav-item .ico { color: rgba(198, 228, 247, 0.7); transition: color 0.25s var(--ease); }
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, 0.06); transform: translateX(3px); }
.nav-item:hover .ico { color: var(--brand-sky); }
.nav-item.is-active {
  color: #fff;
  font-weight: 600;
  background: linear-gradient(90deg, rgba(68, 117, 184, 0.65), rgba(68, 117, 184, 0.15));
  box-shadow: inset 0 0 0 1px rgba(198, 228, 247, 0.12);
}
.nav-item.is-active::before {
  content: "";
  position: absolute; left: 3px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 3px;
  background: linear-gradient(180deg, #b9d47a, var(--brand-green));
  box-shadow: 0 0 10px rgba(134, 167, 63, 0.7);
}
.nav-item.is-active .ico { color: #b9d47a; }
.nav-item:focus-visible { outline: 2px solid rgba(185, 212, 122, 0.85); outline-offset: -2px; }
.nav-item mark { background: rgba(134, 167, 63, 0.45); color: #fff; border-radius: 3px; }
.nav-empty { padding: 12px 6px; color: var(--ink-inv-2); }

/* =========================================================
   CONTEÚDO
   ========================================================= */
.main { min-width: 0; padding: 8px 18px 28px; }

/* ---------- Cabeçalho em vidro ---------- */
.top {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "head head logo" "chip . logo";
  align-items: center;
  row-gap: 12px;
  padding: 14px 24px 14px 28px;
  margin-bottom: 26px;
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.6));
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
/* Filete azul à esquerda, como na referência */
.top::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--brand-blue), var(--brand-green));
}
/* Faixa diagonal clara no canto inferior direito */
.top::after {
  content: "";
  position: absolute; right: -40px; bottom: -70px;
  width: 260px; height: 140px;
  background: linear-gradient(135deg, rgba(198, 228, 247, 0) 0%, rgba(198, 228, 247, 0.75) 100%);
  transform: skewX(-38deg);
  pointer-events: none;
}
.top__head { grid-area: head; display: flex; align-items: center; gap: 12px; }
.top__page-ico {
  display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, #dde9f8, #c6dbf3);
  color: var(--brand-blue);
}
.top__logo { grid-area: logo; position: relative; z-index: 1; width: 132px; height: auto; }
.top__logo--empresa { width: auto; max-width: 160px; max-height: 59px; object-fit: contain; }
.top__burger { display: none; }

.chip {
  grid-area: chip;
  justify-self: start;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #e3e9f2;
  box-shadow: 0 1px 2px rgba(20, 40, 80, 0.05);
}
.chip__ico { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #e7effa; color: var(--brand-blue); }
.chip__text { display: flex; flex-direction: column; line-height: 1.15; }
.chip__label { font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.chip__value { font-size: 11.5px; font-weight: 700; color: var(--brand-blue-800); }

/* ---------- Painel Pesquisar ---------- */
.filter {
  margin-bottom: 22px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.filter__head {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  padding: 18px 40px 18px 22px;
  border: 0; background: none; cursor: pointer; text-align: left;
}
.filter__ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: #e7effa; color: var(--brand-blue); }
.filter__ico .ico { width: 22px; height: 22px; }
.filter__text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.filter__chev { color: var(--ink-3); transition: transform 0.4s var(--ease); }
.filter.is-open .filter__chev { transform: rotate(180deg); }
.filter__body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.45s var(--ease); }
.filter.is-open .filter__body { grid-template-rows: 1fr; }
.filter__form {
  min-height: 0; overflow: hidden;
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px;
  padding: 0 22px;
  transition: padding 0.45s var(--ease);
}
.filter.is-open .filter__form { padding: 4px 22px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 180px; flex: 1; }
.field__label { font-weight: 600; }
.field__in {
  height: 38px; padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #dbe3ee;
  background: #fff;
  outline: 0;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field__in:focus { border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(68, 117, 184, 0.15); }
.filter__actions { display: flex; gap: 8px; }
.btn {
  height: 38px; padding: 0 18px;
  border: 0; border-radius: 10px;
  font-weight: 700; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-600));
  box-shadow: 0 4px 14px rgba(68, 117, 184, 0.35);
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(68, 117, 184, 0.45); }
.btn--ghost { color: var(--ink-2); background: #eef2f8; box-shadow: none; }
.btn--ghost:hover { box-shadow: none; background: #e4eaf3; }

/* ---------- Grade de indicadores ---------- */
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
.kpi {
  position: relative;
  display: flex; flex-direction: column;
  min-height: 148px;
  padding: 16px 28px 20px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  opacity: 0;
  animation: rise 0.7s var(--ease) forwards;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
/* Brilho que acompanha o hover */
.kpi::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(240px 120px at var(--mx, 80%) var(--my, 0%), rgba(198, 228, 247, 0.55), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}
.kpi:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); }
.kpi:hover::after { opacity: 1; }
.kpi:nth-child(1)  { animation-delay: 0.04s; } .kpi:nth-child(2)  { animation-delay: 0.08s; }
.kpi:nth-child(3)  { animation-delay: 0.12s; } .kpi:nth-child(4)  { animation-delay: 0.16s; }
.kpi:nth-child(5)  { animation-delay: 0.20s; } .kpi:nth-child(6)  { animation-delay: 0.24s; }
.kpi:nth-child(7)  { animation-delay: 0.28s; } .kpi:nth-child(8)  { animation-delay: 0.32s; }
.kpi:nth-child(9)  { animation-delay: 0.36s; } .kpi:nth-child(10) { animation-delay: 0.40s; }
.kpi:nth-child(11) { animation-delay: 0.44s; } .kpi:nth-child(12) { animation-delay: 0.48s; }

.kpi__ico {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  margin-bottom: 12px;
  border-radius: 10px;
  color: #fff;
  transition: transform 0.4s var(--ease);
}
.kpi:hover .kpi__ico { transform: scale(1.08) rotate(-4deg); }
.kpi__ico .ico { width: 22px; height: 22px; stroke-width: 2.2; }
.kpi__ico--ok     { background: linear-gradient(135deg, #3cc160, var(--ok));     box-shadow: 0 6px 14px rgba(34, 164, 71, 0.30); }
.kpi__ico--danger { background: linear-gradient(135deg, #f2645d, var(--danger)); box-shadow: 0 6px 14px rgba(229, 65, 58, 0.30); }
.kpi__ico--info   { background: linear-gradient(135deg, #4d97f0, var(--info));   box-shadow: 0 6px 14px rgba(47, 125, 225, 0.30); }
.kpi__label { text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 4px; }
.kpi__value { position: relative; z-index: 1; }

.kpi2__rows { margin: 8px 0 0; display: flex; flex-direction: column; gap: 10px; }
.kpi2__row { display: flex; align-items: baseline; justify-content: space-between; }
.kpi2__row dt { font-size: 13px; color: var(--ink-2); }
.kpi2__row dd { margin: 0; font-size: 18px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .kpi { animation: none; opacity: 1; }
  .kpi, .nav-item, .kpi__ico, .btn { transition: none; }
}

/* =========================================================
   RESPONSIVO
   ========================================================= */
@media (max-width: 1280px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .grid { gap: 16px; }
}
@media (max-width: 680px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Celular: a sidebar (e a faixa de fundo) vira gaveta */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .rail, .nav { transform: translateX(-100%); transition: transform 0.45s var(--ease); }
  .nav { position: fixed; left: 0; top: 0; z-index: 30; width: var(--rail-w); }
  .rail { z-index: 29; }
  body.nav-open .rail, body.nav-open .nav { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 28; background: rgba(10, 25, 50, 0.4); backdrop-filter: blur(2px); }
  .main { padding: 12px 16px 24px; }
  .top {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "burger head logo" "chip chip chip";
    padding: 12px 16px 12px 18px;
  }
  .top__burger {
    grid-area: burger;
    display: grid; place-items: center;
    width: 40px; height: 40px; margin-right: 10px;
    border: 0; border-radius: 12px;
    background: #e7effa; color: var(--brand-blue);
    cursor: pointer;
  }
  .top__page-ico { display: none; }
  .h1 { font-size: 17px; }
  .top__logo { width: 88px; }
  .filter__head { padding: 14px 18px; }
  .kpi { padding: 16px 18px; min-height: 0; }
}
@media (max-width: 520px) {
  .grid { grid-template-columns: 1fr; gap: 12px; }
  /* Card compacto: ícone à esquerda, rótulo e valor à direita */
  .kpi {
    display: grid;
    grid-template-columns: 44px 1fr;
    grid-template-areas: "ico label" "ico value";
    column-gap: 14px;
    align-items: center;
    padding: 14px 16px;
  }
  .kpi__ico { grid-area: ico; margin: 0; }
  .kpi__label { grid-area: label; margin: 0; }
  .kpi__value { grid-area: value; font-size: 19px; }
  .kpi2 { grid-template-areas: "ico label" "ico rows"; }
  .kpi2__rows { grid-area: rows; margin-top: 4px; gap: 4px; }
  .kpi2__row dd { font-size: 15px; }
  .top__logo { display: none; }
  .top { grid-template-areas: "burger head head" "chip chip chip"; }
}

/* =========================================================
   CRM — cores das etapas
   ========================================================= */
:root {
  --st-contato: #3b82f6;
  --st-qualificacao: #f59e0b;
  --st-prospeccao: #8b5cf6;
  --st-proposta: #f97316;
  --st-concluido: #22c55e;
  --thermo-frio: #38bdf8;
  --thermo-morno: #f59e0b;
  --thermo-quente: #ef4444;
  --lost: #94a3b8;
}
.st-contato      { --st: var(--st-contato); }
.st-qualificacao { --st: var(--st-qualificacao); }
.st-prospeccao   { --st: var(--st-prospeccao); }
.st-proposta     { --st: var(--st-proposta); }
.st-concluido    { --st: var(--st-concluido); }

/* ---------- Usuário e empresa (CRM) ---------- */
.nav-user { cursor: default; }
.nav-user__hello { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-user__av { display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-green)); border: 0; }
.nav-user__av.ph { background: rgba(198, 228, 247, 0.25); border: 1px dashed rgba(198, 228, 247, 0.55); }
.nav-user__out {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-inv-2);
  cursor: pointer;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.nav-user__out:hover { background: rgba(229, 65, 58, 0.25); color: #fff; }
.chip--select { cursor: pointer; }
.chip__select {
  border: 0; outline: 0; padding: 0; margin: 0 -2px;
  background: transparent;
  font-size: 11.5px; font-weight: 700; color: var(--brand-blue-800);
  cursor: pointer; max-width: 240px;
}

/* ---------- Faixa de etapas ---------- */
.stages {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px;
  padding: 18px 22px;
  margin-bottom: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-1);
}
.stage { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "bar bar" "name name" "count sum"; align-items: end; row-gap: 6px; min-width: 0; }
.stage__bar { grid-area: bar; height: 6px; border-radius: 6px; background: var(--st); position: relative; overflow: hidden; }
/* Brilho que percorre a barra */
.stage__bar::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  transform: translateX(-100%);
  animation: bar-shine 4.5s var(--ease) infinite;
}
.stage:nth-child(2) .stage__bar::after { animation-delay: 0.4s; }
.stage:nth-child(3) .stage__bar::after { animation-delay: 0.8s; }
.stage:nth-child(4) .stage__bar::after { animation-delay: 1.2s; }
.stage:nth-child(5) .stage__bar::after { animation-delay: 1.6s; }
@keyframes bar-shine { 0%, 60% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.stage__name { grid-area: name; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage__count { grid-area: count; font-size: 26px; line-height: 1; }
.stage__sum { grid-area: sum; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Barra de filtros ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.toolbar[hidden] { display: none; }
.toolbar__search {
  flex: 1 1 260px;
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #dbe3ee;
  color: var(--ink-3);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.toolbar__search:focus-within { border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(68, 117, 184, 0.15); }
.toolbar__search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 13px; color: var(--ink); }
.toolbar__sel { height: 40px; min-width: 0; flex: 0 1 190px; background-color: rgba(255, 255, 255, 0.85); }
.toolbar__new { display: inline-flex; align-items: center; gap: 8px; height: 40px; }
body.no-incluir .toolbar__new, body.no-incluir .col__add { display: none; }

/* ---------- Quadro ---------- */
.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(232px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.board[aria-busy="true"] .col__list { opacity: 0.65; }
.board__deny { grid-column: 1 / -1; padding: 40px; text-align: center; border-radius: var(--radius-lg); background: rgba(255, 255, 255, 0.8); }
.col {
  display: flex; flex-direction: column;
  min-height: 420px;
  max-height: calc(100vh - 330px);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.5));
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: var(--shadow-1);
  scroll-snap-align: start;
  transition: box-shadow 0.3s var(--ease), transform 0.3s var(--ease), background 0.3s var(--ease);
  overflow: hidden;
}
.col::before { content: ""; height: 4px; background: var(--st); flex: none; }
.col.is-over {
  background: linear-gradient(180deg, color-mix(in srgb, var(--st) 14%, white), rgba(255, 255, 255, 0.65));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--st) 55%, transparent), var(--shadow-2);
  transform: translateY(-2px);
}
.col__head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; }
.col__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--st); box-shadow: 0 0 0 4px color-mix(in srgb, var(--st) 18%, transparent); }
.col__name { flex: 1; font-size: 13px; font-weight: 700; color: var(--ink); }
.col__count {
  min-width: 26px; height: 22px; padding: 0 8px;
  display: grid; place-items: center;
  border-radius: 11px;
  font-size: 12px; font-weight: 700;
  color: color-mix(in srgb, var(--st) 80%, black);
  background: color-mix(in srgb, var(--st) 15%, white);
}
.col__list { flex: 1; overflow-y: auto; padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 10px; transition: opacity 0.2s; scrollbar-width: thin; }
.col__empty { margin: 14px 4px; padding: 18px 10px; text-align: center; border: 1.5px dashed #d5deea; border-radius: 12px; }
.col__add {
  margin: 0 10px 10px; height: 36px; flex: none;
  border: 1.5px dashed color-mix(in srgb, var(--st) 45%, #d5deea); border-radius: 10px;
  background: transparent; color: color-mix(in srgb, var(--st) 75%, black);
  font-weight: 700; font-size: 12.5px; cursor: pointer;
  transition: background 0.2s var(--ease);
}
.col__add:hover { background: color-mix(in srgb, var(--st) 10%, white); }
.col__hint { margin: 0 10px 12px; text-align: center; flex: none; }

/* ---------- Card de oportunidade ---------- */
.op-card {
  position: relative;
  flex: none;
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 14px 12px 16px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #e6ecf4;
  box-shadow: 0 1px 2px rgba(20, 40, 80, 0.05);
  cursor: grab;
  user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
  outline: 0;
  animation: card-in 0.45s var(--ease) both;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease), opacity 0.25s;
}
.op-card::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--st); }
.op-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: color-mix(in srgb, var(--st) 35%, #e6ecf4); }
.op-card:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--st) 40%, transparent); }
body.no-alterar .op-card, .op-card.is-done { cursor: pointer; }
.op-card.is-dragging { display: none; }
.op-card.is-saving { opacity: 0.7; }
.op-card.is-saved { animation: saved 0.7s var(--ease); }
.op-card.is-lost { opacity: 0.75; }
.op-card.is-lost .op-card__title { text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, 0.25); }
@keyframes card-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes saved { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--st) 60%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }

.op-card__top { display: flex; align-items: center; gap: 6px; }
.op-card__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st); }
.op-card__stage { flex: 1; font-size: 11.5px; font-weight: 600; color: color-mix(in srgb, var(--st) 75%, black); }
.op-card__badge { padding: 2px 8px; border-radius: 10px; font-size: 10.5px; font-weight: 800; letter-spacing: 0.03em; text-transform: uppercase; }
.op-card__badge--ganho { color: #166534; background: #dcfce7; }
.op-card__badge--perdido { color: #475569; background: #e2e8f0; }
.op-card__clip { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.op-card__title { margin: 0; font-size: 14.5px; font-weight: 700; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere; }
.op-card__company { margin: 0; font-weight: 500; color: var(--ink-2); overflow-wrap: anywhere; }
.op-card__place { margin: 0; display: flex; align-items: center; gap: 4px; }
.op-card__foot { display: flex; align-items: center; gap: 8px; margin-top: 4px; padding-top: 8px; border-top: 1px solid #eef2f7; }
.op-card__av {
  display: grid; place-items: center; flex: none;
  width: 26px; height: 26px; border-radius: 50%;
  font-size: 10.5px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-600));
}
.op-card__value { flex: 1; font-size: 12.5px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.op-card__date { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 9px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); background: #f1f5f9; white-space: nowrap; }
.op-card__date.is-today { color: #92400e; background: #fef3c7; }
.op-card__date.is-late { color: #b91c1c; background: #fee2e2; }

/* Termômetro */
.thermo { display: flex; align-items: center; gap: 6px; }
.thermo .ico { color: var(--thermo); }
.thermo--frio { --thermo: var(--thermo-frio); }
.thermo--morno { --thermo: var(--thermo-morno); }
.thermo--quente { --thermo: var(--thermo-quente); }
.thermo__bar { flex: 1; height: 6px; border-radius: 6px; background: #edf1f6; overflow: hidden; }
.thermo__fill { display: block; height: 100%; width: var(--p, 0%); border-radius: inherit; background: linear-gradient(90deg, var(--thermo-frio), var(--thermo)); transition: width 0.6s var(--ease); }
.thermo--frio .thermo__fill { background: var(--thermo-frio); }
.thermo__pct { min-width: 34px; text-align: right; font-size: 11.5px; font-weight: 700; color: var(--thermo); font-variant-numeric: tabular-nums; }

/* Arraste */
.op-card--ghost {
  position: fixed; left: 0; top: 0; z-index: 100;
  width: var(--w);
  transform: translate(var(--x), var(--y)) rotate(2.5deg) scale(1.03);
  box-shadow: 0 18px 40px rgba(20, 40, 80, 0.28);
  pointer-events: none;
  cursor: grabbing;
  animation: none;
  transition: none;
}
.op-card--ghost.is-landing { transition: transform 0.2s var(--ease), opacity 0.2s; transform: translate(var(--x), var(--y)); opacity: 0; }
.op-ph {
  flex: none;
  height: var(--h);
  border-radius: 14px;
  border: 2px dashed color-mix(in srgb, var(--st, var(--brand-blue)) 55%, transparent);
  background: color-mix(in srgb, var(--st, var(--brand-blue)) 8%, transparent);
  animation: ph-in 0.2s var(--ease);
}
@keyframes ph-in { from { opacity: 0; transform: scaleY(0.6); } to { opacity: 1; transform: none; } }
body.is-dragging-card, body.is-dragging-card * { cursor: grabbing !important; user-select: none; }

/* =========================================================
   MODAIS
   ========================================================= */
.modal {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  padding: 0; border: 0;
  border-radius: 22px;
  background: transparent;
  overflow: visible;
}
.modal--sm { width: min(460px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(12, 28, 56, 0.45); backdrop-filter: blur(4px); }
.modal[open] { animation: modal-in 0.35s var(--ease); }
.modal[open]::backdrop { animation: fade-in 0.3s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
/* Painel: janela grande na área toda ao lado da sidebar (ver "Painéis" no app.js) */
html.panel-aberto { overflow: hidden; }
@media (min-width: 861px) {
  .modal:not(.modal--sm) { position: fixed; inset: 0 0 0 var(--rail-w); z-index: 25; width: auto; max-width: none; height: 100vh; max-height: none; margin: 0; border-radius: 0; }
  .modal:not(.modal--sm) .modal__box { height: 100%; max-height: none; border-radius: 0; box-shadow: -8px 0 30px rgba(12, 28, 56, 0.12); }
  .modal:not(.modal--sm) .form-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}
.modal__box {
  display: flex; flex-direction: column;
  max-height: calc(100vh - 40px);
  border-radius: 22px;
  background: linear-gradient(160deg, #ffffff, #f6f9fd);
  box-shadow: 0 30px 80px rgba(12, 28, 56, 0.35);
  overflow: hidden;
}
.modal__head { display: flex; align-items: center; gap: 12px; padding: 18px 22px 12px; }
.modal__stage {
  flex: none;
  padding: 4px 10px; border-radius: 10px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  color: #fff; background: var(--st, var(--brand-blue));
}
.modal__stage:empty { width: 12px; height: 12px; padding: 0; border-radius: 50%; }
.modal__title { flex: 1; margin: 0; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal__x { flex: none; width: 34px; height: 34px; border: 0; border-radius: 10px; background: #eef2f8; font-size: 20px; line-height: 1; color: var(--ink-2); cursor: pointer; }
.modal__x:hover { background: #e2e8f0; }
.modal__body { flex: 1; overflow-y: auto; padding: 6px 22px 18px; }
.modal__foot { display: flex; align-items: center; gap: 8px; padding: 14px 22px; border-top: 1px solid #e8eef5; background: rgba(246, 249, 253, 0.9); }
.modal__spacer { flex: 1; }

.tabs { display: flex; gap: 4px; padding: 0 22px; border-bottom: 1px solid #e8eef5; }
.tabs__btn {
  position: relative;
  padding: 10px 12px; border: 0; background: none;
  font-size: 13px; font-weight: 600; color: var(--ink-3); cursor: pointer;
  transition: color 0.2s var(--ease);
}
.tabs__btn::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--brand-blue); transform: scaleX(0); transition: transform 0.3s var(--ease); }
.tabs__btn.is-active { color: var(--brand-blue-800); }
.tabs__btn.is-active::after { transform: scaleX(1); }
.tabs__n { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 4px; padding: 0 5px; border-radius: 9px; font-size: 10.5px; background: #e7effa; color: var(--brand-blue); }
.tab { padding-top: 14px; animation: fade-in 0.25s var(--ease); }
.tab[hidden] { display: none; }
.tab__empty { padding: 18px 0; text-align: center; list-style: none; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .field { min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field__in:disabled { background: #f4f7fb; color: var(--ink-2); }
.field__in--area { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; font: inherit; }
select.field__in { padding-right: 8px; }

/* Vínculo com pessoa */
.pessoa-pick { position: relative; }
.pessoa-pick .field__in { width: 100%; }
.pessoa-pick__tag {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 6px; padding: 3px 4px 3px 10px;
  border-radius: 10px;
  font-size: 12px; font-weight: 600; color: #166534; background: #dcfce7;
}
.pessoa-pick__tag[hidden] { display: none; }
.pessoa-pick__tag button { width: 20px; height: 20px; border: 0; border-radius: 6px; background: transparent; color: inherit; cursor: pointer; }
.pessoa-pick__list {
  position: absolute; z-index: 5; left: 0; right: 0; top: 42px;
  margin: 0; padding: 6px; list-style: none;
  border-radius: 12px; background: #fff;
  border: 1px solid #e1e8f1;
  box-shadow: var(--shadow-2);
}
.pessoa-pick__list[hidden] { display: none; }
.pessoa-pick__item { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.pessoa-pick__item:hover { background: #f1f5fb; }

/* Slider do termômetro */
.thermo-input { display: flex; align-items: center; gap: 14px; }
.thermo-input__range {
  flex: 1; height: 8px; margin: 0;
  -webkit-appearance: none; appearance: none;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--thermo-frio), var(--thermo-morno) 50%, var(--thermo-quente));
  outline: 0;
}
.thermo-input__range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid var(--brand-blue-800);
  box-shadow: 0 2px 8px rgba(20, 40, 80, 0.3);
  cursor: pointer;
  transition: transform 0.2s var(--ease);
}
.thermo-input__range::-webkit-slider-thumb:hover { transform: scale(1.12); }
.thermo-input__range::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--brand-blue-800); cursor: pointer; }
.thermo-input__range:disabled { opacity: 0.6; }
.thermo-badge { min-width: 112px; padding: 6px 10px; border-radius: 10px; text-align: center; font-size: 12.5px; font-weight: 800; color: #fff; background: var(--thermo-frio); transition: background 0.3s var(--ease); }
.thermo-badge--morno { background: var(--thermo-morno); }
.thermo-badge--quente { background: var(--thermo-quente); }

.op-result { margin: 14px 0 0; padding: 10px 12px; border-radius: 12px; font-weight: 600; }
.op-result[hidden] { display: none; }
.op-result--ganho { color: #166534; background: #dcfce7; }
.op-result--perdido { color: #475569; background: #e2e8f0; }

/* Anexos */
.drop {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 22px; margin-bottom: 12px;
  border: 2px dashed #cdd8e6; border-radius: 16px;
  text-align: center; color: var(--brand-blue);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.drop[hidden] { display: none; }
.drop:hover, .drop.is-over { border-color: var(--brand-blue); background: #f1f6fd; }
.drop .ico { width: 26px; height: 26px; }
.drop__in { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.files { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: #fff; border: 1px solid #e6ecf4; }
.file__ico { color: var(--brand-blue); }
.file__info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file__name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Histórico */
.timeline { margin: 0; padding: 0 0 0 6px; list-style: none; }
.timeline__item { position: relative; display: flex; flex-direction: column; padding: 0 0 16px 22px; }
.timeline__item::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: 0; width: 2px; background: #e6ecf4; }
.timeline__item:last-child::before { display: none; }
.timeline__dot { position: absolute; left: 0; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--st); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st) 22%, transparent); }
.timeline__txt { font-size: 13px; }

/* Concluir */
.end__assunto { margin: 4px 0 14px; font-size: 13.5px; color: var(--ink); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.seg__opt { position: relative; }
.seg__opt input { position: absolute; opacity: 0; }
.seg__opt span {
  display: grid; place-items: center; height: 46px;
  border-radius: 12px; border: 2px solid #e1e8f1;
  font-weight: 800; color: var(--ink-2); cursor: pointer;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease), color 0.25s var(--ease);
}
.seg__opt--ganho input:checked + span { border-color: var(--st-concluido); color: #166534; background: #dcfce7; }
.seg__opt--perdido input:checked + span { border-color: var(--lost); color: #334155; background: #e2e8f0; }
.seg__opt input:focus-visible + span { box-shadow: 0 0 0 3px rgba(68, 117, 184, 0.25); }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: #f1f6fd; font-size: 13px; cursor: pointer; }
.check[hidden], .field[hidden] { display: none; }
.check input { width: 18px; height: 18px; accent-color: var(--brand-blue); }

/* Botões extras */
.btn--sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn--danger { background: linear-gradient(135deg, #f2645d, var(--danger)); box-shadow: 0 4px 14px rgba(229, 65, 58, 0.3); }
.btn--danger:hover { box-shadow: 0 6px 18px rgba(229, 65, 58, 0.4); }
.btn--ghost.btn--danger-ghost { color: var(--danger); }
.btn:disabled { opacity: 0.6; cursor: wait; transform: none; }
.btn[hidden] { display: none; }

/* =========================================================
   TOASTS
   ========================================================= */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast {
  padding: 12px 16px; border-radius: 14px;
  font-size: 13px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, var(--brand-blue-800), var(--brand-blue));
  box-shadow: var(--shadow-2);
  opacity: 0; transform: translateY(12px) scale(0.98);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
.toast.is-in { opacity: 1; transform: none; }
.toast--erro { background: linear-gradient(135deg, #b91c1c, var(--danger)); }

/* =========================================================
   LOGIN
   ========================================================= */
.page-login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login { width: 100%; display: grid; place-items: center; }
.login__card {
  width: min(400px, 100%);
  display: flex; flex-direction: column; gap: 14px;
  padding: 32px 30px 24px;
  border-radius: 26px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.72));
  backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 30px 70px rgba(20, 40, 80, 0.18);
  animation: modal-in 0.6s var(--ease);
}
.login__card.is-shake { animation: shake 0.4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.login__logo { align-self: center; width: 200px; height: auto; margin-bottom: 6px; filter: drop-shadow(0 6px 14px rgba(68, 117, 184, 0.18)); }
.login__title { text-align: center; }
.login__sub { margin: -8px 0 6px; text-align: center; }
.login .field { min-width: 0; }
.login__erro { margin: 0; padding: 10px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; color: #b91c1c; background: #fee2e2; }
.login__erro[hidden] { display: none; }
.login__btn { height: 44px; margin-top: 4px; font-size: 14px; }
.login__btn.is-loading { color: transparent; position: relative; }
.login__btn.is-loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.5); border-top-color: #fff; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login__foot { margin: 6px 0 0; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .stage__bar::after, .op-card, .modal[open], .login__card { animation: none; }
  .nav-brand__img { transition: none; }
}

/* ---------- CRM responsivo ---------- */
@media (max-width: 1280px) {
  .stages { grid-template-columns: repeat(5, minmax(120px, 1fr)); overflow-x: auto; }
}
@media (max-width: 860px) {
  .stages { display: flex; gap: 12px; padding: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 14px; }
  .stage { flex: 0 0 140px; scroll-snap-align: start; }
  .toolbar__sel { flex: 1 1 140px; }
  .toolbar__new { flex: 1 1 100%; justify-content: center; }
  /* Celular: uma coluna por tela; tablet: colunas de até 300px lado a lado */
  .board { grid-auto-columns: min(84vw, 300px); scroll-snap-type: x mandatory; gap: 12px; }
  .col { max-height: calc(100vh - 220px); min-height: 360px; }
  .form-grid { grid-template-columns: 1fr; }
  .modal { width: 100vw; max-width: 100vw; max-height: 100vh; margin: auto 0 0; border-radius: 22px 22px 0 0; }
  .modal__box { max-height: 92vh; border-radius: 22px 22px 0 0; }
  .modal--sm { margin: auto; border-radius: 22px; width: calc(100vw - 32px); }
  .modal--sm .modal__box { border-radius: 22px; }
  .modal:not(.modal--sm) { height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  .modal:not(.modal--sm) .modal__box { height: 100%; max-height: 100dvh; border-radius: 0; }
  .chip__select { max-width: 160px; }
}

/* =========================================================
   CADASTROS — tabela, formulário e permissões
   ========================================================= */
.nav-item.is-soon { opacity: 0.6; }
.nav-item.is-soon:hover { opacity: 0.85; }
.toolbar__sel[hidden], .toolbar__new[hidden] { display: none; }

.table-card {
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transition: opacity 0.2s var(--ease);
}
.table-card.is-loading { opacity: 0.7; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  position: sticky; top: 0;
  padding: 12px 14px;
  text-align: left; white-space: nowrap;
  font-size: 11px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink-3);
  background: rgba(246, 249, 253, 0.95);
  border-bottom: 1px solid #e6ecf4;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid #eef2f7; color: var(--ink-2); vertical-align: middle; }
.tbl tbody tr { cursor: pointer; outline: 0; animation: row-in 0.35s var(--ease) both; animation-delay: calc(var(--i, 0) * 18ms); transition: background 0.2s var(--ease); }
.tbl tbody tr:hover { background: #f3f7fc; }
.tbl tbody tr:focus-visible { background: #eaf2fc; box-shadow: inset 3px 0 0 var(--brand-blue); }
.tbl tbody tr.is-off td { color: var(--ink-3); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl th.num { text-align: right; }
.tbl .nowrap { white-space: nowrap; }
/* Uma linha: max-width 0 faz a coluna dividir só a sobra da tabela, sem rolagem lateral */
.tbl .cell-1l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; width: 18%; }
.tbl .cell-1l--g { width: 42%; }
.tbl .cell-1l--m { width: 28%; }
@keyframes row-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.cell2 { display: flex; flex-direction: column; line-height: 1.3; }
.cell2 strong { color: var(--ink); font-weight: 700; }
.tbl-empty { margin: 0; padding: 40px 20px; text-align: center; }
.tbl-empty[hidden] { display: none; }

.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 10px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge--ok { color: #166534; background: #dcfce7; }
.badge--off { color: #475569; background: #eef2f7; }
.badge--danger { color: #b91c1c; background: #fee2e2; }
.badge--admin { color: #5b21b6; background: #ede9fe; }
.badge--role { color: var(--brand-blue-800); background: #e7effa; }
.badge--role.is-main { color: #fff; background: var(--brand-blue); }
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid #eef2f7; }
.pager[hidden] { display: none; }
.pager__btns { display: inline-flex; align-items: center; gap: 8px; }
.pager__pg { min-width: 54px; text-align: center; }
.btn:disabled.btn--ghost { cursor: default; }

/* Formulário */
.form-sec {
  grid-column: 1 / -1;
  margin: 10px 0 -2px; padding-top: 10px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--brand-blue);
  border-top: 1px solid #eef2f7;
}
.form-sec:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.form-sec[hidden], .field[hidden] { display: none; }
.field__hint { font-size: 11.5px; color: var(--ink-3); }
.field__hint[hidden] { display: none; }
.field__err { font-size: 11.5px; font-weight: 600; color: var(--danger); }
.field.is-invalid .field__in { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(229, 65, 58, 0.12); }
.field.is-invalid .roles, .field.is-invalid .perm { box-shadow: 0 0 0 2px rgba(229, 65, 58, 0.35); border-radius: 12px; }
.lnk { padding: 0; border: 0; background: none; font: inherit; font-weight: 700; color: var(--brand-blue); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.cad-nota { margin: 16px 0 0; padding: 10px 12px; border-radius: 12px; background: #f1f6fd; color: var(--ink-2); }
.cad-nota[hidden] { display: none; }
.modal__stage--ico { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border-radius: 10px; background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-600)); }

/* Chave liga/desliga */
.switch { position: relative; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; cursor: pointer; }
.switch__in { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { position: relative; width: 42px; height: 24px; flex: none; border-radius: 12px; background: #cbd5e1; transition: background 0.25s var(--ease); }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.3s var(--ease); }
.switch__in:checked + .switch__track { background: var(--ok); }
.switch__in:checked + .switch__track::after { transform: translateX(18px); }
.switch__in:focus-visible + .switch__track { box-shadow: 0 0 0 3px rgba(68, 117, 184, 0.3); }
.switch__in:disabled + .switch__track { opacity: 0.55; }
.switch__label { font-size: 13px; font-weight: 600; color: var(--ink); }
.switch .field__hint { flex-basis: 100%; }

/* Papéis da pessoa */
.roles { display: flex; flex-wrap: wrap; gap: 8px; }
.role { position: relative; }
.role input { position: absolute; opacity: 0; }
.role span {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 10px;
  border: 1.5px solid #dbe3ee; background: #fff;
  font-size: 12.5px; font-weight: 700; color: var(--ink-2);
  cursor: pointer; transition: all 0.2s var(--ease);
}
.role span::before { content: ""; width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid #b8c4d4; transition: all 0.2s var(--ease); }
.role input:checked + span { border-color: var(--brand-blue); color: var(--brand-blue-800); background: #eef4fc; }
.role input:checked + span::before { border-color: var(--brand-blue); background: var(--brand-blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / 11px no-repeat; }
.role input:disabled + span { cursor: not-allowed; opacity: 0.6; }
.role input:focus-visible + span { box-shadow: 0 0 0 3px rgba(68, 117, 184, 0.25); }

/* Matriz de permissões */
.perm { border: 1px solid #e6ecf4; border-radius: 14px; overflow: auto; max-height: 52vh; background: #fff; }
.perm__tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.perm__tbl th, .perm__tbl td { padding: 7px 10px; text-align: center; border-bottom: 1px solid #f0f3f8; }
.perm__tbl thead th { position: sticky; top: 0; z-index: 1; background: #f6f9fd; font-size: 10.5px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); }
.perm__tbl thead th:first-child, .perm__tbl .perm__menu { text-align: left; }
.perm__grp th { text-align: left; padding-top: 12px; font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand-blue); background: #fbfcfe; }
.perm__all { padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; text-align: left; }
.perm__all:hover { color: var(--brand-blue); text-decoration: underline; }
.perm__tbl input { width: 17px; height: 17px; accent-color: var(--brand-blue); cursor: pointer; }
.perm__tbl tbody tr:hover td { background: #f8fbff; }

@media (prefers-reduced-motion: reduce) {
  .tbl tbody tr { animation: none; }
}

/* Celular: cada linha vira um card com rótulos */
@media (max-width: 760px) {
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tbody { padding: 10px; display: flex; flex-direction: column; gap: 10px; }
  .tbl tbody tr { padding: 10px 12px; border: 1px solid #e6ecf4; border-radius: 14px; background: #fff; }
  .tbl td { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border: 0; text-align: right; }
  .tbl td::before { content: attr(data-label); flex: none; font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; text-align: left; }
  .tbl td:first-child { justify-content: flex-start; text-align: left; padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid #eef2f7; }
  .tbl td:first-child::before { display: none; }
  .tbl .num { text-align: right; }
  .tbl .cell-1l, .tbl .cell-1l--g, .tbl .cell-1l--m { white-space: normal; max-width: none; width: 100%; }
  .pager { flex-direction: column; }
  .perm { max-height: none; }
}

/* =========================================================
   CRM — peças comuns (sino, avisos, abas do kanban)
   ========================================================= */
:root {
  --tp-ligacao: #0ea5e9;
  --tp-visita: #16a34a;
  --tp-reuniao: #6366f1;
  --tp-tarefa: #f59e0b;
  --tp-outro: #64748b;
}
.tp-ligacao { --tp: var(--tp-ligacao); }
.tp-visita { --tp: var(--tp-visita); }
.tp-reuniao { --tp: var(--tp-reuniao); }
.tp-tarefa { --tp: var(--tp-tarefa); }
.tp-outro { --tp: var(--tp-outro); }
.cor-amarelo { --nota: #fef6d8; --nota-borda: #f5c84c; }
.cor-azul { --nota: #e3efff; --nota-borda: #7fb0f5; }
.cor-verde { --nota: #e2f7e8; --nota-borda: #6fcf8f; }
.cor-rosa { --nota: #fde7f1; --nota-borda: #f39cc3; }
.cor-roxo { --nota: #efe9ff; --nota-borda: #ab95f3; }
.cor-cinza { --nota: #eef2f7; --nota-borda: #a9b6c8; }

/* Sino na sidebar */
.nav-user__bell {
  position: relative;
  display: grid; place-items: center;
  width: 30px; height: 30px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-inv-2);
  cursor: pointer;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.nav-user__bell[hidden] { display: none; }
.nav-user__bell:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.nav-user__bell.has-late .ico { color: #ffd38a; animation: bell-ring 2.4s var(--ease) infinite; transform-origin: 50% 10%; }
@keyframes bell-ring { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(14deg); } 80% { transform: rotate(-12deg); } 85% { transform: rotate(8deg); } 90% { transform: rotate(-4deg); } }
.nav-user__badge {
  position: absolute; top: -3px; right: -4px;
  min-width: 17px; height: 17px; padding: 0 4px;
  display: grid; place-items: center;
  border-radius: 9px;
  font-size: 10px; font-weight: 800; color: #fff;
  background: var(--brand-blue);
  box-shadow: 0 0 0 2px var(--rail-1);
}
.nav-user__badge.is-late { background: var(--danger); }
.nav-user__badge[hidden] { display: none; }

.bell-panel {
  position: fixed; z-index: 150;
  top: var(--top, 120px); left: var(--left, 12px);
  width: 320px; max-height: 420px;
  display: flex; flex-direction: column;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #e3e9f2;
  box-shadow: var(--shadow-2);
  overflow: hidden;
  animation: modal-in 0.25s var(--ease);
}
.bell-panel[hidden] { display: none; }
.bell-panel__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid #eef2f7; }
.bell-panel__list { margin: 0; padding: 6px; list-style: none; overflow-y: auto; }
.bell-panel__empty { padding: 20px 10px; text-align: center; }
.bell-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.bell-item:hover { background: #f5f8fc; }
.bell-item.is-late .t3 { color: var(--danger); font-weight: 700; }
.bell-item__ok { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #b8c4d4; background: #fff; cursor: pointer; transition: all 0.2s var(--ease); }
.bell-item__ok:hover { border-color: var(--ok); background: #dcfce7; }
.bell-item__txt { display: flex; flex-direction: column; min-width: 0; }
.bell-item__txt strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Aviso de lembrete vencido (fica até a pessoa agir) */
.reminders { position: fixed; left: 50%; top: 16px; z-index: 210; transform: translateX(-50%); display: flex; flex-direction: column; gap: 10px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.reminder {
  pointer-events: auto;
  padding: 14px 16px;
  border-radius: 16px;
  color: var(--ink);
  background: linear-gradient(135deg, #fffdf5, #fff7dc);
  border: 1px solid #f5d27a;
  box-shadow: 0 18px 40px rgba(20, 40, 80, 0.25);
  opacity: 0; transform: translateY(-14px) scale(0.98);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}
.reminder.is-in { opacity: 1; transform: none; }
.reminder__head { display: flex; align-items: center; gap: 8px; }
.reminder__ico { color: #d97706; animation: bell-ring 2.4s var(--ease) infinite; transform-origin: 50% 10%; }
.reminder__title { flex: 1; font-size: 14px; }
.reminder__x { border: 0; background: none; font-size: 18px; color: var(--ink-3); cursor: pointer; }
.reminder__when { display: block; margin: 2px 0 10px 24px; }
.reminder__acts { display: flex; gap: 6px; margin-left: 24px; }

/* Botões em grupo (visões, filtros) */
.seg--inline { display: inline-flex; gap: 2px; padding: 3px; margin: 0; border-radius: 12px; background: rgba(255, 255, 255, 0.85); border: 1px solid #dbe3ee; }
.seg__btn { height: 32px; padding: 0 14px; border: 0; border-radius: 9px; background: none; font-size: 12.5px; font-weight: 700; color: var(--ink-2); cursor: pointer; transition: background 0.25s var(--ease), color 0.25s var(--ease); }
.seg__btn:hover { color: var(--brand-blue-800); }
.seg__btn.is-active { color: #fff; background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-600)); box-shadow: 0 3px 10px rgba(68, 117, 184, 0.3); }
.chip-btn { height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid #dbe3ee; background: #fff; font-size: 12px; font-weight: 700; color: var(--ink-2); cursor: pointer; transition: all 0.2s var(--ease); white-space: nowrap; }
.chip-btn:hover { border-color: var(--brand-blue); color: var(--brand-blue-800); }
.chip-btn.is-active { border-color: var(--brand-blue); background: #eef4fc; color: var(--brand-blue-800); }
.chip-btn--sm { height: 26px; padding: 0 10px; font-size: 11.5px; }

/* Abas Agenda/Anotações no modal do kanban */
.tab__bar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.tab__bar .btn[hidden] { display: none; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.mini-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.mini { border-radius: 12px; border: 1px solid #e6ecf4; background: #fff; transition: border-color 0.2s var(--ease); }
.mini:hover { border-color: var(--brand-blue); }
.mini.is-done { opacity: 0.6; }
.mini.is-late { border-left: 3px solid var(--danger); }
.mini--nota { background: var(--nota); border-color: var(--nota-borda); }
.mini__link { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; color: inherit; text-decoration: none; }
.mini__link strong { font-size: 13px; }
.mini__txt { font-size: 12.5px; color: var(--ink-2); white-space: pre-wrap; }
.perm__na input { opacity: 0.25; cursor: not-allowed; }

@media (prefers-reduced-motion: reduce) {
  .nav-user__bell.has-late .ico, .reminder__ico { animation: none; }
}

/* =========================================================
   DASHBOARD com dados reais
   ========================================================= */
.kpi[hidden] { display: none; }
.kpi[data-href] { cursor: pointer; }
.kpi:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(68, 117, 184, 0.35), var(--shadow-2); }
.kpi__sub { margin-top: 4px; font-size: 11.5px; }
.kpi__value { font-variant-numeric: tabular-nums; }
.kpi.is-neg .kpi__value { color: var(--danger); }
/* Skeleton enquanto carrega */
.kpi.is-loading .kpi__value, .kpi.is-loading .kpi2__row dd, .kpi.is-loading .kpi__sub {
  color: transparent;
  border-radius: 6px;
  background: linear-gradient(90deg, #edf1f6 0%, #f7f9fc 50%, #edf1f6 100%) 0 0 / 200% 100%;
  animation: skeleton 1.2s linear infinite;
}
.kpi.is-loading .kpi__value { min-width: 120px; }
@keyframes skeleton { to { background-position: -200% 0; } }
.board__deny[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .kpi.is-loading .kpi__value, .kpi.is-loading .kpi2__row dd, .kpi.is-loading .kpi__sub { animation: none; } }
@media (max-width: 520px) {
  /* Card compacto: a linha de apoio fica abaixo do valor, ao lado do ícone */
  .kpi:not(.kpi2) { grid-template-areas: "ico label" "ico value" "ico sub"; }
  .kpi__sub { grid-area: sub; margin-top: 0; }
}

/* CNPJ: campo + botão de consulta na Receita */
.field__row { display: flex; gap: 6px; }
.field__row .field__in { flex: 1; min-width: 0; }
.field__btn {
  flex: none; width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid #dbe3ee; background: #fff; color: var(--brand-blue); cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), opacity 0.2s var(--ease);
}
.field__btn:hover:not(:disabled) { background: #eef4fb; border-color: var(--brand-blue); }
.field__btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(68, 117, 184, 0.25); }
.field__btn:disabled { opacity: 0.45; cursor: not-allowed; }
.field__btn.is-loading { position: relative; }
.field__btn.is-loading .ico { visibility: hidden; }
.field__btn.is-loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(68, 117, 184, 0.3); border-top-color: var(--brand-blue); animation: spin 0.8s linear infinite; }
.field.is-filled .field__in { animation: preenchido 1.6s var(--ease); }
@keyframes preenchido { 0%, 35% { border-color: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18); background: #f0fdf4; } }
@media (prefers-reduced-motion: reduce) { .field.is-filled .field__in { animation: none; } }

/* Empresa: certificado digital A1 */
.cert { min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid #dbe3ee; border-radius: 14px; background: #f8fbff; }
.cert__status { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cert__info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.cert__info strong { overflow-wrap: anywhere; }
.cert__ico { width: 28px; height: 28px; flex: none; color: var(--brand-blue); }
.cert__ico--off { color: var(--ink-3); }
.cert__acoes { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cert__acoes[hidden], .cert__painel[hidden] { display: none; }
.cert__rem { color: var(--danger); }
.cert__painel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; min-width: 0; }
.cert__painel .field__in { width: 100%; min-width: 0; }
.cert__arq { padding: 7px 10px; height: auto; min-height: 38px; }
.cert__botoes { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.cert__vazio { margin: 0; }
.logo-previa { max-width: 220px; max-height: 90px; object-fit: contain; }
.btn.is-loading { position: relative; color: transparent; }
.btn.is-loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.5); border-top-color: #fff; animation: spin 0.8s linear infinite; }
@media (max-width: 520px) { .cert__painel { grid-template-columns: minmax(0, 1fr); } }

/* Combobox (busca com lista) compartilhado: orçamento, pedido, NF-e, operação e ficha técnica */
.orc-pick { position: relative; }
.orc-lista {
  position: absolute; z-index: 30; left: 0; right: 0; top: 64px; /* abaixo do rótulo + campo (num flex, a posição estática seria o topo) */
  margin: 0; padding: 6px; list-style: none;
  max-height: 280px; overflow-y: auto;
  border-radius: 12px; background: #fff; border: 1px solid #dbe3ee;
  box-shadow: 0 12px 32px rgba(20, 40, 80, 0.16);
  animation: card-in 0.18s var(--ease) both;
}
.orc-lista[hidden] { display: none; }
.orc-lista__item { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.orc-lista__item:hover, .orc-lista__item[aria-selected="true"] { background: #eef4fb; }
.orc-lista__item strong { font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }
.orc-lista__vazio { padding: 10px; }


/* Ficha técnica do produto (cadastro) */
.ficha { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ficha__add { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; gap: 8px; align-items: start; }
.ficha__add[hidden] { display: none; }
.ficha__add .orc-pick .orc-lista { top: 44px; }
.ficha__add .btn { height: 40px; }
.ficha__wrap { border: 1px solid #e3eaf3; border-radius: 12px; }
.ficha__qtd { width: 120px; margin-left: auto; }
.ficha__rodape { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.ficha__total { margin: 0; font-weight: 700; color: var(--brand-blue-800); }
@media (max-width: 520px) {
  .ficha__add { grid-template-columns: minmax(0, 1fr); }
  .ficha__qtd { width: 100%; }
}

/* Documentos do produto com revisão (cadastro) */
.docs { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.docs__lista { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.docs__item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid #e3eaf3; border-radius: 12px; background: #fff; }
.docs__ico { color: var(--brand-blue); }
.docs__info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.docs__info .t3 { overflow-wrap: anywhere; }
.docs__nome { color: var(--ink); }
.doc-rev { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; letter-spacing: 0.02em; white-space: nowrap; color: var(--brand-blue-800); background: #e7effa; }
.docs__acoes { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.docs__del { color: var(--danger); }
.docs__vazio { padding: 14px; }
.docs__vazio[hidden], .docs__file[hidden] { display: none; }
.docs__dica { margin: 0; }
.docs__add { display: grid; grid-template-columns: minmax(0, 1.3fr) 120px minmax(0, 1.2fr) auto; gap: 8px 10px; align-items: end; padding: 12px; border-radius: 12px; background: #f6f9fd; border: 1px dashed #c9d7ea; }
.docs__add[hidden] { display: none; }
.docs__add .field { min-width: 0; }
.docs__add .btn { height: 40px; }
.docs__file { width: 100%; min-width: 0; font-size: 12.5px; }
.docs__ren { height: 34px; }
@media (max-width: 860px) {
  .docs__item { grid-template-columns: auto minmax(0, 1fr) auto; }
  .docs__acoes { grid-column: 1 / -1; justify-content: flex-start; }
  .docs__add { grid-template-columns: minmax(0, 1fr) 120px; }
  .docs__add .btn { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .docs__add { grid-template-columns: minmax(0, 1fr); }
}

/* Botões de ícone das grades (editar, mover, remover): compartilhados */
.orc-ico {
  width: 28px; height: 28px; margin-right: 2px;
  display: inline-grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--brand-blue); cursor: pointer;
  transition: background 0.2s var(--ease);
}
.orc-ico:hover { background: #eef4fb; }
.orc-ico.is-up .ico { transform: rotate(180deg); }
.orc-ico.is-del { color: var(--danger); }
.orc-ico.is-del:hover { background: #fef2f2; }

/* Módulos do sistema (modulos.html) e matriz de perfis com módulo não liberado */
.mod-aviso { margin: 0 0 14px; padding: 12px 16px; border-radius: 14px; background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.mod-aviso[hidden], .mod-pacotes[hidden], .mod-base[hidden], .mod-foot[hidden] { display: none; }
.mod-pacotes { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; padding: 16px 18px; border-radius: var(--radius-lg); background: rgba(255, 255, 255, 0.86); border: 1px solid rgba(255, 255, 255, 0.9); box-shadow: var(--shadow-1); }
.mod-pacotes__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.mod-pacotes__title { margin: 0; font-size: 15px; }
.mod-pacotes__lista { display: flex; flex-wrap: wrap; gap: 8px; }
.mod-pacote:disabled { opacity: 0.6; cursor: default; }
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.mod-card { position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 16px 18px; border-radius: var(--radius-lg); background: rgba(255, 255, 255, 0.78); border: 1px solid rgba(255, 255, 255, 0.9); box-shadow: var(--shadow-1); animation: row-in 0.35s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); transition: background 0.25s var(--ease), box-shadow 0.25s var(--ease); }
.mod-card.is-on { background: rgba(255, 255, 255, 0.95); box-shadow: var(--shadow-1), inset 0 3px 0 var(--ok); }
.mod-card__head { display: flex; align-items: center; gap: 12px; }
.mod-card__ico { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px; background: #e7effa; color: var(--brand-blue); }
.mod-card:not(.is-on) .mod-card__ico { background: #eef2f7; color: var(--ink-3); }
.mod-card__tit { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.mod-card__nome { font-size: 15px; color: var(--ink); }
.mod-card .switch { display: inline-flex; }
.mod-card__desc { margin: 0; }
.mod-card__menus { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.mod-card__menus li { padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: #f1f5fa; color: var(--ink-2); }
.mod-card__req { margin: 0; }
.mod-card__mudou { align-self: flex-start; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; background: #fff7ed; color: #9a3412; }
.mod-base { margin: 16px 0 0; }
.mod-foot { position: sticky; bottom: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; padding: 12px 16px; border-radius: 16px; background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(12px); box-shadow: var(--shadow-1); }
.mod-chave { display: flex; flex-direction: column; gap: 12px; }
.perm__off td { opacity: 0.55; }
.perm__mod { display: block; font-size: 11px; color: #9a3412; }
@media (max-width: 520px) {
  .mod-foot .btn { flex: 1 1 auto; }
  .mod-foot .modal__spacer { display: none; }
}
