/* ============================================================
   NEXUS — banner e definições de cookies (js/nx-consentimento.js)
   Tema claro por omissão; escuro com body.pv2-dark (portal v2) ou
   [data-portal-theme="dark"] (catálogo/portal antigo). Contraste AA.
   ============================================================ */
.nx-ck {
  --ck-bg: #ffffff;
  --ck-fg: #1f2937;
  --ck-muted: #4b5563;
  --ck-borda: #d1d5db;
  --ck-link: #166534;
  --ck-btn-bg: #166534;
  --ck-btn-fg: #ffffff;
  --ck-btn-hover: #14532d;
  --ck-foco: #1d4ed8;
  --ck-sw-off: #6b7280;
  --ck-sw-on: #166534;
  --ck-sombra: 0 -6px 28px rgba(0, 0, 0, .18);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ck-fg);
  box-sizing: border-box;
}
body.pv2-dark .nx-ck,
[data-portal-theme="dark"] .nx-ck {
  --ck-bg: #0f1f14;
  --ck-fg: #e8f5ec;
  --ck-muted: #b8cfbf;
  --ck-borda: #2f4a37;
  --ck-link: #86efac;
  --ck-btn-bg: #4ade80;
  --ck-btn-fg: #052e16;
  --ck-btn-hover: #86efac;
  --ck-foco: #93c5fd;
  --ck-sw-off: #8a9a8f;
  --ck-sw-on: #4ade80;
  --ck-sombra: 0 -6px 28px rgba(0, 0, 0, .55);
}
.nx-ck *, .nx-ck *::before, .nx-ck *::after { box-sizing: border-box; }
.nx-ck[hidden], .nx-ck [hidden] { display: none !important; }
.nx-ck a { color: var(--ck-link); text-decoration: underline; text-underline-offset: 2px; }
.nx-ck a:focus-visible,
.nx-ck button:focus-visible,
.nx-ck input:focus-visible { outline: 3px solid var(--ck-foco); outline-offset: 2px; }

/* ---------- banner ---------- */
.nx-ck-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 10000;
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px;
  padding: 16px 20px;
  background: var(--ck-bg);
  border: 1px solid var(--ck-borda);
  border-radius: 12px;
  box-shadow: var(--ck-sombra);
}
.nx-ck-txt { margin: 0; flex: 1 1 auto; font-size: 14px; line-height: 1.5; color: var(--ck-fg); }
.nx-ck-acoes { display: flex; gap: 8px; flex: 0 0 auto; }
.nx-ck-btn {
  min-height: 44px; min-width: 112px; padding: 10px 18px;
  border: 1px solid var(--ck-btn-bg); border-radius: 8px;
  background: var(--ck-btn-bg); color: var(--ck-btn-fg);
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.2;
  cursor: pointer;
}
.nx-ck-btn:hover { background: var(--ck-btn-hover); border-color: var(--ck-btn-hover); }

/* ---------- painel de definições ---------- */
.nx-ck-fundo {
  position: fixed; inset: 0; z-index: 10001;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, .5);
}
.nx-ck-painel {
  width: 100%; max-width: 540px; max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 20px 22px;
  background: var(--ck-bg); color: var(--ck-fg);
  border: 1px solid var(--ck-borda); border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}
.nx-ck-painel:focus { outline: none; }
.nx-ck-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.nx-ck-ptit { margin: 0; font-size: 18px; font-weight: 700; color: var(--ck-fg); font-family: inherit; }
.nx-ck-fechar {
  width: 44px; height: 44px; flex: 0 0 auto;
  border: 1px solid var(--ck-borda); border-radius: 8px;
  background: transparent; color: var(--ck-fg);
  font-size: 24px; line-height: 1; cursor: pointer;
}
.nx-ck-intro { margin: 0 0 12px; font-size: 14px; line-height: 1.5; color: var(--ck-muted); }
.nx-ck-cat { padding: 12px 0; border-top: 1px solid var(--ck-borda); }
.nx-ck-cat-cab { display: flex; align-items: center; gap: 10px; }
.nx-ck-cat-tit { flex: 1 1 auto; font-size: 15px; font-weight: 600; color: var(--ck-fg); cursor: pointer; }
.nx-ck-sempre { font-size: 13px; font-weight: 600; color: var(--ck-muted); }
.nx-ck-cat-txt { margin: 4px 0 0; font-size: 13px; line-height: 1.5; color: var(--ck-muted); }

