/* =========================================================================
   Psicossocial SST Class — Design System
   Extraído/estendido de sistema.sstclass.com.br (sistema/dashboard.html)
   ========================================================================= */

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

:root {
  --purple:#1a56d4; --purple-dark:#123f96; --purple-light:#e2ecfb; --purple-rgb:26,86,212;
  --blue:#3b82f6; --blue-light:#eff6ff;
  --amber:#f59e0b; --amber-light:#fffbeb;
  --red:#dc2626; --red-light:#fef2f2;
  --green:#16a34a; --green-light:#ecfdf5;
  --teal:#0d9488; --teal-light:#f0fdfa;
  --gray-50:#f6f7f9; --gray-100:#f0f2f5; --gray-200:#e5e7eb;
  --gray-300:#d1d5db; --gray-400:#9ca3af; --gray-500:#6b7280;
  --gray-700:#374151; --gray-900:#111827;
  --white:#fff; --surface:#fff;
  --body-gradient:linear-gradient(160deg,#f7f8fa 0%,#f1f3f6 100%);
  --radius:10px; --radius-lg:14px;
  --shadow:0 1px 3px rgba(0,0,0,.08),0 1px 2px rgba(0,0,0,.05);
  --shadow-md:0 4px 12px rgba(0,0,0,.08);
  --shadow-xl:0 20px 48px rgba(0,0,0,.16);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234b5563' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* =========================================================================
   Cor da marca (white-label) — o cliente escolhe um tom pra deixar o sistema
   mais próximo da identidade dele. Só mexe nas cores vivas (--purple*), os
   cinzas continuam os mesmos. Só existe pra tema CLARO: o tema escuro é
   único pra todo mundo, por isso todo bloco abaixo usa :not([data-theme=dark]).
   Aplicado em empresa/* e responder/* — nunca no admin (ferramenta da
   própria SST Class, sempre azul-padrão). "azul" = o mesmo padrão de sempre.
   ========================================================================= */
:root[data-brand="verde"]:not([data-theme="dark"]) { --purple:#16803c; --purple-dark:#0f5c2b; --purple-light:#e3f6ea; --purple-rgb:22,128,60; }
:root[data-brand="vermelho"]:not([data-theme="dark"]) { --purple:#b91c1c; --purple-dark:#8a1414; --purple-light:#fbe8e8; --purple-rgb:185,28,28; }
:root[data-brand="roxo"]:not([data-theme="dark"]) { --purple:#7c3aed; --purple-dark:#5b21b6; --purple-light:#efe6fc; --purple-rgb:124,58,237; }
:root[data-brand="laranja"]:not([data-theme="dark"]) { --purple:#c2410c; --purple-dark:#9a3412; --purple-light:#fdece0; --purple-rgb:194,65,12; }
:root[data-brand="teal"]:not([data-theme="dark"]) { --purple:#0f766e; --purple-dark:#0b5c55; --purple-light:#e2f5f3; --purple-rgb:15,118,110; }
:root[data-brand="grafite"]:not([data-theme="dark"]) { --purple:#1e3a5f; --purple-dark:#14263f; --purple-light:#e6ebf1; --purple-rgb:30,58,95; }

:root[data-theme="dark"] {
  color-scheme: dark;
  --purple:#4f8ff5; --purple-dark:#7fb0ff; --purple-light:#152a4d; --purple-rgb:79,143,245;
  --blue:#60a5fa; --blue-light:#152a4d;
  --amber:#fbbf24; --amber-light:#2b2010;
  --red:#f87171; --red-light:#2a1717;
  --green:#4ade80; --green-light:#122019;
  --teal:#2dd4bf; --teal-light:#0f2622;
  --gray-50:#0f1b30; --gray-100:#13223c; --gray-200:#20345a;
  --gray-300:#2d4770; --gray-400:#6b82a8; --gray-500:#8fa4c8;
  --gray-700:#cddaf0; --gray-900:#e6edfa;
  --white:#0d1729; --surface:#0d1729;
  --body-gradient:linear-gradient(160deg,#0a1628 0%,#060d1a 100%);
  --shadow:0 1px 2px rgba(0,0,0,.5),0 1px 1px rgba(0,0,0,.4);
  --shadow-md:0 4px 16px rgba(0,0,0,.5);
  --shadow-xl:0 20px 48px rgba(0,0,0,.65);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b82a8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

html { scrollbar-width:thin; scrollbar-color:var(--purple) transparent; scrollbar-gutter:stable; }
html::-webkit-scrollbar { width:10px; height:10px; }
html::-webkit-scrollbar-track { background:transparent; }
html::-webkit-scrollbar-thumb { background:var(--purple); border-radius:20px; }
html::-webkit-scrollbar-thumb:hover { background:var(--purple-dark); }
html::-webkit-scrollbar-corner { background:transparent; }

body {
  font-family:'Inter',system-ui,sans-serif; background:var(--body-gradient);
  color:var(--gray-900); min-height:100vh; transition:background .2s;
  -webkit-tap-highlight-color: transparent;
}

::selection { background:var(--purple-light); color:var(--purple-dark); }

a { color:var(--purple); }

/* Qualquer container rolável usa este utilitário — nunca a barra padrão do SO */
.scroll-y { overflow-y:auto; overflow-x:hidden; scrollbar-width:thin; scrollbar-color:var(--gray-300) transparent; scrollbar-gutter:stable; overscroll-behavior:contain; }
.scroll-y::-webkit-scrollbar { width:7px; }
.scroll-y::-webkit-scrollbar-track { background:transparent; }
.scroll-y::-webkit-scrollbar-thumb { background:var(--gray-300); border-radius:20px; }
.scroll-y::-webkit-scrollbar-thumb:hover { background:var(--purple); }
.scroll-x { overflow-x:auto; overflow-y:hidden; scrollbar-width:thin; scrollbar-color:var(--gray-300) transparent; }
.scroll-x::-webkit-scrollbar { height:7px; }
.scroll-x::-webkit-scrollbar-track { background:transparent; }
.scroll-x::-webkit-scrollbar-thumb { background:var(--gray-300); border-radius:20px; }

:focus { outline:none; }
:focus-visible { outline:none; box-shadow:0 0 0 3px rgba(var(--purple-rgb),.22); border-radius:4px; }

/* ── Zero UI nativa: inputs base ── */
input, textarea, button { font-family:inherit; color:inherit; }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
  box-shadow: inset 0 0 0 100px var(--surface); -webkit-text-fill-color: var(--gray-900);
  transition: background-color 9999s ease-in-out 0s;
}
input[type="number"] { appearance:textfield; -moz-appearance:textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance:none; display:none; }
textarea { resize:none; }
details summary { cursor:pointer; list-style:none; }
details summary::-webkit-details-marker { display:none; }
progress, meter { display:none; } /* substituídos por .pbar custom em toda a UI */

/* =========================================================================
   Topbar
   ========================================================================= */
.topbar {
  background:var(--surface); border-bottom:1px solid var(--gray-200);
  padding:0 1.5rem; height:64px;
  display:flex; align-items:center; justify-content:space-between;
  position:sticky; top:0; z-index:200;
  box-shadow:0 2px 12px rgba(17,24,39,.06);
}
.topbar__brand { display:flex; align-items:center; gap:1rem; }
.topbar__logo { display:flex; align-items:center; gap:.55rem; text-decoration:none; color:inherit; }
.topbar__logo img { height:26px; width:auto; display:block; flex-shrink:0; }
/* Logo com versão própria por tema (usada no topbar, no login e na tela do
   colaborador) — a versão errada fica display:none, nunca as duas juntas.
   !important de propósito: isso é um utilitário de visibilidade por tema,
   não pode perder de especificidade pra nenhuma regra de container (ex.:
   .topbar__logo img), senão as duas logos aparecem juntas. */
img.logo-dark { display:none !important; }
[data-theme="dark"] img.logo-light { display:none !important; }
[data-theme="dark"] img.logo-dark { display:block !important; }

/* Logo da empresa cliente (white-label) — fundo branco fixo, porque a logo
   enviada pelo cliente pode ter cores escuras e precisa ficar legível tanto
   no tema claro quanto no escuro. */
.client-logo-wrap { background:#fff; padding:.35rem .7rem; border-radius:9px; display:inline-flex; align-items:center; box-shadow:0 1px 2px rgba(0,0,0,.15); }
.client-logo-wrap img { height:24px; width:auto; max-width:180px; object-fit:contain; display:block; }
.topbar__divider { width:1px; height:28px; background:var(--gray-200); }
.topbar__badge { background:var(--purple-light); color:var(--purple); font-size:.7rem; font-weight:700; letter-spacing:.06em; text-transform:uppercase; border-radius:20px; padding:.25rem .625rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:220px; }
.topbar__right { display:flex; align-items:center; gap:.75rem; }
.topbar__account { display:flex; align-items:center; gap:.6rem; border:none; background:none; padding:.3rem .7rem .3rem .3rem; border-radius:999px; cursor:pointer; transition:background .15s; font-family:inherit; }
.topbar__account:hover { background:var(--gray-100); }
.topbar__avatar { width:38px; height:38px; border-radius:50%; border:2px solid var(--gray-200); background:var(--purple); color:#fff; font-weight:800; font-size:.9rem; display:flex; align-items:center; justify-content:center; overflow:hidden; flex-shrink:0; }
.topbar__account-text { display:flex; flex-direction:column; align-items:flex-start; line-height:1.25; }
.topbar__account-name { font-size:.85rem; font-weight:700; color:var(--gray-900); }
.topbar__account-role { font-size:.7rem; color:var(--gray-500); }
.topbar__icon-btn { display:flex; align-items:center; justify-content:center; width:36px; height:36px; border:1px solid var(--gray-200); background:var(--surface); color:var(--gray-500); border-radius:50%; cursor:pointer; transition:all .15s; flex-shrink:0; }
.topbar__icon-btn:hover { background:var(--gray-100); color:var(--gray-900); }
.topbar__icon-btn--logout:hover { border-color:var(--red); color:var(--red); background:var(--red-light); }
.topbar__icon-btn.is-active { background:var(--purple-light); color:var(--purple-dark); border-color:var(--purple-light); }
.topbar__icon-btn svg.icon-sun { display:none; }
[data-theme="dark"] .topbar__icon-btn svg.icon-moon { display:none; }
[data-theme="dark"] .topbar__icon-btn svg.icon-sun { display:block; }

/* =========================================================================
   Sidebar
   ========================================================================= */
.app-body { display:flex; align-items:flex-start; }
.app-sidebar { width:216px; flex-shrink:0; background:var(--surface); box-shadow:2px 0 12px rgba(0,0,0,.05), 1px 0 0 rgba(0,0,0,.04); height:calc(100vh - 64px); position:sticky; top:64px; padding:1.25rem .75rem; display:flex; flex-direction:column; gap:.2rem; z-index:5; transition:width .2s; }
.app-sidebar__item { display:flex; align-items:center; gap:.65rem; width:100%; text-align:left; padding:.75rem .9rem; border:none; border-radius:999px; background:none; font-family:inherit; font-size:.88rem; font-weight:500; color:var(--gray-500); cursor:pointer; transition:all .15s; text-decoration:none; }
.app-sidebar__item:hover { background:var(--gray-100); color:var(--gray-900); }
.app-sidebar__item.active { background:var(--purple-light); color:var(--purple-dark); font-weight:600; }
.app-sidebar__icon { flex-shrink:0; display:flex; }
.app-sidebar__label { flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.app-sidebar__toggle { display:flex; align-items:center; justify-content:flex-end; width:100%; padding:.4rem .5rem; margin-top:auto; border:none; background:none; color:var(--gray-400); cursor:pointer; border-radius:999px; transition:all .15s; }
.app-sidebar__toggle:hover { background:var(--gray-100); color:var(--gray-700); }
.app-sidebar__toggle svg { transition:transform .2s; flex-shrink:0; }
.app-sidebar--collapsed { width:64px; }
.app-sidebar--collapsed .app-sidebar__toggle { justify-content:center; }
.app-sidebar--collapsed .app-sidebar__toggle svg { transform:rotate(180deg); }
.app-sidebar--collapsed .app-sidebar__item { justify-content:center; padding-left:.5rem; padding-right:.5rem; }
.app-sidebar--collapsed .app-sidebar__label { display:none; }

/* =========================================================================
   Layout / Main
   ========================================================================= */
.main { flex:1; min-width:0; padding:2rem; max-width:1280px; margin:0 auto; }
.main--wide { max-width:1440px; }
.page-head { display:flex; align-items:flex-start; justify-content:space-between; gap:1rem; flex-wrap:wrap; margin-bottom:1.75rem; }
.page-head h1 { font-size:1.4rem; font-weight:800; color:var(--gray-900); letter-spacing:-.01em; }
.page-head p { font-size:.88rem; color:var(--gray-500); margin-top:.3rem; max-width:640px; }
.page-actions { display:flex; gap:.6rem; flex-wrap:wrap; }

/* =========================================================================
   Cards / Stats
   ========================================================================= */
.stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:1rem; margin-bottom:1.75rem; }
.stat { background:var(--surface); border-radius:var(--radius-lg); padding:1.25rem 1.5rem; box-shadow:var(--shadow); border-top:4px solid var(--purple); cursor:default; }
.stat--clickable { cursor:pointer; transition:transform .15s, box-shadow .15s; }
.stat--clickable:hover { transform:translateY(-2px); box-shadow:var(--shadow-md); }
.stat--purple .stat__value { color:var(--purple); }
.stat--blue { border-color:var(--blue); } .stat--blue .stat__value { color:var(--blue); }
.stat--amber { border-color:var(--amber); } .stat--amber .stat__value { color:#b45309; }
[data-theme="dark"] .stat--amber .stat__value { color:var(--amber); }
.stat--red { border-color:var(--red); } .stat--red .stat__value { color:var(--red); }
.stat--green { border-color:var(--green); } .stat--green .stat__value { color:var(--green); }
.stat--teal { border-color:var(--teal); } .stat--teal .stat__value { color:var(--teal); }
.stat__label { font-size:.75rem; font-weight:700; color:var(--gray-500); text-transform:uppercase; letter-spacing:.06em; margin-bottom:.5rem; display:flex; align-items:center; gap:.35rem; }
.stat__value { font-size:1.55rem; font-weight:800; color:var(--gray-900); line-height:1; }
.stat__sub { font-size:.78rem; color:var(--gray-500); margin-top:.4rem; }

.card { background:var(--surface); border:1px solid var(--gray-200); border-radius:var(--radius-lg); box-shadow:var(--shadow); padding:1.5rem; margin-bottom:1.75rem; }
.card__head { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.6rem; margin-bottom:1.25rem; }
.card__head h3 { font-size:.95rem; font-weight:700; color:var(--purple-dark); }
.card__head p { font-size:.8rem; color:var(--gray-500); margin-top:.2rem; }

/* =========================================================================
   Botões
   ========================================================================= */
.btn { display:inline-flex; align-items:center; justify-content:center; gap:.45rem; padding:.65rem 1.35rem; border-radius:999px; font-size:.875rem; font-weight:700; font-family:inherit; cursor:pointer; transition:all .15s; border:none; white-space:nowrap; }
.btn-primary { background:var(--purple); color:#fff; }
.btn-primary:hover { background:var(--purple-dark); }
.btn-outline { background:transparent; border:1.5px solid var(--gray-200); color:var(--gray-700); }
.btn-outline:hover { border-color:var(--purple); color:var(--purple); }
.btn-ghost { background:transparent; border:none; color:var(--gray-500); }
.btn-ghost:hover { background:var(--gray-100); color:var(--gray-900); }
.btn-danger-outline { background:transparent; border:1.5px solid var(--gray-200); color:var(--red); }
.btn-danger-outline:hover { background:var(--red-light); border-color:var(--red); }
.btn-sm { padding:.45rem .875rem; font-size:.8rem; }
.btn-lg { padding:.85rem 1.75rem; font-size:.95rem; }
.btn-full { width:100%; }
.btn:disabled { opacity:.5; cursor:not-allowed; }
.btn-icon { width:38px; height:38px; padding:0; border-radius:50%; }

/* .btn-clear ("Limpar filtros") nunca herdava .btn — sem isso, o botão
   caía no controle nativo do SO/navegador (inclusive o destaque de
   foco/seleção padrão), violando o zero-UI-nativa do resto do sistema. */
.btn-clear {
  appearance:none; -webkit-appearance:none; display:inline-flex; align-items:center;
  background:none; border:none; padding:.45rem .75rem; border-radius:999px;
  font-family:inherit; font-size:.8rem; font-weight:600; color:var(--gray-500);
  cursor:pointer; white-space:nowrap; transition:background .15s, color .15s;
}
.btn-clear:hover { background:var(--gray-100); color:var(--gray-900); }
.btn-clear:disabled { opacity:.5; cursor:not-allowed; }

/* =========================================================================
   Badges / Pills
   ========================================================================= */
.badge { display:inline-flex; align-items:center; gap:.3rem; font-size:.7rem; font-weight:700; border-radius:20px; padding:.28rem .7rem; white-space:nowrap; }
.badge-purple { background:var(--purple-light); color:var(--purple-dark); }
.badge-green  { background:var(--green-light); color:var(--green); }
[data-theme="dark"] .badge-green { color:#4ade80; }
.badge-amber  { background:var(--amber-light); color:#b45309; }
[data-theme="dark"] .badge-amber { color:var(--amber); }
.badge-red    { background:var(--red-light); color:var(--red); }
.badge-gray   { background:var(--gray-100); color:var(--gray-500); }
.badge-blue   { background:var(--blue-light); color:var(--blue); }

.risk-alto { color:var(--red); } .risk-moderado { color:#b45309; } [data-theme="dark"] .risk-moderado{color:var(--amber);}
.risk-aceitavel { color:var(--blue); } .risk-favoravel { color:var(--green); }
.risk-dot { width:9px; height:9px; border-radius:50%; display:inline-block; flex-shrink:0; }
.risk-dot.risk-alto { background:var(--red); } .risk-dot.risk-moderado { background:var(--amber); }
.risk-dot.risk-aceitavel { background:var(--blue); } .risk-dot.risk-favoravel { background:var(--green); }

/* Barra de progresso (substitui <progress>) */
.pbar { height:8px; border-radius:20px; background:var(--gray-100); overflow:hidden; }
.pbar__fill { height:100%; border-radius:20px; background:var(--green); transition:width .3s; }
.pbar--amber .pbar__fill { background:var(--amber); }
.pbar--red .pbar__fill { background:var(--red); }
.pbar--purple .pbar__fill { background:var(--purple); }

/* =========================================================================
   Formulários / inputs de texto
   ========================================================================= */
.form-group { margin-bottom:1.15rem; }
.form-group label { display:block; font-size:.8rem; font-weight:700; color:var(--gray-700); margin-bottom:.4rem; }
.form-group .hint { font-size:.75rem; color:var(--gray-500); margin-top:.35rem; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:1rem; }
.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group input[type="search"],
.form-group textarea {
  width:100%; padding:.65rem .9rem; border:1.5px solid var(--gray-200); border-radius:999px;
  font-size:.875rem; font-family:inherit; color:var(--gray-900); background:var(--surface);
  transition:border-color .2s, box-shadow .2s;
}
.form-group textarea { border-radius:var(--radius); min-height:96px; line-height:1.5; }
.form-group input:focus, .form-group textarea:focus {
  border-color:var(--purple); box-shadow:0 0 0 3px rgba(var(--purple-rgb),.12);
}
.form-group input::placeholder, .form-group textarea::placeholder { color:var(--gray-400); }
.form-group .field-error { font-size:.75rem; color:var(--red); margin-top:.35rem; display:none; }
.form-group.has-error input, .form-group.has-error textarea { border-color:var(--red); }
.form-group.has-error .field-error { display:block; }

/* Campo de senha — mascarado por CSS (-webkit-text-security), porque
   type="password" nativo não aceita nosso CSS de input (mesmo padrão já
   usado no sistema comercial). Com botão de olho pra mostrar/esconder. */
.pw-wrap { position:relative; }
.pw-wrap input { padding-right:2.75rem !important; -webkit-text-security:disc; }
.pw-wrap input.pw-visible { -webkit-text-security:none; }
.pw-toggle { position:absolute; right:.5rem; top:50%; transform:translateY(-50%); width:30px; height:30px; border:none; background:none; color:var(--gray-400); cursor:pointer; display:flex; align-items:center; justify-content:center; border-radius:50%; }
.pw-toggle:hover { background:var(--gray-100); color:var(--gray-700); }

/* =========================================================================
   Busca (barra de filtros) — input próprio com ícone, nunca o <input> nu do
   navegador. Mesma pílula/foco dos demais campos, só que com ícone e botão
   de limpar embutidos.
   ========================================================================= */
.search-input { position:relative; display:flex; align-items:center; flex:1; min-width:200px; max-width:280px; }
.search-input__icon { position:absolute; left:.85rem; color:var(--gray-400); display:flex; pointer-events:none; }
.search-input input { width:100%; padding:.6rem .9rem .6rem 2.4rem; border:1.5px solid var(--gray-200); border-radius:999px; font-size:.85rem; font-family:inherit; color:var(--gray-900); background:var(--surface); transition:border-color .2s, box-shadow .2s; }
.search-input input::placeholder { color:var(--gray-400); }
.search-input input:focus { outline:none; border-color:var(--purple); box-shadow:0 0 0 3px rgba(var(--purple-rgb),.12); }
.search-input__clear { position:absolute; right:.5rem; width:22px; height:22px; border:none; background:var(--gray-100); color:var(--gray-500); border-radius:50%; display:none; align-items:center; justify-content:center; cursor:pointer; }
.search-input__clear:hover { background:var(--gray-200); color:var(--gray-900); }
.search-input.has-value .search-input__clear { display:flex; }

/* =========================================================================
   PsicoSelect — dropdown 100% customizado (substitui <select> por completo,
   inclusive o estado ABERTO, que appearance:none sozinho não resolve em
   iOS/Android: eles ainda abrem o picker nativo do SO).
   ========================================================================= */
.psel { position:relative; width:100%; }
.psel__trigger {
  width:100%; display:flex; align-items:center; justify-content:space-between; gap:.5rem;
  padding:.65rem .9rem; border:1.5px solid var(--gray-200); border-radius:999px;
  background:var(--surface); color:var(--gray-900); font-family:inherit; font-size:.875rem;
  cursor:pointer; transition:border-color .2s, box-shadow .2s; text-align:left;
}
.psel__trigger:hover { border-color:var(--gray-300); }
.psel__trigger.open, .psel__trigger:focus-visible { border-color:var(--purple); box-shadow:0 0 0 3px rgba(var(--purple-rgb),.12); }
.psel__trigger-label { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.psel__trigger-label.placeholder { color:var(--gray-400); }
.psel__chevron { flex-shrink:0; color:var(--gray-500); transition:transform .15s; display:flex; }
.psel__trigger.open .psel__chevron { transform:rotate(180deg); }
.psel--sm .psel__trigger { padding:.5rem .75rem; font-size:.8rem; }

.psel__panel {
  position:fixed; z-index:800; background:var(--surface); border:1px solid var(--gray-200);
  border-radius:var(--radius); box-shadow:var(--shadow-xl); overflow:hidden;
  opacity:0; transform:translateY(-6px); pointer-events:none; transition:opacity .15s, transform .15s;
}
.psel__panel.open { opacity:1; transform:translateY(0); pointer-events:all; }
.psel__search { padding:.6rem; border-bottom:1px solid var(--gray-100); }
.psel__search input { width:100%; border:1.5px solid var(--gray-200); border-radius:999px; padding:.45rem .8rem; font-size:.8rem; font-family:inherit; background:var(--gray-50); color:var(--gray-900); }
.psel__list { max-height:240px; overflow-y:auto; padding:.35rem; scrollbar-width:thin; scrollbar-color:var(--gray-300) transparent; overscroll-behavior:contain; }
.psel__list::-webkit-scrollbar { width:7px; }
.psel__list::-webkit-scrollbar-track { background:transparent; }
.psel__list::-webkit-scrollbar-thumb { background:var(--gray-300); border-radius:20px; }
.psel__opt { display:flex; align-items:center; justify-content:space-between; gap:.5rem; padding:.55rem .75rem; border-radius:8px; font-size:.85rem; color:var(--gray-900); cursor:pointer; }
.psel__opt:hover, .psel__opt.active { background:var(--gray-100); }
.psel__opt.selected { color:var(--purple-dark); font-weight:700; background:var(--purple-light); }
.psel__opt-check { color:var(--purple-dark); display:flex; flex-shrink:0; opacity:0; }
.psel__opt.selected .psel__opt-check { opacity:1; }
.psel__empty { padding:1.25rem .75rem; text-align:center; font-size:.8rem; color:var(--gray-500); }

/* Overlay + bottom sheet: em telas pequenas o PsicoSelect vira uma folha que
   sobe do rodapé, nunca o picker/roleta nativa do sistema operacional. */
.psel-sheet-overlay { position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:790; opacity:0; pointer-events:none; transition:opacity .2s; }
.psel-sheet-overlay.open { opacity:1; pointer-events:all; }
@media (max-width:768px) {
  .psel__panel.is-sheet {
    position:fixed; left:0; right:0; bottom:0; top:auto; width:100%;
    border-radius:20px 20px 0 0; transform:translateY(100%); max-height:70vh; display:flex; flex-direction:column;
    padding-bottom:env(safe-area-inset-bottom, 0);
  }
  .psel__panel.is-sheet.open { transform:translateY(0); }
  .psel__panel.is-sheet .psel__list { max-height:calc(70vh - 60px); -webkit-overflow-scrolling:touch; }
  .psel__sheet-handle { width:36px; height:4px; border-radius:4px; background:var(--gray-300); margin:.6rem auto; flex-shrink:0; }
  .psel__opt { padding:.8rem .9rem; font-size:.92rem; }
}

/* =========================================================================
   Checkbox / Radio custom
   ========================================================================= */
.pcheck { display:flex; align-items:center; gap:.6rem; cursor:pointer; font-size:.85rem; color:var(--gray-900); user-select:none; }
.pcheck input { position:absolute; opacity:0; width:0; height:0; }
.pcheck__box { width:20px; height:20px; border-radius:6px; border:1.5px solid var(--gray-300); background:var(--surface); display:flex; align-items:center; justify-content:center; flex-shrink:0; transition:all .15s; }
.pcheck input:checked ~ .pcheck__box { background:var(--purple); border-color:var(--purple); }
.pcheck__box svg { opacity:0; transform:scale(.5); transition:all .1s; color:#fff; }
.pcheck input:checked ~ .pcheck__box svg { opacity:1; transform:scale(1); }
.pcheck input:focus-visible ~ .pcheck__box { box-shadow:0 0 0 3px rgba(var(--purple-rgb),.2); }
.pradio__box { width:20px; height:20px; border-radius:50%; border:1.5px solid var(--gray-300); background:var(--surface); display:flex; align-items:center; justify-content:center; flex-shrink:0; transition:all .15s; }
.pradio input:checked ~ .pradio__box { border-color:var(--purple); }
.pradio__box::after { content:''; width:10px; height:10px; border-radius:50%; background:var(--purple); opacity:0; transform:scale(.4); transition:all .1s; }
.pradio input:checked ~ .pradio__box::after { opacity:1; transform:scale(1); }

/* Toggle switch (usado em Configurações) */
.pswitch { position:relative; display:inline-flex; align-items:center; width:44px; height:26px; flex-shrink:0; cursor:pointer; }
.pswitch input { position:absolute; opacity:0; width:0; height:0; }
.pswitch__track { position:absolute; inset:0; background:var(--gray-300); border-radius:20px; transition:background .2s; }
.pswitch__thumb { position:absolute; top:3px; left:3px; width:20px; height:20px; background:#fff; border-radius:50%; box-shadow:0 1px 3px rgba(0,0,0,.25); transition:transform .2s; }
.pswitch input:checked ~ .pswitch__track { background:var(--purple); }
.pswitch input:checked ~ .pswitch__thumb { transform:translateX(18px); }

/* =========================================================================
   Likert (escala de 1 a 5) — nunca radio nativo
   ========================================================================= */
.likert { display:flex; gap:.55rem; flex-wrap:wrap; }
.likert__opt { flex:1; min-width:64px; display:flex; flex-direction:column; align-items:center; gap:.4rem; padding:.85rem .5rem; border:1.5px solid var(--gray-200); border-radius:var(--radius); cursor:pointer; transition:all .15s; text-align:center; background:var(--surface); }
.likert__opt:hover { border-color:var(--gray-400); }
.likert__opt.selected { border-color:var(--gray-900); background:var(--gray-100); }
[data-theme="dark"] .likert__opt.selected { border-color:var(--gray-700); }
.likert__num { font-size:1.1rem; font-weight:800; color:var(--gray-500); }
.likert__opt.selected .likert__num { color:var(--gray-900); }
.likert__label { font-size:.68rem; color:var(--gray-500); line-height:1.25; }

/* =========================================================================
   Modal
   ========================================================================= */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:500; display:flex; align-items:center; justify-content:center; padding:1.5rem; opacity:0; pointer-events:none; transition:opacity .2s; overscroll-behavior:contain; }
.modal-overlay.open { opacity:1; pointer-events:all; }
.modal { background:var(--surface); border-radius:var(--radius-lg); box-shadow:var(--shadow-xl); width:100%; max-width:820px; max-height:92vh; display:flex; flex-direction:column; transform:translateY(16px); transition:transform .2s; }
.modal-overlay.open .modal { transform:translateY(0); }
.modal--sm { max-width:460px; }
.modal-head { display:flex; align-items:center; justify-content:space-between; padding:1.25rem 1.5rem; border-bottom:1px solid var(--gray-200); flex-shrink:0; }
.modal-head h3 { font-size:1.05rem; font-weight:800; color:var(--gray-900); }
.modal-close { display:flex; align-items:center; justify-content:center; width:32px; height:32px; border:none; background:var(--gray-100); color:var(--gray-500); border-radius:50%; cursor:pointer; transition:all .15s; flex-shrink:0; }
.modal-close:hover { background:var(--gray-200); color:var(--gray-900); }
.modal-tabs { display:flex; gap:.35rem; padding:0 1.5rem; border-bottom:1px solid var(--gray-200); flex-shrink:0; overflow-x:auto; scrollbar-width:none; }
.modal-tabs::-webkit-scrollbar { display:none; }
.modal-tab { padding:.85rem .3rem; margin-right:1.25rem; border:none; background:none; font-family:inherit; font-size:.82rem; font-weight:600; color:var(--gray-500); cursor:pointer; border-bottom:2px solid transparent; white-space:nowrap; }
.modal-tab.active { color:var(--purple-dark); border-bottom-color:var(--purple); }
.modal-body { padding:1.5rem; overflow-y:auto; scrollbar-width:thin; scrollbar-color:var(--gray-300) transparent; }
.modal-body::-webkit-scrollbar { width:7px; }
.modal-body::-webkit-scrollbar-track { background:transparent; }
.modal-body::-webkit-scrollbar-thumb { background:var(--gray-300); border-radius:20px; }
.modal-pane { display:none; } .modal-pane.active { display:block; }
.modal-foot { display:flex; align-items:center; justify-content:flex-end; gap:.65rem; padding:1.1rem 1.5rem; border-top:1px solid var(--gray-200); flex-shrink:0; }
.modal-foot__left { margin-right:auto; font-size:.85rem; color:var(--gray-500); }

/* .btn-cancel/.btn-save nunca herdavam .btn — mesmo problema do .btn-clear,
   só que aqui afeta o rodapé de TODO modal do sistema (cliente, colaborador,
   campanha, config). */
.btn-cancel, .btn-save {
  appearance:none; -webkit-appearance:none; padding:.65rem 1.35rem; border-radius:999px;
  font-family:inherit; font-size:.875rem; font-weight:700; cursor:pointer;
  transition:all .15s; white-space:nowrap; border:1.5px solid transparent;
}
.btn-cancel { background:transparent; border-color:var(--gray-200); color:var(--gray-700); }
.btn-cancel:hover { border-color:var(--gray-300); color:var(--gray-900); }
.btn-save { background:var(--purple); color:#fff; }
.btn-save:hover { background:var(--purple-dark); }
.btn-cancel:disabled, .btn-save:disabled { opacity:.5; cursor:not-allowed; }
@media (max-width:640px) { .modal { max-width:100%; margin:0 .5rem; } .form-row { grid-template-columns:1fr; } }

/* =========================================================================
   Toast
   ========================================================================= */
.toast-stack { position:fixed; bottom:1.5rem; right:1.5rem; z-index:999; display:flex; flex-direction:column; gap:.6rem; align-items:flex-end; }
.toast { background:var(--gray-900); color:#fff; border-radius:var(--radius); padding:.875rem 1.25rem; font-size:.875rem; font-weight:500; box-shadow:var(--shadow-md); transform:translateY(20px); opacity:0; transition:all .25s ease; max-width:340px; }
[data-theme="dark"] .toast { background:#1c2b45; }
.toast.show { transform:translateY(0); opacity:1; }
.toast.success { background:var(--purple); } .toast.error { background:var(--red); }

/* =========================================================================
   Tooltip custom (substitui title="")
   ========================================================================= */
.ptip { position:relative; display:inline-flex; }
.ptip__bubble { position:absolute; bottom:calc(100% + 8px); left:50%; transform:translateX(-50%) translateY(4px); background:var(--gray-900); color:#fff; font-size:.72rem; font-weight:600; padding:.45rem .7rem; border-radius:8px; white-space:nowrap; box-shadow:var(--shadow-md); opacity:0; pointer-events:none; transition:all .15s; z-index:600; }
[data-theme="dark"] .ptip__bubble { background:#1c2b45; }
.ptip__bubble::after { content:''; position:absolute; top:100%; left:50%; transform:translateX(-50%); border:5px solid transparent; border-top-color:var(--gray-900); }
[data-theme="dark"] .ptip__bubble::after { border-top-color:#1c2b45; }
.ptip:hover .ptip__bubble, .ptip:focus-within .ptip__bubble { opacity:1; transform:translateX(-50%) translateY(0); }

/* =========================================================================
   Tabelas
   ========================================================================= */
.ptable-wrap { border:1px solid var(--gray-200); border-radius:var(--radius-lg); overflow:hidden; background:var(--surface); }
table.ptable { width:100%; border-collapse:collapse; font-size:.85rem; }
.ptable thead th { text-align:left; padding:.85rem 1.1rem; font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--gray-500); background:var(--gray-50); border-bottom:1px solid var(--gray-200); white-space:nowrap; }
.ptable tbody td { padding:.9rem 1.1rem; border-bottom:1px solid var(--gray-100); color:var(--gray-900); vertical-align:middle; }
.ptable tbody tr:last-child td { border-bottom:none; }
.ptable tbody tr:hover { background:var(--gray-50); }
.ptable .muted { color:var(--gray-500); }

/* =========================================================================
   Dropzone (substitui <input type=file>)
   ========================================================================= */
.dropzone { border:1.5px dashed var(--gray-300); border-radius:var(--radius-lg); padding:2rem 1.5rem; text-align:center; cursor:pointer; transition:all .15s; background:var(--gray-50); }
.dropzone:hover, .dropzone.dragover { border-color:var(--purple); background:var(--purple-light); }
.dropzone svg { color:var(--gray-400); margin-bottom:.6rem; }
.dropzone__title { font-weight:700; font-size:.88rem; color:var(--gray-900); }
.dropzone__hint { font-size:.78rem; color:var(--gray-500); margin-top:.25rem; }
.file-label { display:inline-flex; align-items:center; gap:.4rem; padding:.5rem 1rem; border:1.5px solid var(--gray-200); border-radius:999px; font-size:.82rem; font-weight:600; cursor:pointer; background:var(--surface); }
.file-label:hover { border-color:var(--purple); color:var(--purple); }

/* =========================================================================
   Datepicker popover (substitui <input type=date>)
   ========================================================================= */
.pdate { position:relative; }
.pdate__trigger { width:100%; display:flex; align-items:center; justify-content:space-between; gap:.5rem; padding:.65rem .9rem; border:1.5px solid var(--gray-200); border-radius:999px; background:var(--surface); font-family:inherit; font-size:.875rem; color:var(--gray-900); cursor:pointer; text-align:left; }
.pdate__trigger.placeholder { color:var(--gray-400); }
.pdate__panel { position:fixed; z-index:800; background:var(--surface); border:1px solid var(--gray-200); border-radius:var(--radius-lg); box-shadow:var(--shadow-xl); padding:1rem; width:280px; opacity:0; transform:translateY(-6px); pointer-events:none; transition:all .15s; }
.pdate__panel.open { opacity:1; transform:translateY(0); pointer-events:all; }
.pdate__head { display:flex; align-items:center; justify-content:space-between; margin-bottom:.75rem; }
.pdate__head button { width:28px; height:28px; border:none; background:var(--gray-100); border-radius:50%; cursor:pointer; color:var(--gray-700); display:flex; align-items:center; justify-content:center; }
.pdate__head button:hover { background:var(--gray-200); }
.pdate__month { font-size:.85rem; font-weight:700; }
.pdate__grid { display:grid; grid-template-columns:repeat(7,1fr); gap:.15rem; }
.pdate__dow { font-size:.65rem; font-weight:700; color:var(--gray-400); text-align:center; padding:.3rem 0; }
.pdate__day { aspect-ratio:1; display:flex; align-items:center; justify-content:center; font-size:.78rem; border-radius:8px; cursor:pointer; color:var(--gray-900); }
.pdate__day:hover { background:var(--gray-100); }
.pdate__day.muted { color:var(--gray-300); }
.pdate__day.selected { background:var(--purple); color:#fff; font-weight:700; }
.pdate__day.today:not(.selected) { box-shadow:inset 0 0 0 1.5px var(--purple); }

/* =========================================================================
   Bandeiras / seletor de idioma
   ========================================================================= */
.flag-chip { width:26px; height:19px; border-radius:3px; display:block; flex-shrink:0; box-shadow:0 0 0 1px rgba(0,0,0,.08); overflow:hidden; }
.flag-chip img, .flag-chip svg { width:100%; height:100%; display:block; object-fit:cover; }

/* =========================================================================
   Login
   ========================================================================= */
.auth-shell { min-height:100vh; display:grid; grid-template-columns:1fr 1fr; }
.auth-shell__panel { background:var(--body-gradient); display:flex; flex-direction:column; justify-content:center; padding:3rem; position:relative; overflow:hidden; }
.auth-shell__form { display:flex; flex-direction:column; justify-content:center; padding:3rem; }
.auth-box { width:100%; max-width:380px; margin:0 auto; }
@media (max-width:900px) { .auth-shell { grid-template-columns:1fr; } .auth-shell__panel { display:none; } }

/* =========================================================================
   Empty states
   ========================================================================= */
.empty-state { text-align:center; padding:3rem 1.5rem; color:var(--gray-500); }
.empty-state svg { color:var(--gray-300); margin-bottom:1rem; }
.empty-state h4 { color:var(--gray-700); font-size:.95rem; margin-bottom:.4rem; }
.empty-state p { font-size:.82rem; max-width:360px; margin:0 auto; }

/* =========================================================================
   Gráficos (psico-charts.js)
   ========================================================================= */
.chart-hbars { display:flex; flex-direction:column; gap:.9rem; }
.chart-hbars__row { display:grid; grid-template-columns:130px 1fr 48px; align-items:center; gap:.75rem; }
.chart-hbars__label { font-size:.8rem; font-weight:600; color:var(--gray-700); }
.chart-hbars__track { height:10px; border-radius:20px; background:var(--gray-100); overflow:hidden; }
.chart-hbars__fill { height:100%; border-radius:20px; transition:width .4s; }
.chart-hbars__value { font-size:.82rem; font-weight:700; color:var(--gray-900); text-align:right; }
@media (max-width:640px) { .chart-hbars__row { grid-template-columns:96px 1fr 40px; } }

.heatmap__table { border-collapse:separate; border-spacing:4px; font-size:.78rem; }
.heatmap__table th { font-size:.68rem; font-weight:700; color:var(--gray-500); text-transform:uppercase; padding:.3rem .5rem; }
.heatmap__rowlabel { font-size:.78rem; font-weight:600; color:var(--gray-900); white-space:nowrap; padding-right:.75rem; text-align:left; }
.heatmap__cell { width:52px; height:38px; text-align:center; border-radius:8px; font-weight:800; color:#fff; text-shadow:0 1px 2px rgba(0,0,0,.25); cursor:default; }
.heatmap__cell--suppressed { background:repeating-linear-gradient(45deg, var(--gray-200), var(--gray-200) 4px, var(--gray-100) 4px, var(--gray-100) 8px); color:var(--gray-500); font-size:.68rem; text-shadow:none; }
.heatmap__n { text-align:center; font-weight:700; color:var(--gray-500); }

.donut-wrap { display:flex; align-items:center; gap:1.5rem; flex-wrap:wrap; }
.donut-svg { width:150px; height:150px; flex-shrink:0; }

.line-svg { display:block; }
.gauge-svg { width:100%; max-width:220px; display:block; margin:0 auto; }

/* =========================================================================
   Responsivo geral
   ========================================================================= */
@media (max-width:900px) {
  .app-sidebar { position:fixed; left:0; top:64px; height:calc(100vh - 64px); width:248px; transform:translateX(-100%); transition:transform .2s; box-shadow:var(--shadow-xl); }
  .app-sidebar.drawer-open { transform:translateX(0); }
  .app-sidebar--collapsed { width:248px; }
  .app-sidebar--collapsed .app-sidebar__label { display:block; }
  .app-sidebar--collapsed .app-sidebar__item { justify-content:flex-start; padding:.75rem .9rem; }
  .sidebar-scrim { position:fixed; inset:0; top:64px; background:rgba(0,0,0,.4); z-index:4; opacity:0; pointer-events:none; transition:opacity .2s; }
  .sidebar-scrim.show { opacity:1; pointer-events:all; }
  .main { padding:1.25rem; }
  .stats { grid-template-columns:repeat(2,1fr); }
  .ptable-wrap { overflow-x:auto; }
}
@media (max-width:560px) {
  .stats { grid-template-columns:1fr 1fr; }
  .topbar { padding:0 .75rem; }
  .topbar__account-text { display:none; }
  .topbar__divider { display:none; }
  .topbar__badge { max-width:96px; }
  .topbar__brand { gap:.6rem; min-width:0; }
  .topbar__right { gap:.4rem; }
}
html, body { overflow-x:hidden; }