/* interruptor (checkbox com role="switch") */
.nx-ck-switch {
  -webkit-appearance: none; appearance: none; margin: 0; flex: 0 0 auto;
  position: relative; width: 44px; height: 26px; border-radius: 13px;
  background: var(--ck-sw-off); cursor: pointer;
  transition: background .15s;
}
.nx-ck-switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #ffffff;
  transition: transform .15s;
}
.nx-ck-switch:checked { background: var(--ck-sw-on); }
.nx-ck-switch:checked::after { transform: translateX(18px); }
body.pv2-dark .nx-ck-switch:checked::after,
[data-portal-theme="dark"] .nx-ck-switch:checked::after { background: #052e16; }
.nx-ck-switch:disabled { cursor: not-allowed; opacity: .75; }
.nx-ck-acoes-painel { justify-content: flex-end; padding-top: 14px; border-top: 1px solid var(--ck-borda); }

html.nx-ck-aberto { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .nx-ck-switch, .nx-ck-switch::after { transition: none; }
}

/* ---------- telemóvel: banner compacto, colado ao fundo ---------- */
@media (max-width: 640px) {
  .nx-ck-banner {
    left: 0; right: 0; bottom: 0;
    flex-direction: column; align-items: stretch; gap: 10px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
    border-radius: 14px 14px 0 0; border-left: 0; border-right: 0; border-bottom: 0;
  }
  .nx-ck-txt { font-size: 13px; line-height: 1.45; }
  .nx-ck-acoes { width: 100%; }
  .nx-ck-acoes .nx-ck-btn { flex: 1 1 0; min-width: 0; padding: 10px 6px; font-size: 14px; }
  .nx-ck-fundo { align-items: flex-end; padding: 0; }
  .nx-ck-painel { max-width: none; max-height: 92vh; border-radius: 14px 14px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
  .nx-ck-acoes-painel .nx-ck-btn { flex: 1 1 auto; }
}

@media print {
  .nx-ck-banner, .nx-ck-fundo { display: none !important; }
}

/* ---------- ligações no rodapé ---------- */
.nx-ck-rodape { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.nx-ck-rodape a,
.nx-ck-rodape button {
  padding: 0; border: 0; background: none;
  font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 2px;
  cursor: pointer;
}
.nx-ck-rodape a:focus-visible,
.nx-ck-rodape button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.footer .nx-ck-rodape a,
.footer .nx-ck-rodape button { color: rgba(255, 255, 255, .78); }
.footer .nx-ck-rodape a:hover,
.footer .nx-ck-rodape button:hover { color: #ffffff; }
.portal-footer .nx-ck-rodape { justify-content: center; }
.portal-footer .nx-ck-rodape a,
.portal-footer .nx-ck-rodape button { color: #4b5563; }
body.pv2-dark .portal-footer .nx-ck-rodape a,
body.pv2-dark .portal-footer .nx-ck-rodape button { color: rgba(232, 245, 236, .78); }

/* ---------- ligações no fundo de login.html e set-password.html (fundo sempre escuro) ---------- */
.auth-rodape { display: flex; justify-content: center; padding: 0 var(--container-pad, 16px) 22px; font-size: .85rem; }
.auth-rodape .nx-ck-rodape { justify-content: center; }
.auth-rodape .nx-ck-rodape a,
.auth-rodape .nx-ck-rodape button { color: rgba(255, 255, 255, .78); }
.auth-rodape .nx-ck-rodape a:hover,
.auth-rodape .nx-ck-rodape button:hover { color: #ffffff; }
.auth-body .auth-main { min-height: calc(100vh - var(--nav-height, 72px) - 56px); }
